From: Martin Schwenke Date: Mon, 12 Feb 2018 19:53:44 +0000 (+1100) Subject: ctdb-tests: 60.nfs (and 06.nfs) event script setup modularisation X-Git-Tag: talloc-2.1.13~151 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=042a5101fc401eb023ee010896da75279e2a7d9c;p=thirdparty%2Fsamba.git ctdb-tests: 60.nfs (and 06.nfs) event script setup modularisation Includes gratuitous changes to get lines below 80 columns. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/eventscripts/06.nfs.releaseip.001.sh b/ctdb/tests/eventscripts/06.nfs.releaseip.001.sh index 8f590b01757..538eae787e8 100755 --- a/ctdb/tests/eventscripts/06.nfs.releaseip.001.sh +++ b/ctdb/tests/eventscripts/06.nfs.releaseip.001.sh @@ -4,9 +4,9 @@ define_test "callout is 'true'" -setup_nfs +setup -export CTDB_NFS_CALLOUT="true" +CTDB_NFS_CALLOUT="true" ok_null simple_test diff --git a/ctdb/tests/eventscripts/06.nfs.releaseip.002.sh b/ctdb/tests/eventscripts/06.nfs.releaseip.002.sh index c0b893929b6..884ca81a0b1 100755 --- a/ctdb/tests/eventscripts/06.nfs.releaseip.002.sh +++ b/ctdb/tests/eventscripts/06.nfs.releaseip.002.sh @@ -4,9 +4,9 @@ define_test "callout is 'false', causes releaseip-pre to fail" -setup_nfs +setup -export CTDB_NFS_CALLOUT="echo releaseip-pre ; false" +CTDB_NFS_CALLOUT="echo releaseip-pre ; false" required_result 1 "releaseip-pre" simple_test diff --git a/ctdb/tests/eventscripts/06.nfs.takeip.001.sh b/ctdb/tests/eventscripts/06.nfs.takeip.001.sh index 8f590b01757..538eae787e8 100755 --- a/ctdb/tests/eventscripts/06.nfs.takeip.001.sh +++ b/ctdb/tests/eventscripts/06.nfs.takeip.001.sh @@ -4,9 +4,9 @@ define_test "callout is 'true'" -setup_nfs +setup -export CTDB_NFS_CALLOUT="true" +CTDB_NFS_CALLOUT="true" ok_null simple_test diff --git a/ctdb/tests/eventscripts/06.nfs.takeip.002.sh b/ctdb/tests/eventscripts/06.nfs.takeip.002.sh index 1baf351265c..895bf2d2ce2 100755 --- a/ctdb/tests/eventscripts/06.nfs.takeip.002.sh +++ b/ctdb/tests/eventscripts/06.nfs.takeip.002.sh @@ -4,9 +4,9 @@ define_test "callout is 'false', causes takeip-pre to fail" -setup_nfs +setup -export CTDB_NFS_CALLOUT="echo takeip-pre ; false" +CTDB_NFS_CALLOUT="echo takeip-pre ; false" required_result 1 "takeip-pre" simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.001.sh b/ctdb/tests/eventscripts/60.nfs.monitor.001.sh index c62e5cf8789..00f8180901f 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.001.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.001.sh @@ -4,7 +4,7 @@ define_test "not managed, check no-op" -setup_nfs "down" +setup "down" ok_null diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.101.sh b/ctdb/tests/eventscripts/60.nfs.monitor.101.sh index 1a689278106..293b724001e 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.101.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.101.sh @@ -4,7 +4,7 @@ define_test "all services available" -setup_nfs +setup ok_null diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.102.sh b/ctdb/tests/eventscripts/60.nfs.monitor.102.sh index 5bb72b65255..2f83b2ce976 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.102.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.102.sh @@ -4,7 +4,7 @@ define_test "all services available, check nfsd thread count, count matches" -setup_nfs +setup RPCNFSDCOUNT=8 nfs_setup_fake_threads "nfsd" 1 2 3 4 5 6 7 8 diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.103.sh b/ctdb/tests/eventscripts/60.nfs.monitor.103.sh index cf2491d009c..c0bb305875a 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.103.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.103.sh @@ -2,9 +2,9 @@ . "${TEST_SCRIPTS_DIR}/unit.sh" -define_test "all services available, check nfsd thread count, not enough threads" +define_test "all services available, not enough nfsd threads" -setup_nfs +setup RPCNFSDCOUNT=8 nfs_setup_fake_threads "nfsd" 1 2 3 4 5 diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.104.sh b/ctdb/tests/eventscripts/60.nfs.monitor.104.sh index ea3f66561a1..d5688925629 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.104.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.104.sh @@ -7,7 +7,7 @@ # consciously removed. define_test "all services available, check nfsd thread count, too many threads" -setup_nfs +setup RPCNFSDCOUNT=4 nfs_setup_fake_threads "nfsd" 1 2 3 4 5 6 diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.105.sh b/ctdb/tests/eventscripts/60.nfs.monitor.105.sh index c0513e46764..e83ead84e33 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.105.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.105.sh @@ -4,7 +4,7 @@ define_test "all services available, 10 iterations with ok_null" -setup_nfs +setup ok_null nfs_iterate_test 10 diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.106.sh b/ctdb/tests/eventscripts/60.nfs.monitor.106.sh index 49329c33e36..43d6b2f03ec 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.106.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.106.sh @@ -4,7 +4,8 @@ define_test "portmapper down, 2 iterations" -setup_nfs +setup + rpc_services_down "portmapper" nfs_iterate_test 2 "portmapper" diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.107.sh b/ctdb/tests/eventscripts/60.nfs.monitor.107.sh index 8f590b01757..538eae787e8 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.107.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.107.sh @@ -4,9 +4,9 @@ define_test "callout is 'true'" -setup_nfs +setup -export CTDB_NFS_CALLOUT="true" +CTDB_NFS_CALLOUT="true" ok_null simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.108.sh b/ctdb/tests/eventscripts/60.nfs.monitor.108.sh index 6fe7bada1cc..5ec9a0765d5 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.108.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.108.sh @@ -4,9 +4,9 @@ define_test "callout is 'false', causes monitor-pre to fail" -setup_nfs +setup -export CTDB_NFS_CALLOUT="echo monitor-pre ; false" +CTDB_NFS_CALLOUT="echo monitor-pre ; false" required_result 1 "monitor-pre" simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.109.sh b/ctdb/tests/eventscripts/60.nfs.monitor.109.sh index a86f6d99e12..2197ade6f9f 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.109.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.109.sh @@ -4,9 +4,9 @@ define_test "callout is 'false', causes monitor-post to fail" -setup_nfs +setup -export CTDB_NFS_CALLOUT="echo monitor-post ; false" +CTDB_NFS_CALLOUT="echo monitor-post ; false" required_result 1 "monitor-post" simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.111.sh b/ctdb/tests/eventscripts/60.nfs.monitor.111.sh index 414fcc8066b..2bbda9686b7 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.111.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.111.sh @@ -4,7 +4,8 @@ define_test "knfsd down, 1 iteration" -setup_nfs +setup + rpc_services_down "nfs" ok_null diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.112.sh b/ctdb/tests/eventscripts/60.nfs.monitor.112.sh index 7c7bbf5a350..4000b5d8435 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.112.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.112.sh @@ -6,7 +6,8 @@ define_test "knfsd down, 10 iterations" # knfsd fails and attempts to restart it fail. -setup_nfs +setup + rpc_services_down "nfs" nfs_iterate_test 10 "nfs" diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.113.sh b/ctdb/tests/eventscripts/60.nfs.monitor.113.sh index 68ade385aea..744966c94c7 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.113.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.113.sh @@ -5,7 +5,8 @@ define_test "knfsd down, 10 iterations, no hung threads" # knfsd fails and attempts to restart it fail. -setup_nfs +setup + rpc_services_down "nfs" nfs_setup_fake_threads "nfsd" diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.114.sh b/ctdb/tests/eventscripts/60.nfs.monitor.114.sh index 94de41fb73f..7170fff6472 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.114.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.114.sh @@ -5,7 +5,8 @@ define_test "knfsd down, 10 iterations, 3 hung threads" # knfsd fails and attempts to restart it fail. -setup_nfs +setup + rpc_services_down "nfs" nfs_setup_fake_threads "nfsd" 1001 1002 1003 diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.121.sh b/ctdb/tests/eventscripts/60.nfs.monitor.121.sh index de69498721a..1cda2765c38 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.121.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.121.sh @@ -8,7 +8,8 @@ define_test "lockd down, 7 iterations" # attempts to restart the service. That is, the eventscript is unable # to restart the service. -setup_nfs +setup + rpc_services_down "nlockmgr" nfs_iterate_test 7 "nlockmgr" diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.122.sh b/ctdb/tests/eventscripts/60.nfs.monitor.122.sh index a0e0656c412..eae7ca0b42a 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.122.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.122.sh @@ -7,7 +7,8 @@ define_test "lockd down, 7 iterations, back up after 2" # This simulates a success the eventscript's automated attempts to # restart the service. -setup_nfs +setup + rpc_services_down "nlockmgr" # Iteration 2 should try to restart rpc.lockd. However, our test diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.131.sh b/ctdb/tests/eventscripts/60.nfs.monitor.131.sh index 72a1917f6f1..33e1cf47499 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.131.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.131.sh @@ -4,7 +4,8 @@ define_test "rquotad down, 7 iterations" -setup_nfs +setup + rpc_services_down "rquotad" nfs_iterate_test 7 "rquotad" diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.132.sh b/ctdb/tests/eventscripts/60.nfs.monitor.132.sh index e34bb494b1a..207d872c24f 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.132.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.132.sh @@ -7,7 +7,8 @@ define_test "rquotad down, 7 iterations, back up after 2" # rquotad fails once but then comes back after restart after 2nd # failure. -setup_nfs +setup + rpc_services_down "rquotad" nfs_iterate_test 7 "rquotad" \ diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.141.sh b/ctdb/tests/eventscripts/60.nfs.monitor.141.sh index 96159338a0e..5a8c5ce75a7 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.141.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.141.sh @@ -6,7 +6,8 @@ define_test "statd down, 7 iterations" # statd fails and attempts to restart it fail. -setup_nfs +setup + rpc_services_down "status" nfs_iterate_test 7 "status" diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.142.sh b/ctdb/tests/eventscripts/60.nfs.monitor.142.sh index ec88bdcff0b..694bf928b7e 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.142.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.142.sh @@ -6,7 +6,8 @@ define_test "statd down, 7 iterations, back up after 2" # statd fails and the first attempt to restart it succeeds. -setup_nfs +setup + rpc_services_down "status" nfs_iterate_test 7 "status" \ diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.143.sh b/ctdb/tests/eventscripts/60.nfs.monitor.143.sh index 2e7f3cfce82..d17277ea88d 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.143.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.143.sh @@ -6,7 +6,8 @@ define_test "statd down, 2 iterations, stuck process" # statd fails and the first attempt to restart it succeeds. -setup_nfs +setup + rpc_services_down "status" nfs_setup_fake_threads "rpc.status" 1001 diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.144.sh b/ctdb/tests/eventscripts/60.nfs.monitor.144.sh index 96159338a0e..5a8c5ce75a7 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.144.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.144.sh @@ -6,7 +6,8 @@ define_test "statd down, 7 iterations" # statd fails and attempts to restart it fail. -setup_nfs +setup + rpc_services_down "status" nfs_iterate_test 7 "status" diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.151.sh b/ctdb/tests/eventscripts/60.nfs.monitor.151.sh index ea9aa7830ec..9ab18072d4f 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.151.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.151.sh @@ -4,7 +4,8 @@ define_test "mountd down, 1 iteration" -setup_nfs +setup + rpc_services_down "mountd" ok_null diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.152.sh b/ctdb/tests/eventscripts/60.nfs.monitor.152.sh index 514369849d4..c3a6b8bbf30 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.152.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.152.sh @@ -8,7 +8,8 @@ define_test "mountd down, 7 iterations" # attempts to restart the service. That is, the eventscript is unable # to restart the service. -setup_nfs +setup + rpc_services_down "mountd" nfs_iterate_test 7 "mountd" diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.153.sh b/ctdb/tests/eventscripts/60.nfs.monitor.153.sh index 5dce3c47c5d..a09315bcac5 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.153.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.153.sh @@ -4,7 +4,8 @@ define_test "mountd down, 7 iterations, back up after 2" -setup_nfs +setup + rpc_services_down "mountd" # Iteration 2 should try to restart rpc.mountd. However, our test diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.161.sh b/ctdb/tests/eventscripts/60.nfs.monitor.161.sh index 11c4f78172e..ed080c2c4c8 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.161.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.161.sh @@ -4,7 +4,7 @@ define_test "2nd share missing" -setup_nfs +setup out=$(shares_missing "ERROR: nfs directory \"%s\" not available" 2) diff --git a/ctdb/tests/eventscripts/60.nfs.monitor.162.sh b/ctdb/tests/eventscripts/60.nfs.monitor.162.sh index 4a8be869e1d..51ce93e5267 100755 --- a/ctdb/tests/eventscripts/60.nfs.monitor.162.sh +++ b/ctdb/tests/eventscripts/60.nfs.monitor.162.sh @@ -4,8 +4,9 @@ define_test "2nd share missing, skipping share checks" -setup_nfs -export CTDB_NFS_SKIP_SHARE_CHECK="yes" +setup + +CTDB_NFS_SKIP_SHARE_CHECK="yes" ok_null diff --git a/ctdb/tests/eventscripts/60.nfs.multi.001.sh b/ctdb/tests/eventscripts/60.nfs.multi.001.sh index f983df7615a..baa57019e32 100755 --- a/ctdb/tests/eventscripts/60.nfs.multi.001.sh +++ b/ctdb/tests/eventscripts/60.nfs.multi.001.sh @@ -4,7 +4,7 @@ define_test "takeip, ipreallocated -> reconfigure" -setup_nfs +setup public_address=$(ctdb_get_1_public_address) diff --git a/ctdb/tests/eventscripts/60.nfs.multi.002.sh b/ctdb/tests/eventscripts/60.nfs.multi.002.sh index 29386c13b23..846380f92b1 100755 --- a/ctdb/tests/eventscripts/60.nfs.multi.002.sh +++ b/ctdb/tests/eventscripts/60.nfs.multi.002.sh @@ -4,7 +4,7 @@ define_test "takeip, monitor -> no reconfigure" -setup_nfs +setup public_address=$(ctdb_get_1_public_address) diff --git a/ctdb/tests/eventscripts/60.nfs.releaseip.001.sh b/ctdb/tests/eventscripts/60.nfs.releaseip.001.sh index 8f590b01757..538eae787e8 100755 --- a/ctdb/tests/eventscripts/60.nfs.releaseip.001.sh +++ b/ctdb/tests/eventscripts/60.nfs.releaseip.001.sh @@ -4,9 +4,9 @@ define_test "callout is 'true'" -setup_nfs +setup -export CTDB_NFS_CALLOUT="true" +CTDB_NFS_CALLOUT="true" ok_null simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.releaseip.002.sh b/ctdb/tests/eventscripts/60.nfs.releaseip.002.sh index 68f636f489f..752070c2452 100755 --- a/ctdb/tests/eventscripts/60.nfs.releaseip.002.sh +++ b/ctdb/tests/eventscripts/60.nfs.releaseip.002.sh @@ -4,9 +4,9 @@ define_test "callout is 'false', causes releaseip to fail" -setup_nfs +setup -export CTDB_NFS_CALLOUT="echo releaseip ; false" +CTDB_NFS_CALLOUT="echo releaseip ; false" required_result 1 "releaseip" simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.shutdown.001.sh b/ctdb/tests/eventscripts/60.nfs.shutdown.001.sh index 8f590b01757..538eae787e8 100755 --- a/ctdb/tests/eventscripts/60.nfs.shutdown.001.sh +++ b/ctdb/tests/eventscripts/60.nfs.shutdown.001.sh @@ -4,9 +4,9 @@ define_test "callout is 'true'" -setup_nfs +setup -export CTDB_NFS_CALLOUT="true" +CTDB_NFS_CALLOUT="true" ok_null simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.shutdown.002.sh b/ctdb/tests/eventscripts/60.nfs.shutdown.002.sh index b8bb5606b27..9ddf9d87825 100755 --- a/ctdb/tests/eventscripts/60.nfs.shutdown.002.sh +++ b/ctdb/tests/eventscripts/60.nfs.shutdown.002.sh @@ -4,9 +4,9 @@ define_test "callout is 'false', causes shutdown to fail" -setup_nfs +setup -export CTDB_NFS_CALLOUT="echo shutdown ; false" +CTDB_NFS_CALLOUT="echo shutdown ; false" required_result 1 "shutdown" simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.startup.001.sh b/ctdb/tests/eventscripts/60.nfs.startup.001.sh index 8f590b01757..538eae787e8 100755 --- a/ctdb/tests/eventscripts/60.nfs.startup.001.sh +++ b/ctdb/tests/eventscripts/60.nfs.startup.001.sh @@ -4,9 +4,9 @@ define_test "callout is 'true'" -setup_nfs +setup -export CTDB_NFS_CALLOUT="true" +CTDB_NFS_CALLOUT="true" ok_null simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.startup.002.sh b/ctdb/tests/eventscripts/60.nfs.startup.002.sh index e020c9dd669..d431ea425b9 100755 --- a/ctdb/tests/eventscripts/60.nfs.startup.002.sh +++ b/ctdb/tests/eventscripts/60.nfs.startup.002.sh @@ -4,9 +4,9 @@ define_test "callout is 'false', causes startup to fail" -setup_nfs +setup -export CTDB_NFS_CALLOUT="echo startup ; false" +CTDB_NFS_CALLOUT="echo startup ; false" required_result 1 "startup" simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.takeip.001.sh b/ctdb/tests/eventscripts/60.nfs.takeip.001.sh index 8f590b01757..538eae787e8 100755 --- a/ctdb/tests/eventscripts/60.nfs.takeip.001.sh +++ b/ctdb/tests/eventscripts/60.nfs.takeip.001.sh @@ -4,9 +4,9 @@ define_test "callout is 'true'" -setup_nfs +setup -export CTDB_NFS_CALLOUT="true" +CTDB_NFS_CALLOUT="true" ok_null simple_test diff --git a/ctdb/tests/eventscripts/60.nfs.takeip.002.sh b/ctdb/tests/eventscripts/60.nfs.takeip.002.sh index 4fc3f7270ee..5f4f19762c9 100755 --- a/ctdb/tests/eventscripts/60.nfs.takeip.002.sh +++ b/ctdb/tests/eventscripts/60.nfs.takeip.002.sh @@ -4,9 +4,9 @@ define_test "callout is 'false', causes takeip to fail" -setup_nfs +setup -export CTDB_NFS_CALLOUT="echo takeip ; false" +CTDB_NFS_CALLOUT="echo takeip ; false" required_result 1 "takeip" simple_test diff --git a/ctdb/tests/eventscripts/scripts/60.nfs.sh b/ctdb/tests/eventscripts/scripts/60.nfs.sh index b91a5d96a68..efc5810218a 100644 --- a/ctdb/tests/eventscripts/scripts/60.nfs.sh +++ b/ctdb/tests/eventscripts/scripts/60.nfs.sh @@ -1,6 +1,6 @@ -setup_nfs () +setup () { - setup_ctdb + setup_shares service_name="nfs" @@ -13,11 +13,10 @@ setup_nfs () # This doesn't even need to exist export CTDB_NFS_EXPORTS_FILE="$EVENTSCRIPTS_TESTS_VAR_DIR/etc-exports" - # Reset the failcounts for nfs services. - eventscript_call eval rm -f '$ctdb_fail_dir/nfs_*' - if [ "$1" != "down" ] ; then - debug "Setting up NFS environment: all RPC services up, NFS managed by CTDB" + debug <"$_threads" @@ -136,10 +148,12 @@ rpc_set_service_failure_response () _dir="${CTDB_NFS_CHECKS_DIR:-${CTDB_BASE}/nfs-checks.d}" _file=$(ls "$_dir"/[0-9][0-9]."${_rpc_service}.check") - [ -r "$_file" ] || die "RPC check file \"$_file\" does not exist or is not unique" + [ -r "$_file" ] || \ + die "RPC check file \"$_file\" does not exist or is not unique" - _out=$(mktemp --tmpdir="$EVENTSCRIPTS_TESTS_VAR_DIR") - _rc_file=$(mktemp --tmpdir="$EVENTSCRIPTS_TESTS_VAR_DIR") + _out="${EVENTSCRIPTS_TESTS_VAR_DIR}/rpc_failure_output" + : >"$_out" + _rc_file="${EVENTSCRIPTS_TESTS_VAR_DIR}/rpc_result" ( # Subshell to restrict scope variables... @@ -173,7 +187,8 @@ $_rpc_service failed RPC check: rpcinfo: RPC: Program not registered program $_rpc_service${_ver:+ version }${_ver} is not available" - if [ $unhealthy_after -gt 0 -a $_numfails -ge $unhealthy_after ] ; then + if [ $unhealthy_after -gt 0 -a \ + $_numfails -ge $unhealthy_after ] ; then _unhealthy=true echo 1 >"$_rc_file" echo "ERROR: ${_rpc_check_out}" >>"$_out" @@ -188,7 +203,8 @@ program $_rpc_service${_ver:+ version }${_ver} is not available" echo "WARNING: ${_rpc_check_out}" >>"$_out" fi - echo "Trying to restart service \"${_rpc_service}\"..." >>"$_out" + echo "Trying to restart service \"${_rpc_service}\"..."\ + >>"$_out" if [ -n "$service_debug_cmd" ] ; then $service_debug_cmd 2>&1 >>"$_out" @@ -258,9 +274,13 @@ nfs_iterate_test () # This is not a numerical comparison because $1 will # often not be set. if [ "$_iteration" = "$1" ] ; then - debug "##################################################" + debug </dev/null 2>&1 ; then + if rpcinfo -T tcp localhost "$_rpc_service" \ + >/dev/null 2>&1 ; then _ok=true fi fi @@ -280,14 +301,17 @@ nfs_iterate_test () else _iterate_failcount=$(($_iterate_failcount + 1)) fi - rpc_set_service_failure_response "$_rpc_service" $_iterate_failcount + rpc_set_service_failure_response \ + "$_rpc_service" $_iterate_failcount fi _out=$(simple_test 2>&1) _ret=$? if "$TEST_VERBOSE" || [ $_ret -ne 0 ] ; then - echo "##################################################" - echo "Iteration ${_iteration}:" - echo "$_out" + cat <