ctdb-tests: Add tests for client with multiple connections
authorAmitay Isaacs <amitay@gmail.com>
Fri, 22 Sep 2017 04:17:59 +0000 (14:17 +1000)
committerVolker Lendecke <vl@samba.org>
Fri, 22 Sep 2017 18:58:46 +0000 (20:58 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13042

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Sep 22 20:58:46 CEST 2017 on sn-devel-144

ctdb/tests/simple/07_ctdb_process_exists.sh
ctdb/tests/tool/ctdb.process-exists.003.sh [new file with mode: 0755]

index b3b8e513741f6eb9384b2a42f03b22ad6b7efd4c..8ccfc69baa99d99bb0eef437e3a9c2288554ede3 100755 (executable)
@@ -41,7 +41,7 @@ srvid=0xAE00000012345678
 # Execute a ctdb client on $test_node that will last for 60 seconds.
 # It should still be there when we check.
 try_command_on_node -v $test_node \
-       "$CTDB_TEST_WRAPPER exec dummy_client -S ${srvid} >/dev/null 2>&1 & echo \$!"
+       "$CTDB_TEST_WRAPPER exec dummy_client -n 10 -S ${srvid} >/dev/null 2>&1 & echo \$!"
 client_pid="$out"
 
 cleanup ()
diff --git a/ctdb/tests/tool/ctdb.process-exists.003.sh b/ctdb/tests/tool/ctdb.process-exists.003.sh
new file mode 100755 (executable)
index 0000000..bb1ef9a
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "ctdbd process with multiple connections on node 0"
+
+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
+
+srvid="0xaebbccdd12345678"
+
+dummy_client -d INFO -s "$ctdbd_socket" -n 10 -S "$srvid" &
+pid=$!
+
+srvid2="0x1234567812345678"
+required_result 1 "PID $pid with SRVID $srvid2 does not exist"
+simple_test "$pid" "$srvid2"
+
+ok "PID $pid with SRVID $srvid exists"
+simple_test "$pid" "$srvid"
+
+kill -9 $pid