s3: smbd: SMB2 close. If a file has delete on close, store the return info before...
[Samba.git] / ctdb / tests / simple / 07_ctdb_process_exists.sh
blob83205aa07f622407a4d29326933c43a0996d54db
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that 'ctdb process-exists' shows correct information.
8 The implementation is creative about how it gets PIDs for existing and
9 non-existing processes.
11 Prerequisites:
13 * An active CTDB cluster with at least 2 active nodes.
15 Steps:
17 1. Verify that the status on all of the ctdb nodes is 'OK'.
18 2. On one of the cluster nodes, get the PID of an existing process
19 (using ps wax).
20 3. Run 'ctdb process-exists <pid>' on the node and verify that the
21 correct output is shown.
22 4. Run 'ctdb process-exists <pid>' with a pid of a non-existent
23 process and verify that the correct output is shown.
25 Expected results:
27 * 'ctdb process-exists' shows the correct output.
28 EOF
31 . "${TEST_SCRIPTS_DIR}/integration.bash"
33 ctdb_test_init "$@"
35 set -e
37 cluster_is_healthy
39 test_node=1
41 # Create a background process on $test_node that will last for 60 seconds.
42 # It should still be there when we check.
43 try_command_on_node $test_node 'sleep 60 >/dev/null 2>&1 & echo $!'
44 pid="$out"
46 echo "Checking for PID $pid on node $test_node"
47 # set -e is good, but avoid it here
48 status=0
49 onnode 0 "$CTDB process-exists ${test_node}:${pid}" || status=$?
50 echo "$out"
52 if [ $status -eq 0 ] ; then
53 echo "OK"
54 else
55 echo "BAD"
56 testfailures=1
59 # Now just echo the PID of the shell from the onnode process on node
60 # 2. This PID will disappear and PIDs shouldn't roll around fast
61 # enough to trick the test... but there is a chance that will happen!
62 try_command_on_node $test_node 'echo $$'
63 pid="$out"
65 echo "Checking for PID $pid on node $test_node"
66 try_command_on_node -v 0 "! $CTDB process-exists ${test_node}:${pid}"