add exec_on helper
so we don't repeat the remote docker invocation command (complete with hard-coded port) over and over again.
This commit is contained in:
1 parent
3ad186d727
commit
a7c9fd272c
8 files changed
+19
-12
No files matched your search
@@ -18,7 +18,7 @@ weave_on $HOST2 launch $HOST1
|
||||
|
||||
weave_on $HOST2 run $C2/24 -t --name=c2 ubuntu
|
||||
weave_on $HOST1 run $C1/24 -t --name=c1 ubuntu
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 sh -c "ping -q -c 4 $C2 >&2 && echo ok")
|
||||
ok=$(exec_on $HOST1 c1 ping -q -c 4 $C2 >&2 && echo ok)
|
||||
assert "echo $ok" "ok"
|
||||
|
||||
end_suite
|
||||
@@ -18,7 +18,7 @@ weave_on $HOST2 launch -password notverysecure $HOST1
|
||||
|
||||
weave_on $HOST2 run $C2/24 -t --name=c2 ubuntu
|
||||
weave_on $HOST1 run $C1/24 -t --name=c1 ubuntu
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 sh -c "ping -q -c 4 $C2 >&2 && echo ok")
|
||||
ok=$(exec_on $HOST1 c1 ping -q -c 4 $C2 >&2 && echo ok)
|
||||
assert "echo $ok" "ok"
|
||||
|
||||
end_suite
|
||||
@@ -16,10 +16,10 @@ docker_on $HOST1 rm -f c1 c2 || true
|
||||
weave_on $HOST1 run $C2/24 -t --name=c2 -h seetwo.weave.local ubuntu
|
||||
weave_on $HOST1 run --with-dns $C1/24 -t --name=c1 aanand/docker-dnsutils /bin/sh
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 sh -c "dig +short seetwo.weave.local")
|
||||
ok=$(exec_on $HOST1 c1 dig +short seetwo.weave.local)
|
||||
assert "echo $ok" "$C2"
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 sh -c "dig +short -x $C2")
|
||||
ok=$(exec_on $HOST1 c1 dig +short -x $C2)
|
||||
assert "echo $ok" "seetwo.weave.local."
|
||||
|
||||
end_suite
|
||||
@@ -22,13 +22,13 @@ weave_on $HOST2 launch-dns 10.2.254.2/24 -debug
|
||||
weave_on $HOST2 run $C2/24 -t --name=c2 -h seetwo.weave.local ubuntu
|
||||
weave_on $HOST1 run --with-dns $C1/24 --name=c1 -t aanand/docker-dnsutils /bin/sh
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 dig +short seetwo.weave.local)
|
||||
ok=$(exec_on $HOST1 c1 dig +short seetwo.weave.local)
|
||||
assert "echo $ok" "$C2"
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 dig +short -x $C2)
|
||||
ok=$(exec_on $HOST1 c1 dig +short -x $C2)
|
||||
assert "echo $ok" "seetwo.weave.local."
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 dig +short -x 8.8.8.8)
|
||||
ok=$(exec_on $HOST1 c1 dig +short -x 8.8.8.8)
|
||||
assert "test -n \"$ok\" && echo pass" "pass"
|
||||
|
||||
end_suite
|
||||
@@ -16,10 +16,10 @@ docker_on $HOST1 rm -f c1 c2 || true
|
||||
weave_on $HOST1 run $C2/24 -t --name=c2 -h seetwo.foo.bar ubuntu
|
||||
weave_on $HOST1 run --with-dns $C1/24 -t --name=c1 aanand/docker-dnsutils /bin/sh
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 sh -c "dig +short seetwo.foo.bar.")
|
||||
ok=$(exec_on $HOST1 c1 dig +short seetwo.foo.bar.)
|
||||
assert "echo $ok" "$C2"
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 sh -c "dig +short -x $C2")
|
||||
ok=$(exec_on $HOST1 c1 dig +short -x $C2)
|
||||
assert "echo $ok" "seetwo.foo.bar."
|
||||
|
||||
end_suite
|
||||
@@ -10,10 +10,10 @@ docker_on $HOST1 rm -f c1 || true
|
||||
|
||||
weave_on $HOST1 run --with-dns 10.2.1.5/24 --name=c1 -t aanand/docker-dnsutils /bin/sh
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 dig +short -t MX weave.works)
|
||||
ok=$(exec_on $HOST1 c1 dig +short -t MX weave.works)
|
||||
assert "test -n \"$ok\" && echo pass" "pass"
|
||||
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 dig +short -x 8.8.8.8)
|
||||
ok=$(exec_on $HOST1 c1 dig +short -x 8.8.8.8)
|
||||
assert "test -n \"$ok\" && echo pass" "pass"
|
||||
|
||||
end_suite
|
||||
@@ -11,7 +11,7 @@ assert_raises "docker_on $HOST1 ps | grep weave" 0
|
||||
|
||||
docker_on $HOST1 rm -f c1 || true
|
||||
run_on $HOST1 sudo ./weave --local run 10.2.6.5/24 -ti --name=c1 ubuntu
|
||||
ok=$(docker -H tcp://$HOST1:2375 exec c1 sh -c "ifconfig | grep ethwe")
|
||||
ok=$(exec_on $HOST1 c1 ifconfig | grep ethwe)
|
||||
assert "test -n \"$ok\" && echo pass" "pass"
|
||||
|
||||
docker_on $HOST1 rm -f c1 || true
|
||||
|
||||
@@ -57,6 +57,13 @@ weave_on() {
|
||||
DOCKER_HOST=tcp://$host:2375 $WEAVE $@
|
||||
}
|
||||
|
||||
exec_on() {
|
||||
host=$1
|
||||
container=$2
|
||||
shift 2
|
||||
docker -H tcp://$host:2375 exec $container "$@"
|
||||
}
|
||||
|
||||
start_suite() {
|
||||
whitely echo $@
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user