extract helper for obtaining container ip address
thus keeping the ghastly regexp in one place instead of three.
This commit is contained in:
1 parent
bb8a745431
commit
2647fd4c92
4 files changed
+7
-3
No files matched your search
@@ -11,7 +11,7 @@ weave_on $HOST2 launch -iprange $UNIVERSE $HOST1
|
||||
|
||||
weave_on $HOST1 run -t --name=c1 gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST2 run -t --name=c2 gliderlabs/alpine /bin/sh
|
||||
C2=$(weave_on $HOST2 ps | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
|
||||
C2=$(container_ip $HOST2 c2)
|
||||
assert_raises "exec_on $HOST1 c1 ping -q -c 4 $C2"
|
||||
|
||||
end_suite
|
||||
@@ -35,7 +35,7 @@ weave_on $HOST1 run -t --name=c1 gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST1 run -t --name=c2 gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST1 run $C3/24 -t --name=c3 gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST1 run $C4/24 -t --name=c4 gliderlabs/alpine /bin/sh
|
||||
C1=$(weave_on $HOST1 ps c1 | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
|
||||
C1=$(container_ip $HOST1 c1)
|
||||
|
||||
# absence of host connectivity by default
|
||||
run_on1 "! $PING $C1"
|
||||
|
||||
@@ -14,7 +14,7 @@ weave_on $HOST2 launch-dns 10.2.254.2/24
|
||||
|
||||
weave_on $HOST2 run -t --name=c2 -h seetwo.weave.local gliderlabs/alpine /bin/sh
|
||||
weave_on $HOST1 run --with-dns --name=c1 -t aanand/docker-dnsutils /bin/sh
|
||||
C2=$(weave_on $HOST2 ps c2 | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
|
||||
C2=$(container_ip $HOST2 c2)
|
||||
|
||||
assert "exec_on $HOST1 c1 dig +short seetwo.weave.local" "$C2"
|
||||
assert "exec_on $HOST1 c1 dig +short -x $C2" "seetwo.weave.local."
|
||||
|
||||
@@ -88,6 +88,10 @@ exec_on() {
|
||||
docker -H tcp://$host:2375 exec $container $@
|
||||
}
|
||||
|
||||
container_ip() {
|
||||
weave_on $1 ps $2 | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
|
||||
}
|
||||
|
||||
# assert_dns_record <host> <container> <name> <ip>
|
||||
assert_dns_record() {
|
||||
assert "exec_on $1 $2 getent hosts $3 | tr -s ' '" "$4 $3"
|
||||
|
||||
Reference in new issue
Block a user