blob: 5d86faa4df5fed6d2c3e34a98ce0626cc4a489a9 (
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
29
30
31
32
|
package test
import (
"testing"
"github.com/miekg/dns"
)
func TestEDNS0(t *testing.T) {
corefile := `.:0 {
whoami
}`
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.TypeSOA)
m.SetEdns0(4096, true)
resp, err := dns.Exchange(m, udp)
if err != nil {
t.Fatalf("Expected to receive reply, but didn't: %v", err)
}
opt := resp.Extra[len(resp.Extra)-1]
if opt.Header().Rrtype != dns.TypeOPT {
t.Errorf("Last RR must be OPT record")
}
}
|