aboutsummaryrefslogtreecommitdiff
path: root/test/cache_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/cache_test.go')
-rw-r--r--test/cache_test.go25
1 files changed, 3 insertions, 22 deletions
diff --git a/test/cache_test.go b/test/cache_test.go
index 2379cd2a3..37aa55368 100644
--- a/test/cache_test.go
+++ b/test/cache_test.go
@@ -1,10 +1,7 @@
package test
import (
- "io/ioutil"
- "log"
"testing"
- "time"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
@@ -14,7 +11,6 @@ import (
)
func TestLookupCache(t *testing.T) {
- t.Parallel()
// Start auth. CoreDNS holding the auth zone.
name, rm, err := test.TempFile(".", exampleOrg)
if err != nil {
@@ -35,7 +31,7 @@ func TestLookupCache(t *testing.T) {
// Start caching proxy CoreDNS that we want to test.
corefile = `example.org:0 {
proxy . ` + udp + `
- cache
+ cache 10
}
`
i, udp, _, err = CoreDNSServerAndPorts(corefile)
@@ -44,8 +40,6 @@ func TestLookupCache(t *testing.T) {
}
defer i.Stop()
- log.SetOutput(ioutil.Discard)
-
p := proxy.NewLookup([]string{udp})
state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)}
@@ -59,20 +53,7 @@ func TestLookupCache(t *testing.T) {
}
ttl := resp.Answer[0].Header().Ttl
-
- time.Sleep(2 * time.Second) // TODO(miek): meh.
-
- resp, err = p.Lookup(state, "example.org.", dns.TypeA)
- if err != nil {
- t.Fatal("Expected to receive reply, but didn't")
- }
-
- // expect answer section with A record in it
- if len(resp.Answer) == 0 {
- t.Error("Expected to at least one RR in the answer section, got none")
- }
- newTTL := resp.Answer[0].Header().Ttl
- if newTTL >= ttl {
- t.Errorf("Expected TTL to be lower than: %d, got %d", ttl, newTTL)
+ if ttl != 10 { // as set in the Corefile
+ t.Errorf("Expected TTL to be %d, got %d", 10, ttl)
}
}