1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ctdb-tests: Add "ctdb ban/unban" tool tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-07-21 12:45:44 +10:00 committed by Amitay Isaacs
parent 3d6c23ef8e
commit ae07e3b815
6 changed files with 161 additions and 0 deletions

35
ctdb/tests/tool/ctdb.ban.001.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "ban default (0), wait for timeout"
setup_ctdbd <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x0
EOF
ok_null
simple_test 4
required_result 8 <<EOF
Number of nodes:3
pnn:0 192.168.20.41 BANNED|INACTIVE (THIS NODE)
pnn:1 192.168.20.42 OK
pnn:2 192.168.20.43 OK
EOF
simple_test_other nodestatus all
echo
echo "Waiting 5 seconds for ban to expire..."
sleep 5
ok <<EOF
Number of nodes:3
pnn:0 192.168.20.41 OK (THIS NODE)
pnn:1 192.168.20.42 OK
pnn:2 192.168.20.43 OK
EOF
simple_test_other nodestatus all

23
ctdb/tests/tool/ctdb.ban.002.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "ban node 1"
setup_ctdbd <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x0
EOF
ok_null
simple_test 60 -n 1
required_result 8 <<EOF
Number of nodes:3
pnn:0 192.168.20.41 OK (THIS NODE)
pnn:1 192.168.20.42 BANNED|INACTIVE
pnn:2 192.168.20.43 OK
EOF
simple_test_other nodestatus all

23
ctdb/tests/tool/ctdb.ban.003.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "already banned"
setup_ctdbd <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x8
2 192.168.20.43 0x0
EOF
ok "Node 1 is already banned"
simple_test 60 -n 1
required_result 8 <<EOF
Number of nodes:3
pnn:0 192.168.20.41 OK (THIS NODE)
pnn:1 192.168.20.42 BANNED|INACTIVE
pnn:2 192.168.20.43 OK
EOF
simple_test_other nodestatus all

View File

@ -0,0 +1,23 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "unban default (0)"
setup_ctdbd <<EOF
NODEMAP
0 192.168.20.41 0x8 CURRENT
1 192.168.20.42 0x0
2 192.168.20.43 0x0 RECMASTER
EOF
ok_null
simple_test
ok <<EOF
Number of nodes:3
pnn:0 192.168.20.41 OK (THIS NODE)
pnn:1 192.168.20.42 OK
pnn:2 192.168.20.43 OK
EOF
simple_test_other nodestatus all

View File

@ -0,0 +1,34 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "ban, unban node 1"
setup_ctdbd <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x0
EOF
ok_null
simple_test_other ban 60 -n 1
required_result 8 <<EOF
Number of nodes:3
pnn:0 192.168.20.41 OK (THIS NODE)
pnn:1 192.168.20.42 BANNED|INACTIVE
pnn:2 192.168.20.43 OK
EOF
simple_test_other nodestatus all
ok_null
simple_test_other unban -n 1
ok <<EOF
Number of nodes:3
pnn:0 192.168.20.41 OK (THIS NODE)
pnn:1 192.168.20.42 OK
pnn:2 192.168.20.43 OK
EOF
simple_test_other nodestatus all

View File

@ -0,0 +1,23 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "node not banned"
setup_ctdbd <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x0
EOF
ok "Node 0 is not banned"
simple_test
ok <<EOF
Number of nodes:3
pnn:0 192.168.20.41 OK (THIS NODE)
pnn:1 192.168.20.42 OK
pnn:2 192.168.20.43 OK
EOF
simple_test_other nodestatus all