mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
ctdb-tests: Update statd-callout tests to handle both modes
Add support for shared_dir mode. Instead of duplicating all of the tests, update them so they can be wrapped. Created new tests for shared_dir mode that source the "original" tests. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
08310072aa
commit
112c6b43bc
@ -1,10 +1,28 @@
|
||||
setup()
|
||||
{
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="$1"
|
||||
|
||||
setup_public_addresses
|
||||
ctdb_set_pnn
|
||||
setup_date "1234567890"
|
||||
|
||||
export FAKE_NFS_HOSTNAME="cluster1"
|
||||
|
||||
case "$CTDB_STATD_CALLOUT_SHARED_STORAGE" in
|
||||
"" | persistent_db)
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="persistent_db:ctdb.tdb"
|
||||
;;
|
||||
shared_dir)
|
||||
export CTDB_NFS_SHARED_STATE_DIR="/clusterfs"
|
||||
;;
|
||||
esac
|
||||
|
||||
export CTDB_STATD_CALLOUT_SHARED_STORAGE
|
||||
statd_callout_mode="${CTDB_STATD_CALLOUT_SHARED_STORAGE%%:*}"
|
||||
statd_callout_location="${CTDB_STATD_CALLOUT_SHARED_STORAGE#*:}"
|
||||
if [ "$statd_callout_location" = "$CTDB_STATD_CALLOUT_SHARED_STORAGE" ]; then
|
||||
statd_callout_location=""
|
||||
fi
|
||||
}
|
||||
|
||||
ctdb_catdb_format_pairs()
|
||||
@ -44,10 +62,53 @@ EOF
|
||||
done |
|
||||
ctdb_catdb_format_pairs | {
|
||||
ok
|
||||
simple_test_command ctdb catdb ctdb.tdb
|
||||
simple_test_command ctdb catdb "$statd_callout_location"
|
||||
} || exit $?
|
||||
}
|
||||
|
||||
check_shared_dir_statd_state()
|
||||
{
|
||||
ctdb_get_my_public_addresses |
|
||||
while read -r _ _sip _; do
|
||||
for _cip; do
|
||||
echo "statd-state@${_sip}@${_cip}"
|
||||
done
|
||||
done |
|
||||
sort | {
|
||||
ok
|
||||
_dir="${CTDB_TEST_TMP_DIR}${statd_callout_location}"
|
||||
mkdir -p "$_dir"
|
||||
(cd "$_dir" && simple_test_command ls)
|
||||
} || exit $?
|
||||
}
|
||||
|
||||
check_shared_storage_statd_state()
|
||||
{
|
||||
case "$statd_callout_mode" in
|
||||
persistent_db)
|
||||
if [ -z "$statd_callout_location" ]; then
|
||||
statd_callout_location="ctdb.tdb"
|
||||
fi
|
||||
check_ctdb_tdb_statd_state "$@"
|
||||
;;
|
||||
shared_dir)
|
||||
if [ -z "$statd_callout_location" ]; then
|
||||
statd_callout_location="statd"
|
||||
fi
|
||||
case "$statd_callout_location" in
|
||||
/*)
|
||||
:
|
||||
;;
|
||||
*)
|
||||
_t="$CTDB_NFS_SHARED_STATE_DIR"
|
||||
statd_callout_location="${_t}/${statd_callout_location}"
|
||||
;;
|
||||
esac
|
||||
check_shared_dir_statd_state "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
check_statd_callout_smnotify()
|
||||
{
|
||||
# The state here doesn't really matter because the date stub
|
||||
|
@ -2,13 +2,18 @@
|
||||
|
||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
||||
|
||||
define_test "single add-client"
|
||||
if [ -z "$CTDB_STATD_CALLOUT_SHARED_STORAGE" ]; then
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="persistent_db"
|
||||
fi
|
||||
mode="$CTDB_STATD_CALLOUT_SHARED_STORAGE"
|
||||
|
||||
setup
|
||||
define_test "${mode} - single add-client"
|
||||
|
||||
setup "$mode"
|
||||
|
||||
ok_null
|
||||
simple_test_event "startup"
|
||||
simple_test_event "add-client" "192.168.123.45"
|
||||
simple_test_event "update"
|
||||
|
||||
check_ctdb_tdb_statd_state "192.168.123.45"
|
||||
check_shared_storage_statd_state "192.168.123.45"
|
||||
|
@ -2,9 +2,14 @@
|
||||
|
||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
||||
|
||||
define_test "2 x add-client, update"
|
||||
if [ -z "$CTDB_STATD_CALLOUT_SHARED_STORAGE" ]; then
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="persistent_db"
|
||||
fi
|
||||
mode="$CTDB_STATD_CALLOUT_SHARED_STORAGE"
|
||||
|
||||
setup
|
||||
define_test "${mode} - 2 x add-client, update"
|
||||
|
||||
setup "$mode"
|
||||
|
||||
ok_null
|
||||
simple_test_event "startup"
|
||||
@ -12,4 +17,4 @@ simple_test_event "add-client" "192.168.123.45"
|
||||
simple_test_event "add-client" "192.168.123.46"
|
||||
simple_test_event "update"
|
||||
|
||||
check_ctdb_tdb_statd_state "192.168.123.45" "192.168.123.46"
|
||||
check_shared_storage_statd_state "192.168.123.45" "192.168.123.46"
|
||||
|
@ -2,9 +2,14 @@
|
||||
|
||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
||||
|
||||
define_test "add-client, update, del-client, update"
|
||||
if [ -z "$CTDB_STATD_CALLOUT_SHARED_STORAGE" ]; then
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="persistent_db"
|
||||
fi
|
||||
mode="$CTDB_STATD_CALLOUT_SHARED_STORAGE"
|
||||
|
||||
setup
|
||||
define_test "${mode} - add-client, update, del-client, update"
|
||||
|
||||
setup "$mode"
|
||||
|
||||
ok_null
|
||||
simple_test_event "startup"
|
||||
@ -14,4 +19,4 @@ simple_test_event "update"
|
||||
simple_test_event "del-client" "192.168.123.45"
|
||||
simple_test_event "update"
|
||||
|
||||
check_ctdb_tdb_statd_state
|
||||
check_shared_storage_statd_state
|
||||
|
@ -2,17 +2,22 @@
|
||||
|
||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
||||
|
||||
define_test "single add-client, notify"
|
||||
if [ -z "$CTDB_STATD_CALLOUT_SHARED_STORAGE" ]; then
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="persistent_db"
|
||||
fi
|
||||
mode="$CTDB_STATD_CALLOUT_SHARED_STORAGE"
|
||||
|
||||
setup
|
||||
define_test "${mode} - single add-client, notify"
|
||||
|
||||
setup "$mode"
|
||||
|
||||
ok_null
|
||||
simple_test_event "startup"
|
||||
simple_test_event "add-client" "192.168.123.45"
|
||||
simple_test_event "update"
|
||||
|
||||
check_ctdb_tdb_statd_state "192.168.123.45"
|
||||
check_shared_storage_statd_state "192.168.123.45"
|
||||
|
||||
check_statd_callout_smnotify "192.168.123.45"
|
||||
|
||||
check_ctdb_tdb_statd_state
|
||||
check_shared_storage_statd_state
|
||||
|
@ -2,9 +2,14 @@
|
||||
|
||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
||||
|
||||
define_test "2 x add-client to different nodes, notify on 1"
|
||||
if [ -z "$CTDB_STATD_CALLOUT_SHARED_STORAGE" ]; then
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="persistent_db"
|
||||
fi
|
||||
mode="$CTDB_STATD_CALLOUT_SHARED_STORAGE"
|
||||
|
||||
setup
|
||||
define_test "${mode} - 2 x add-client to different nodes, notify on 1"
|
||||
|
||||
setup "$mode"
|
||||
|
||||
ok_null
|
||||
simple_test_event "startup"
|
||||
@ -24,4 +29,4 @@ check_statd_callout_smnotify "192.168.123.45"
|
||||
|
||||
ctdb_set_pnn 1
|
||||
|
||||
check_ctdb_tdb_statd_state "192.168.123.46"
|
||||
check_shared_storage_statd_state "192.168.123.46"
|
||||
|
@ -2,9 +2,14 @@
|
||||
|
||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
||||
|
||||
define_test "2 x add-client to different nodes, notify on both"
|
||||
if [ -z "$CTDB_STATD_CALLOUT_SHARED_STORAGE" ]; then
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="persistent_db"
|
||||
fi
|
||||
mode="$CTDB_STATD_CALLOUT_SHARED_STORAGE"
|
||||
|
||||
setup
|
||||
define_test "${mode} - 2 x add-client to different nodes, notify on both"
|
||||
|
||||
setup "$mode"
|
||||
|
||||
ok_null
|
||||
simple_test_event "startup"
|
||||
@ -26,4 +31,4 @@ ctdb_set_pnn 1
|
||||
|
||||
check_statd_callout_smnotify "192.168.123.46"
|
||||
|
||||
check_ctdb_tdb_statd_state
|
||||
check_shared_storage_statd_state
|
||||
|
@ -2,9 +2,14 @@
|
||||
|
||||
. "${TEST_SCRIPTS_DIR}/unit.sh"
|
||||
|
||||
define_test "add-client, del-client, update"
|
||||
if [ -z "$CTDB_STATD_CALLOUT_SHARED_STORAGE" ]; then
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="persistent_db"
|
||||
fi
|
||||
mode="$CTDB_STATD_CALLOUT_SHARED_STORAGE"
|
||||
|
||||
setup
|
||||
define_test "${mode} - add-client, del-client, update"
|
||||
|
||||
setup "$mode"
|
||||
|
||||
ok_null
|
||||
simple_test_event "startup"
|
||||
@ -12,4 +17,4 @@ simple_test_event "add-client" "192.168.123.45"
|
||||
simple_test_event "del-client" "192.168.123.45"
|
||||
simple_test_event "update"
|
||||
|
||||
check_ctdb_tdb_statd_state
|
||||
check_shared_storage_statd_state
|
||||
|
6
ctdb/tests/UNIT/eventscripts/statd-callout.101.sh
Executable file
6
ctdb/tests/UNIT/eventscripts/statd-callout.101.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="shared_dir"
|
||||
|
||||
_dir=$(dirname "$0")
|
||||
. "${_dir}/statd-callout.001.sh"
|
6
ctdb/tests/UNIT/eventscripts/statd-callout.102.sh
Executable file
6
ctdb/tests/UNIT/eventscripts/statd-callout.102.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="shared_dir"
|
||||
|
||||
_dir=$(dirname "$0")
|
||||
. "${_dir}/statd-callout.002.sh"
|
6
ctdb/tests/UNIT/eventscripts/statd-callout.103.sh
Executable file
6
ctdb/tests/UNIT/eventscripts/statd-callout.103.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="shared_dir"
|
||||
|
||||
_dir=$(dirname "$0")
|
||||
. "${_dir}/statd-callout.003.sh"
|
6
ctdb/tests/UNIT/eventscripts/statd-callout.104.sh
Executable file
6
ctdb/tests/UNIT/eventscripts/statd-callout.104.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="shared_dir"
|
||||
|
||||
_dir=$(dirname "$0")
|
||||
. "${_dir}/statd-callout.004.sh"
|
6
ctdb/tests/UNIT/eventscripts/statd-callout.105.sh
Executable file
6
ctdb/tests/UNIT/eventscripts/statd-callout.105.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="shared_dir"
|
||||
|
||||
_dir=$(dirname "$0")
|
||||
. "${_dir}/statd-callout.005.sh"
|
6
ctdb/tests/UNIT/eventscripts/statd-callout.106.sh
Executable file
6
ctdb/tests/UNIT/eventscripts/statd-callout.106.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="shared_dir"
|
||||
|
||||
_dir=$(dirname "$0")
|
||||
. "${_dir}/statd-callout.006.sh"
|
6
ctdb/tests/UNIT/eventscripts/statd-callout.107.sh
Executable file
6
ctdb/tests/UNIT/eventscripts/statd-callout.107.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
CTDB_STATD_CALLOUT_SHARED_STORAGE="shared_dir"
|
||||
|
||||
_dir=$(dirname "$0")
|
||||
. "${_dir}/statd-callout.007.sh"
|
Loading…
Reference in New Issue
Block a user