Debian Codegraph @

issue_test.go

raw symbols SCIP
1 package dns
2
3 // Tests that solve that an specific issue.
4
5 import (
6 "strings"
7 "testing"
8 )
9
10 func TestNSEC3MissingSalt(t *testing.T) {
11 rr := testRR("ji6neoaepv8b5o6k4ev33abha8ht9fgc.example. NSEC3 1 1 12 aabbccdd K8UDEMVP1J2F7EG6JEBPS17VP3N8I58H")
12 m := new(Msg)
13 m.Answer = []RR{rr}
14 mb, err := m.Pack()
15 if err != nil {
16 t.Fatalf("expected to pack message. err: %s", err)
17 }
18 if err := m.Unpack(mb); err != nil {
19 t.Fatalf("expected to unpack message. missing salt? err: %s", err)
20 }
21 in := rr.(*NSEC3).Salt
22 out := m.Answer[0].(*NSEC3).Salt
23 if in != out {
24 t.Fatalf("expected salts to match. packed: `%s`. returned: `%s`", in, out)
25 }
26 }
27
28 func TestNSEC3MixedNextDomain(t *testing.T) {
29 rr := testRR("ji6neoaepv8b5o6k4ev33abha8ht9fgc.example. NSEC3 1 1 12 - k8udemvp1j2f7eg6jebps17vp3n8i58h")
30 m := new(Msg)
31 m.Answer = []RR{rr}
32 mb, err := m.Pack()
33 if err != nil {
34 t.Fatalf("expected to pack message. err: %s", err)
35 }
36 if err := m.Unpack(mb); err != nil {
37 t.Fatalf("expected to unpack message. err: %s", err)
38 }
39 in := strings.ToUpper(rr.(*NSEC3).NextDomain)
40 out := m.Answer[0].(*NSEC3).NextDomain
41 if in != out {
42 t.Fatalf("expected round trip to produce NextDomain `%s`, instead `%s`", in, out)
43 }
44 }