Skip to content

Commit

Permalink
pubsub sharness tests after chriscool feedback
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jan Winkelmann <[email protected]>
  • Loading branch information
keks committed Dec 3, 2016
1 parent 175bc4d commit d49ca0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 5 additions & 3 deletions test/sharness/lib/iptb-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ check_has_connection() {

startup_cluster() {
num_nodes="$1"
shift
other_args="$@"
bound=$(expr "$num_nodes" - 1)

if [ "$2" = "--enable-pubsub-experiment" ]; then
test_expect_success "start up nodes with pubsub enabled" '
iptb start --args --enable-pubsub-experiment
if test -n "$other_args"; then
test_expect_success "start up nodes with additional args" '
iptb start --args $other_args
'
else
test_expect_success "start up nodes" '
Expand Down
15 changes: 7 additions & 8 deletions test/sharness/t0180-pubsub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ test_expect_success 'pubsub' '
mkfifo wait ||
test_fsh echo init fail
# ipfs pubsub sub is long-running so we need to start it in the background and
# wait put its output somewhere where we can access it
(
ipfsi 0 pubsub sub --enc=ndpayload testTopic |
while read line; do
ipfsi 0 pubsub sub --enc=ndpayload testTopic | if read line; then
echo $line > actual &&
echo > done
exit
done
echo > wait
fi
) &
ipfspid=$!
sleep 1
# wait until ipfs pubsub sub is ready to do work
sleep 1 &&
# publish something
ipfsi 1 pubsub pub testTopic "testOK" &> pubErr &&
Expand Down

0 comments on commit d49ca0c

Please sign in to comment.