]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: retry the property check a couple of times
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 8 Nov 2023 08:13:45 +0000 (09:13 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 8 Nov 2023 10:03:53 +0000 (10:03 +0000)
41e4ce06fe shortened existing sleeps, which resulted in the check being
sometimes done before the property had a chance to update. Let's do what
what we do with the rest of the checks and retry it a couple of times.

Resolves: #29923

test/units/testsuite-45.sh

index 9688a850f745d3e0c8c3359f6acb34b35b90ebbd..779fa2b98d7276da0c85e494b19441fe417a3be7 100755 (executable)
@@ -205,7 +205,14 @@ LOCAL"
 }
 
 assert_ntp() {
-    assert_eq "$(busctl get-property org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 NTP)" "b $1"
+    local value="${1:?}"
+
+    for _ in {0..9}; do
+        [[ "$(busctl get-property org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 NTP)" == "b $value" ]] && return 0
+        sleep .5
+    done
+
+    return 1
 }
 
 assert_timedated_signal() {