aboutsummaryrefslogtreecommitdiff
path: root/plugin/k8s_external/external_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/k8s_external/external_test.go')
-rw-r--r--plugin/k8s_external/external_test.go41
1 files changed, 36 insertions, 5 deletions
diff --git a/plugin/k8s_external/external_test.go b/plugin/k8s_external/external_test.go
index cc29fd7a6..7c7ee8069 100644
--- a/plugin/k8s_external/external_test.go
+++ b/plugin/k8s_external/external_test.go
@@ -23,7 +23,8 @@ func TestExternal(t *testing.T) {
e.Zones = []string{"example.com."}
e.Next = test.NextHandler(dns.RcodeSuccess, nil)
e.externalFunc = k.External
- e.externalAddrFunc = externalAddress // internal test function
+ e.externalAddrFunc = externalAddress // internal test function
+ e.externalSerialFunc = externalSerial // internal test function
ctx := context.TODO()
for i, tc := range tests {
@@ -147,6 +148,7 @@ var tests = []test.Case{
test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
},
},
+ // svc11
{
Qname: "svc11.testns.example.com.", Qtype: dns.TypeA, Rcode: dns.RcodeSuccess,
Answer: []dns.RR{
@@ -154,17 +156,42 @@ var tests = []test.Case{
},
},
{
- Qname: "_http._tcp.svc12.testns.example.com.", Qtype: dns.TypeSRV, Rcode: dns.RcodeSuccess,
+ Qname: "_http._tcp.svc11.testns.example.com.", Qtype: dns.TypeSRV, Rcode: dns.RcodeSuccess,
Answer: []dns.RR{
- test.SRV("_http._tcp.svc12.testns.example.com. 5 IN SRV 0 100 80 dummy.hostname."),
+ test.SRV("_http._tcp.svc11.testns.example.com. 5 IN SRV 0 100 80 svc11.testns.example.com."),
+ },
+ Extra: []dns.RR{
+ test.A("svc11.testns.example.com. 5 IN A 1.2.3.4"),
+ },
+ },
+ {
+ Qname: "svc11.testns.example.com.", Qtype: dns.TypeSRV, Rcode: dns.RcodeSuccess,
+ Answer: []dns.RR{
+ test.SRV("svc11.testns.example.com. 5 IN SRV 0 100 80 svc11.testns.example.com."),
+ },
+ Extra: []dns.RR{
+ test.A("svc11.testns.example.com. 5 IN A 1.2.3.4"),
},
},
+ // svc12
{
Qname: "svc12.testns.example.com.", Qtype: dns.TypeA, Rcode: dns.RcodeSuccess,
Answer: []dns.RR{
test.CNAME("svc12.testns.example.com. 5 IN CNAME dummy.hostname"),
},
},
+ {
+ Qname: "_http._tcp.svc12.testns.example.com.", Qtype: dns.TypeSRV, Rcode: dns.RcodeSuccess,
+ Answer: []dns.RR{
+ test.SRV("_http._tcp.svc12.testns.example.com. 5 IN SRV 0 100 80 dummy.hostname."),
+ },
+ },
+ {
+ Qname: "svc12.testns.example.com.", Qtype: dns.TypeSRV, Rcode: dns.RcodeSuccess,
+ Answer: []dns.RR{
+ test.SRV("svc12.testns.example.com. 5 IN SRV 0 100 80 dummy.hostname."),
+ },
+ },
}
type external struct{}
@@ -173,8 +200,8 @@ func (external) HasSynced() bool
func (external) Run() {}
func (external) Stop() error { return nil }
func (external) EpIndexReverse(string) []*object.Endpoints { return nil }
-func (external) SvcIndexReverse(string) []*object.Service { return nil }
-func (external) Modified() int64 { return 0 }
+func (external) SvcIndexReverse(string) []*object.Service { return nil }
+func (external) Modified(bool) int64 { return 0 }
func (external) EpIndex(s string) []*object.Endpoints { return nil }
func (external) EndpointsList() []*object.Endpoints { return nil }
func (external) GetNodeByName(ctx context.Context, name string) (*api.Node, error) { return nil, nil }
@@ -240,3 +267,7 @@ func externalAddress(state request.Request) []dns.RR {
a := test.A("example.org. IN A 127.0.0.1")
return []dns.RR{a}
}
+
+func externalSerial(string) uint32 {
+ return 1499347823
+}