]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Replace implicit healthy behaviour with early exits
authorMartin Schwenke <mschwenke@ddn.com>
Thu, 4 Jul 2024 05:17:25 +0000 (15:17 +1000)
committerMartin Schwenke <martins@samba.org>
Tue, 20 Aug 2024 22:50:34 +0000 (22:50 +0000)
The early exits from the sub-shell make the obvious successes much
more obvious, and slightly simplify the code that follows.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh

index af817d8d30bdc3e0a5a5dfe748df1f796f3b31f7..ae295df85b12710bc6eeaea8129a2754915a5529 100644 (file)
@@ -342,7 +342,8 @@ rpc_set_service_failure_response()
                if rpcinfo -T tcp localhost "$_rpc_service" \
                        >/dev/null 2>&1; then
 
-                       _numfails=0
+                       echo 0 >"$_failcount_file"
+                       exit # from subshell
                elif nfs_stats_check_changed \
                        "$_rpc_service" "$_iteration"; then
 
@@ -351,7 +352,8 @@ rpc_set_service_failure_response()
                                "$_rpc_service" \
                                "$_ver" \
                                >"$_out"
-                       _numfails=0
+                       echo 0 >"$_failcount_file"
+                       exit # from subshell
                else
                        _numfails=$((_numfails + 1))
                fi
@@ -371,7 +373,6 @@ rpc_set_service_failure_response()
                fi
 
                if [ $restart_every -gt 0 ] &&
-                       [ $_numfails -gt 0 ] &&
                        [ $((_numfails % restart_every)) -eq 0 ]; then
                        if ! $_unhealthy; then
                                rpc_failure \