From 0e8b781e0740310d251bf1fa7db7a467d4f7f9b5 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Wed, 25 Oct 2017 12:15:23 +1100 Subject: [PATCH] ctdb-tests: Process-exists unit tests should wait until PID is registered Otherwise the client registration can race with the check in the test. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13097 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs Autobuild-User(master): Amitay Isaacs Autobuild-Date(master): Thu Oct 26 13:32:24 CEST 2017 on sn-devel-144 --- ctdb/tests/tool/ctdb.process-exists.001.sh | 2 ++ ctdb/tests/tool/ctdb.process-exists.002.sh | 2 ++ ctdb/tests/tool/ctdb.process-exists.003.sh | 2 ++ 3 files changed, 6 insertions(+) diff --git a/ctdb/tests/tool/ctdb.process-exists.001.sh b/ctdb/tests/tool/ctdb.process-exists.001.sh index 2339344fec5..1b6d213b3ad 100755 --- a/ctdb/tests/tool/ctdb.process-exists.001.sh +++ b/ctdb/tests/tool/ctdb.process-exists.001.sh @@ -14,6 +14,8 @@ EOF dummy_client -s $ctdbd_socket & pid=$! +wait_until 10 $CTDB process-exists "$pid" + ok "PID $pid exists" simple_test "$pid" diff --git a/ctdb/tests/tool/ctdb.process-exists.002.sh b/ctdb/tests/tool/ctdb.process-exists.002.sh index fe3dfd4d59f..ace77493565 100755 --- a/ctdb/tests/tool/ctdb.process-exists.002.sh +++ b/ctdb/tests/tool/ctdb.process-exists.002.sh @@ -16,6 +16,8 @@ srvid="0xaebbccdd12345678" dummy_client -d INFO -s "$ctdbd_socket" -S "$srvid" & pid=$! +wait_until 10 $CTDB process-exists "$pid" + srvid2="0x1234567812345678" required_result 1 "PID $pid with SRVID $srvid2 does not exist" simple_test "$pid" "$srvid2" diff --git a/ctdb/tests/tool/ctdb.process-exists.003.sh b/ctdb/tests/tool/ctdb.process-exists.003.sh index bb1ef9ae940..29c42a1a627 100755 --- a/ctdb/tests/tool/ctdb.process-exists.003.sh +++ b/ctdb/tests/tool/ctdb.process-exists.003.sh @@ -16,6 +16,8 @@ srvid="0xaebbccdd12345678" dummy_client -d INFO -s "$ctdbd_socket" -n 10 -S "$srvid" & pid=$! +wait_until 10 $CTDB process-exists "$pid" + srvid2="0x1234567812345678" required_result 1 "PID $pid with SRVID $srvid2 does not exist" simple_test "$pid" "$srvid2"