diff options
author | Louis Scalbert <louis.scalbert@6wind.com> | 2024-11-20 11:24:13 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2024-12-02 18:44:53 +0100 |
commit | b12e04fdf1e3de3c03e5efc58bd4a58f893f5717 (patch) | |
tree | 98441559254938210efe2d72c4a499f46c5a9458 /tests/topotests/lib/topogen.py | |
parent | tests: add py extension to bmpserver (diff) | |
download | frr-b12e04fdf1e3de3c03e5efc58bd4a58f893f5717.tar.xz frr-b12e04fdf1e3de3c03e5efc58bd4a58f893f5717.zip |
tests: fix bmp test parallelization
Multiple BMP tests can run in parallel but, when one instance ends,
it kills the BMP server process of all BMP tests.
Save the PID of a BMP server and only kill it at the end.
Link: https://github.com/FRRouting/frr/issues/17465
Fixes: 875511c466 ("topotests: add basic bmp collector")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to '')
-rw-r--r-- | tests/topotests/lib/topogen.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index dce83d5ef..0a9a84a4b 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -1293,18 +1293,19 @@ class TopoBMPCollector(TopoHost): log_err = os.path.join(log_dir, "bmpserver.log") log_arg = "-l {}".format(log_file) if log_file else "" + self.pid_file = os.path.join(log_dir, "bmpserver.pid") with open(log_err, "w") as err: self.run( - "{}/bmp_collector/bmpserver.py -a {} -p {} {}&".format( - CWD, self.ip, self.port, log_arg + "{}/bmp_collector/bmpserver.py -a {} -p {} -r {} {}&".format( + CWD, self.ip, self.port, self.pid_file, log_arg ), stdout=None, stderr=err, ) def stop(self): - self.run("pkill -f bmpserver.py") + self.run(f"kill $(cat {self.pid_file}") return "" |