1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00

ctdb-tests: rpc_set_service_failure_response() should take RPC service name

... not a process name

Update the tests that matter.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2015-06-17 16:45:28 +10:00 committed by Amitay Isaacs
parent 87b215c390
commit c72c5b754f
9 changed files with 33 additions and 23 deletions

View File

@ -2,11 +2,11 @@
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "knfsd down, 6 iterations"
define_test "knfsd down, 10 iterations"
# knfsd fails and attempts to restart it fail.
setup_nfs
rpc_services_down "nfs"
iterate_test 10 'rpc_set_service_failure_response "nfsd"'
iterate_test 10 'rpc_set_service_failure_response "nfs"'

View File

@ -2,7 +2,7 @@
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "knfsd down, 6 iterations, dump 5 threads, none hung"
define_test "knfsd down, 10 iterations, dump 5 threads, none hung"
# knfsd fails and attempts to restart it fail.
setup_nfs
@ -12,4 +12,4 @@ rpc_services_down "nfs"
CTDB_NFS_DUMP_STUCK_THREADS=5
FAKE_NFSD_THREAD_PIDS=""
iterate_test 10 'rpc_set_service_failure_response "nfsd"'
iterate_test 10 'rpc_set_service_failure_response "nfs"'

View File

@ -2,7 +2,7 @@
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "knfsd down, 6 iterations, dump 5 threads, 3 hung"
define_test "knfsd down, 10 iterations, dump 5 threads, 3 hung"
# knfsd fails and attempts to restart it fail.
setup_nfs
@ -12,4 +12,4 @@ rpc_services_down "nfs"
CTDB_NFS_DUMP_STUCK_THREADS=5
FAKE_NFSD_THREAD_PIDS="1001 1002 1003"
iterate_test 10 'rpc_set_service_failure_response "nfsd"'
iterate_test 10 'rpc_set_service_failure_response "nfs"'

View File

@ -11,7 +11,6 @@ define_test "lockd down, 15 iterations"
setup_nfs
rpc_services_down "nlockmgr"
#EVENTSCRIPTS_TESTS_TRACE="sh -x"
iterate_test 15 "ok_null" \
10 "rpc_set_service_failure_response 'lockd'" \
15 "rpc_set_service_failure_response 'lockd'"
10 "rpc_set_service_failure_response 'nlockmgr'" \
15 "rpc_set_service_failure_response 'nlockmgr'"

View File

@ -14,6 +14,6 @@ rpc_services_down "nlockmgr"
# stub rpc.lockd does nothing, so we have to explicitly flag it as up.
iterate_test 15 "ok_null" \
10 "rpc_set_service_failure_response 'lockd'" \
10 "rpc_set_service_failure_response 'nlockmgr'" \
11 "rpc_services_up nlockmgr"

View File

@ -10,6 +10,6 @@ setup_nfs
rpc_services_down "status"
iterate_test 6 'ok_null' \
2 'rpc_set_service_failure_response "statd"' \
4 'rpc_set_service_failure_response "statd"' \
6 'rpc_set_service_failure_response "statd"'
2 'rpc_set_service_failure_response "status"' \
4 'rpc_set_service_failure_response "status"' \
6 'rpc_set_service_failure_response "status"'

View File

@ -10,5 +10,5 @@ setup_nfs
rpc_services_down "status"
iterate_test 8 'ok_null' \
2 'rpc_set_service_failure_response "statd"' \
2 'rpc_set_service_failure_response "status"' \
3 'rpc_services_up "status"'

View File

@ -12,4 +12,4 @@ CTDB_NFS_DUMP_STUCK_THREADS=2
FAKE_RPC_THREAD_PIDS="1001"
iterate_test 2 'ok_null' \
2 'rpc_set_service_failure_response "statd"'
2 'rpc_set_service_failure_response "status"'

View File

@ -896,6 +896,17 @@ mark_background ()
sed -e 's@^@\&@'
}
convert_progname ()
{
case "$1" in
nfs) echo "nfsd" ;;
nlockmgr) echo "lockd" ;;
status) echo "statd" ;;
*) echo "$1" ;;
esac
}
# Set the required result for a particular RPC program having failed
# for a certain number of iterations. This is probably still a work
# in progress. Note that we could hook aggressively
@ -906,12 +917,14 @@ mark_background ()
# function being incomplete.
rpc_set_service_failure_response ()
{
_progname="$1"
_rpc_service="$1"
# The number of failures defaults to the iteration number. This
# will be true when we fail from the 1st iteration... but we need
# the flexibility to set the number of failures.
_numfails="${2:-${iteration:-1}}"
_progname=$(convert_progname "$_rpc_service")
nfs_load_config
# A handy newline. :-)
@ -947,16 +960,14 @@ rpc_set_service_failure_response ()
case "$_action" in
verbose)
_ver=1
_pn="$_progname"
case "$_progname" in
nfsd) _ver=3 ; _pn="nfs" ;;
lockd) _ver=4 ; _pn="nlockmgr" ;;
statd) _pn="status" ;;
case "$_rpc_service" in
nfs) _ver=3 ;;
nlockmgr) _ver=4 ;;
esac
_out="\
ERROR: $_pn failed RPC check:
ERROR: $_rpc_service failed RPC check:
rpcinfo: RPC: Program not registered
program $_pn version $_ver is not available"
program $_rpc_service version $_ver is not available"
;;
restart*)
_p="rpc.${_progname}"