]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Simplify handling of statistics change
authorMartin Schwenke <mschwenke@ddn.com>
Fri, 5 Jul 2024 00:46:30 +0000 (10:46 +1000)
committerMartin Schwenke <martins@samba.org>
Tue, 20 Aug 2024 22:50:34 +0000 (22:50 +0000)
Handling this across two different functions led to insanity, so
simplify.

The handling of unhealthy_after when $_numfails = 0 implicitly causes
the node to be healthy.  This is how the "rpcinfo succeeds" case
works.  Doing it this way for statistics makes this patch easier to
read.  The implicit behaviour will go away in the next patch.

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

index ff273a49f845b7a60faed105689cec1a46c6d5c5..af817d8d30bdc3e0a5a5dfe748df1f796f3b31f7 100644 (file)
@@ -346,25 +346,18 @@ rpc_set_service_failure_response()
                elif nfs_stats_check_changed \
                        "$_rpc_service" "$_iteration"; then
 
-                       _numfails=-1
-               else
-                       # -1 above is a special case of 0:
-                       # hack, unhack ;-)
-                       if [ "$_numfails" -eq -1 ]; then
-                               _numfails=0
-                       fi
-                       _numfails=$((_numfails + 1))
-               fi
-               echo "$_numfails" >"$_failcount_file"
-
-               if [ "$_numfails" -eq -1 ]; then
-                       _unhealthy=false
                        rpc_failure \
                                "WARNING: statistics changed but" \
                                "$_rpc_service" \
                                "$_ver" \
                                >"$_out"
-               elif [ $unhealthy_after -gt 0 ] &&
+                       _numfails=0
+               else
+                       _numfails=$((_numfails + 1))
+               fi
+               echo "$_numfails" >"$_failcount_file"
+
+               if [ $unhealthy_after -gt 0 ] &&
                        [ "$_numfails" -ge $unhealthy_after ]; then
                        _unhealthy=true
                        echo 1 >"$_rc_file"