osmith submitted this change.

View Change

Approvals: pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved
testenv: fix podman_extra with multiple cfgs

Do not reuse the container that gets started to build the testsuite and
test components, to also do the the first testsuite run. Restart it
after selecting the current testenv*.cfg, and use the podman_extra value
from the right config instead.

As side-effect, this also makes the container restart logic much
simpler.

Change-Id: I12e187726673e1ca1b1ecfff6b34b1803127be86
---
M _testenv/testenv.py
M _testenv/testenv/podman.py
M _testenv/testenv/testenv_cfg.py
3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/_testenv/testenv.py b/_testenv/testenv.py
index 9450c8f..29bf56e 100755
--- a/_testenv/testenv.py
+++ b/_testenv/testenv.py
@@ -61,18 +61,13 @@
# Run the components + testsuite
loop_count = 0
while loop_continue_cond(loop_count):
- # Restart podman container before running again
- if testenv.args.podman and loop_count:
- testenv.podman.stop(True)
-
- cfg_count = 0
for cfg_name, cfg in testenv.testenv_cfg.cfgs.items():
- # Restart podman container before running with another config
- if testenv.args.podman and cfg_count:
- testenv.podman.stop(True)
-
testenv.testenv_cfg.set_current(cfg_name, loop_count)

+ # Restart podman container after testenv_cfg.current or loop_count change
+ if testenv.args.podman:
+ testenv.podman.stop(True)
+
if testenv.args.binary_repo:
testenv.podman.enable_binary_repo()
testenv.podman_install.packages(cfg, cfg_name)
@@ -83,7 +78,6 @@
testenv.daemons.stop()
testenv.testdir.clean_run_scripts("finished")

- cfg_count += 1
testenv.set_log_prefix("[testenv]")

loop_count += 1
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index 072b20e..dd3c592 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -267,7 +267,7 @@
dest = os.readlink(testenv.custom_kernel_path)
cmd += ["--volume", f"{dest}:{dest}:ro"]

- podman_extra = testenv.testenv_cfg.get_podman_extra_first_cfg()
+ podman_extra = testenv.testenv_cfg.get_podman_extra_current_cfg()
if podman_extra:
cmd += shlex.split(podman_extra)

diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py
index 3146ae1..93ffa5d 100644
--- a/_testenv/testenv/testenv_cfg.py
+++ b/_testenv/testenv/testenv_cfg.py
@@ -74,9 +74,10 @@
return host, port


-def get_podman_extra_first_cfg():
- _, cfg = next(iter(cfgs.items()))
- return cfg["testsuite"].get("podman_extra", None)
+def get_podman_extra_current_cfg():
+ if current:
+ return cfgs[current]["testsuite"].get("podman_extra", None)
+ return None


def verify_qemu_cfgs():

To view, visit change 42816. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I12e187726673e1ca1b1ecfff6b34b1803127be86
Gerrit-Change-Number: 42816
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: jolly <andreas@eversberg.eu>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>