This repository was archived by the owner on May 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathplain-dns.bats
executable file
·62 lines (51 loc) · 1.6 KB
/
plain-dns.bats
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
61
62
#!/usr/bin/env bats
load test_helper
setup() {
$BIN --port="$PORT" &
pid=$!
}
teardown() {
kill -9 $pid
sleep 0
}
# subdomain tests
@test "dig foo.dev A record (plain DNS)" {
name="foo.dev"
run dig +tries=1 +time=1 -p $PORT @127.0.0.1 $name A +noedns +noall +answer +comments
[ "$status" -eq 0 ]
[[ "$output" == *"status: NOERROR,"* ]]
[[ "$output" == *"foo.dev. 600 IN A 127.0.0.1"* ]]
}
@test "dig foo.bar.dev A record (plain DNS)" {
name="foo.bar.dev"
run dig +tries=1 +time=1 -p $PORT @127.0.0.1 $name A +noedns +noall +answer +comments
[ "$status" -eq 0 ]
[[ "$output" == *"status: NOERROR,"* ]]
[[ "$output" == *"foo.bar.dev. 600 IN A 127.0.0.1"* ]]
}
@test "dig foo.dev AAAA record (plain DNS)" {
name="foo.dev"
run dig +tries=1 +time=1 -p $PORT @127.0.0.1 $name AAAA +noedns +noall +answer +comments
[ "$status" -eq 0 ]
[[ "$output" == *"status: NOERROR,"* ]]
[[ "$output" == *"foo.dev. 600 IN AAAA ::1"* ]]
}
# NXDOMAIN tests
@test "dig MX record (plain DNS)" {
name="dev"
run dig +tries=1 +time=1 -p $PORT @127.0.0.1 $name MX +noedns +noall +answer +comments
[ "$status" -eq 0 ]
[[ "$output" == *"status: NXDOMAIN,"* ]]
}
@test "dig subdomain MX record (plain DNS)" {
name="foo.dev"
run dig +tries=1 +time=1 -p $PORT @127.0.0.1 $name MX +noedns +noall +answer +comments
[ "$status" -eq 0 ]
[[ "$output" == *"status: NXDOMAIN,"* ]]
}
@test "dig subdomain CNAME record (plain DNS)" {
name="foo.dev"
run dig +tries=1 +time=1 -p $PORT @127.0.0.1 $name CNAME +noedns +noall +answer +comments
[ "$status" -eq 0 ]
[[ "$output" == *"status: NXDOMAIN,"* ]]
}