-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup_test.go
69 lines (58 loc) · 2.2 KB
/
setup_test.go
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
63
64
65
66
67
68
69
package amazondns
import (
"testing"
"github.com/mholt/caddy"
)
func TestSetupRoute53(t *testing.T) {
c := caddy.NewTestController("dns", `amazondns`)
if err := setup(c); err == nil {
t.Fatalf("Expected errors, but got: %v", err)
}
c = caddy.NewTestController("dns", `amazondns example.org`)
if err := setup(c); err == nil {
t.Fatalf("Expected errors, but got: %v", err)
}
c = caddy.NewTestController("dns", `amazondns example.org 10.0.0.2`)
if err := setup(c); err == nil {
t.Fatalf("Expected errors, but got: %v", err)
}
c = caddy.NewTestController("dns", `amazondns example.org 10.0.0.2 {
soa "example.org 60 IN SOA ns1.example.org hostmaster.example.org (1 7200 900 1209600 86400)"
}`)
if err := setup(c); err == nil {
t.Fatalf("Expected errors, but got: %v", err)
}
c = caddy.NewTestController("dns", `amazondns example.org 10.0.0.2 {
soa "example.org 60 IN SOA ns1.example.org hostmaster.example.org (1 7200 900 1209600 86400)"
ns "example.org 60 IN NS ns1.example.org"
}`)
if err := setup(c); err == nil {
t.Fatalf("Expected errors, but got: %v", err)
}
c = caddy.NewTestController("dns", `amazondns example.org 10.0.0.2 {
soa "example.org 60 IN SOA ns1.example.org hostmaster.example.org (1 7200 900 1209600 86400)"
ns "example.org 60 IN NS ns1.example.org"
nsa "ns1.example.org 60 IN A 192.168.0.1"
}`)
if err := setup(c); err != nil {
t.Fatalf("Expected no errors, but got: %v", err)
}
c = caddy.NewTestController("dns", `amazondns example.org 10.0.0.2 {
soa "example.org 60 IN SOA ns1.example.org hostmaster.example.org (1 7200 900 1209600 86400)"
ns "example.org 60 IN NS ns1.example.org"
ns "example.org 60 IN NS ns2.example.org"
nsa "ns1.example.org 60 IN A 192.168.0.1"
nsa "ns2.example.org 60 IN A 192.168.0.2"
}`)
if err := setup(c); err != nil {
t.Fatalf("Expected no errors, but got: %v", err)
}
c = caddy.NewTestController("dns", `amazondns example.org invalid {
soa "example.org 60 IN SOA ns1.example.org hostmaster.example.org (1 7200 900 1209600 86400)"
ns "example.org 60 IN NS ns1.example.org"
nsa "ns1.example.org 60 IN A 192.168.0.1"
}`)
if err := setup(c); err == nil {
t.Fatalf("Expected errors, but got: %v", err)
}
}