From 453eb88127ea458b03ad3382ff4d4ecc6063be64 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 10 Apr 2024 10:04:04 -0400 Subject: [PATCH] bin/helpers: check for unexpected LXD warnings/errors during cleanup() Signed-off-by: Simon Deziel --- bin/helpers | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bin/helpers b/bin/helpers index 13f04fd4d..1e6cd3f9e 100644 --- a/bin/helpers +++ b/bin/helpers @@ -184,6 +184,7 @@ certificateFingerprintShort() ( ) # cleanup: report if the test passed or not and return the appropriate return code. +# Also fail the test if unexpected warnings/errors are logged by LXD cleanup() { set +e echo "" @@ -208,6 +209,19 @@ cleanup() { echo "::endgroup::" exit 1 + else + # The test passed but check for unexpected warnings/errors + problems="$(journalctl --quiet --no-hostname --output cat --no-pager --boot=0 --lines=100 --unit=snap.lxd.daemon.service --grep ' level=(warning|error) ' | \ + grep -vF 'per-instance network priority will be ignored. Please use per-device limits.priority instead')" + if [ -n "${problems}" ]; then + echo "Test failed" + + echo "Unexpected LXD warnings/errors:" + echo + echo "${problems}" + + exit 1 + fi fi echo "Test passed"