diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index b5c03ba48..4f3d92073 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -55,6 +55,10 @@ test "$TEST_EXPENSIVE" = 1 && test_set_prereq EXPENSIVE test "$TEST_NO_DOCKER" != 1 && type docker >/dev/null 2>&1 && test_set_prereq DOCKER test "$TEST_NO_PLUGIN" != 1 && test "$TEST_OS" = "LINUX" && test_set_prereq PLUGIN +# this may not be available, skip a few dependent tests +type socat >/dev/null 2>&1 && test_set_prereq SOCAT + + # Set a prereq as error messages are often different on Windows/Cygwin expr "$TEST_OS" : "CYGWIN_NT" >/dev/null || test_set_prereq STD_ERR_MSG diff --git a/test/sharness/t0060-daemon.sh b/test/sharness/t0060-daemon.sh index 67108f7cd..c51d7e6bb 100755 --- a/test/sharness/t0060-daemon.sh +++ b/test/sharness/t0060-daemon.sh @@ -124,13 +124,8 @@ test_expect_success "ipfs help output looks good" ' test_fsh cat help.txt ' -# netcat (nc) is needed for the following test -test_expect_success "socat is available" ' - type socat >/dev/null -' - # check transport is encrypted -test_expect_success "transport should be encrypted" ' +test_expect_success SOCAT "transport should be encrypted ( needs socat )" ' socat - tcp:localhost:$SWARM_PORT,connect-timeout=1 > swarmnc < ../t0060-data/mss-ls && grep -q "/secio" swarmnc && test_must_fail grep -q "/plaintext/1.0.0" swarmnc || diff --git a/test/sharness/t0061-daemon-opts.sh b/test/sharness/t0061-daemon-opts.sh index 227d4fa30..7d5cf7fe7 100755 --- a/test/sharness/t0061-daemon-opts.sh +++ b/test/sharness/t0061-daemon-opts.sh @@ -17,7 +17,7 @@ gwyaddr=$GWAY_ADDR apiaddr=$API_ADDR # Odd. this fails here, but the inverse works on t0060-daemon. -test_expect_success 'transport should be unencrypted' ' +test_expect_success SOCAT 'transport should be unencrypted ( needs socat )' ' socat - tcp:localhost:$SWARM_PORT,connect-timeout=1 > swarmnc < ../t0060-data/mss-ls && grep -q -v "/secio" swarmnc && grep -q "/plaintext" swarmnc || diff --git a/test/sharness/t0184-http-proxy-over-p2p.sh b/test/sharness/t0184-http-proxy-over-p2p.sh index d647273f0..9beda4fbc 100755 --- a/test/sharness/t0184-http-proxy-over-p2p.sh +++ b/test/sharness/t0184-http-proxy-over-p2p.sh @@ -3,6 +3,12 @@ test_description="Test http proxy over p2p" . lib/test-lib.sh + +if ! test_have_prereq SOCAT; then + skip_all="skipping '$test_description': socat is not available" + test_done +fi + WEB_SERVE_PORT=5099 IPFS_GATEWAY_PORT=5199 SENDER_GATEWAY="http://127.0.0.1:$IPFS_GATEWAY_PORT" diff --git a/test/sharness/t0235-cli-request.sh b/test/sharness/t0235-cli-request.sh index 24bccd4d5..3d50a2e62 100755 --- a/test/sharness/t0235-cli-request.sh +++ b/test/sharness/t0235-cli-request.sh @@ -8,6 +8,12 @@ test_description="test http requests made by cli" . lib/test-lib.sh +if ! test_have_prereq SOCAT; then + skip_all="skipping '$test_description': socat is not available" + test_done +fi + + test_init_ipfs test_expect_success "start nc" ' diff --git a/test/sharness/t0236-cli-api-dns-resolve.sh b/test/sharness/t0236-cli-api-dns-resolve.sh index 1beefed09..eddbc93da 100755 --- a/test/sharness/t0236-cli-api-dns-resolve.sh +++ b/test/sharness/t0236-cli-api-dns-resolve.sh @@ -8,6 +8,11 @@ test_description="test dns resolution of api endpoint by cli" . lib/test-lib.sh +if ! test_have_prereq SOCAT; then + skip_all="skipping '$test_description': socat is not available" + test_done +fi + test_init_ipfs test_expect_success "start nc" ' diff --git a/test/sharness/t0301-docker-migrate.sh b/test/sharness/t0301-docker-migrate.sh index 767769202..d5b2fda3b 100755 --- a/test/sharness/t0301-docker-migrate.sh +++ b/test/sharness/t0301-docker-migrate.sh @@ -15,6 +15,11 @@ if ! test_have_prereq DOCKER; then test_done fi +if ! test_have_prereq SOCAT; then + skip_all="skipping '$test_description': socat is not available" + test_done +fi + TEST_TRASH_DIR=$(pwd) TEST_SCRIPTS_DIR=$(dirname "$TEST_TRASH_DIR") TEST_TESTS_DIR=$(dirname "$TEST_SCRIPTS_DIR") diff --git a/test/sharness/t0600-issues-and-regressions-online.sh b/test/sharness/t0600-issues-and-regressions-online.sh index 1abf87170..8496a0f03 100755 --- a/test/sharness/t0600-issues-and-regressions-online.sh +++ b/test/sharness/t0600-issues-and-regressions-online.sh @@ -46,7 +46,7 @@ test_expect_success "pin add api looks right - #3753" ' test_cmp pinrm_out pinrm_exp ' -test_expect_success "no daemon crash on improper file argument - #4003" ' +test_expect_success SOCAT "no daemon crash on improper file argument - #4003 ( test needs socat )" ' FNC=$(echo $API_ADDR | awk -F: '\''{ printf "%s:%s", $1, $2 }'\'') && 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" '