Improve reliability of vcontainer-tests
cover Improve reliability of vcontainer-tests
From: Tim Orling <[email protected]>
Running the tests locally highlighted some issues -- including timing issues -- with additional timing sensitivity highlighted on the Yocto Project autobuilder [1].
The full test suite, without memres passed on local host Debian 13.6 (trixie):
pytest tests/test_vdkr.py -v \
--vdkr-dir /tmp/vcontainer \
--oci-image .../build/tmp/deploy/images/qemux86-64/app-container-curl-latest-oci
With these changes, the test suites pass on the Yocto Project autobuilder [2].
[1] https://autobuilder.yoctoproject.org/valkyrie/#/builders/118/builds/6
[2] https://autobuilder.yoctoproject.org/valkyrie/#/builders/118/builds/7
The following changes since commit a4987f0af6f30883e1dcd52cec66311343241d6f:
grub-efi: Ensure changes only apply with the selected DISTRO_FEATURES (2026-07-21 12:41:02 +0000)
are available in the Git repository at:
https://github.com/moto-timo/meta-virtualization contrib/timo/vcontainer-tests
https://github.com/moto-timo/meta-virtualization/tree/contrib/timo/vcontainer-tests
for you to fetch changes up to 76663da09cf268817d875971c8fd11cf4820ed96:
tests/conftest.py: memrest_stop timeout=120 (2026-07-26 16:48:47 -0700)
----------------------------------------------------------------
Tim Orling (3):
vrunner: add /sbin,/usr/sbin to PATH vrunner.sh: fix daemon_stop() shutdown reliability tests/conftest.py: memrest_stop timeout=120
recipes-containers/vcontainer/files/vrunner.sh | 11 ++++++++++- tests/conftest.py | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/3 vrunner: add /sbin,/usr/sbin to PATH
From: Tim Orling <[email protected]>
mke2fs (state disk creation) and iptables (Xen backend port forwarding) live in /sbin or /usr/sbin, which many non-root interactive shells (e.g. Debian/Ubuntu) don't put on PATH. Under set -e a missing command here kills the script silently (no output reaches the caller), so make sure these are reachable regardless of the caller's PATH.
--- recipes-containers/vcontainer/files/vrunner.sh | 1 + 1 file changed, 1 insertion(+)
recipes-containers/vcontainer/files/vrunner.sh +1 -0
@@ -28,6 +28,7 @@ set -e VERSION="3.5.0" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PATH="$PATH:/sbin:/usr/sbin" # Runtime selection: docker or podman # This affects blob directory, cmdline prefix, state directory, and log prefix
Signature · 1 line
2.47.3
PATCH 2/3 vrunner.sh: fix daemon_stop() shutdown reliability
In reply to [email protected]From: Tim Orling <[email protected]>
Hold the connection open briefly after sending the kill command so the guest's "===SHUTTING_DOWN===" ack has somewhere to land (mirrors the ===PING===/===PONG=== handshake). A bare echo | socat closes the connection the instant echo's stdin hits EOF; the guest's write of its ack into that already-closed channel then never returns, so it never reaches break and graceful_shutdown() never runs -- every stop was silently burning the full 60s and falling through to QMP quit / SIGKILL instead.
--- recipes-containers/vcontainer/files/vrunner.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
recipes-containers/vcontainer/files/vrunner.sh +9 -1
@@ -669,7 +669,15 @@ daemon_stop() { # Error: reading blob sha256:<hash>: file integrity checksum # failed for "<file>" if [ -S "$DAEMON_SOCKET" ]; then - echo "===SHUTDOWN===" | socat - "UNIX-CONNECT:$DAEMON_SOCKET" 2>/dev/null || true + # Hold the connection open briefly after sending the command so the + # guest's "===SHUTTING_DOWN===" ack has somewhere to land (mirrors + # the ===PING===/===PONG=== handshake above). A bare `echo | socat` + # closes the connection the instant echo's stdin hits EOF; the + # guest's write of its ack into that already-closed channel then + # never returns, so it never reaches `break` and graceful_shutdown() + # never runs -- every stop was silently burning the full 60s poll + # below and falling through to QMP quit / SIGKILL instead. + { echo "===SHUTDOWN==="; sleep 3; } | timeout 10 socat - "UNIX-CONNECT:$DAEMON_SOCKET" 2>/dev/null || true # Poll up to 60s (120 * 0.5s). Generous enough to cover heavy # ext4 journal commits; short enough that a truly hung guest # doesn't block the caller indefinitely.
Signature · 1 line
2.47.3
PATCH 3/3 tests/conftest.py: memrest_stop timeout=120
In reply to [email protected]From: Tim Orling <[email protected]>
Match the documented daemon_stop() worst case already used elsewhere in test_vcontainer_daemon_lifecycle.py.
--- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/conftest.py +2 -2
@@ -495,7 +495,7 @@ class VdkrRunner: cmd, proc.returncode, stdout=output, stderr="") return result - def memres_stop(self, timeout=30): + def memres_stop(self, timeout=120): """Stop memory resident mode.""" return self.run("memres", "stop", timeout=timeout, check=False)
@@ -794,7 +794,7 @@ class VpdmnRunner: cmd, proc.returncode, stdout=output, stderr="") return result - def memres_stop(self, timeout=30): + def memres_stop(self, timeout=120): """Stop memory resident mode.""" return self.run("memres", "stop", timeout=timeout, check=False)
Signature · 1 line
2.47.3
Re: [meta-virtualization] [PATCH 1/3] vrunner: add /sbin,/usr/sbin to PATH
In reply to [email protected]merged
Bruce
Re: [meta-virtualization] [PATCH 2/3] vrunner.sh: fix daemon_stop() shutdown reliability
In reply to [email protected]merged
Bruce
Re: [meta-virtualization] [PATCH 3/3] tests/conftest.py: memrest_stop timeout=120
In reply to [email protected]merged
Bruce