mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 18:23:13 -04:00 
			
		
		
		
	* 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>
		
			
				
	
	
		
			29 lines
		
	
	
		
			587 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			587 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 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)
 | |
| 	}
 | |
| }
 |