aboutsummaryrefslogtreecommitdiff
path: root/plugin/k8s_external/apex_test.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2022-03-07 12:16:24 -0500
committerGravatar GitHub <noreply@github.com> 2022-03-07 12:16:24 -0500
commit7263808fe1cfb3b9dfbc09d70c52d52a563e5254 (patch)
treec4cd35304fc001617d6943903d6ec5744906737d /plugin/k8s_external/apex_test.go
parent267ce8a820a9e3491106dbdbe85793a771f516ba (diff)
downloadcoredns-7263808fe1cfb3b9dfbc09d70c52d52a563e5254.tar.gz
coredns-7263808fe1cfb3b9dfbc09d70c52d52a563e5254.tar.zst
coredns-7263808fe1cfb3b9dfbc09d70c52d52a563e5254.zip
plugin/k8s_external: implement zone transfers (#4977)
Implement transfer for k8s_external. Notifies not supported. Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin/k8s_external/apex_test.go')
-rw-r--r--plugin/k8s_external/apex_test.go27
1 files changed, 19 insertions, 8 deletions
diff --git a/plugin/k8s_external/apex_test.go b/plugin/k8s_external/apex_test.go
index 2f6923f56..45b835e3a 100644
--- a/plugin/k8s_external/apex_test.go
+++ b/plugin/k8s_external/apex_test.go
@@ -20,7 +20,8 @@ func TestApex(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 testsApex {
@@ -43,6 +44,16 @@ func TestApex(t *testing.T) {
if err := test.SortAndCheck(resp, tc); err != nil {
t.Error(err)
}
+ for i, rr := range tc.Ns {
+ expectsoa := rr.(*dns.SOA)
+ gotsoa, ok := resp.Ns[i].(*dns.SOA)
+ if !ok {
+ t.Fatalf("Unexpected record type in Authority section")
+ }
+ if expectsoa.Serial != gotsoa.Serial {
+ t.Fatalf("Expected soa serial %d, got %d", expectsoa.Serial, gotsoa.Serial)
+ }
+ }
}
}
@@ -50,7 +61,7 @@ var testsApex = []test.Case{
{
Qname: "example.com.", Qtype: dns.TypeSOA, Rcode: dns.RcodeSuccess,
Answer: []dns.RR{
- test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
+ test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.dns.example.com. 1499347823 7200 1800 86400 5"),
},
},
{
@@ -65,37 +76,37 @@ var testsApex = []test.Case{
{
Qname: "example.com.", Qtype: dns.TypeSRV, Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
- test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
+ test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.dns.example.com. 1499347823 7200 1800 86400 5"),
},
},
{
Qname: "dns.example.com.", Qtype: dns.TypeSRV, Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
- test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
+ test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.dns.example.com. 1499347823 7200 1800 86400 5"),
},
},
{
Qname: "dns.example.com.", Qtype: dns.TypeNS, Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
- test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
+ test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.dns.example.com. 1499347823 7200 1800 86400 5"),
},
},
{
Qname: "ns1.dns.example.com.", Qtype: dns.TypeSRV, Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
- test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
+ test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.dns.example.com. 1499347823 7200 1800 86400 5"),
},
},
{
Qname: "ns1.dns.example.com.", Qtype: dns.TypeNS, Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
- test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
+ test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.dns.example.com. 1499347823 7200 1800 86400 5"),
},
},
{
Qname: "ns1.dns.example.com.", Qtype: dns.TypeAAAA, Rcode: dns.RcodeSuccess,
Ns: []dns.RR{
- test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.example.com. 1499347823 7200 1800 86400 5"),
+ test.SOA("example.com. 5 IN SOA ns1.dns.example.com. hostmaster.dns.example.com. 1499347823 7200 1800 86400 5"),
},
},
{