mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
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.
This commit is contained in:
parent
3c95f65b21
commit
ba3a7d4a55
@ -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
|
||||
|
||||
|
||||
@ -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 ||
|
||||
|
||||
@ -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 ||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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" '
|
||||
|
||||
@ -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" '
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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"
|
||||
'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user