aboutsummaryrefslogtreecommitdiff
path: root/test/file_reload_test.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-10-13cleanup deprecated package io/ioutil (#4920)Gravatar Zou Nengren 1-2/+2
Signed-off-by: zounengren <zouyee1989@gmail.com>
2021-05-11test: Fix rare race condition in TestZoneReload (#4617)Gravatar Steve Greene 1-2/+2
The following test failure for `TestZoneReload` can be observed periodically: `file_reload_test.go:58: Expected two RR in answer section got 2` This failure can be consistently reproduced using the following command (on my machine, at least): `( cd test ; go test -v -race -run "TestZoneReload" ./... -count=500)` test/file_reload_test.go: Address a typo in a test failure message. Sleep for double the file reload interval to avoid a rare race condition between test code and the file plugin's reload code, which is presumably a result of the time it takes to actually reload. Signed-off-by: Stephen Greene <sgreene@redhat.com>
2020-10-30Speed up testing (#4239)Gravatar Miek Gieben 1-2/+2
* Speed up testing * make notification run in the background, this recudes the test_readme time from 18s to 0.10s * reduce time for zone reload * TestServeDNSConcurrent remove entirely. This took a whopping 58s for ... ? A few minutes staring didn't reveal wth it is actually testing. Making values smaller revealed race conditions in the tests. Remove entirely. * Move many interval values to variables so we can reset them to short values for the tests. * test_large_axfr: make the zone smaller. The number used 64K has no rational, make it 64/10 to speed up. * TestProxyThreeWay: use client with shorter timeout A few random tidbits in other tests. Total time saved: 177s (almost 3m) - which makes it worthwhile again to run the test locally: this branch: ~~~ ok github.com/coredns/coredns/test 10.437s cd plugin; time go t ./... 5,51s user 7,51s system 11,15s elapsed 744%CPU ( ~~~ master: ~~~ ok github.com/coredns/coredns/test 35.252s cd plugin; time go t ./... 157,64s user 15,39s system 50,05s elapsed 345%CPU () ~~~ tests/ -25s plugins/ -40s This brings the total on 20s, and another 10s can be saved by fixing dnstapio. Moving this to 5s would be even better, but 10s is also nice. Signed-off-by: Miek Gieben <miek@miek.nl> * Also 0.01 Signed-off-by: Miek Gieben <miek@miek.nl>
2020-10-15reduce sleeps (#4205)Gravatar Miek Gieben 1-2/+2
This reduces the amount of sleep time to speed up testing. master: PASS ok github.com/coredns/coredns/test 42.088s 12,33s user 1,30s system 44,29s elapsed 30%CPU () this branch: PASS ok github.com/coredns/coredns/test 33.527s Signed-off-by: Miek Gieben <miek@miek.nl>
2020-04-25Fix mixed indentation within tests (#3855)Gravatar Ambrose Chua 1-9/+9
Signed-off-by: Ambrose Chua <ambrose@chua.family>
2019-07-04plugin/file: make non-existent file non-fatal (#2955)Gravatar Miek Gieben 1-3/+0
* plugin/file: make non-existent file non-fatal If the zone file being loaded doesn't exist *and* reload is enabled, just wait the file to pop up in the normal Reload routine. If reload is set to 0s; we keep this a fatal error on startup. Aslo fix the ticker in z.Reload(): remove the per second ticks and just use the reload interval for the ticker. Brush up the documentation a bit as well. Fixes: #2951 Signed-off-by: Miek Gieben <miek@miek.nl> * Stickler and test compile Signed-off-by: Miek Gieben <miek@miek.nl> * Remove there too Signed-off-by: Miek Gieben <miek@miek.nl> * Cant README test these because zone files dont exist Signed-off-by: Miek Gieben <miek@miek.nl>
2019-02-17Fix unsorted imports (#2561)Gravatar Nguyen Quang Huy 1-1/+1
Imports should be sorted by Go coding convention
2019-01-28Remove duplicated TempFile testsuit (#2508)Gravatar Xuanwo 1-1/+2
2019-01-13Default to upstream to self (#2436)Gravatar Miek Gieben 1-8/+4
* 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-09-29Configurable zone reload interval in file plugin (#2110)Gravatar marqc 1-1/+3
* Configurable zone reload interval in file plugin * passing reload config from auto plugin to file plugin. removed noReload property from Zone struct. fixed tests based on short file reload hack
2017-09-20plugin/{file,auto}: drop fsnotify (#1090)Gravatar Miek Gieben 1-4/+3
* plugin/{file,auto}: drop fsnotify Reload every minute. This is more deterministic then fsnotify. Also other thing cropped up: sharing zone files between zone; there is only 1 fsnotify event and we need to fan out the reload to all zone files. This is a large rewrite (which could still be done), for now, poll the zone file on disk. Give serial no change a special error type so we can check for this. Improve the logging for reloading: 2017/09/19 07:34:39 [INFO] Successfully reloaded zone "miek.nl." in "db.miek.nl" with serial 128263060 2017/09/19 07:34:45 [INFO] Successfully reloaded zone "miek.nl." in "db.miek.nl" with serial 128263059 2017/09/19 07:34:51 [INFO] Successfully reloaded zone "miek.nl." in "db.miek.nl" with serial 128263060 Fixes #1013 * typo
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-6/+1
* 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-2/+3
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-1/+1
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-28go vet issueGravatar Miek Gieben 1-2/+2
2016-10-27middleware/file: add test for reload (#361)Gravatar Miek Gieben 1-0/+75
This add a highlevel integration test for zone reloading. It also fixes a data race in the actual reloading process.