aboutsummaryrefslogtreecommitdiff
path: root/test/cache_test.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-01-13Default to upstream to self (#2436)Gravatar Miek Gieben 1-9/+6
* Default to upstream to self This is a backwards incompatible change. This is a massive (cleanup) PR where we default to resolving external names by the coredns process itself, instead of directly forwarding them to some upstream. This ignores any arguments `upstream` may have had and makes it depend on proxy/forward configuration in the Corefile. This allows resolved upstream names to be cached and we have better healthchecking of the upstreams. It also means there is only one way to resolve names, by either using the proxy or forward plugin. The proxy/forward lookup.go functions have been removed. This also lessen the dependency on proxy, meaning deprecating proxy will become easier. Some tests have been removed as well, or moved to the top-level test directory as they now require a full coredns process instead of just the plugin. For the etcd plugin, the entire StubZone resolving is *dropped*! This was a hacky (but working) solution to say the least. If someone cares deeply it can be brought back (maybe)? The pkg/upstream is now very small and almost does nothing. Also the New() function was changed to return a pointer to upstream.Upstream. It also returns only one parameter, so any stragglers using it will encounter a compile error. All documentation has been adapted. This affected the following plugins: * etcd * file * auto * secondary * federation * template * route53 A followup PR will make any upstream directives with arguments an error, right now they are ignored. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix etcd build - probably still fails unit test Signed-off-by: Miek Gieben <miek@miek.nl> * Slightly smarter lookup check in upstream Signed-off-by: Miek Gieben <miek@miek.nl> * Compilez Signed-off-by: Miek Gieben <miek@miek.nl>
2018-10-22make default min ttl 5 (#2227)Gravatar Chris O'Haver 1-1/+1
2018-10-16plugin/cache: Set min TTL default to zero (#2199)Gravatar Chris O'Haver 1-6/+17
* set min ttl default to zero * add short TTL test case
2018-06-01Extend presubmit to covert test and request (#1846)Gravatar Miek Gieben 1-1/+1
Fix the casing *and* fix use of context as we were still referencing the non-std lib context - no wondering how this could have worked...
2017-09-20plugin/cache: cap TTL on first answer (#1092)Gravatar Miek Gieben 1-22/+3
Cache would let the first response through and would then cap subsequent ones to whatever the cache duration was. This would lead to huge drops in TTL values: 3600 -> 20 for instance, which is not only bad, but can mess up your careful TTL planning business. This PR fixes that and applies the cache duration to all replies. As a bonus I could remove a time.Sleep() from the cache test and just check for the cache duration as the TTL on the reply. Fixes #1038
2017-09-14Remove the word middleware (#1067)Gravatar Miek Gieben 1-2/+2
* 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
2017-08-24tests: CoreDNSServerAndPorts (#972)Gravatar Miek Gieben 1-12/+2
* tests: CoreDNSServerAndPorts Copy from kubernetes.go and renamed to fit the style, adapted almost all callers. This is a mechanicl change, no testdata was changed. * typos
2017-03-02Fix resolving CNAME with no proxy (#564)Gravatar Miek Gieben 1-1/+1
This fixes a crash when we resolve (or try to) an external CNAME when no proxy is set. Add test as well.
2017-02-22Fix import path `github.com/miekg/coredns` -> `github.com/coredns/coredns` ↵Gravatar Yong Tang 1-3/+3
(#547) This fix fixes import path from `github.com/miekg/coredns` -> `github.com/coredns/coredns`
2017-01-15middleware/proxy: implement Exchanger (#480)Gravatar Miek Gieben 1-2/+2
By defining and using an proxy.Exchanger interface we make the proxy more generic and we can then fold back httproxy into proxy. This overrides #463 and #473 and should make futures extensions rather trivial * Add docs that talk about `protocol` and how to set it. * middleware/proxy: rename New to NewLookup It's used as a Lookup mechanism not as a completely new proxy, reflect that in the name. * Set maxfails to 3 by default when looking up names. Most of the changes have been copied from https://github.com/johnbelamaric/coredns/pull/1/files
2017-01-12Run tests in parallel (#478)Gravatar Miek Gieben 1-0/+1
Create a small speedup running the tests: PASS ok github.com/miekg/coredns/test 10.329s PASS ok github.com/miekg/coredns/test 6.079s Skip the etcd ones. Doing the middleware/*/*_test ones doesn't yield any speedup as these are still done on a per directory basis.
2016-10-28middleware/proxy: add request duration monitoring (#362)Gravatar Miek Gieben 1-2/+0
Add a separate request duration metrics specially for proxying requests upstream. Fixes #259
2016-10-02Pr 311 2 (#312)Gravatar Miek Gieben 1-1/+1
* Add a setup test for middleware/file This fix adds a setup test for middleware/file so that there is a basic coverage for the Corefile processing of middleware/file. This fix is related to 308 (Will look into it). Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * middleware/file: use helper function for test Fixup setup_test.go and use the test.TempFile function to make things somewhat shorter. Use clean up the use of testing.T in TempFile - it is not used.
2016-10-02middleware/cache: split cache in positive and negative and use lru (#298)Gravatar Miek Gieben 1-0/+89
Make the cache memory bounded, by using a LRU cache. Also split the cache in a positive and negative one - each with its own controls. Extend the cache stanza to allow for this: cache { positive limit [ttl] negative limit [ttl] } is now possible. This also add a cache_test.go in the toplevel test/ directory that exercises the caching path. Fixes #260