diff options
author | Amitay Isaacs <amitay@gmail.com> | 2017-08-30 16:35:49 +1000 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2017-10-25 08:43:03 +0200 |
commit | 4c833aabaaa8a42e695c62dc9f07591f0da56c35 (patch) | |
tree | a30ed6983d7c9bdeab3e227ce6a8c954de60837d | |
parent | c3b68601b6d41f8a2444616202e5346ccd80f2b0 (diff) | |
download | samba-4c833aabaaa8a42e695c62dc9f07591f0da56c35.tar.gz |
ctdb-tests: Add tests for PID with srvid
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13042
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Sep 21 12:56:30 CEST 2017 on sn-devel-144
(cherry picked from commit 503bc3997800cfb2fd9f7f092ef896c355b844cd)
-rwxr-xr-x | ctdb/tests/simple/07_ctdb_process_exists.sh | 20 | ||||
-rwxr-xr-x | ctdb/tests/tool/ctdb.process-exists.002.sh | 26 |
2 files changed, 45 insertions, 1 deletions
diff --git a/ctdb/tests/simple/07_ctdb_process_exists.sh b/ctdb/tests/simple/07_ctdb_process_exists.sh index f24e93a47ad..b3b8e513741 100755 --- a/ctdb/tests/simple/07_ctdb_process_exists.sh +++ b/ctdb/tests/simple/07_ctdb_process_exists.sh @@ -36,11 +36,12 @@ set -e cluster_is_healthy test_node=1 +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 >/dev/null 2>&1 & echo \$!" + "$CTDB_TEST_WRAPPER exec dummy_client -S ${srvid} >/dev/null 2>&1 & echo \$!" client_pid="$out" cleanup () @@ -65,6 +66,23 @@ else testfailures=1 fi +echo "Checking for PID $client_pid with SRVID $srvid on node $test_node" +status=0 +try_command_on_node $test_node \ + "$CTDB process-exists ${client_pid} ${srvid}" || status=$? +echo "$out" + +if [ $status -eq 0 ] ; then + echo "OK" +else + echo "BAD" + testfailures=1 +fi + +echo "Checking for PID $client_pid with SRVID $client_pid on node $test_node" +try_command_on_node -v $test_node \ + "! $CTDB process-exists ${client_pid} ${client_pid}" + # Now just echo the PID of the ctdb daemon on test node. # This is not a ctdb client and process-exists should return error. try_command_on_node $test_node "ctdb getpid" diff --git a/ctdb/tests/tool/ctdb.process-exists.002.sh b/ctdb/tests/tool/ctdb.process-exists.002.sh new file mode 100755 index 00000000000..fe3dfd4d59f --- /dev/null +++ b/ctdb/tests/tool/ctdb.process-exists.002.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "ctdbd process 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" -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 |