socat is not part of any default install, make tests conditional
54b1969c4b correctly switched from nc to socat, but did not account for it not being as widely available. Adjust tests that depend on it with the correct message. There are also a number of comments pertaining to nc - they were not adjusted.
Peter Rabbitson committed
Dec 14, 2019 at 15:11 UTC
ba3a7d4a5556eccdd9e4cdd1e971df1f005bdf3a
8 files changed
+29
-8
test/sharness/lib/test-lib.sh
+4
@@ -55,6 +55,10 @@ test "$TEST_EXPENSIVE" = 1 && test_set_prereq EXPENSIVE
55
test "$TEST_NO_DOCKER" != 1 && type docker >/dev/null 2>&1 && test_set_prereq DOCKER
56
test "$TEST_NO_PLUGIN" != 1 && test "$TEST_OS" = "LINUX" && test_set_prereq PLUGIN
57
58
+# this may not be available, skip a few dependent tests
59
+type socat >/dev/null 2>&1 && test_set_prereq SOCAT
60
+
61
+
62
# Set a prereq as error messages are often different on Windows/Cygwin
63
expr "$TEST_OS" : "CYGWIN_NT" >/dev/null || test_set_prereq STD_ERR_MSG
64
test/sharness/t0060-daemon.sh
+1
-6
@@ -124,13 +124,8 @@ test_expect_success "ipfs help output looks good" '
124
test_fsh cat help.txt
125
'
126
127
-# netcat (nc) is needed for the following test
128
-test_expect_success "socat is available" '
129
- type socat >/dev/null
130
-'
131
-
127
# check transport is encrypted
133
-test_expect_success "transport should be encrypted" '
128
+test_expect_success SOCAT "transport should be encrypted ( needs socat )" '
129
socat - tcp:localhost:$SWARM_PORT,connect-timeout=1 > swarmnc < ../t0060-data/mss-ls &&
130
grep -q "/secio" swarmnc &&
131
test_must_fail grep -q "/plaintext/1.0.0" swarmnc ||
test/sharness/t0061-daemon-opts.sh
+1
-1
@@ -17,7 +17,7 @@ gwyaddr=$GWAY_ADDR
17
apiaddr=$API_ADDR
18
19
# Odd. this fails here, but the inverse works on t0060-daemon.
20
-test_expect_success 'transport should be unencrypted' '
20
+test_expect_success SOCAT 'transport should be unencrypted ( needs socat )' '
21
socat - tcp:localhost:$SWARM_PORT,connect-timeout=1 > swarmnc < ../t0060-data/mss-ls &&
22
grep -q -v "/secio" swarmnc &&
23
grep -q "/plaintext" swarmnc ||
test/sharness/t0184-http-proxy-over-p2p.sh
+6
@@ -3,6 +3,12 @@
3
test_description="Test http proxy over p2p"
4
5
. lib/test-lib.sh
6
+
7
+if ! test_have_prereq SOCAT; then
8
+ skip_all="skipping '$test_description': socat is not available"
9
+ test_done
10
+fi
11
+
12
WEB_SERVE_PORT=5099
13
IPFS_GATEWAY_PORT=5199
14
SENDER_GATEWAY="http://127.0.0.1:$IPFS_GATEWAY_PORT"
test/sharness/t0235-cli-request.sh
+6
@@ -8,6 +8,12 @@ test_description="test http requests made by cli"
8
9
. lib/test-lib.sh
10
11
+if ! test_have_prereq SOCAT; then
12
+ skip_all="skipping '$test_description': socat is not available"
13
+ test_done
14
+fi
15
+
16
+
17
test_init_ipfs
18
19
test_expect_success "start nc" '
test/sharness/t0236-cli-api-dns-resolve.sh
+5
@@ -8,6 +8,11 @@ test_description="test dns resolution of api endpoint by cli"
8
9
. lib/test-lib.sh
10
11
+if ! test_have_prereq SOCAT; then
12
+ skip_all="skipping '$test_description': socat is not available"
13
+ test_done
14
+fi
15
+
16
test_init_ipfs
17
18
test_expect_success "start nc" '
test/sharness/t0301-docker-migrate.sh
+5
@@ -15,6 +15,11 @@ if ! test_have_prereq DOCKER; then
15
test_done
16
fi
17
18
+if ! test_have_prereq SOCAT; then
19
+ skip_all="skipping '$test_description': socat is not available"
20
+ test_done
21
+fi
22
+
23
TEST_TRASH_DIR=$(pwd)
24
TEST_SCRIPTS_DIR=$(dirname "$TEST_TRASH_DIR")
25
TEST_TESTS_DIR=$(dirname "$TEST_SCRIPTS_DIR")
test/sharness/t0600-issues-and-regressions-online.sh
+1
-1
@@ -46,7 +46,7 @@ test_expect_success "pin add api looks right - #3753" '
46
test_cmp pinrm_out pinrm_exp
47
'
48
49
-test_expect_success "no daemon crash on improper file argument - #4003" '
49
+test_expect_success SOCAT "no daemon crash on improper file argument - #4003 ( test needs socat )" '
50
FNC=$(echo $API_ADDR | awk -F: '\''{ printf "%s:%s", $1, $2 }'\'') &&
51
printf "POST /api/v0/add?pin=true HTTP/1.1\r\nHost: $API_ADDR\r\nContent-Type: multipart/form-data; boundary=Pyw9xQLtiLPE6XcI\r\nContent-Length: 22\r\n\r\n\r\n--Pyw9xQLtiLPE6XcI\r\n" | socat STDIO tcp-connect:$FNC | grep -m1 "500 Internal Server Error"
52
'