[proxy] Set hostname and domainname based on container name, when dns

Had to make the assert_dns_record test helper more robust against
'getent hosts' returning duplicates
This commit is contained in:
Paul Bellamy committed 2015-06-11 10:27:29 +01:00
1 parent 9fddad02ad
commit b9850ac200
3 files changed
+18 -7

No files matched your search

+6 -4
View File
@@ -4,15 +4,17 @@
C1=10.2.0.78
C2=10.2.0.34
NAME=seetwo.weave.local
C1_NAME=c1.weave.local
C2_NAME=seetwo.weave.local
start_suite "Proxy registers containers with dns"
weave_on $HOST1 launch-dns 10.2.254.1/24
weave_on $HOST1 launch-proxy --with-dns
proxy docker_on $HOST1 run -e WEAVE_CIDR=$C2/24 -dt --name=c2 -h $NAME $SMALL_IMAGE /bin/sh
proxy docker_on $HOST1 run -e WEAVE_CIDR=$C1/24 -dt --name=c1 $DNS_IMAGE /bin/sh
proxy docker_on $HOST1 run -e WEAVE_CIDR=$C2/24 -dt --name=c2 -h $C2_NAME $SMALL_IMAGE /bin/sh
proxy docker_on $HOST1 run -e WEAVE_CIDR=$C1/24 -dt --name=c1 $DNS_IMAGE /bin/sh
assert_dns_record $HOST1 c1 $NAME $C2
assert_dns_record $HOST1 c1 $C2_NAME $C2
assert_dns_record $HOST1 c2 $C1_NAME $C1
end_suite
+1 -1
View File
@@ -128,7 +128,7 @@ assert_dns_record() {
[ -z "$DEBUG" ] || greyly echo "Checking whether the IPs '$@' exists at $host:$container"
for ip in "$@" ; do
assert "exec_on $host $container getent hosts $ip | tr -s ' '" "$ip $name"
assert "exec_on $host $container getent hosts $ip | awk '{print \$2}'" "$name"
done
}