ctdb-tests: Make process exists test more resilient
authorMartin Schwenke <martin@meltin.net>
Tue, 5 Nov 2019 04:34:18 +0000 (15:34 +1100)
committerAmitay Isaacs <amitay@samba.org>
Wed, 6 Nov 2019 02:46:24 +0000 (02:46 +0000)
This can fail as follows:

--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
Running test ./tests/UNIT/tool/ctdb.process-exists.003.sh (02:26:30)
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
ctdb.process-exists.003      - ctdbd process with multiple connections on node 0
Setting up fake ctdbd
<10||0|
OK
<10|PID 26107 exists
|0|
OK
==================================================
Running "ctdb -d NOTICE process-exists 26107 0x1234567812345678"
PASSED
==================================================
Running "ctdb -d NOTICE process-exists 26107 0xaebbccdd12345678"
Registered SRVID 0xaebbccdd12345678
--------------------------------------------------
Output (Exit status: 1):
--------------------------------------------------
PID 26107 with SRVID 0xaebbccdd12345678 does not exist
--------------------------------------------------
Required output (Exit status: 0):
--------------------------------------------------
PID 26107 with SRVID 0xaebbccdd12345678 exists

FAILED
connection to daemon closed, exiting
==========================================================================
TEST FAILED: ./tests/UNIT/tool/ctdb.process-exists.003.sh (status 1) (duration: 0s)
==========================================================================

This happens when dummy_client has not registered the SRVID (for its
10th connection) before the 2nd simple_test.

Change the initial wait to ensure that the SRVID is registered.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Nov  6 02:46:24 UTC 2019 on sn-devel-184

ctdb/tests/UNIT/tool/ctdb.process-exists.003.sh

index 29c42a1a6278d39cad55d3d2ac89892449bb37e3..402b0d6f5abebd1e7389c01a0ab82aa5def1ae28 100755 (executable)
@@ -16,7 +16,7 @@ srvid="0xaebbccdd12345678"
 dummy_client -d INFO -s "$ctdbd_socket" -n 10 -S "$srvid" &
 pid=$!
 
-wait_until 10 $CTDB process-exists "$pid"
+wait_until 10 $CTDB process-exists "$pid" "$srvid"
 
 srvid2="0x1234567812345678"
 required_result 1 "PID $pid with SRVID $srvid2 does not exist"