-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #271 from AkihiroSuda/dev
tests: refactor
- Loading branch information
Showing
16 changed files
with
262 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
#!/bin/bash | ||
set -xeuo pipefail | ||
|
||
. $(dirname $0)/common.sh | ||
|
||
SLIRP_CONFIG_VERSION_MAX=$(slirp4netns -v | grep "SLIRP_CONFIG_VERSION_MAX: " | sed 's#SLIRP_CONFIG_VERSION_MAX: \(\)##') | ||
|
||
if [ "${SLIRP_CONFIG_VERSION_MAX:-0}" -lt 3 ]; then | ||
printf "'--disable-dns' requires SLIRP_CONFIG_VERSION_MAX 3 or newer. Test skipped..." | ||
exit 0 | ||
printf "'--disable-dns' requires SLIRP_CONFIG_VERSION_MAX 3 or newer. Test skipped..." | ||
exit "$TEST_EXIT_CODE_SKIP" | ||
fi | ||
|
||
. $(dirname $0)/common.sh | ||
|
||
port=53 | ||
unshare -r -n sleep infinity & | ||
child=$! | ||
|
||
wait_for_network_namespace $child | ||
|
||
mtu=${MTU:=1500} | ||
slirp4netns -c --mtu $mtu --disable-dns $child tun11 & | ||
slirp4netns -c --mtu $mtu --disable-dns $child tap11 & | ||
slirp_pid=$! | ||
|
||
wait_for_network_device $child tun11 | ||
wait_for_network_device $child tap11 | ||
# ping to 10.0.2.2 | ||
wait_for_ping_connectivity $child 10.0.2.2 | ||
|
||
function cleanup() { | ||
kill -9 $child $slirp_pid | ||
kill -9 $child $slirp_pid | ||
} | ||
trap cleanup EXIT | ||
|
||
set +e | ||
err=$(echo "should fail" | nsenter --preserve-credentials -U -n --target=$child ncat -v 10.0.2.3 $port 2>&1) | ||
err=$(echo "should fail" | nsenter $(nsenter_flags $child) ncat -v 10.0.2.3 $port 2>&1) | ||
set -e | ||
echo $err | grep 'Connection timed out\|TIMEOUT' |
Oops, something went wrong.