Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharness macos no brainer fixes #6805

Merged
merged 6 commits into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/sharness/lib/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion test/sharness/t0010-basic-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
'
Expand Down
10 changes: 3 additions & 7 deletions test/sharness/t0060-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
'
Expand All @@ -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 ||
Expand Down
2 changes: 1 addition & 1 deletion test/sharness/t0061-daemon-opts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down
4 changes: 2 additions & 2 deletions test/sharness/t0080-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
'

Expand Down
2 changes: 2 additions & 0 deletions test/sharness/t0095-refs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,6 @@ test_refs_output '' 'cat'

test_refs_output '--cid-base=base32' 'ipfs cid base32'

test_kill_ipfs_daemon

test_done
10 changes: 5 additions & 5 deletions test/sharness/t0121-bootstrap-iptb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/sharness/t0130-multinode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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*
'
}

Expand Down
8 changes: 4 additions & 4 deletions test/sharness/t0180-p2p.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/sharness/t0181-private-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,6 @@ test_expect_success "stop testbed" '
iptb stop
'

test_kill_ipfs_daemon

test_done
6 changes: 6 additions & 0 deletions test/sharness/t0184-http-proxy-over-p2p.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions test/sharness/t0235-cli-request.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" '
Expand Down
5 changes: 5 additions & 0 deletions test/sharness/t0236-cli-api-dns-resolve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" '
Expand Down
2 changes: 1 addition & 1 deletion test/sharness/t0280-plugin-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" '
Expand Down
4 changes: 0 additions & 4 deletions test/sharness/t0300-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
7 changes: 6 additions & 1 deletion test/sharness/t0301-docker-migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion test/sharness/t0600-issues-and-regressions-online.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
'
Expand Down