forked from mrwilson/helixdns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
etcd_test.go
42 lines (26 loc) · 835 Bytes
/
etcd_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
package main
import (
"github.com/coreos/go-etcd/etcd"
"testing"
)
func TestEtcd_shouldValidateARecords(t *testing.T) {
aRecordNode := &etcd.Node{ Key: "/example/A", Value: "notanip" }
valid, _ := validate(aRecordNode)
if valid {
t.Errorf("Should not accept an invalid ip for A record")
}
}
func TestEtcd_shouldValidateCNAMERecords(t *testing.T) {
cnameRecordNode := &etcd.Node{ Key: "/example/CNAME", Value: "notfqdn" }
valid, _ := validate(cnameRecordNode)
if valid {
t.Errorf("Should not accept a non-fqdn value for a CNAME record")
}
}
func TestEtcd_shouldValidatePTRRecords(t *testing.T) {
ptrRecordNode := &etcd.Node{ Key: "/example/PTR", Value: "notfqdn" }
valid, _ := validate(ptrRecordNode)
if valid {
t.Errorf("Should not accept a non-fqdn value for a PTR record")
}
}