mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
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
This commit is contained in:
parent
7d034fe139
commit
503bc39978
@ -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"
|
||||
|
26
ctdb/tests/tool/ctdb.process-exists.002.sh
Executable file
26
ctdb/tests/tool/ctdb.process-exists.002.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user