osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38425?usp=email )
Change subject: testenv: podman: restart_count in container_name ......................................................................
testenv: podman: restart_count in container_name
When running testsuites with multiple configurations in a row, as it is the case with the ttcn3-ggsn jobs in jenkins, the podman container gets restarted whenever switching to the next config.
Use a different name for each container by appending a restart count. This should fix that podman sometimes didn't fully shutdown the container yet and complains that the container name is already in use. This happens even though we use "podman kill" and "podman wait" on the previous container. When checking later, the container is really gone and the same name can be used, it seems that it just needs some more time to shutdown in some cases.
Fix for:
Error: error creating container storage: the container name "testenv-ggsn_tests-osmo_ggsn_-osmocom-nightly-20241012-0752-2eb85125" is already in use by "8b7ea42371a922ffbf4e966b853124b98cd25c9905ae443fefb4115a103d7779". You have to remove that container to be able to reuse that name.: that name is already in use
Related: https://github.com/containers/podman/issues/2553 Related: https://jenkins.osmocom.org/jenkins/job/ttcn3-ggsn-test/2674/console Change-Id: Ia791be2fee69765293ce7a7a058319c92bb92714 --- M _testenv/testenv/podman.py 1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/25/38425/1
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py index bd1e8d8..683f468 100644 --- a/_testenv/testenv/podman.py +++ b/_testenv/testenv/podman.py @@ -20,6 +20,7 @@ apt_dir_var_lib = None feed_watchdog_process = None run_shell_on_stop = False +restart_count = 0
def image_exists(): @@ -190,7 +191,8 @@
testdir_topdir = testenv.testdir.testdir_topdir osmo_dev_dir = testenv.osmo_dev.get_osmo_dev_dir() - container_name = testenv.testdir.prefix + container_name = f"{testenv.testdir.prefix}-{restart_count}" + # Custom seccomp profile that allows io_uring seccomp = os.path.join(testenv.data_dir, "podman/seccomp.json")
@@ -287,6 +289,7 @@ def stop(restart=False): global container_name global run_shell_on_stop + global restart_count
if not is_running(): return @@ -316,4 +319,5 @@ container_name = None
if restart: + restart_count += 1 start()