diff options
author | 2016-04-12 21:30:08 +0100 | |
---|---|---|
committer | 2016-04-12 21:30:08 +0100 | |
commit | 27ff83e70f554314b8162d2a3d29d26023e7bd6c (patch) | |
tree | e08c28d4d5abbb607c335c74f117094116743f97 /middleware/test/helpers.go | |
parent | 9f651a397baabcd7d1876771f8568e14d7b4b6ef (diff) | |
download | coredns-27ff83e70f554314b8162d2a3d29d26023e7bd6c.tar.gz coredns-27ff83e70f554314b8162d2a3d29d26023e7bd6c.tar.zst coredns-27ff83e70f554314b8162d2a3d29d26023e7bd6c.zip |
Stub forward/proxy tests (#108)
Test the handling of EDNS0 payloads and forwarding to stubzones
servers.
Diffstat (limited to 'middleware/test/helpers.go')
-rw-r--r-- | middleware/test/helpers.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/middleware/test/helpers.go b/middleware/test/helpers.go index 7caa3fd4a..3096f126b 100644 --- a/middleware/test/helpers.go +++ b/middleware/test/helpers.go @@ -108,8 +108,11 @@ func Section(t *testing.T, tc Case, sect Sect, rr []dns.RR) bool { } // 303 signals: don't care what the ttl is. if section[i].Header().Ttl != 303 && a.Header().Ttl != section[i].Header().Ttl { - t.Errorf("rr %d should have a Header TTL of %d, but has %d", i, section[i].Header().Ttl, a.Header().Ttl) - return false + if _, ok := section[i].(*dns.OPT); !ok { + // we check edns0 bufize on this one + t.Errorf("rr %d should have a Header TTL of %d, but has %d", i, section[i].Header().Ttl, a.Header().Ttl) + return false + } } if a.Header().Rrtype != section[i].Header().Rrtype { t.Errorf("rr %d should have a header rr type of %d, but has %d", i, section[i].Header().Rrtype, a.Header().Rrtype) @@ -206,12 +209,12 @@ func Section(t *testing.T, tc Case, sect Sect, rr []dns.RR) bool { } case *dns.OPT: tt := section[i].(*dns.OPT) - if x.Do() != tt.Do() { - t.Errorf("OPT DO should be %q, but is %q", x.Do(), tt.Do()) + if x.UDPSize() != tt.UDPSize() { + t.Errorf("OPT UDPSize should be %d, but is %d", tt.UDPSize(), x.UDPSize()) return false } - if x.UDPSize() != tt.UDPSize() { - t.Errorf("OPT UDPSize should be %q, but is %q", x.UDPSize(), tt.UDPSize()) + if x.Do() != tt.Do() { + t.Errorf("OPT DO should be %t, but is %t", tt.Do(), x.Do()) return false } } |