aboutsummaryrefslogtreecommitdiff
path: root/middleware/file
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/file')
-rw-r--r--middleware/file/cname_test.go41
-rw-r--r--middleware/file/delegation_test.go19
-rw-r--r--middleware/file/dname_test.go37
-rw-r--r--middleware/file/dnssec_test.go21
-rw-r--r--middleware/file/ds_test.go19
-rw-r--r--middleware/file/ent_test.go21
-rw-r--r--middleware/file/glue_test.go21
-rw-r--r--middleware/file/lookup_test.go21
-rw-r--r--middleware/file/wildcard_test.go73
9 files changed, 14 insertions, 259 deletions
diff --git a/middleware/file/cname_test.go b/middleware/file/cname_test.go
index ff9387b29..90e6f05a9 100644
--- a/middleware/file/cname_test.go
+++ b/middleware/file/cname_test.go
@@ -1,7 +1,6 @@
package file
import (
- "sort"
"strings"
"testing"
@@ -34,25 +33,7 @@ func TestLookupCNAMEChain(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
-
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
-
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
@@ -109,25 +90,7 @@ func TestLookupCNAMEExternal(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
-
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
-
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
diff --git a/middleware/file/delegation_test.go b/middleware/file/delegation_test.go
index 925930bab..49510944f 100644
--- a/middleware/file/delegation_test.go
+++ b/middleware/file/delegation_test.go
@@ -1,7 +1,6 @@
package file
import (
- "sort"
"strings"
"testing"
@@ -171,23 +170,7 @@ func testDelegation(t *testing.T, z, origin string, testcases []test.Case) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
diff --git a/middleware/file/dname_test.go b/middleware/file/dname_test.go
index 96e42454f..27890a78c 100644
--- a/middleware/file/dname_test.go
+++ b/middleware/file/dname_test.go
@@ -1,7 +1,6 @@
package file
import (
- "sort"
"strings"
"testing"
@@ -110,23 +109,7 @@ func TestLookupDNAME(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
@@ -179,23 +162,7 @@ func TestLookupDNAMEDNSSEC(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
diff --git a/middleware/file/dnssec_test.go b/middleware/file/dnssec_test.go
index 95bc74ed1..136a9dfee 100644
--- a/middleware/file/dnssec_test.go
+++ b/middleware/file/dnssec_test.go
@@ -1,7 +1,6 @@
package file
import (
- "sort"
"strings"
"testing"
@@ -147,25 +146,7 @@ func TestLookupDNSSEC(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
-
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
-
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
diff --git a/middleware/file/ds_test.go b/middleware/file/ds_test.go
index 32ae5187a..f5c9bb332 100644
--- a/middleware/file/ds_test.go
+++ b/middleware/file/ds_test.go
@@ -1,7 +1,6 @@
package file
import (
- "sort"
"strings"
"testing"
@@ -71,22 +70,6 @@ func TestLookupDS(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
diff --git a/middleware/file/ent_test.go b/middleware/file/ent_test.go
index f8e5da4fe..433aa182d 100644
--- a/middleware/file/ent_test.go
+++ b/middleware/file/ent_test.go
@@ -1,7 +1,6 @@
package file
import (
- "sort"
"strings"
"testing"
@@ -51,25 +50,7 @@ func TestLookupEnt(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
-
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
-
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
diff --git a/middleware/file/glue_test.go b/middleware/file/glue_test.go
index 4e9cf1823..14716ae33 100644
--- a/middleware/file/glue_test.go
+++ b/middleware/file/glue_test.go
@@ -1,7 +1,6 @@
package file
import (
- "sort"
"strings"
"testing"
@@ -53,25 +52,7 @@ func TestLookupGlue(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
-
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
-
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
diff --git a/middleware/file/lookup_test.go b/middleware/file/lookup_test.go
index 9be6ae542..82d8f77ff 100644
--- a/middleware/file/lookup_test.go
+++ b/middleware/file/lookup_test.go
@@ -1,7 +1,6 @@
package file
import (
- "sort"
"strings"
"testing"
@@ -123,25 +122,7 @@ func TestLookup(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
-
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
-
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
diff --git a/middleware/file/wildcard_test.go b/middleware/file/wildcard_test.go
index 29a6adb33..7f1a2fed3 100644
--- a/middleware/file/wildcard_test.go
+++ b/middleware/file/wildcard_test.go
@@ -1,7 +1,6 @@
package file
import (
- "sort"
"strings"
"testing"
@@ -98,23 +97,7 @@ func TestLookupWildcard(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
@@ -175,23 +158,7 @@ func TestLookupDoubleWildcard(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
@@ -246,23 +213,7 @@ func TestLookupApexWildcard(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}
@@ -305,23 +256,7 @@ func TestLookupMultiWildcard(t *testing.T) {
}
resp := rec.Msg
- sort.Sort(test.RRSet(resp.Answer))
- sort.Sort(test.RRSet(resp.Ns))
- sort.Sort(test.RRSet(resp.Extra))
-
- if !test.Header(t, tc, resp) {
- t.Logf("%v\n", resp)
- continue
- }
- if !test.Section(t, tc, test.Answer, resp.Answer) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Ns, resp.Ns) {
- t.Logf("%v\n", resp)
- }
- if !test.Section(t, tc, test.Extra, resp.Extra) {
- t.Logf("%v\n", resp)
- }
+ test.SortAndCheck(t, resp, tc)
}
}