diff options
author | 2017-08-16 15:30:58 +0100 | |
---|---|---|
committer | 2017-08-16 15:30:58 +0100 | |
commit | 7f46df6d274eff51569b57b382480301caa1dff6 (patch) | |
tree | 4a6062700acc0bd110ef622b64f055a235042294 /test/ds_file_test.go | |
parent | 65b56248f0f4a43fe71435c4d801b94c3f168f65 (diff) | |
download | coredns-7f46df6d274eff51569b57b382480301caa1dff6.tar.gz coredns-7f46df6d274eff51569b57b382480301caa1dff6.tar.zst coredns-7f46df6d274eff51569b57b382480301caa1dff6.zip |
tests: add SortAndCheck helper (#926)
There was quite some code duplication in a lot of tests to check if
an answer was considered Ok. Created a test.SortAndCheck helper function
that takes care of this.
Diffstat (limited to 'test/ds_file_test.go')
-rw-r--r-- | test/ds_file_test.go | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/test/ds_file_test.go b/test/ds_file_test.go index 16170aad3..3775c9033 100644 --- a/test/ds_file_test.go +++ b/test/ds_file_test.go @@ -3,7 +3,6 @@ package test import ( "io/ioutil" "log" - "sort" "testing" "github.com/coredns/coredns/middleware/proxy" @@ -66,22 +65,6 @@ func TestLookupDS(t *testing.T) { t.Fatalf("Expected to receive reply, but didn't for %s %d", tc.Qname, tc.Qtype) } - sort.Sort(mtest.RRSet(resp.Answer)) - sort.Sort(mtest.RRSet(resp.Ns)) - sort.Sort(mtest.RRSet(resp.Extra)) - - if !mtest.Header(t, tc, resp) { - t.Logf("%v\n", resp) - continue - } - if !mtest.Section(t, tc, mtest.Answer, resp.Answer) { - t.Logf("%v\n", resp) - } - if !mtest.Section(t, tc, mtest.Ns, resp.Ns) { - t.Logf("%v\n", resp) - } - if !mtest.Section(t, tc, mtest.Extra, resp.Extra) { - t.Logf("%v\n", resp) - } + mtest.SortAndCheck(t, resp, tc) } } |