@cryptotaxi247 / kubo / commits / ef43fb8c8

Don't use wait in p2p sharness test

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Jun 21, 2017 at 18:35 UTC ef43fb8c8b977cda196f668dc372fa1d4c3cca41
1 file changed +12 -7
test/sharness/t0180-p2p.sh
+12 -7
@@ -40,21 +40,26 @@ test_expect_success 'start p2p listener' '
40 '
41
42 test_expect_success 'Test server to client communications' '
43 - ma-pipe-unidir --listen send /ip4/127.0.0.1/tcp/10101 < test0.bin &
44 - SERVER_PID=$!
43 + ma-pipe-unidir --listen --pidFile=listener.pid send /ip4/127.0.0.1/tcp/10101 < test0.bin &
44 +
45 + go-sleep 500ms &&
46 + kill -0 $(cat listener.pid) &&
47
48 ipfsi 1 p2p stream dial $PEERID_0 p2p-test /ip4/127.0.0.1/tcp/10102 2>&1 > dialer-stdouterr.log &&
49 ma-pipe-unidir recv /ip4/127.0.0.1/tcp/10102 > client.out &&
48 - wait $SERVER_PID
50 + test ! -f listener.pid
51 '
52
53 test_expect_success 'Test client to server communications' '
52 - ma-pipe-unidir --listen recv /ip4/127.0.0.1/tcp/10101 > server.out &
53 - SERVER_PID=$!
54 + ma-pipe-unidir --listen --pidFile=listener.pid recv /ip4/127.0.0.1/tcp/10101 > server.out &
55 +
56 + go-sleep 500ms &&
57 + kill -0 $(cat listener.pid) &&
58
59 ipfsi 1 p2p stream dial $PEERID_0 p2p-test /ip4/127.0.0.1/tcp/10102 2>&1 > dialer-stdouterr.log &&
56 - ma-pipe-unidir send /ip4/127.0.0.1/tcp/10102 < test1.bin
57 - wait $SERVER_PID
60 + ma-pipe-unidir send /ip4/127.0.0.1/tcp/10102 < test1.bin &&
61 + go-sleep 250ms &&
62 + test ! -f listener.pid
63 '
64
65 test_expect_success 'server to client output looks good' '