From abad8ca76ea2a3ff57cb0c90c0393593e37c15b1 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 30 Jul 2018 11:57:27 -0700 Subject: [PATCH] wait for the nodes to fully stop Ideally, we'd fix this in IPTB but I'm tired of this bug and this is the easy fix. fixes #5272 License: MIT Signed-off-by: Steven Allen --- test/sharness/lib/iptb-lib.sh | 6 ++++++ test/sharness/t0125-twonode.sh | 2 +- test/sharness/t0130-multinode.sh | 4 ++-- test/sharness/t0182-circuit-relay.sh | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/test/sharness/lib/iptb-lib.sh b/test/sharness/lib/iptb-lib.sh index 94475b7ae..e9699ea3e 100644 --- a/test/sharness/lib/iptb-lib.sh +++ b/test/sharness/lib/iptb-lib.sh @@ -56,3 +56,9 @@ startup_cluster() { ' done } + +iptb_wait_stop() { + while ! iptb for-each sh -c '! { test -e "$IPFS_PATH/repo.lock" && fuser -f "$IPFS_PATH/repo.lock" >/dev/null; }'; do + go-sleep 10ms + done +} diff --git a/test/sharness/t0125-twonode.sh b/test/sharness/t0125-twonode.sh index 342cf1c4f..5af4d4d97 100755 --- a/test/sharness/t0125-twonode.sh +++ b/test/sharness/t0125-twonode.sh @@ -81,7 +81,7 @@ run_advanced_test() { ' test_expect_success "shut down nodes" ' - iptb stop + iptb stop && iptb_wait_stop ' } diff --git a/test/sharness/t0130-multinode.sh b/test/sharness/t0130-multinode.sh index 7620b8911..cf5b9044f 100755 --- a/test/sharness/t0130-multinode.sh +++ b/test/sharness/t0130-multinode.sh @@ -67,7 +67,7 @@ run_basic_test() { run_single_file_test test_expect_success "shut down nodes" ' - iptb stop + iptb stop && iptb_wait_stop ' } @@ -79,7 +79,7 @@ run_advanced_test() { run_random_dir_test test_expect_success "shut down nodes" ' - iptb stop || + iptb stop && iptb_wait_stop || test_fsh tail -n +1 .iptb/*/daemon.std* ' } diff --git a/test/sharness/t0182-circuit-relay.sh b/test/sharness/t0182-circuit-relay.sh index a6e888ee4..4f48827a3 100755 --- a/test/sharness/t0182-circuit-relay.sh +++ b/test/sharness/t0182-circuit-relay.sh @@ -21,6 +21,7 @@ test_expect_success 'configure EnableRelayHop in relay node' ' test_expect_success 'restart nodes' ' iptb stop && + iptb_wait_stop && iptb start --args --routing=none '