aboutsummaryrefslogtreecommitdiff
path: root/plugin/hosts/setup_test.go
diff options
context:
space:
mode:
authorGravatar John Belamaric <jbelamaric@infoblox.com> 2018-01-07 14:51:32 -0500
committerGravatar GitHub <noreply@github.com> 2018-01-07 14:51:32 -0500
commitc59f5f6e86e1d041a9aa7b324b90582b3a4b277a (patch)
treec8091f7101125f066d5bc59c20dbf6b4b192311d /plugin/hosts/setup_test.go
parentc6febe6250361eee580dbb8a601a444f23ed7ac2 (diff)
downloadcoredns-c59f5f6e86e1d041a9aa7b324b90582b3a4b277a.tar.gz
coredns-c59f5f6e86e1d041a9aa7b324b90582b3a4b277a.tar.zst
coredns-c59f5f6e86e1d041a9aa7b324b90582b3a4b277a.zip
Simplify plugin/pkg/fall (#1358)
* Simplify plugin/pkg/fall * Remove unused import * Fix fall_test * Get fall coverage to 100% just because * gofmt. sigh.
Diffstat (limited to 'plugin/hosts/setup_test.go')
-rw-r--r--plugin/hosts/setup_test.go27
1 files changed, 13 insertions, 14 deletions
diff --git a/plugin/hosts/setup_test.go b/plugin/hosts/setup_test.go
index 58351cc52..3c4f94948 100644
--- a/plugin/hosts/setup_test.go
+++ b/plugin/hosts/setup_test.go
@@ -14,48 +14,48 @@ func TestHostsParse(t *testing.T) {
shouldErr bool
expectedPath string
expectedOrigins []string
- expectedFallthrough *fall.F
+ expectedFallthrough fall.F
}{
{
`hosts
`,
- false, "/etc/hosts", nil, nil,
+ false, "/etc/hosts", nil, fall.Zero(),
},
{
`hosts /tmp`,
- false, "/tmp", nil, nil,
+ false, "/tmp", nil, fall.Zero(),
},
{
`hosts /etc/hosts miek.nl.`,
- false, "/etc/hosts", []string{"miek.nl."}, nil,
+ false, "/etc/hosts", []string{"miek.nl."}, fall.Zero(),
},
{
`hosts /etc/hosts miek.nl. pun.gent.`,
- false, "/etc/hosts", []string{"miek.nl.", "pun.gent."}, nil,
+ false, "/etc/hosts", []string{"miek.nl.", "pun.gent."}, fall.Zero(),
},
{
`hosts {
fallthrough
}`,
- false, "/etc/hosts", nil, fall.Zero(),
+ false, "/etc/hosts", nil, fall.Root(),
},
{
`hosts /tmp {
fallthrough
}`,
- false, "/tmp", nil, fall.Zero(),
+ false, "/tmp", nil, fall.Root(),
},
{
`hosts /etc/hosts miek.nl. {
fallthrough
}`,
- false, "/etc/hosts", []string{"miek.nl."}, fall.Zero(),
+ false, "/etc/hosts", []string{"miek.nl."}, fall.Root(),
},
{
`hosts /etc/hosts miek.nl 10.0.0.9/8 {
fallthrough
}`,
- false, "/etc/hosts", []string{"miek.nl.", "10.in-addr.arpa."}, fall.Zero(),
+ false, "/etc/hosts", []string{"miek.nl.", "10.in-addr.arpa."}, fall.Root(),
},
}
@@ -92,7 +92,7 @@ func TestHostsInlineParse(t *testing.T) {
inputFileRules string
shouldErr bool
expectedbyAddr map[string][]string
- expectedFallthrough *fall.F
+ expectedFallthrough fall.F
}{
{
`hosts highly_unlikely_to_exist_hosts_file example.org {
@@ -105,7 +105,7 @@ func TestHostsInlineParse(t *testing.T) {
`example.org.`,
},
},
- fall.Zero(),
+ fall.Root(),
},
{
`hosts highly_unlikely_to_exist_hosts_file example.org {
@@ -117,7 +117,7 @@ func TestHostsInlineParse(t *testing.T) {
`example.org.`,
},
},
- nil,
+ fall.Zero(),
},
{
`hosts highly_unlikely_to_exist_hosts_file example.org {
@@ -126,14 +126,13 @@ func TestHostsInlineParse(t *testing.T) {
}`,
true,
map[string][]string{},
- fall.Zero(),
+ fall.Root(),
},
}
for i, test := range tests {
c := caddy.NewTestController("dns", test.inputFileRules)
h, err := hostsParse(c)
-
if err == nil && test.shouldErr {
t.Fatalf("Test %d expected errors, but got no error", i)
} else if err != nil && !test.shouldErr {