pubsub sharness tests after chriscool feedback
License: MIT Signed-off-by: Jan Winkelmann <j-winkelmann@tuhh.de>
Jan Winkelmann committed
Nov 30, 2016 at 15:04 UTC
993e7816f84dc4eb6bc8303763a6897d9387ca95
2 files changed
+12
-11
test/sharness/lib/iptb-lib.sh
+5
-3
@@ -19,11 +19,13 @@ check_has_connection() {
19
20
startup_cluster() {
21
num_nodes="$1"
22
+ shift
23
+ other_args="$@"
24
bound=$(expr "$num_nodes" - 1)
25
24
- if [ "$2" = "--enable-pubsub-experiment" ]; then
25
- test_expect_success "start up nodes with pubsub enabled" '
26
- iptb start --args --enable-pubsub-experiment
26
+ if test -n "$other_args"; then
27
+ test_expect_success "start up nodes with additional args" '
28
+ iptb start --args $other_args
29
'
30
else
31
test_expect_success "start up nodes" '
test/sharness/t0180-pubsub.sh
+7
-8
@@ -24,18 +24,17 @@ test_expect_success 'pubsub' '
24
mkfifo wait ||
25
test_fsh echo init fail
26
27
+ # ipfs pubsub sub is long-running so we need to start it in the background and
28
+ # wait put its output somewhere where we can access it
29
(
28
- ipfsi 0 pubsub sub --enc=ndpayload testTopic |
29
- while read line; do
30
+ ipfsi 0 pubsub sub --enc=ndpayload testTopic | if read line; then
31
echo $line > actual &&
31
- echo > done
32
- exit
33
- done
32
+ echo > wait
33
+ fi
34
) &
35
36
- ipfspid=$!
37
-
38
- sleep 1
36
+ # wait until ipfs pubsub sub is ready to do work
37
+ sleep 1 &&
38
39
# publish something
40
ipfsi 1 pubsub pub testTopic "testOK" &> pubErr &&