From: Martin Schwenke Date: Thu, 4 Jul 2024 00:55:07 +0000 (+1000) Subject: ctdb-tests: nfs_iterate_test() marks RPC service down X-Git-Tag: tdb-1.4.13~1340 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7c5e7080015117319162d37eced72f7a01b8d1af;p=thirdparty%2Fsamba.git ctdb-tests: nfs_iterate_test() marks RPC service down If an RPC service is given, it is automatically marked down. This avoids repetition in test cases and loosens coupling. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.106.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.106.sh index 43d6b2f03ec..9cd716baaac 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.106.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.106.sh @@ -6,6 +6,4 @@ define_test "portmapper down, 2 iterations" setup -rpc_services_down "portmapper" - nfs_iterate_test 2 "portmapper" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.112.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.112.sh index 4000b5d8435..1885c943312 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.112.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.112.sh @@ -8,6 +8,4 @@ define_test "knfsd down, 10 iterations" setup -rpc_services_down "nfs" - nfs_iterate_test 10 "nfs" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.113.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.113.sh index 744966c94c7..764ef30826f 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.113.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.113.sh @@ -7,8 +7,6 @@ define_test "knfsd down, 10 iterations, no hung threads" # knfsd fails and attempts to restart it fail. setup -rpc_services_down "nfs" - nfs_setup_fake_threads "nfsd" nfs_iterate_test 10 "nfs" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.114.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.114.sh index 7170fff6472..aba348742b6 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.114.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.114.sh @@ -7,8 +7,6 @@ define_test "knfsd down, 10 iterations, 3 hung threads" # knfsd fails and attempts to restart it fail. setup -rpc_services_down "nfs" - nfs_setup_fake_threads "nfsd" 1001 1002 1003 nfs_iterate_test 10 "nfs" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.115.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.115.sh index 860436328d4..b51e20d0740 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.115.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.115.sh @@ -21,6 +21,4 @@ EOF # Test flag to indicate that stats are expected to change nfs_stats_set_changed "nfs" "status" -rpc_services_down "nfs" - nfs_iterate_test 10 "nfs" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.116.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.116.sh index 1bdd29e73ec..6865c9eca98 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.116.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.116.sh @@ -21,6 +21,4 @@ EOF # Test flag to indicate that stats are expected to change nfs_stats_set_changed "status" -rpc_services_down "nfs" - nfs_iterate_test 10 "nfs" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.121.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.121.sh index 1cda2765c38..ab336654a58 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.121.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.121.sh @@ -10,6 +10,4 @@ define_test "lockd down, 7 iterations" setup -rpc_services_down "nlockmgr" - nfs_iterate_test 7 "nlockmgr" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.122.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.122.sh index eae7ca0b42a..783bafe89b5 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.122.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.122.sh @@ -9,8 +9,6 @@ define_test "lockd down, 7 iterations, back up after 2" setup -rpc_services_down "nlockmgr" - # Iteration 2 should try to restart rpc.lockd. However, our test # stub rpc.lockd does nothing, so we have to explicitly flag it as up. diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.131.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.131.sh index 33e1cf47499..174ae9e06c3 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.131.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.131.sh @@ -6,6 +6,4 @@ define_test "rquotad down, 7 iterations" setup -rpc_services_down "rquotad" - nfs_iterate_test 7 "rquotad" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.132.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.132.sh index 207d872c24f..97af413f631 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.132.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.132.sh @@ -9,7 +9,5 @@ define_test "rquotad down, 7 iterations, back up after 2" setup -rpc_services_down "rquotad" - nfs_iterate_test 7 "rquotad" \ 3 'rpc_services_up "rquotad"' diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.141.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.141.sh index 5a8c5ce75a7..a436edbb138 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.141.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.141.sh @@ -8,6 +8,4 @@ define_test "statd down, 7 iterations" setup -rpc_services_down "status" - nfs_iterate_test 7 "status" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.142.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.142.sh index 694bf928b7e..266c52fe73c 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.142.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.142.sh @@ -8,7 +8,5 @@ define_test "statd down, 7 iterations, back up after 2" setup -rpc_services_down "status" - nfs_iterate_test 7 "status" \ 3 'rpc_services_up "status"' diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.143.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.143.sh index d17277ea88d..d2e42fcbaee 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.143.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.143.sh @@ -8,7 +8,6 @@ define_test "statd down, 2 iterations, stuck process" setup -rpc_services_down "status" nfs_setup_fake_threads "rpc.status" 1001 nfs_iterate_test 2 "status" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.144.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.144.sh index 5a8c5ce75a7..a436edbb138 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.144.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.144.sh @@ -8,6 +8,4 @@ define_test "statd down, 7 iterations" setup -rpc_services_down "status" - nfs_iterate_test 7 "status" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.152.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.152.sh index c3a6b8bbf30..c1db405f051 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.152.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.152.sh @@ -10,6 +10,4 @@ define_test "mountd down, 7 iterations" setup -rpc_services_down "mountd" - nfs_iterate_test 7 "mountd" diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.153.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.153.sh index a09315bcac5..f105976702e 100755 --- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.153.sh +++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.153.sh @@ -6,8 +6,6 @@ define_test "mountd down, 7 iterations, back up after 2" setup -rpc_services_down "mountd" - # Iteration 2 should try to restart rpc.mountd. However, our test # stub rpc.mountd does nothing, so we have to explicitly flag it as # up. diff --git a/ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh b/ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh index 1a8dab73ded..a09f4b6a148 100644 --- a/ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh +++ b/ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh @@ -387,12 +387,14 @@ program_stack_traces() # # - 2nd argument is the NFS/RPC service being tested # -# rpcinfo is used on each iteration to test the availability of the -# service +# This service is marked down before the 1st iteration. # -# If this is not set or null then no RPC service is checked and the -# required output is not reset on each iteration. This is useful in -# baseline tests to confirm that the eventscript and test +# rpcinfo is then used on each iteration to test the availability of +# the service. +# +# If this is not set or null it is assumed all services are healthy +# and no output or non-zero return codes are generated. This is +# useful in baseline tests to confirm that the eventscript and test # infrastructure is working correctly. # # - Subsequent arguments come in pairs: an iteration number and @@ -414,6 +416,16 @@ nfs_iterate_test() shift fi + if [ -n "$_rpc_service" ]; then + debug <