From 1952e96846bd79a939b69cf044b196e933d00d04 Mon Sep 17 00:00:00 2001 From: Nick Liu Date: Wed, 11 Jun 2025 13:19:07 -0500 Subject: [PATCH] fix(tests/common/lib.sh): Support set -e in test scripts The `systemctl is-active virtualbox-guest-utils.service` command returns a non-zero exit status when the service is inactive, causing early exit in tests that use `set -e`. This change suppresses that error with `|| true` to prevent test failure when the service check returns non-zero. Fixes this test: ``` root@demo:~/sanoid/tests/syncoid# cat /tmp/syncoid_test_run_011_sync_out-of-order_snapshots.log + set -e + . ../../common/lib.sh +++ uname ++ unamestr=Linux + POOL_IMAGE=/tmp/jimsalterjrs_sanoid_815.img + POOL_SIZE=64M + POOL_NAME=jimsalterjrs_sanoid_815 + truncate -s 64M /tmp/jimsalterjrs_sanoid_815.img + zpool create -m none -f jimsalterjrs_sanoid_815 /tmp/jimsalterjrs_sanoid_815.img + trap cleanUp EXIT + zfs create jimsalterjrs_sanoid_815/before + zfs snapshot jimsalterjrs_sanoid_815/before@this-snapshot-should-make-it-into-the-after-dataset + disableTimeSync + which timedatectl + '[' 0 -eq 0 ']' + timedatectl set-ntp 0 + which systemctl + '[' 0 -eq 0 ']' + systemctl is-active virtualbox-guest-utils.service inactive + cleanUp + zpool export jimsalterjrs_sanoid_815 + rm -f /tmp/jimsalterjrs_sanoid_815.img ``` --- tests/common/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common/lib.sh b/tests/common/lib.sh index 84b2c63..a204652 100644 --- a/tests/common/lib.sh +++ b/tests/common/lib.sh @@ -57,7 +57,7 @@ function disableTimeSync { which systemctl > /dev/null if [ $? -eq 0 ]; then - systemctl is-active virtualbox-guest-utils.service && systemctl stop virtualbox-guest-utils.service + systemctl is-active virtualbox-guest-utils.service && systemctl stop virtualbox-guest-utils.service || true fi }