From e94756c5668697d0b11f4cdf449a2fbfe13ffb1f Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 2 May 2023 15:15:30 +0900 Subject: test: replace sleep with timeout If the test environment is too slow, then sleeping 2 seconds may not be sufficient. --- test/units/testsuite-63.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/units/testsuite-63.sh b/test/units/testsuite-63.sh index 591e6d3104..59a7b3208f 100755 --- a/test/units/testsuite-63.sh +++ b/test/units/testsuite-63.sh @@ -15,10 +15,10 @@ systemctl start test63.path touch /tmp/test63 # Make sure systemd has sufficient time to hit the trigger limit for test63.path. -sleep 2 +# shellcheck disable=SC2016 +timeout 30 bash -c 'while ! test "$(systemctl show test63.path -P ActiveState)" = failed; do sleep .2; done' test "$(systemctl show test63.service -P ActiveState)" = inactive test "$(systemctl show test63.service -P Result)" = success -test "$(systemctl show test63.path -P ActiveState)" = failed test "$(systemctl show test63.path -P Result)" = trigger-limit-hit # Test that starting the service manually doesn't affect the path unit. -- cgit v1.2.1