mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-04 15:58:13 +08:00
Merge pull request #6805 from ipfs/sharness_macos_no_brainer_fixes
Sharness macos no brainer fixes
This commit is contained in:
commit
72d01d3bf4
@ -52,9 +52,13 @@ TEST_OS="$(uname -s | tr '[a-z]' '[A-Z]')"
|
||||
# grab + output options
|
||||
test "$TEST_NO_FUSE" != 1 && test_set_prereq FUSE
|
||||
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_DOCKER" != 1 && type docker >/dev/null 2>&1 && groups | egrep "\bdocker\b" && 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
|
||||
|
||||
|
||||
@ -45,8 +45,9 @@ test_expect_success "ipfs version deps succeeds" '
|
||||
ipfs version deps >deps.txt
|
||||
'
|
||||
|
||||
test_expect_success "ipfs version deps output looks good" '
|
||||
test_expect_success "ipfs version deps output looks good ( set \$GOIPFSTEST_SKIP_LOCAL_DEVTREE_DEPS_CHECK to skip this test )" '
|
||||
head -1 deps.txt | grep "go-ipfs@(devel)" &&
|
||||
[[ "$GOIPFSTEST_SKIP_LOCAL_DEVTREE_DEPS_CHECK" == "1" ]] ||
|
||||
[[ $(tail -n +2 deps.txt | egrep -v -c "^[^ @]+@v[^ @]+( => [^ @]+@v[^ @]+)?$") -eq 0 ]] ||
|
||||
test_fsh cat deps.txt
|
||||
'
|
||||
|
||||
@ -108,8 +108,9 @@ test_expect_success "ipfs version deps succeeds" '
|
||||
ipfs version deps >deps.txt
|
||||
'
|
||||
|
||||
test_expect_success "ipfs version deps output looks good" '
|
||||
test_expect_success "ipfs version deps output looks good ( set \$GOIPFSTEST_SKIP_LOCAL_DEVTREE_DEPS_CHECK to skip this test )" '
|
||||
head -1 deps.txt | grep "go-ipfs@(devel)" &&
|
||||
[[ "$GOIPFSTEST_SKIP_LOCAL_DEVTREE_DEPS_CHECK" == "1" ]] ||
|
||||
[[ $(tail -n +2 deps.txt | egrep -v -c "^[^ @]+@v[^ @]+( => [^ @]+@v[^ @]+)?$") -eq 0 ]] ||
|
||||
test_fsh cat deps.txt
|
||||
'
|
||||
@ -124,13 +125,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 ||
|
||||
|
||||
@ -247,10 +247,10 @@ test_expect_success "'ipfs repo stat --human' succeeds" '
|
||||
|
||||
test_expect_success "repo stats --human came out correct" '
|
||||
grep "RepoPath" repo-stats-human &&
|
||||
grep -P "RepoSize:\s*([0-9]*[.])?[0-9]+\s+?(B|kB|MB|GB|TB|PB|EB)" repo-stats-human &&
|
||||
grep -E "RepoSize:\s*([0-9]*[.])?[0-9]+\s+?(B|kB|MB|GB|TB|PB|EB)" repo-stats-human &&
|
||||
grep "NumObjects" repo-stats-human &&
|
||||
grep "Version" repo-stats-human &&
|
||||
grep -P "StorageMax:\s*([0-9]*[.])?[0-9]+\s+?(B|kB|MB|GB|TB|PB|EB)" repo-stats-human ||
|
||||
grep -E "StorageMax:\s*([0-9]*[.])?[0-9]+\s+?(B|kB|MB|GB|TB|PB|EB)" repo-stats-human ||
|
||||
test_fsh cat repo-stats-human
|
||||
'
|
||||
|
||||
|
||||
@ -182,4 +182,6 @@ test_refs_output '' 'cat'
|
||||
|
||||
test_refs_output '--cid-base=base32' 'ipfs cid base32'
|
||||
|
||||
test_kill_ipfs_daemon
|
||||
|
||||
test_done
|
||||
|
||||
@ -38,11 +38,11 @@ betterwait() {
|
||||
}
|
||||
|
||||
test_expect_success "bring down iptb nodes" '
|
||||
PID0=$(cat "$IPTB_ROOT/benches/default/0/daemon.pid") &&
|
||||
PID1=$(cat "$IPTB_ROOT/benches/default/1/daemon.pid") &&
|
||||
PID2=$(cat "$IPTB_ROOT/benches/default/2/daemon.pid") &&
|
||||
PID3=$(cat "$IPTB_ROOT/benches/default/3/daemon.pid") &&
|
||||
PID4=$(cat "$IPTB_ROOT/benches/default/4/daemon.pid") &&
|
||||
PID0=$(cat "$IPTB_ROOT/testbeds/default/0/daemon.pid") &&
|
||||
PID1=$(cat "$IPTB_ROOT/testbeds/default/1/daemon.pid") &&
|
||||
PID2=$(cat "$IPTB_ROOT/testbeds/default/2/daemon.pid") &&
|
||||
PID3=$(cat "$IPTB_ROOT/testbeds/default/3/daemon.pid") &&
|
||||
PID4=$(cat "$IPTB_ROOT/testbeds/default/4/daemon.pid") &&
|
||||
iptb stop && # TODO: add --wait flag to iptb stop
|
||||
betterwait $PID0
|
||||
betterwait $PID1
|
||||
|
||||
@ -80,7 +80,7 @@ run_advanced_test() {
|
||||
|
||||
test_expect_success "shut down nodes" '
|
||||
iptb stop && iptb_wait_stop ||
|
||||
test_fsh tail -n +1 .iptb/benches/default/*/daemon.std*
|
||||
test_fsh tail -n +1 .iptb/testbeds/default/*/daemon.std*
|
||||
'
|
||||
}
|
||||
|
||||
|
||||
@ -22,10 +22,10 @@ test_expect_success 'peer ids' '
|
||||
'
|
||||
check_test_ports() {
|
||||
test_expect_success "test ports are closed" '
|
||||
(! (netstat -lnp | grep "LISTEN" | grep ":10101 ")) &&
|
||||
(! (netstat -lnp | grep "LISTEN" | grep ":10102 "))&&
|
||||
(! (netstat -lnp | grep "LISTEN" | grep ":10103 ")) &&
|
||||
(! (netstat -lnp | grep "LISTEN" | grep ":10104 "))
|
||||
(! (netstat -aln | grep "LISTEN" | grep -E "[.:]10101 ")) &&
|
||||
(! (netstat -aln | grep "LISTEN" | grep -E "[.:]10102 ")) &&
|
||||
(! (netstat -aln | grep "LISTEN" | grep -E "[.:]10103 ")) &&
|
||||
(! (netstat -aln | grep "LISTEN" | grep -E "[.:]10104 "))
|
||||
'
|
||||
}
|
||||
check_test_ports
|
||||
|
||||
@ -132,4 +132,6 @@ test_expect_success "stop testbed" '
|
||||
iptb stop
|
||||
'
|
||||
|
||||
test_kill_ipfs_daemon
|
||||
|
||||
test_done
|
||||
|
||||
@ -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" '
|
||||
|
||||
@ -21,7 +21,7 @@ test_dag_git() {
|
||||
'
|
||||
|
||||
test_expect_success "successfully get added objects" '
|
||||
cat hashes | xargs -i ipfs dag get -- {} > /dev/null
|
||||
cat hashes | xargs -I {} ipfs dag get -- {} > /dev/null
|
||||
'
|
||||
|
||||
test_expect_success "path traversals work" '
|
||||
|
||||
@ -23,10 +23,6 @@ test_expect_success "'docker --version' output looks good" '
|
||||
egrep "^Docker version" actual
|
||||
'
|
||||
|
||||
test_expect_success "current user is in the 'docker' group" '
|
||||
groups | egrep "\bdocker\b"
|
||||
'
|
||||
|
||||
TEST_TRASH_DIR=$(pwd)
|
||||
TEST_SCRIPTS_DIR=$(dirname "$TEST_TRASH_DIR")
|
||||
TEST_TESTS_DIR=$(dirname "$TEST_SCRIPTS_DIR")
|
||||
|
||||
@ -10,11 +10,16 @@ test_description="Test docker image migration"
|
||||
|
||||
# if in travis CI on OSX, docker is not available
|
||||
if ! test_have_prereq DOCKER; then
|
||||
skip_all='skipping docker tests, docker not available'
|
||||
skip_all='skipping '$test_description', docker not available'
|
||||
|
||||
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