Skip to content

Commit 06cb47e

Browse files
yuwatabluca
authored andcommitted
test: replace sleep with timeout
If the test environment is too slow, then sleeping 2 seconds may not be sufficient. (cherry picked from commit e94756c) (cherry picked from commit 93143b6)
1 parent a4bef2a commit 06cb47e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/units/testsuite-63.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ systemctl start test63.path
1515
touch /tmp/test63
1616

1717
# Make sure systemd has sufficient time to hit the trigger limit for test63.path.
18-
sleep 2
18+
# shellcheck disable=SC2016
19+
timeout 30 bash -c 'while ! test "$(systemctl show test63.path -P ActiveState)" = failed; do sleep .2; done'
1920
test "$(systemctl show test63.service -P ActiveState)" = inactive
2021
test "$(systemctl show test63.service -P Result)" = success
21-
test "$(systemctl show test63.path -P ActiveState)" = failed
2222
test "$(systemctl show test63.path -P Result)" = trigger-limit-hit
2323

2424
# Test that starting the service manually doesn't affect the path unit.

0 commit comments

Comments
 (0)