[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 02/02: tests: Make ‘log-rotation’ test more deterministic.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 02/02: tests: Make ‘log-rotation’ test more deterministic. |
Date: |
Tue, 18 Jun 2024 08:15:25 -0400 (EDT) |
civodul pushed a commit to branch devel
in repository shepherd.
commit 9f2d5ea865a7a769fe2c7ef5cd13ff84cf277ec5
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Jun 18 14:14:24 2024 +0200
tests: Make ‘log-rotation’ test more deterministic.
* tests/services/log-rotation.sh: Grep for the “Deleting” message in
$log* instead of just $log.
---
tests/services/log-rotation.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/services/log-rotation.sh b/tests/services/log-rotation.sh
index 19982bd..cf3d55f 100644
--- a/tests/services/log-rotation.sh
+++ b/tests/services/log-rotation.sh
@@ -110,7 +110,9 @@ test -f "$service_log2.1.gz" && false
touch -d "2017-10-01" "$service_log1.2.gz"
$herd trigger log-rotation
-until grep "Deleting .*$service_log1.2.gz" "$log"; do sleep 0.2; done
+# The "Deleting ..." message might end up in the current $log or in $log.1.gz,
+# depending on the order in which they are rotated.
+until zgrep "Deleting .*$service_log1.2.gz" "$log"*; do sleep 0.2; tail -10
"$log"; done
until test -f "$service_log1.2.gz"; do sleep 0.2; done
until test -f "$service_log1.1.gz"; do sleep 0.2; done
test -f "$service_log1.3.gz" && false