aboutsummaryrefslogtreecommitdiff
path: root/plugin/any/any_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/any/any_test.go')
-rw-r--r--plugin/any/any_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugin/any/any_test.go b/plugin/any/any_test.go
new file mode 100644
index 000000000..85df7d672
--- /dev/null
+++ b/plugin/any/any_test.go
@@ -0,0 +1,28 @@
+package any
+
+import (
+ "context"
+ "testing"
+
+ "github.com/coredns/coredns/plugin/pkg/dnstest"
+ "github.com/coredns/coredns/plugin/test"
+
+ "github.com/miekg/dns"
+)
+
+func TestAny(t *testing.T) {
+ req := new(dns.Msg)
+ req.SetQuestion("example.org.", dns.TypeANY)
+ a := &Any{}
+
+ rec := dnstest.NewRecorder(&test.ResponseWriter{})
+ _, err := a.ServeDNS(context.TODO(), rec, req)
+
+ if err != nil {
+ t.Errorf("Expected no error, but got %q", err)
+ }
+
+ if rec.Msg.Answer[0].(*dns.HINFO).Cpu != "ANY obsoleted" {
+ t.Errorf("Expected HINFO, but got %q", rec.Msg.Answer[0].(*dns.HINFO).Cpu)
+ }
+}