Skip to content

Commit

Permalink
fix t0061-daemon-opts.sh nc wait
Browse files Browse the repository at this point in the history
fix the nc wait. the issue was that stdin needs to remain _open_
but not receive any input for some time. If stdin receives (invalid)
input or closes, the other side terminates the connection before
writing out the muxer frames + identify handshake.

This commit also changes the use of `!` for `test_must_fail`

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
  • Loading branch information
jbenet committed Jun 27, 2015
1 parent 006aad2 commit a390541
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions test/sharness/t0060-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test_expect_success "setup IPFS_PATH" '
# NOTE: this should remove bootstrap peers (needs a flag)
# TODO(cryptix):
# - we won't see daemon startup failure because we put the daemon in the background - fix: fork with exit code after api listen
# - also default ports: might clash with local clients. Failure in that case isn't clear as well because pollEndpoint just uses the already running node
# - also default ports: might clash with local clients. Failure in that case isn't clear as well because pollEndpoint just uses the already running node
test_expect_success "ipfs daemon --init launches" '
ipfs daemon --init >actual_daemon 2>daemon_err &
'
Expand Down Expand Up @@ -101,10 +101,9 @@ test_expect_success "ipfs help output looks good" '
# check transport is encrypted

test_expect_success 'transport should be encrypted' '
nc localhost 4001 >swarmnc &
go-sleep 0.1s &&
nc -w 5 localhost 4001 >swarmnc &&
grep -q "AES-256,AES-128" swarmnc &&
! grep -q "/ipfs/identify" swarmnc ||
test_must_fail grep -q "/ipfs/identify" swarmnc ||
test_fsh cat swarmnc
'

Expand Down
7 changes: 3 additions & 4 deletions test/sharness/t0061-daemon-opts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ test_expect_success 'api gateway should be unrestricted' '
'

# Odd. this fails here, but the inverse works on t0060-daemon.
test_expect_failure 'transport should be unencrypted' '
nc 127.0.0.1 "$PORT_SWARM" >swarmnc &
go-sleep 0.1s &&
! grep -q "AES-256,AES-128" swarmnc &&
test_expect_success 'transport should be unencrypted' '
go-sleep 0.5s | nc localhost "$PORT_SWARM" >swarmnc &&
test_must_fail grep -q "AES-256,AES-128" swarmnc &&
grep -q "/ipfs/identify" swarmnc ||
test_fsh cat swarmnc
'
Expand Down

0 comments on commit a390541

Please sign in to comment.