mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #615 from mrjana/bridge
Make the integration tests robust
This commit is contained in:
commit
14afa765a9
2 changed files with 44 additions and 4 deletions
|
@ -59,7 +59,7 @@ function test_single_network_connectivity() {
|
||||||
test_single_network_connectivity bridge 3
|
test_single_network_connectivity bridge 3
|
||||||
if [ "$iter" -eq 1 ]; then
|
if [ "$iter" -eq 1 ]; then
|
||||||
docker restart dnet-1-bridge
|
docker restart dnet-1-bridge
|
||||||
sleep 5
|
wait_for_dnet $(inst_id2port 1) dnet-1-bridge
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ function test_single_network_connectivity() {
|
||||||
test_single_network_connectivity singlehost 3
|
test_single_network_connectivity singlehost 3
|
||||||
if [ "$iter" -eq 1 ]; then
|
if [ "$iter" -eq 1 ]; then
|
||||||
docker restart dnet-1-bridge
|
docker restart dnet-1-bridge
|
||||||
sleep 5
|
wait_for_dnet $(inst_id2port 1) dnet-1-bridge
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ function test_single_network_connectivity() {
|
||||||
if [ "$iter" -eq 1 ]; then
|
if [ "$iter" -eq 1 ]; then
|
||||||
test_single_network_connectivity singlehost 3 skip
|
test_single_network_connectivity singlehost 3 skip
|
||||||
docker restart dnet-1-bridge
|
docker restart dnet-1-bridge
|
||||||
sleep 5
|
wait_for_dnet $(inst_id2port 1) dnet-1-bridge
|
||||||
else
|
else
|
||||||
test_single_network_connectivity singlehost 3
|
test_single_network_connectivity singlehost 3
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -44,6 +44,46 @@ function stop_consul() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hrun() {
|
||||||
|
local e E T oldIFS
|
||||||
|
[[ ! "$-" =~ e ]] || e=1
|
||||||
|
[[ ! "$-" =~ E ]] || E=1
|
||||||
|
[[ ! "$-" =~ T ]] || T=1
|
||||||
|
set +e
|
||||||
|
set +E
|
||||||
|
set +T
|
||||||
|
output="$("$@" 2>&1)"
|
||||||
|
status="$?"
|
||||||
|
oldIFS=$IFS
|
||||||
|
IFS=$'\n' lines=($output)
|
||||||
|
[ -z "$e" ] || set -e
|
||||||
|
[ -z "$E" ] || set -E
|
||||||
|
[ -z "$T" ] || set -T
|
||||||
|
IFS=$oldIFS
|
||||||
|
}
|
||||||
|
|
||||||
|
function wait_for_dnet() {
|
||||||
|
local hport
|
||||||
|
|
||||||
|
hport=$1
|
||||||
|
echo "waiting on dnet to come up ..."
|
||||||
|
for i in `seq 1 10`;
|
||||||
|
do
|
||||||
|
hrun ./cmd/dnet/dnet -H tcp://127.0.0.1:${hport} network ls
|
||||||
|
echo ${output}
|
||||||
|
if [ "$status" -eq 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${lines[1]}" =~ .*EOF.* ]]
|
||||||
|
then
|
||||||
|
docker logs ${2}
|
||||||
|
fi
|
||||||
|
echo "still waiting after ${i} seconds"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function start_dnet() {
|
function start_dnet() {
|
||||||
local inst suffix name hport cport hopt neighip bridge_ip labels tomlfile
|
local inst suffix name hport cport hopt neighip bridge_ip labels tomlfile
|
||||||
inst=$1
|
inst=$1
|
||||||
|
@ -110,7 +150,7 @@ EOF
|
||||||
-v /usr/local/bin/runc:/usr/local/bin/runc \
|
-v /usr/local/bin/runc:/usr/local/bin/runc \
|
||||||
-w /go/src/github.com/docker/libnetwork \
|
-w /go/src/github.com/docker/libnetwork \
|
||||||
golang:1.4 ./cmd/dnet/dnet -d -D ${hopt} -c ${tomlfile}
|
golang:1.4 ./cmd/dnet/dnet -d -D ${hopt} -c ${tomlfile}
|
||||||
sleep 3
|
wait_for_dnet $(inst_id2port ${inst}) ${name}
|
||||||
}
|
}
|
||||||
|
|
||||||
function skip_for_circleci() {
|
function skip_for_circleci() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue