aboutsummaryrefslogtreecommitdiff
path: root/plugin/hosts/hosts_test.go
diff options
context:
space:
mode:
authorGravatar Thomas Mangin <thomas@mangin.com> 2019-02-12 16:09:33 +0000
committerGravatar Pat Moroney <pat@pat.email> 2019-02-12 09:09:33 -0700
commit4b402e000d22a18b333e5b136e43de634f131a99 (patch)
treeafaa2f76ede63d58280842b83633034ce2cc50e0 /plugin/hosts/hosts_test.go
parente47d881461a947dbcc1d285d8a8d9f6a79e77fd7 (diff)
downloadcoredns-4b402e000d22a18b333e5b136e43de634f131a99.tar.gz
coredns-4b402e000d22a18b333e5b136e43de634f131a99.tar.zst
coredns-4b402e000d22a18b333e5b136e43de634f131a99.zip
plugin/hosts provide more configuration flexibility (#2535)
* plugin/hosts provide more configuration flexibility This patch adds few features to the host plugin * no-reverse (both as first argument on the plugin line and inline) disable the automatic generation of reserve entries for hosts * ttl <duration> (inline only atm) allows to change the default ttl (default 5 minutes) * reload <duration> (inline only atm) allows to change the reloading interval (default 5s) * plugin/hosts remove superfluous parameters to parse
Diffstat (limited to 'plugin/hosts/hosts_test.go')
-rw-r--r--plugin/hosts/hosts_test.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/plugin/hosts/hosts_test.go b/plugin/hosts/hosts_test.go
index e412b7ae5..975710bb3 100644
--- a/plugin/hosts/hosts_test.go
+++ b/plugin/hosts/hosts_test.go
@@ -12,10 +12,19 @@ import (
"github.com/miekg/dns"
)
-func (h *Hostsfile) parseReader(r io.Reader) { h.hmap = h.parse(r, h.inline) }
+func (h *Hostsfile) parseReader(r io.Reader) {
+ h.hmap = h.parse(r)
+}
func TestLookupA(t *testing.T) {
- h := Hosts{Next: test.ErrorHandler(), Hostsfile: &Hostsfile{Origins: []string{"."}}}
+ h := Hosts{
+ Next: test.ErrorHandler(),
+ Hostsfile: &Hostsfile{
+ Origins: []string{"."},
+ hmap: newHostsMap(),
+ options: newOptions(),
+ },
+ }
h.parseReader(strings.NewReader(hostsExample))
ctx := context.TODO()
@@ -90,4 +99,6 @@ const hostsExample = `
::1 localhost localhost.domain
10.0.0.1 example.org
::FFFF:10.0.0.2 example.com
+reload 5s
+timeout 3600
`