"include/svn:/svn.code.sf.net/p/irrlicht/code/trunk@3280" did not exist on "3c8c56d3fde89a1d06544fdbb4639be2201a34dd"
Commit 5e999155 authored by Sandeep Rajan's avatar Sandeep Rajan Committed by Chris O'Haver

Middleware/Kubernetes: Add RR check to K8s integration tests (#884)

parent f901b0ce
......@@ -25,7 +25,7 @@ env:
# IPv6 is needed by some of the CoreDNS test cases. The VM environment
# is needed to have access to sudo in the test environment. Sudo is
# needed to have docker in the test environment. Docker is needed to
# launch a kubernetes instance in the test environment.
# launch a Kubernetes instance in the test environment.
# (Dependencies are fun! :) )
before_install:
- cat /proc/net/if_inet6
......@@ -51,5 +51,6 @@ before_script:
script:
- make TEST_TYPE=$TEST_TYPE travis
after_success:
- bash <(curl -s https://codecov.io/bash)
......@@ -235,19 +235,8 @@ func runServeDNSTests(ctx context.Context, t *testing.T, dnsTestCases map[string
}
// Before sorting, make sure that CNAMES do not appear after their target records
for i, c := range resp.Answer {
if c.Header().Rrtype != dns.TypeCNAME {
continue
}
for _, a := range resp.Answer[:i] {
if a.Header().Name != c.(*dns.CNAME).Target {
continue
}
t.Errorf("%v: CNAME found after target record\n", testname)
t.Logf("%v Received:\n %v\n", testname, resp)
}
}
test.CNAMEOrder(t, resp)
test.SortAndCheck(t, resp, tc)
}
}
......
......@@ -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))
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment