mirror of
https://github.com/coredns/coredns.git
synced 2025-11-25 13:14:02 -05:00
Middleware/Kubernetes: Add RR check to K8s integration tests (#884)
This commit is contained in:
committed by
Chris O'Haver
parent
f901b0cefa
commit
5e9991556e
@@ -13,7 +13,7 @@ type sect int
|
||||
const (
|
||||
// Answer is the answer section in an Msg.
|
||||
Answer sect = iota
|
||||
// Ns is the authrotitative section in an Msg.
|
||||
// Ns is the authoritative section in an Msg.
|
||||
Ns
|
||||
// Extra is the additional section in an Msg.
|
||||
Extra
|
||||
@@ -264,6 +264,23 @@ func Section(t *testing.T, tc Case, sec sect, rr []dns.RR) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// CNAMEOrder makes sure that CNAMES do not appear after their target records
|
||||
func CNAMEOrder(t *testing.T, res *dns.Msg) {
|
||||
for i, c := range res.Answer {
|
||||
if c.Header().Rrtype != dns.TypeCNAME {
|
||||
continue
|
||||
}
|
||||
for _, a := range res.Answer[:i] {
|
||||
if a.Header().Name != c.(*dns.CNAME).Target {
|
||||
continue
|
||||
}
|
||||
t.Errorf("CNAME found after target record\n")
|
||||
t.Logf("%v\n", res)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SortAndCheck sorts resp and the checks the header and three sections against the testcase in tc.
|
||||
func SortAndCheck(t *testing.T, resp *dns.Msg, tc Case) {
|
||||
sort.Sort(RRSet(resp.Answer))
|
||||
|
||||
Reference in New Issue
Block a user