Skip to content

Commit

Permalink
Remove duplicated TempFile testsuit (coredns#2508)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuanwo authored and miekg committed Jan 28, 2019
1 parent f300fa9 commit ffe79b0
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 31 deletions.
2 changes: 1 addition & 1 deletion test/ds_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var dsTestCases = []mtest.Case{

func TestLookupDS(t *testing.T) {
t.Parallel()
name, rm, err := TempFile(".", miekNL)
name, rm, err := mtest.TempFile(".", miekNL)
if err != nil {
t.Fatalf("Failed to create zone: %s", err)
}
Expand Down
19 changes: 0 additions & 19 deletions test/file.go

This file was deleted.

6 changes: 4 additions & 2 deletions test/file_cname_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package test
import (
"testing"

"github.com/coredns/coredns/plugin/test"

"github.com/miekg/dns"
)

func TestZoneExternalCNAMELookupWithoutProxy(t *testing.T) {
t.Parallel()

name, rm, err := TempFile(".", exampleOrg)
name, rm, err := test.TempFile(".", exampleOrg)
if err != nil {
t.Fatalf("Failed to create zone: %s", err)
}
Expand Down Expand Up @@ -41,7 +43,7 @@ func TestZoneExternalCNAMELookupWithoutProxy(t *testing.T) {
func TestZoneExternalCNAMELookupWithProxy(t *testing.T) {
t.Parallel()

name, rm, err := TempFile(".", exampleOrg)
name, rm, err := test.TempFile(".", exampleOrg)
if err != nil {
t.Fatalf("Failed to create zone: %s", err)
}
Expand Down
3 changes: 2 additions & 1 deletion test/file_reload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"
"time"

"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/plugin/file"

"github.com/miekg/dns"
Expand All @@ -13,7 +14,7 @@ import (
func TestZoneReload(t *testing.T) {
file.TickTime = 1 * time.Second

name, rm, err := TempFile(".", exampleOrg)
name, rm, err := test.TempFile(".", exampleOrg)
if err != nil {
t.Fatalf("Failed to create zone: %s", err)
}
Expand Down
6 changes: 4 additions & 2 deletions test/file_serve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package test
import (
"testing"

"github.com/coredns/coredns/plugin/test"

"github.com/miekg/dns"
)

func TestZoneEDNS0Lookup(t *testing.T) {
t.Parallel()

name, rm, err := TempFile(".", `$ORIGIN example.org.
name, rm, err := test.TempFile(".", `$ORIGIN example.org.
@ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. (
2017042745 ; serial
7200 ; refresh (2 hours)
Expand Down Expand Up @@ -56,7 +58,7 @@ www IN AAAA ::1
func TestZoneNoNS(t *testing.T) {
t.Parallel()

name, rm, err := TempFile(".", `$ORIGIN example.org.
name, rm, err := test.TempFile(".", `$ORIGIN example.org.
@ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. (
2017042745 ; serial
7200 ; refresh (2 hours)
Expand Down
4 changes: 3 additions & 1 deletion test/file_srv_additional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package test
import (
"testing"

"github.com/coredns/coredns/plugin/test"

"github.com/miekg/dns"
)

func TestZoneSRVAdditional(t *testing.T) {
t.Parallel()

name, rm, err := TempFile(".", exampleOrg)
name, rm, err := test.TempFile(".", exampleOrg)
if err != nil {
t.Fatalf("Failed to create zone: %s", err)
}
Expand Down
8 changes: 6 additions & 2 deletions test/file_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package test

import "testing"
import (
"testing"

"github.com/coredns/coredns/plugin/test"
)

func TestTempFile(t *testing.T) {
t.Parallel()
_, f, e := TempFile(".", "test")
_, f, e := test.TempFile(".", "test")
if e != nil {
t.Fatalf("Failed to create temp file: %s", e)
}
Expand Down
8 changes: 5 additions & 3 deletions test/file_upstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package test
import (
"testing"

"github.com/coredns/coredns/plugin/test"

"github.com/miekg/dns"
)

func TestFileUpstream(t *testing.T) {
name, rm, err := TempFile(".", `$ORIGIN example.org.
name, rm, err := test.TempFile(".", `$ORIGIN example.org.
@ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. (
2017042745 ; serial
7200 ; refresh (2 hours)
Expand Down Expand Up @@ -61,7 +63,7 @@ www 3600 IN CNAME www.example.net.
// TestFileUpstreamAdditional runs two CoreDNS servers that serve example.org and foo.example.org.
// example.org contains a cname to foo.example.org; this should be resolved via upstream.Self.
func TestFileUpstreamAdditional(t *testing.T) {
name, rm, err := TempFile(".", `$ORIGIN example.org.
name, rm, err := test.TempFile(".", `$ORIGIN example.org.
@ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. 2017042745 7200 3600 1209600 3600
3600 IN NS b.iana-servers.net.
Expand All @@ -73,7 +75,7 @@ www 3600 IN CNAME www.foo
}
defer rm()

name2, rm2, err2 := TempFile(".", `$ORIGIN foo.example.org.
name2, rm2, err2 := test.TempFile(".", `$ORIGIN foo.example.org.
@ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. 2017042745 7200 3600 1209600 3600
3600 IN NS b.iana-servers.net.
Expand Down

0 comments on commit ffe79b0

Please sign in to comment.