fix t0061-daemon-opts.sh nc wait
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>
Juan Batiz-Benet committed
Jun 26, 2015 at 23:22 UTC
6b8e9f51fe1566293a5a795b1c331cb4acfa17d9
2 files changed
+6
-8
test/sharness/t0060-daemon.sh
+3
-4
@@ -19,7 +19,7 @@ test_expect_success "setup IPFS_PATH" '
19
# NOTE: this should remove bootstrap peers (needs a flag)
20
# TODO(cryptix):
21
# - we won't see daemon startup failure because we put the daemon in the background - fix: fork with exit code after api listen
22
-# - 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
22
+# - 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
23
test_expect_success "ipfs daemon --init launches" '
24
ipfs daemon --init >actual_daemon 2>daemon_err &
25
'
@@ -102,10 +102,9 @@ test_expect_success "ipfs help output looks good" '
102
# check transport is encrypted
103
104
test_expect_success 'transport should be encrypted' '
105
- nc localhost 4001 >swarmnc &
106
- go-sleep 0.1s &&
105
+ nc -w 5 localhost 4001 >swarmnc &&
106
grep -q "AES-256,AES-128" swarmnc &&
108
- ! grep -q "/ipfs/identify" swarmnc ||
107
+ test_must_fail grep -q "/ipfs/identify" swarmnc ||
108
test_fsh cat swarmnc
109
'
110
test/sharness/t0061-daemon-opts.sh
+3
-4
@@ -26,10 +26,9 @@ test_expect_success 'api gateway should be unrestricted' '
26
'
27
28
# Odd. this fails here, but the inverse works on t0060-daemon.
29
-test_expect_failure 'transport should be unencrypted' '
30
- nc 127.0.0.1 "$PORT_SWARM" >swarmnc &
31
- go-sleep 0.1s &&
32
- ! grep -q "AES-256,AES-128" swarmnc &&
29
+test_expect_success 'transport should be unencrypted' '
30
+ go-sleep 0.5s | nc localhost "$PORT_SWARM" >swarmnc &&
31
+ test_must_fail grep -q "AES-256,AES-128" swarmnc &&
32
grep -q "/ipfs/identify" swarmnc ||
33
test_fsh cat swarmnc
34
'