aboutsummaryrefslogtreecommitdiff
path: root/plugin/any/any_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2019-04-28 11:46:45 +0100
committerGravatar GitHub <noreply@github.com> 2019-04-28 11:46:45 +0100
commit39bc2af5092a64f6ac7c9d2ff7ba2bded8f682c8 (patch)
treed72ee7f5fced3aadf4347e3ff0a73ea0b9024ad8 /plugin/any/any_test.go
parent4f7fb98284f9e3a24232af921ddc5bf852e998da (diff)
downloadcoredns-39bc2af5092a64f6ac7c9d2ff7ba2bded8f682c8.tar.gz
coredns-39bc2af5092a64f6ac7c9d2ff7ba2bded8f682c8.tar.zst
coredns-39bc2af5092a64f6ac7c9d2ff7ba2bded8f682c8.zip
Add any plugin (#2801)
* Add any plugin This adds the any plugin, a plain copy of coredns/any documented here https://coredns.io/explugins/any/ as an external plugin. Fixes: #2785 Signed-off-by: Miek Gieben <miek@miek.nl> * Stickler bot nit Signed-off-by: Miek Gieben <miek@miek.nl>
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)
+ }
+}