mirror of https://github.com/jimsalterjrs/sanoid
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 ```
This commit is contained in:
parent
f2e1e4f8a0
commit
1952e96846
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue