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
cced1a4c
Commit
cced1a4c
authored
Jan 09, 2018
by
Miek Gieben
Committed by
GitHub
Jan 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg/fall: make Zero and Root vars not funcs (#1367)
These can be just vars. Think that was intended as well.
parent
a19ea63d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
52 deletions
+51
-52
plugin/hosts/setup_test.go
plugin/hosts/setup_test.go
+11
-11
plugin/kubernetes/setup_test.go
plugin/kubernetes/setup_test.go
+24
-24
plugin/pkg/fall/fall.go
plugin/pkg/fall/fall.go
+3
-3
plugin/pkg/fall/fall_test.go
plugin/pkg/fall/fall_test.go
+2
-2
plugin/template/template_test.go
plugin/template/template_test.go
+11
-12
No files found.
plugin/hosts/setup_test.go
View file @
cced1a4c
...
@@ -19,43 +19,43 @@ func TestHostsParse(t *testing.T) {
...
@@ -19,43 +19,43 @@ func TestHostsParse(t *testing.T) {
{
{
`hosts
`hosts
`
,
`
,
false
,
"/etc/hosts"
,
nil
,
fall
.
Zero
()
,
false
,
"/etc/hosts"
,
nil
,
fall
.
Zero
,
},
},
{
{
`hosts /tmp`
,
`hosts /tmp`
,
false
,
"/tmp"
,
nil
,
fall
.
Zero
()
,
false
,
"/tmp"
,
nil
,
fall
.
Zero
,
},
},
{
{
`hosts /etc/hosts miek.nl.`
,
`hosts /etc/hosts miek.nl.`
,
false
,
"/etc/hosts"
,
[]
string
{
"miek.nl."
},
fall
.
Zero
()
,
false
,
"/etc/hosts"
,
[]
string
{
"miek.nl."
},
fall
.
Zero
,
},
},
{
{
`hosts /etc/hosts miek.nl. pun.gent.`
,
`hosts /etc/hosts miek.nl. pun.gent.`
,
false
,
"/etc/hosts"
,
[]
string
{
"miek.nl."
,
"pun.gent."
},
fall
.
Zero
()
,
false
,
"/etc/hosts"
,
[]
string
{
"miek.nl."
,
"pun.gent."
},
fall
.
Zero
,
},
},
{
{
`hosts {
`hosts {
fallthrough
fallthrough
}`
,
}`
,
false
,
"/etc/hosts"
,
nil
,
fall
.
Root
()
,
false
,
"/etc/hosts"
,
nil
,
fall
.
Root
,
},
},
{
{
`hosts /tmp {
`hosts /tmp {
fallthrough
fallthrough
}`
,
}`
,
false
,
"/tmp"
,
nil
,
fall
.
Root
()
,
false
,
"/tmp"
,
nil
,
fall
.
Root
,
},
},
{
{
`hosts /etc/hosts miek.nl. {
`hosts /etc/hosts miek.nl. {
fallthrough
fallthrough
}`
,
}`
,
false
,
"/etc/hosts"
,
[]
string
{
"miek.nl."
},
fall
.
Root
()
,
false
,
"/etc/hosts"
,
[]
string
{
"miek.nl."
},
fall
.
Root
,
},
},
{
{
`hosts /etc/hosts miek.nl 10.0.0.9/8 {
`hosts /etc/hosts miek.nl 10.0.0.9/8 {
fallthrough
fallthrough
}`
,
}`
,
false
,
"/etc/hosts"
,
[]
string
{
"miek.nl."
,
"10.in-addr.arpa."
},
fall
.
Root
()
,
false
,
"/etc/hosts"
,
[]
string
{
"miek.nl."
,
"10.in-addr.arpa."
},
fall
.
Root
,
},
},
}
}
...
@@ -105,7 +105,7 @@ func TestHostsInlineParse(t *testing.T) {
...
@@ -105,7 +105,7 @@ func TestHostsInlineParse(t *testing.T) {
`example.org.`
,
`example.org.`
,
},
},
},
},
fall
.
Root
()
,
fall
.
Root
,
},
},
{
{
`hosts highly_unlikely_to_exist_hosts_file example.org {
`hosts highly_unlikely_to_exist_hosts_file example.org {
...
@@ -117,7 +117,7 @@ func TestHostsInlineParse(t *testing.T) {
...
@@ -117,7 +117,7 @@ func TestHostsInlineParse(t *testing.T) {
`example.org.`
,
`example.org.`
,
},
},
},
},
fall
.
Zero
()
,
fall
.
Zero
,
},
},
{
{
`hosts highly_unlikely_to_exist_hosts_file example.org {
`hosts highly_unlikely_to_exist_hosts_file example.org {
...
@@ -126,7 +126,7 @@ func TestHostsInlineParse(t *testing.T) {
...
@@ -126,7 +126,7 @@ func TestHostsInlineParse(t *testing.T) {
}`
,
}`
,
true
,
true
,
map
[
string
][]
string
{},
map
[
string
][]
string
{},
fall
.
Root
()
,
fall
.
Root
,
},
},
}
}
...
...
plugin/kubernetes/setup_test.go
View file @
cced1a4c
...
@@ -34,7 +34,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -34,7 +34,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -46,7 +46,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -46,7 +46,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -59,7 +59,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -59,7 +59,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -73,7 +73,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -73,7 +73,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -87,7 +87,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -87,7 +87,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -101,7 +101,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -101,7 +101,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -115,7 +115,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -115,7 +115,7 @@ func TestKubernetesParse(t *testing.T) {
30
*
time
.
Second
,
30
*
time
.
Second
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -129,7 +129,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -129,7 +129,7 @@ func TestKubernetesParse(t *testing.T) {
15
*
time
.
Minute
,
15
*
time
.
Minute
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -143,7 +143,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -143,7 +143,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
"environment=prod"
,
"environment=prod"
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -157,7 +157,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -157,7 +157,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
"application=nginx,environment in (production,qa,staging)"
,
"application=nginx,environment in (production,qa,staging)"
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -175,7 +175,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -175,7 +175,7 @@ func TestKubernetesParse(t *testing.T) {
15
*
time
.
Minute
,
15
*
time
.
Minute
,
"application=nginx,environment in (production,qa,staging)"
,
"application=nginx,environment in (production,qa,staging)"
,
podModeDisabled
,
podModeDisabled
,
fall
.
Root
()
,
fall
.
Root
,
nil
,
nil
,
},
},
// negative
// negative
...
@@ -190,7 +190,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -190,7 +190,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -204,7 +204,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -204,7 +204,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -218,7 +218,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -218,7 +218,7 @@ func TestKubernetesParse(t *testing.T) {
0
*
time
.
Minute
,
0
*
time
.
Minute
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -232,7 +232,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -232,7 +232,7 @@ func TestKubernetesParse(t *testing.T) {
0
*
time
.
Second
,
0
*
time
.
Second
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -246,7 +246,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -246,7 +246,7 @@ func TestKubernetesParse(t *testing.T) {
0
*
time
.
Second
,
0
*
time
.
Second
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -260,7 +260,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -260,7 +260,7 @@ func TestKubernetesParse(t *testing.T) {
0
*
time
.
Second
,
0
*
time
.
Second
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
{
{
...
@@ -274,7 +274,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -274,7 +274,7 @@ func TestKubernetesParse(t *testing.T) {
0
*
time
.
Second
,
0
*
time
.
Second
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
// pods disabled
// pods disabled
...
@@ -289,7 +289,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -289,7 +289,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
// pods insecure
// pods insecure
...
@@ -304,7 +304,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -304,7 +304,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeInsecure
,
podModeInsecure
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
// pods verified
// pods verified
...
@@ -319,7 +319,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -319,7 +319,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeVerified
,
podModeVerified
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
// pods invalid
// pods invalid
...
@@ -334,7 +334,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -334,7 +334,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeVerified
,
podModeVerified
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
// fallthrough with zones
// fallthrough with zones
...
@@ -364,7 +364,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -364,7 +364,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
[]
string
{
"13.14.15.16:53"
},
[]
string
{
"13.14.15.16:53"
},
},
},
// Invalid upstream
// Invalid upstream
...
@@ -379,7 +379,7 @@ func TestKubernetesParse(t *testing.T) {
...
@@ -379,7 +379,7 @@ func TestKubernetesParse(t *testing.T) {
defaultResyncPeriod
,
defaultResyncPeriod
,
""
,
""
,
podModeDisabled
,
podModeDisabled
,
fall
.
Zero
()
,
fall
.
Zero
,
nil
,
nil
,
},
},
}
}
...
...
plugin/pkg/fall/fall.go
View file @
cced1a4c
...
@@ -28,7 +28,7 @@ func (f *F) setZones(zones []string) {
...
@@ -28,7 +28,7 @@ func (f *F) setZones(zones []string) {
// SetZonesFromArgs sets zones in f to the passed value or to "." if the slice is empty.
// SetZonesFromArgs sets zones in f to the passed value or to "." if the slice is empty.
func
(
f
*
F
)
SetZonesFromArgs
(
zones
[]
string
)
{
func
(
f
*
F
)
SetZonesFromArgs
(
zones
[]
string
)
{
if
len
(
zones
)
==
0
{
if
len
(
zones
)
==
0
{
f
.
setZones
(
Root
()
.
Zones
)
f
.
setZones
(
Root
.
Zones
)
return
return
}
}
f
.
setZones
(
zones
)
f
.
setZones
(
zones
)
...
@@ -50,9 +50,9 @@ func (f F) Equal(g F) bool {
...
@@ -50,9 +50,9 @@ func (f F) Equal(g F) bool {
// Zero returns a zero valued F.
// Zero returns a zero valued F.
var
Zero
=
func
()
F
{
var
Zero
=
func
()
F
{
return
F
{[]
string
{}}
return
F
{[]
string
{}}
}
}
()
// Root returns F set to only ".".
// Root returns F set to only ".".
var
Root
=
func
()
F
{
var
Root
=
func
()
F
{
return
F
{[]
string
{
"."
}}
return
F
{[]
string
{
"."
}}
}
}
()
plugin/pkg/fall/fall_test.go
View file @
cced1a4c
...
@@ -23,7 +23,7 @@ func TestEqual(t *testing.T) {
...
@@ -23,7 +23,7 @@ func TestEqual(t *testing.T) {
func
TestZero
(
t
*
testing
.
T
)
{
func
TestZero
(
t
*
testing
.
T
)
{
var
f
F
var
f
F
if
!
f
.
Equal
(
Zero
()
)
{
if
!
f
.
Equal
(
Zero
)
{
t
.
Errorf
(
"F should be zero"
)
t
.
Errorf
(
"F should be zero"
)
}
}
}
}
...
@@ -31,7 +31,7 @@ func TestZero(t *testing.T) {
...
@@ -31,7 +31,7 @@ func TestZero(t *testing.T) {
func
TestSetZonesFromArgs
(
t
*
testing
.
T
)
{
func
TestSetZonesFromArgs
(
t
*
testing
.
T
)
{
var
f
F
var
f
F
f
.
SetZonesFromArgs
([]
string
{})
f
.
SetZonesFromArgs
([]
string
{})
if
!
f
.
Equal
(
Root
()
)
{
if
!
f
.
Equal
(
Root
)
{
t
.
Errorf
(
"F should have the root zone"
)
t
.
Errorf
(
"F should have the root zone"
)
}
}
...
...
plugin/template/template_test.go
View file @
cced1a4c
...
@@ -16,13 +16,12 @@ import (
...
@@ -16,13 +16,12 @@ import (
)
)
func
TestHandler
(
t
*
testing
.
T
)
{
func
TestHandler
(
t
*
testing
.
T
)
{
rcodeFallthrough
:=
3841
// reserved for private use, used to indicate a fallthrough
exampleDomainATemplate
:=
template
{
exampleDomainATemplate
:=
template
{
regex
:
[]
*
regexp
.
Regexp
{
regexp
.
MustCompile
(
"(^|[.])ip-10-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]$"
)},
regex
:
[]
*
regexp
.
Regexp
{
regexp
.
MustCompile
(
"(^|[.])ip-10-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]example[.]$"
)},
answer
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
))},
answer
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
))},
qclass
:
dns
.
ClassANY
,
qclass
:
dns
.
ClassANY
,
qtype
:
dns
.
TypeANY
,
qtype
:
dns
.
TypeANY
,
fall
:
fall
.
F
{
Zones
:
[]
string
{
"."
}}
,
fall
:
fall
.
Root
,
zones
:
[]
string
{
"."
},
zones
:
[]
string
{
"."
},
}
}
exampleDomainANSTemplate
:=
template
{
exampleDomainANSTemplate
:=
template
{
...
@@ -32,7 +31,7 @@ func TestHandler(t *testing.T) {
...
@@ -32,7 +31,7 @@ func TestHandler(t *testing.T) {
authority
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"authority"
)
.
Parse
(
"example. IN NS ns0.example.com."
))},
authority
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"authority"
)
.
Parse
(
"example. IN NS ns0.example.com."
))},
qclass
:
dns
.
ClassANY
,
qclass
:
dns
.
ClassANY
,
qtype
:
dns
.
TypeANY
,
qtype
:
dns
.
TypeANY
,
fall
:
fall
.
F
{
Zones
:
[]
string
{
"."
}}
,
fall
:
fall
.
Root
,
zones
:
[]
string
{
"."
},
zones
:
[]
string
{
"."
},
}
}
exampleDomainMXTemplate
:=
template
{
exampleDomainMXTemplate
:=
template
{
...
@@ -41,7 +40,7 @@ func TestHandler(t *testing.T) {
...
@@ -41,7 +40,7 @@ func TestHandler(t *testing.T) {
additional
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"additional"
)
.
Parse
(
"{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
))},
additional
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"additional"
)
.
Parse
(
"{{ .Name }} 60 IN A 10.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
))},
qclass
:
dns
.
ClassANY
,
qclass
:
dns
.
ClassANY
,
qtype
:
dns
.
TypeANY
,
qtype
:
dns
.
TypeANY
,
fall
:
fall
.
F
{
Zones
:
[]
string
{
"."
}}
,
fall
:
fall
.
Root
,
zones
:
[]
string
{
"."
},
zones
:
[]
string
{
"."
},
}
}
invalidDomainTemplate
:=
template
{
invalidDomainTemplate
:=
template
{
...
@@ -50,7 +49,7 @@ func TestHandler(t *testing.T) {
...
@@ -50,7 +49,7 @@ func TestHandler(t *testing.T) {
answer
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"invalid. 60 {{ .Class }} SOA a.invalid. b.invalid. (1 60 60 60 60)"
))},
answer
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"invalid. 60 {{ .Class }} SOA a.invalid. b.invalid. (1 60 60 60 60)"
))},
qclass
:
dns
.
ClassANY
,
qclass
:
dns
.
ClassANY
,
qtype
:
dns
.
TypeANY
,
qtype
:
dns
.
TypeANY
,
fall
:
fall
.
F
{
Zones
:
[]
string
{
"."
}}
,
fall
:
fall
.
Root
,
zones
:
[]
string
{
"."
},
zones
:
[]
string
{
"."
},
}
}
rcodeServfailTemplate
:=
template
{
rcodeServfailTemplate
:=
template
{
...
@@ -58,7 +57,7 @@ func TestHandler(t *testing.T) {
...
@@ -58,7 +57,7 @@ func TestHandler(t *testing.T) {
rcode
:
dns
.
RcodeServerFailure
,
rcode
:
dns
.
RcodeServerFailure
,
qclass
:
dns
.
ClassANY
,
qclass
:
dns
.
ClassANY
,
qtype
:
dns
.
TypeANY
,
qtype
:
dns
.
TypeANY
,
fall
:
fall
.
F
{
Zones
:
[]
string
{
"."
}}
,
fall
:
fall
.
Root
,
zones
:
[]
string
{
"."
},
zones
:
[]
string
{
"."
},
}
}
brokenTemplate
:=
template
{
brokenTemplate
:=
template
{
...
@@ -66,7 +65,7 @@ func TestHandler(t *testing.T) {
...
@@ -66,7 +65,7 @@ func TestHandler(t *testing.T) {
answer
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"{{ .Name }} 60 IN TXT
\"
{{ index .Match 2 }}
\"
"
))},
answer
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"{{ .Name }} 60 IN TXT
\"
{{ index .Match 2 }}
\"
"
))},
qclass
:
dns
.
ClassANY
,
qclass
:
dns
.
ClassANY
,
qtype
:
dns
.
TypeANY
,
qtype
:
dns
.
TypeANY
,
fall
:
fall
.
F
{
Zones
:
[]
string
{
"."
}}
,
fall
:
fall
.
Root
,
zones
:
[]
string
{
"."
},
zones
:
[]
string
{
"."
},
}
}
nonRRTemplate
:=
template
{
nonRRTemplate
:=
template
{
...
@@ -74,7 +73,7 @@ func TestHandler(t *testing.T) {
...
@@ -74,7 +73,7 @@ func TestHandler(t *testing.T) {
answer
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"{{ .Name }}"
))},
answer
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"{{ .Name }}"
))},
qclass
:
dns
.
ClassANY
,
qclass
:
dns
.
ClassANY
,
qtype
:
dns
.
TypeANY
,
qtype
:
dns
.
TypeANY
,
fall
:
fall
.
F
{
Zones
:
[]
string
{
"."
}}
,
fall
:
fall
.
Root
,
zones
:
[]
string
{
"."
},
zones
:
[]
string
{
"."
},
}
}
nonRRAdditionalTemplate
:=
template
{
nonRRAdditionalTemplate
:=
template
{
...
@@ -82,7 +81,7 @@ func TestHandler(t *testing.T) {
...
@@ -82,7 +81,7 @@ func TestHandler(t *testing.T) {
additional
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"{{ .Name }}"
))},
additional
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"answer"
)
.
Parse
(
"{{ .Name }}"
))},
qclass
:
dns
.
ClassANY
,
qclass
:
dns
.
ClassANY
,
qtype
:
dns
.
TypeANY
,
qtype
:
dns
.
TypeANY
,
fall
:
fall
.
F
{
Zones
:
[]
string
{
"."
}}
,
fall
:
fall
.
Root
,
zones
:
[]
string
{
"."
},
zones
:
[]
string
{
"."
},
}
}
nonRRAuthoritativeTemplate
:=
template
{
nonRRAuthoritativeTemplate
:=
template
{
...
@@ -90,7 +89,7 @@ func TestHandler(t *testing.T) {
...
@@ -90,7 +89,7 @@ func TestHandler(t *testing.T) {
authority
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"authority"
)
.
Parse
(
"{{ .Name }}"
))},
authority
:
[]
*
gotmpl
.
Template
{
gotmpl
.
Must
(
gotmpl
.
New
(
"authority"
)
.
Parse
(
"{{ .Name }}"
))},
qclass
:
dns
.
ClassANY
,
qclass
:
dns
.
ClassANY
,
qtype
:
dns
.
TypeANY
,
qtype
:
dns
.
TypeANY
,
fall
:
fall
.
F
{
Zones
:
[]
string
{
"."
}}
,
fall
:
fall
.
Root
,
zones
:
[]
string
{
"."
},
zones
:
[]
string
{
"."
},
}
}
...
@@ -297,7 +296,6 @@ func TestHandler(t *testing.T) {
...
@@ -297,7 +296,6 @@ func TestHandler(t *testing.T) {
// TestMultiSection verfies that a corefile with mutliple but different template sections works
// TestMultiSection verfies that a corefile with mutliple but different template sections works
func
TestMultiSection
(
t
*
testing
.
T
)
{
func
TestMultiSection
(
t
*
testing
.
T
)
{
rcodeFallthrough
:=
3841
// reserved for private use, used to indicate a fallthrough
ctx
:=
context
.
TODO
()
ctx
:=
context
.
TODO
()
multisectionConfig
:=
`
multisectionConfig
:=
`
...
@@ -438,5 +436,6 @@ func TestMultiSection(t *testing.T) {
...
@@ -438,5 +436,6 @@ func TestMultiSection(t *testing.T) {
if
code
!=
dns
.
RcodeNameError
{
if
code
!=
dns
.
RcodeNameError
{
t
.
Fatalf
(
"TestMultiSection expected NXDOMAIN resolving something.example. IN MX, got %v, %v"
,
code
,
dns
.
RcodeToString
[
code
])
t
.
Fatalf
(
"TestMultiSection expected NXDOMAIN resolving something.example. IN MX, got %v, %v"
,
code
,
dns
.
RcodeToString
[
code
])
}
}
}
}
const
rcodeFallthrough
=
3841
// reserved for private use, used to indicate a fallthrough
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