osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38644?usp=email )


Change subject: testenv: more tweaks for container shutdown logic
......................................................................

testenv: more tweaks for container shutdown logic

* Don't do "podman wait" when restarting the container. The idea was to
  really wait before the current container was shutdown before
  restarting one with the same name. But even with the wait we got "the
  container name ... is already in use" errors and so we use different
  names when restarting the container since 6fe837de ("testenv: podman:
  restart_count in container_name"). This means "podman wait" is not
  needed anymore.

* feed_watchdog_loop: change sleep from 5s to 2s, as we wait up to that
  long after the container was shutdown, before testenv stops. 5s is
  quite noticable compared to 2s when running the script locally.

* feed_watchdog_loop: hide stderr of "podman exec" since it will print
  "Error: container ... does not exist in database: no such container"
  during shutdown. This is expected as we stop the container, but it
  looks like an actual error. We already have a more userfriendly
  message "feed_watchdog_loop: podman container has stopped" that will
  appear when the "podman exec" fails during shutdown.

Change-Id: I71721fd41f044817e4021aea045a288f88506f76
---
M _testenv/testenv/podman.py
1 file changed, 2 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/44/38644/1

diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index dc1b333..16db400 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -176,8 +176,8 @@
     # container will terminate after a few seconds.
     try:
         while True:
-            time.sleep(5)
-            p = subprocess.run(["podman", "exec", container_name, "touch", 
"/tmp/watchdog"])
+            time.sleep(2)
+            p = subprocess.run(["podman", "exec", container_name, "touch", 
"/tmp/watchdog"], stderr=subprocess.DEVNULL)
             if p.returncode:
                 logging.debug("feed_watchdog_loop: podman container has 
stopped")
                 return
@@ -340,9 +340,6 @@

     testenv.cmd.run(["podman", "kill", container_name], no_podman=True, 
check=False)

-    if restart:
-        testenv.cmd.run(["podman", "wait", container_name], no_podman=True, 
check=False)
-
     container_name = None

     if restart:

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38644?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I71721fd41f044817e4021aea045a288f88506f76
Gerrit-Change-Number: 38644
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>

Reply via email to