From a522864138a36c6dba952fcca760fd0c89428a2a Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 5 Jul 2024 10:46:30 +1000 Subject: [PATCH] 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 --- .../tests/UNIT/eventscripts/scripts/60.nfs.sh | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) 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" -- 2.47.3