diff options
Diffstat (limited to 'plugin/pkg/edns/edns_test.go')
-rw-r--r-- | plugin/pkg/edns/edns_test.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/plugin/pkg/edns/edns_test.go b/plugin/pkg/edns/edns_test.go index a775b50f1..1976779bd 100644 --- a/plugin/pkg/edns/edns_test.go +++ b/plugin/pkg/edns/edns_test.go @@ -10,20 +10,32 @@ func TestVersion(t *testing.T) { m := ednsMsg() m.Extra[0].(*dns.OPT).SetVersion(2) - _, err := Version(m) + r, err := Version(m) if err == nil { t.Errorf("Expected wrong version, but got OK") } + if r.Question == nil { + t.Errorf("Expected question section, but got nil") + } + if r.Rcode != dns.RcodeBadVers { + t.Errorf("Expected Rcode to be of BADVER (16), but got %d", r.Rcode) + } + if r.Extra == nil { + t.Errorf("Expected OPT section, but got nil") + } } func TestVersionNoEdns(t *testing.T) { m := ednsMsg() m.Extra = nil - _, err := Version(m) + r, err := Version(m) if err != nil { t.Errorf("Expected no error, but got one: %s", err) } + if r != nil { + t.Errorf("Expected nil since not an EDNS0 request, but did not got nil") + } } func ednsMsg() *dns.Msg { |