aboutsummaryrefslogtreecommitdiff
path: root/plugin/cache/prefech_test.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-01-30presubmit: check import path ordering (#3636)Gravatar Miek Gieben 1-1/+1
Add a test for this as well as it's annoying to point out in every code review. Fix all the import paths that are flagged by this new test. Fixes: #3634 Signed-off-by: Miek Gieben <miek@miek.nl>
2018-05-07presubmit: check for uppercase (#1774)Gravatar Miek Gieben 1-5/+5
Another thing we can test automatically, we sorta settled on using an uppercase letter in in t.Log and t.Fatal calls. Let's just check for this.
2018-04-22all: fix plugin import ordering (#1717)Gravatar Miek Gieben 1-2/+1
Got a bit messed up with stb lib "context" usage.
2018-04-20global: move to context (#1699)Gravatar Miek Gieben 1-1/+2
* global: move to context Move from golang.org/x/net/context to std lib's context. Change done with: for i in $(grep -l '/context' **/*.go); do sed -e 's|golang.org/x/net/context|context|' -i $i; echo $i; done for i in **/*.go; do goimports -w $i; done * drop from dns.pb.go as well
2018-01-17plugin/cache: Fix prefetching issues (#1363)Gravatar Tobias Schmidt 1-25/+134
* Improve plugin/cache metrics * Add coredns_cache_prefetch_total metric to track number of prefetches. * Remove unnecessary Cache.get() call which would incorrectly increment cache counters. * Initialize all counters and gauges at zero. * Allow prefetching of a single request per ttl The original implementation didn't allow prefetching queries which are only requested once during the duration of a TTL. The minimum amount of queries which had to be seen was therefore capped at 2. This change also implements a real prefetch test. The existing test was a noop and always passed regardless of any prefetch implementation. * Fix prefetching for items with a short TTL The default prefetch threshold (percentage) is 10% of the lifetime of a cache item. With the previous implementation, this disabled prefetching for all items with a TTL < 10s (the resulting percentage would be 0, at which point a cached item is already discarded). This change uses a time based threshold calculation and ensures that a prefetch is triggered at a TTL of 1 at the latest. * Fix wrong duration reporting of cached responses The logging and metrics plugins (among others) included the duration of a cache prefetch in the request latency of client request. This change fixes this wrong reporting and executes the prefetch request in a goroutine in the background.
2017-09-21pkg: add dnstest (#1098)Gravatar Miek Gieben 1-2/+2
Add a full test server impl in this new package + tests. Move dnsrecorder into this package as well and finish up the commented out tests that were left in the old dnsrecorder package. Update all callers and tests.
2017-09-14Remove the word middleware (#1067)Gravatar Miek Gieben 1-0/+54
* Rename middleware to plugin first pass; mostly used 'sed', few spots where I manually changed text. This still builds a coredns binary. * fmt error * Rename AddMiddleware to AddPlugin * Readd AddMiddleware to remain backwards compat