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

ctdb-tests: Add unit tests for "reloadnodes" sanity checking

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2015-02-04 14:57:03 +11:00 committed by Amitay Isaacs
parent 1cebd75f62
commit c99d2702ee
13 changed files with 447 additions and 0 deletions

View File

@ -0,0 +1,38 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, add a node"
setup_nodes <<EOF
192.168.20.41
192.168.20.42
192.168.20.43
192.168.20.44
EOF
required_result 0 <<EOF
Node 0 is unchanged
Node 1 is unchanged
Node 2 is unchanged
Node 3 is NEW
Reloading nodes file on node 1
ctdb_ctrl_reload_nodes_file: node 1
Reloading nodes file on node 2
ctdb_ctrl_reload_nodes_file: node 2
Reloading nodes file on node 0
ctdb_ctrl_reload_nodes_file: node 0
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x0
VNNMAP
654321
0
1
2
EOF

View File

@ -0,0 +1,33 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, delete last node"
setup_nodes <<EOF
192.168.20.41
192.168.20.42
#192.168.20.43
EOF
required_result 0 <<EOF
Node 0 is unchanged
Node 1 is unchanged
Node 2 is DELETED
Reloading nodes file on node 1
ctdb_ctrl_reload_nodes_file: node 1
Reloading nodes file on node 0
ctdb_ctrl_reload_nodes_file: node 0
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x1
VNNMAP
654321
0
1
EOF

View File

@ -0,0 +1,32 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, delete connected last node"
setup_nodes <<EOF
192.168.20.41
192.168.20.42
#192.168.20.43
EOF
required_result 1 <<EOF
Node 0 is unchanged
Node 1 is unchanged
Node 2 is DELETED
ERROR: Node 2 is still connected
ERROR: Nodes will not be reloaded due to previous error
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x0
VNNMAP
654321
0
1
2
EOF

View File

@ -0,0 +1,33 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, delete first node"
setup_nodes <<EOF
#192.168.20.41
192.168.20.42
192.168.20.43
EOF
required_result 0 <<EOF
Node 0 is DELETED
Node 1 is unchanged
Node 2 is unchanged
Reloading nodes file on node 1
ctdb_ctrl_reload_nodes_file: node 1
Reloading nodes file on node 2
ctdb_ctrl_reload_nodes_file: node 2
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x1
1 192.168.20.42 0x0
2 192.168.20.43 0x0 CURRENT RECMASTER
VNNMAP
654321
1
2
EOF

View File

@ -0,0 +1,32 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, delete connected first node"
setup_nodes <<EOF
#192.168.20.41
192.168.20.42
192.168.20.43
EOF
required_result 1 <<EOF
Node 0 is DELETED
ERROR: Node 0 is still connected
Node 1 is unchanged
Node 2 is unchanged
ERROR: Nodes will not be reloaded due to previous error
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0
1 192.168.20.42 0x0
2 192.168.20.43 0x0 CURRENT RECMASTER
VNNMAP
654321
0
1
2
EOF

View File

@ -0,0 +1,33 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, delete middle node"
setup_nodes <<EOF
192.168.20.41
#192.168.20.42
192.168.20.43
EOF
required_result 0 <<EOF
Node 0 is unchanged
Node 1 is DELETED
Node 2 is unchanged
Reloading nodes file on node 2
ctdb_ctrl_reload_nodes_file: node 2
Reloading nodes file on node 0
ctdb_ctrl_reload_nodes_file: node 0
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x1
2 192.168.20.43 0x0
VNNMAP
654321
0
2
EOF

View File

@ -0,0 +1,32 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, delete connected middle node"
setup_nodes <<EOF
192.168.20.41
#192.168.20.42
192.168.20.43
EOF
required_result 1 <<EOF
Node 0 is unchanged
Node 1 is DELETED
ERROR: Node 1 is still connected
Node 2 is unchanged
ERROR: Nodes will not be reloaded due to previous error
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x0
VNNMAP
654321
0
1
2
EOF

View File

@ -0,0 +1,42 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, add a 3 nodes"
setup_nodes <<EOF
192.168.20.41
192.168.20.42
192.168.20.43
192.168.20.44
192.168.20.45
192.168.20.46
EOF
required_result 0 <<EOF
Node 0 is unchanged
Node 1 is unchanged
Node 2 is unchanged
Node 3 is NEW
Node 4 is NEW
Node 5 is NEW
Reloading nodes file on node 1
ctdb_ctrl_reload_nodes_file: node 1
Reloading nodes file on node 2
ctdb_ctrl_reload_nodes_file: node 2
Reloading nodes file on node 0
ctdb_ctrl_reload_nodes_file: node 0
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x0
VNNMAP
654321
0
1
2
EOF

View File

@ -0,0 +1,37 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, delete middle, add 2 nodes"
setup_nodes <<EOF
192.168.20.41
#192.168.20.42
192.168.20.43
192.168.20.44
192.168.20.45
EOF
required_result 0 <<EOF
Node 0 is unchanged
Node 1 is DELETED
Node 2 is unchanged
Node 3 is NEW
Node 4 is NEW
Reloading nodes file on node 2
ctdb_ctrl_reload_nodes_file: node 2
Reloading nodes file on node 0
ctdb_ctrl_reload_nodes_file: node 0
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x1
2 192.168.20.43 0x0
VNNMAP
654321
0
2
EOF

View File

@ -0,0 +1,37 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, delete last, add 2 nodes"
setup_nodes <<EOF
192.168.20.41
192.168.20.42
#192.168.20.43
192.168.20.44
192.168.20.45
EOF
required_result 0 <<EOF
Node 0 is unchanged
Node 1 is unchanged
Node 2 is DELETED
Node 3 is NEW
Node 4 is NEW
Reloading nodes file on node 1
ctdb_ctrl_reload_nodes_file: node 1
Reloading nodes file on node 0
ctdb_ctrl_reload_nodes_file: node 0
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
2 192.168.20.43 0x1
VNNMAP
654321
0
1
EOF

View File

@ -0,0 +1,36 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, 1 disconnected, add a node"
setup_nodes <<EOF
192.168.20.41
192.168.20.42
192.168.20.43
192.168.20.44
EOF
required_result 0 <<EOF
Node 0 is unchanged
Node 1 is unchanged
WARNING: Node 1 is disconnected. You MUST fix this node manually!
Node 2 is unchanged
Node 3 is NEW
Reloading nodes file on node 2
ctdb_ctrl_reload_nodes_file: node 2
Reloading nodes file on node 0
ctdb_ctrl_reload_nodes_file: node 0
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x1
2 192.168.20.43 0x0
VNNMAP
654321
0
2
EOF

View File

@ -0,0 +1,29 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, delete middle, add 2 nodes, less debug"
CTDB_DEBUGLEVEL=0
setup_nodes <<EOF
192.168.20.41
#192.168.20.42
192.168.20.43
192.168.20.44
192.168.20.45
EOF
ok_null
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x1
2 192.168.20.43 0x0
VNNMAP
654321
0
2
EOF

View File

@ -0,0 +1,33 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "3 nodes, undelete middle"
setup_nodes <<EOF
192.168.20.41
192.168.20.42
192.168.20.43
EOF
ok <<EOF
Node 0 is unchanged
Node 1 is UNDELETED
Node 2 is unchanged
Reloading nodes file on node 2
ctdb_ctrl_reload_nodes_file: node 2
Reloading nodes file on node 0
ctdb_ctrl_reload_nodes_file: node 0
EOF
simple_test <<EOF
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x11
2 192.168.20.43 0x0
VNNMAP
654321
0
2
EOF