mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-27 16:24:19 -04:00 
			
		
		
		
	* Update Caddy to 1.0.1, and update import path This fix updates caddy to 1.0.1 and also updates the import path to github.com/caddyserver/caddy This fix fixes 2959 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Also update plugin.cfg Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update and bump zplugin.go Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
		
			
				
	
	
		
			39 lines
		
	
	
		
			825 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			825 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package test
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| 
 | |
| 	// Plug in CoreDNS, needed for AppVersion and AppName in this test.
 | |
| 	_ "github.com/coredns/coredns/coremain"
 | |
| 
 | |
| 	"github.com/caddyserver/caddy"
 | |
| 	"github.com/miekg/dns"
 | |
| )
 | |
| 
 | |
| func TestChaos(t *testing.T) {
 | |
| 	corefile := `.:0 {
 | |
| 		chaos
 | |
| }
 | |
| `
 | |
| 
 | |
| 	i, udp, _, err := CoreDNSServerAndPorts(corefile)
 | |
| 	if err != nil {
 | |
| 		t.Fatalf("Could not get CoreDNS serving instance: %s", err)
 | |
| 	}
 | |
| 	defer i.Stop()
 | |
| 
 | |
| 	m := new(dns.Msg)
 | |
| 	m.SetQuestion("version.bind.", dns.TypeTXT)
 | |
| 	m.Question[0].Qclass = dns.ClassCHAOS
 | |
| 
 | |
| 	resp, err := dns.Exchange(m, udp)
 | |
| 	if err != nil {
 | |
| 		t.Fatalf("Expected to receive reply, but didn't: %v", err)
 | |
| 	}
 | |
| 	chTxt := resp.Answer[0].(*dns.TXT).Txt[0]
 | |
| 	version := caddy.AppName + "-" + caddy.AppVersion
 | |
| 	if chTxt != version {
 | |
| 		t.Fatalf("Expected version to bo %s, got %s", version, chTxt)
 | |
| 	}
 | |
| }
 |