Merge pull request #706 from awh/dns_delete_individual_records
delete individual dns records Closes #631. Closes #654.
This commit is contained in:
commit
fca02eb489
10 files changed
+239
-163
No files matched your search
@@ -6,6 +6,7 @@ C1=10.2.0.78
|
||||
C2=10.2.0.34
|
||||
NAME1=seeone.weave.local
|
||||
NAME2=seetwo.weave.local
|
||||
NAME3=seethree.weave.local
|
||||
|
||||
start_suite "Add and remove names on a single host"
|
||||
|
||||
@@ -19,11 +20,14 @@ weave_on $HOST1 dns-add $C2 c2 -h $NAME2
|
||||
assert_dns_record $HOST1 c1 $NAME2 $C2
|
||||
|
||||
weave_on $HOST1 dns-add $C1 c1 -h $NAME1
|
||||
weave_on $HOST1 dns-add $C1 c1 -h $NAME3
|
||||
|
||||
assert "exec_on $HOST1 c1 getent hosts $C1 | tr -s ' '" "$C1 $NAME1"
|
||||
assert_dns_a_record $HOST1 c1 $NAME1 $C1
|
||||
assert_dns_a_record $HOST1 c1 $NAME3 $C1
|
||||
|
||||
weave_on $HOST1 dns-remove $C1 c1
|
||||
weave_on $HOST1 dns-remove $C1 c1 -h $NAME1
|
||||
|
||||
assert_no_dns_record $HOST1 c1 $NAME1
|
||||
assert_dns_a_record $HOST1 c1 $NAME3 $C1
|
||||
|
||||
end_suite
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#! /bin/bash
|
||||
|
||||
. ./config.sh
|
||||
|
||||
C1=10.2.0.78
|
||||
C2=10.2.0.34
|
||||
NAME=seetwo.weave.local
|
||||
|
||||
start_suite "Repopulation on weaveDNS restart"
|
||||
|
||||
start_container $HOST1 $C2/24 --name=c2 -h $NAME
|
||||
start_container_with_dns $HOST1 $C1/24 --name=c1
|
||||
|
||||
weave_on $HOST1 launch-dns 10.2.254.1/24
|
||||
|
||||
assert_dns_record $HOST1 c1 $NAME $C2
|
||||
|
||||
end_suite
|
||||
@@ -143,6 +143,16 @@ assert_no_dns_record() {
|
||||
assert_raises "exec_on $host $container getent hosts $name" 2
|
||||
}
|
||||
|
||||
# assert_dns_a_record <host> <container> <name> <ip>
|
||||
assert_dns_a_record() {
|
||||
assert "exec_on $1 $2 getent hosts $3 | tr -s ' '" "$4 $3"
|
||||
}
|
||||
|
||||
# assert_dns_ptr_record <host> <container> <name> <ip>
|
||||
assert_dns_ptr_record() {
|
||||
assert "exec_on $1 $2 getent hosts $4 | tr -s ' '" "$4 $3"
|
||||
}
|
||||
|
||||
start_suite() {
|
||||
for host in $HOST1 $HOST2; do
|
||||
[ -z "$DEBUG" ] || echo "Cleaning up on $host: removing all containers and resetting weave"
|
||||
|
||||
Reference in new issue
Block a user