aboutsummaryrefslogtreecommitdiff
path: root/test/no_plugins_test.go
blob: 51d546db31d202b5c4f21c91eb943c5eeb9a1718 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package test

import (
	"testing"

	"github.com/miekg/dns"
)

func TestNoPlugins(t *testing.T) {
	corefile := `example.org:0 {
	}`

	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("example.org.", dns.TypeA)
	resp, err := dns.Exchange(m, udp)
	if err != nil {
		t.Fatalf("Expected to receive reply, but didn't: %v", err)
	}
	if resp.Rcode != dns.RcodeRefused {
		t.Fatalf("Expected rcode to be %d, got %d", dns.RcodeRefused, resp.Rcode)
	}
}