This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-cases.sh
executable file
·60 lines (52 loc) · 2.25 KB
/
test-cases.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
set -e
export PATH=/in/bin:$PATH
etcdctl() {
case "$1" in
set)
curl -sL "http://${ETCD_ADDR}/v2/keys${2}" -XPUT -d value="$3"
;;
get)
curl -sL "http://${ETCD_ADDR}/v2/keys${2}"
;;
*)
echo "etcdctl $1 is not implemeneted" >&2
return 1
esac
}
# Set the nameserver
etcdctl set /skydns/planitar/test/dns/ns \
'{"host":"127.0.0.1", "priority":10, "weight":10}'
dig @${DOCKER_IP} -p1053 NS test.planitar | grep ^test.planitar. | \
grep -w NS | grep -q ns.dns.test.planitar.
dig @${DOCKER_IP} -p1053 NS test.planitar | grep ^ns.dns.test.planitar. | \
grep -w A | grep -q 127.0.0.1
#
etcdctl set /skydns/planitar/test/a/01 \
'{"host":"planitar.com", "port":9001, "priority":10, "weight":30}'
etcdctl set /skydns/planitar/test/a/02 \
'{"host":"example.com", "port":9002, "priority":10, "weight":10}'
etcdctl set /skydns/planitar/test/b/01 \
'{"host":"10.0.2.3", "port":9003, "priority":20}'
dig @${DOCKER_IP} -p1053 SRV 01.a.test.planitar | \
grep -q '^01.a.test.planitar\..*.\<SRV\>.*\<10\>.*\<100\>.*\<9001\>.*planitar.com'
dig @${DOCKER_IP} -p1053 SRV 01.a.test.planitar | \
grep -q '^planitar.com\..*.\<A\>'
dig @${DOCKER_IP} -p1053 SRV 02.a.test.planitar | \
grep -q '^02.a.test.planitar\..*\<SRV\>.*\<10\>.*\<100\>.*\<9002\>.*\<example.com'
dig @${DOCKER_IP} -p1053 SRV 02.a.test.planitar | \
grep -q '^example.com\..*.\<A\>'
dig @${DOCKER_IP} -p1053 SRV 01.b.test.planitar | \
grep '^01.b.test.planitar\..*\<SRV\>.*\<20\>.*\<100\>.*\<9003\>.*\<01.b.test.planitar\>'
dig @${DOCKER_IP} -p1053 SRV 01.b.test.planitar | \
grep -q '^01.b.test.planitar\..*.\<A\>.*\<10.0.2.3\>'
dig @${DOCKER_IP} -p1053 SRV a.test.planitar | \
grep -q '^a.test.planitar\..*.\<SRV\>.*\<10\>.*\<75\>.*\<9001\>.*planitar.com'
dig @${DOCKER_IP} -p1053 SRV a.test.planitar | \
grep -q '^a.test.planitar\..*.\<SRV\>.*\<10\>.*\<25\>.*\<9002\>.*example.com'
dig @${DOCKER_IP} -p1053 SRV test.planitar | \
grep -q '^test.planitar\..*.\<SRV\>.*\<10\>.*\<60\>.*\<9001\>.*planitar.com'
dig @${DOCKER_IP} -p1053 SRV test.planitar | \
grep -q '^test.planitar\..*.\<SRV\>.*\<10\>.*\<20\>.*\<9002\>.*example.com'
dig @${DOCKER_IP} -p1053 SRV test.planitar | \
grep -q '^test.planitar\..*.\<SRV\>.*\<20\>.*\<100\>.*\<9003\>.*01.b.test.planitar'