]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Argument 3 to nfs_iterate_test() is up iteration
authorMartin Schwenke <mschwenke@ddn.com>
Thu, 4 Jul 2024 00:44:18 +0000 (10:44 +1000)
committerMartin Schwenke <martins@samba.org>
Tue, 20 Aug 2024 22:50:34 +0000 (22:50 +0000)
Nothing more complex is ever done, so we might as well simplify and
reduce coupling.

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

index 783bafe89b51eebf44bcb4e8875c3cb88df55518..9999b2b4b285b6faced4c13ca02554b6649aed2d 100755 (executable)
@@ -12,5 +12,4 @@ setup
 # 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.
 
-nfs_iterate_test 7 "nlockmgr" \
-    3 "rpc_services_up nlockmgr"
+nfs_iterate_test 7 "nlockmgr" 3
index 97af413f6311186c7611108d444625bb1213528d..648469390a1836115a895947a7aa87f7f9f6d192 100755 (executable)
@@ -9,5 +9,4 @@ define_test "rquotad down, 7 iterations, back up after 2"
 
 setup
 
-nfs_iterate_test 7 "rquotad" \
-    3 'rpc_services_up "rquotad"'
+nfs_iterate_test 7 "rquotad" 3
index 266c52fe73ca78320bb2727a8d6f8f5236fe8206..d0ed6b527e3eee8d7869f8be46210a39f26aef81 100755 (executable)
@@ -8,5 +8,4 @@ define_test "statd down, 7 iterations, back up after 2"
 
 setup
 
-nfs_iterate_test 7 "status" \
-    3 'rpc_services_up "status"'
+nfs_iterate_test 7 "status" 3
index f105976702e99bc54e98370dee0a1f28d0964956..c840bbe4b604fb2646540f6ab7be206ae0051486 100755 (executable)
@@ -9,5 +9,4 @@ setup
 # 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.
-nfs_iterate_test 7 "mountd" \
-    3 "rpc_services_up mountd"
+nfs_iterate_test 7 "mountd" 3
index a09f4b6a1482a0b01217fca7f6d78ea5d2c77871..d5e752a99f178c64646f03495f14a5a0b6e319a6 100644 (file)
@@ -397,19 +397,14 @@ program_stack_traces()
 #   useful in baseline tests to confirm that the eventscript and test
 #   infrastructure is working correctly.
 #
-# - Subsequent arguments come in pairs: an iteration number and
-#   something to eval before that iteration.  Each time an iteration
-#   number is matched the associated argument is given to eval after
-#   the default setup is done.  The iteration numbers need to be given
-#   in ascending order.
-#
-#   These arguments can allow a service to be started or stopped
-#   before a particular iteration.
+# - 3rd argument is optional iteration on which to bring the RPC
+#   service back up
 #
 nfs_iterate_test()
 {
        _repeats="$1"
        _rpc_service="$2"
+       _up_iteration="${3:--1}"
        if [ -n "$2" ]; then
                shift 2
        else
@@ -432,19 +427,14 @@ EOF
 
        _iterate_failcount=0
        for _iteration in $(seq 1 "$_repeats"); do
-               # This is not a numerical comparison because $1 will
-               # often not be set.
-               if [ "$_iteration" = "$1" ]; then
-                       debug <<EOF
-##################################################
-EOF
-                       eval "$2"
-                       debug <<EOF
-##################################################
-EOF
-                       shift 2
-               fi
                if [ -n "$_rpc_service" ]; then
+                       if [ "$_iteration" = "$_up_iteration" ]; then
+                               debug <<EOF
+--------------------------------------------------
+EOF
+                               rpc_services_up "$_rpc_service"
+                       fi
+
                        if rpcinfo -T tcp localhost "$_rpc_service" \
                                >/dev/null 2>&1; then
                                _iterate_failcount=0