add goroutine to check hosts file for updates (#1180)

* add goroutine to check hosts file for updates

* rename parseFile to parseReader, remove extra error check
This commit is contained in:
Pat Moroney
2017-10-31 01:40:47 -06:00
committed by Miek Gieben
parent 87c9f00c83
commit 1d4ac4adbb
6 changed files with 124 additions and 83 deletions

View File

@@ -3,7 +3,6 @@ package hosts
import (
"strings"
"testing"
"time"
"github.com/coredns/coredns/plugin/pkg/dnstest"
"github.com/coredns/coredns/plugin/test"
@@ -13,8 +12,8 @@ import (
)
func TestLookupA(t *testing.T) {
h := Hosts{Next: test.ErrorHandler(), Hostsfile: &Hostsfile{expire: time.Now().Add(1 * time.Hour), Origins: []string{"."}}}
h.Parse(strings.NewReader(hostsExample))
h := Hosts{Next: test.ErrorHandler(), Hostsfile: &Hostsfile{Origins: []string{"."}}}
h.parseReader(strings.NewReader(hostsExample))
ctx := context.TODO()