Skip to content

Commit

Permalink
test(pubsub): publishing with line breaks
Browse files Browse the repository at this point in the history
Making sure we don't see regressions in the future.
Ref. ipfs#7939
  • Loading branch information
lidel committed Oct 15, 2021
1 parent c4f56a7 commit dd9fa9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions test/sharness/t0180-pubsub-gossipsub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test_expect_success 'peer ids' '
'

test_expect_success 'pubsub' '
echo -n "testOK" | ipfs multibase encode -b base64url > expected &&
echo -n -e "test\nOK" | ipfs multibase encode -b base64url > expected &&
touch empty &&
mkfifo wait ||
test_fsh echo init fail
Expand Down Expand Up @@ -53,8 +53,9 @@ test_expect_success "output looks good" '
test_cmp peers_exp peers_out
'

test_expect_success "publish something" '
ipfsi 1 pubsub pub testTopic "testOK" &> pubErr
test_expect_success "publish something from a file" '
echo -n -e "test\nOK" > payload-file &&
ipfsi 1 pubsub pub testTopic payload-file &> pubErr
'

test_expect_success "wait until echo > wait executed" '
Expand All @@ -64,7 +65,7 @@ test_expect_success "wait until echo > wait executed" '
'

test_expect_success "wait for another pubsub message" '
echo -n "testOK2" | ipfs multibase encode -b base64url > expected &&
echo -n -e "test\nOK2" | ipfs multibase encode -b base64url > expected &&
mkfifo wait2 ||
test_fsh echo init fail
Expand All @@ -83,7 +84,7 @@ test_expect_success "wait until ipfs pubsub sub is ready to do work" '
'

test_expect_success "publish something" '
echo -n "testOK2" | ipfsi 1 pubsub pub testTopic &> pubErr
echo -n -e "test\nOK2" | ipfsi 1 pubsub pub testTopic &> pubErr
'

test_expect_success "wait until echo > wait executed" '
Expand Down
8 changes: 4 additions & 4 deletions test/sharness/t0180-pubsub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ run_pubsub_tests() {

# ipfs pubsub sub
test_expect_success 'pubsub' '
echo -n "testOK" | ipfs multibase encode -b base64url > expected &&
echo -n -e "test\nOK" | ipfs multibase encode -b base64url > expected &&
touch empty &&
mkfifo wait ||
test_fsh echo init fail
Expand Down Expand Up @@ -51,7 +51,7 @@ run_pubsub_tests() {
'

test_expect_success "publish something from file" '
echo -n "testOK" > payload-file &&
echo -n -e "test\nOK" > payload-file &&
ipfsi 1 pubsub pub testTopic payload-file &> pubErr
'

Expand All @@ -62,7 +62,7 @@ run_pubsub_tests() {
'

test_expect_success "wait for another pubsub message" '
echo -n "testOK2" | ipfs multibase encode -b base64url > expected &&
echo -n -e "test\nOK\r\n2" | ipfs multibase encode -b base64url > expected &&
mkfifo wait2 ||
test_fsh echo init fail
Expand All @@ -81,7 +81,7 @@ run_pubsub_tests() {
'

test_expect_success "publish something from stdin" '
echo -n "testOK2" | ipfsi 3 pubsub pub testTopic &> pubErr
echo -n -e "test\nOK\r\n2" | ipfsi 3 pubsub pub testTopic &> pubErr
'

test_expect_success "wait until echo > wait executed" '
Expand Down

0 comments on commit dd9fa9e

Please sign in to comment.