Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
ffe79b02
Commit
ffe79b02
authored
Jan 28, 2019
by
Xuanwo
Committed by
Miek Gieben
Jan 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplicated TempFile testsuit (#2508)
parent
f300fa9b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
25 additions
and
31 deletions
+25
-31
test/ds_file_test.go
test/ds_file_test.go
+1
-1
test/file.go
test/file.go
+0
-19
test/file_cname_proxy_test.go
test/file_cname_proxy_test.go
+4
-2
test/file_reload_test.go
test/file_reload_test.go
+2
-1
test/file_serve_test.go
test/file_serve_test.go
+4
-2
test/file_srv_additional_test.go
test/file_srv_additional_test.go
+3
-1
test/file_test.go
test/file_test.go
+6
-2
test/file_upstream_test.go
test/file_upstream_test.go
+5
-3
No files found.
test/ds_file_test.go
View file @
ffe79b02
...
...
@@ -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
)
}
...
...
test/file.go
deleted
100644 → 0
View file @
f300fa9b
package
test
import
(
"io/ioutil"
"os"
)
// TempFile will create a temporary file on disk and returns the name and a cleanup function to remove it later.
func
TempFile
(
dir
,
content
string
)
(
string
,
func
(),
error
)
{
f
,
err
:=
ioutil
.
TempFile
(
dir
,
"go-test-tmpfile"
)
if
err
!=
nil
{
return
""
,
nil
,
err
}
if
err
:=
ioutil
.
WriteFile
(
f
.
Name
(),
[]
byte
(
content
),
0644
);
err
!=
nil
{
return
""
,
nil
,
err
}
rmFunc
:=
func
()
{
os
.
Remove
(
f
.
Name
())
}
return
f
.
Name
(),
rmFunc
,
nil
}
test/file_cname_proxy_test.go
View file @
ffe79b02
...
...
@@ -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
)
}
...
...
@@ -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
)
}
...
...
test/file_reload_test.go
View file @
ffe79b02
...
...
@@ -5,6 +5,7 @@ import (
"testing"
"time"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/plugin/file"
"github.com/miekg/dns"
...
...
@@ -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
)
}
...
...
test/file_serve_test.go
View file @
ffe79b02
...
...
@@ -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)
...
...
@@ -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)
...
...
test/file_srv_additional_test.go
View file @
ffe79b02
...
...
@@ -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
)
}
...
...
test/file_test.go
View file @
ffe79b02
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
)
}
...
...
test/file_upstream_test.go
View file @
ffe79b02
...
...
@@ -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)
...
...
@@ -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.
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment