guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 04/06: tests: Simplify 'tests/replacement.sh'.


From: Ludovic Courtès
Subject: [shepherd] 04/06: tests: Simplify 'tests/replacement.sh'.
Date: Wed, 14 Jun 2023 12:46:25 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit 3952f647472562b1a6b988333eccaa4d8c6db47c
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Jun 14 18:11:31 2023 +0200

    tests: Simplify 'tests/replacement.sh'.
    
    * tests/replacement.sh: Make tests more compact.
---
 tests/replacement.sh | 37 +++++++------------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/tests/replacement.sh b/tests/replacement.sh
index 31776fe..4b5d29e 100644
--- a/tests/replacement.sh
+++ b/tests/replacement.sh
@@ -58,11 +58,8 @@ shepherd -I -s "$socket" -c "$conf" --pid="$pid" 
--log="$log" &
 while ! test -f "$pid"; do sleep 0.5 ; done
 
 $herd start test
-
-if ! $herd say-hello test; then
-    echo "say-hello failed"
-    exit 1
-fi
+$herd say-hello test
+test -f "$stamp"
 
 cat > "$rconf"<<EOF
 (register-services
@@ -81,34 +78,14 @@ EOF
 
 $herd load root "$rconf"
 
-if ! $herd say-hello test; then
-    echo "say-hello failed after setting replacement"
-    exit 1
-fi
-
-if test "`cat $stamp`" != "Hello"; then
-    echo "Output file had the wrong contents! Was:"
-    cat $stamp
-    exit 1
-fi
+$herd say-hello test
+test "`cat $stamp`" = "Hello"
 
 $herd restart test
 
 $herd status test | grep running
 grep "The replacement is starting" "$log"
 
-if $herd say-hello test; then
-    echo "say-hello should have failed after stop/start"
-    exit 1
-fi
-
-if ! $herd say-goodbye test; then
-    echo "say-goodbye failed after replacement"
-    exit 1
-fi
-
-if test "`cat $stamp`" != "Goodbye"; then
-    echo "Output file had the wrong contents! Was:"
-    cat $stamp
-    exit 1
-fi
+$herd say-hello test && false  # this action should have vanished
+$herd say-goodbye test         # this one is new
+test "`cat $stamp`" = "Goodbye"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]