osmith submitted this change.

View Change

Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve
testenv: fix 'container crashed' detection

* When the testsuite stopped and using podman, check if it stopped
because the container crashed and raise an exception.

* Even after 9eb5e696 ("testenv: make podman stop more robust") it
happens sometimes in jenkins that the container gets stopped on
purpose because the testsuite is done, but then the watchdog process
prints an error saying it crashed (without actually stopping testenv
at this point). Change the message to a debug message that just says
it stopped, this should not be an error.

Related: OS#6607
Change-Id: I3c116719cdc00a99e27e5237ba3d57d5258b0919
---
M _testenv/testenv/podman.py
M _testenv/testenv/testsuite.py
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index 719afcb..dc1b333 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -179,7 +179,7 @@
time.sleep(5)
p = subprocess.run(["podman", "exec", container_name, "touch", "/tmp/watchdog"])
if p.returncode:
- logging.error("podman container crashed!")
+ logging.debug("feed_watchdog_loop: podman container has stopped")
return
except KeyboardInterrupt:
pass
diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py
index 601f339..3bc8d9d 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -195,6 +195,8 @@
time.sleep(1)

if not is_running(testsuite_proc.pid):
+ if testenv.args.podman and not testenv.podman.is_running():
+ raise testenv.NoTraceException("podman container crashed!")
logging.debug("Testsuite is done")
stop()
break

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

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I3c116719cdc00a99e27e5237ba3d57d5258b0919
Gerrit-Change-Number: 38620
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>