From: Martin Schwenke Date: Fri, 5 Jul 2024 00:46:30 +0000 (+1000) Subject: ctdb-tests: Simplify handling of statistics change X-Git-Tag: tdb-1.4.13~1335 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a522864138a36c6dba952fcca760fd0c89428a2a;p=thirdparty%2Fsamba.git ctdb-tests: Simplify handling of statistics change 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 Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh b/ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh index ff273a49f84..af817d8d30b 100644 --- a/ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh +++ b/ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh @@ -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"