* 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>
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>
* - ensure plugins that use prometheus.MustRegister, re-register after reload
- removing once.Do on the startup function was simplest way to do it.
* - fix underscored names (advice of bot)
* - tune existing UT for reload, and add a test verifying failing reload does not prevent correct registering for metrics
* - ensure different ports for tests that can run in same time ..
* Create test to verify correct listener behavior
* Create Unset function to remove todo items
* Reset address for prometheus listener before restarting
* Add inline documentation for Unset function
* Make shutdownTimeout a constant and change to five seconds
* Revert ForEach behavior in uniq package
A bit meh, but we *need* hardcoded addresses in these tests, because
we can't get them from a running coredns. These may be in-use and this
fails the tests then. Do an ugly err.Error() string match if this is the
case to prevent failing the test for something not in our control.
A better fix would be to retreive the listening address from coredns via
some api, so we could listen on :0 for these as well. No such API exists
as of yet.
* reload: use OnRestart
Close the listener on OnRestart for health and metrics so the default
setup function can setup the listener when the plugin is "starting up".
Lightly test with some SIGUSR1-ing. Also checked the reload plugin with
this, seems fine:
.com.:1043
.:1043
2018/04/20 15:01:25 [INFO] CoreDNS-1.1.1
2018/04/20 15:01:25 [INFO] linux/amd64, go1.10,
CoreDNS-1.1.1
linux/amd64, go1.10,
2018/04/20 15:01:25 [INFO] Running configuration MD5 = aa8b3f03946fb60546ca1f725d482714
2018/04/20 15:02:01 [INFO] Reloading
2018/04/20 15:02:01 [INFO] Running configuration MD5 = b34a96d99e01db4015a892212560155f
2018/04/20 15:02:01 [INFO] Reloading complete
^C2018/04/20 15:02:06 [INFO] SIGINT: Shutting down
With this corefile:
.com {
proxy . 127.0.0.1:53
prometheus :9054
whoami
reload
}
. {
proxy . 127.0.0.1:53
prometheus :9054
whoami
reload
}
The prometheus port was 9053, changed that to 54 so reload would pick it
up.
From a cursory look it seems this also fixes:
Fixes#1604#1618#1686#1492
* At least make it test
* Use onfinalshutdown
* reload: add reload test
This test #1604 adn right now fails.
* Address review comments
* Add bug section explaining things a bit
* compile tests
* Fix tests
* fixes
* slightly less crazy
* try to make prometheus setup less confusing
* Use ephermal port for test
* Don't use the listener
* These are shared between goroutines, just use the boolean in the main
structure.
* Fix text in the reload README,
* Set addr to TODO once stopping it
* Morph fturb's comment into test, to test reload and scrape health and
metric endpoint
* Use gometalinter and enforcing go fmt/lint/vet
Before this PR go fmt is enabled, go lint is suggest only.
From time to time we have to manually check for go lint and go vet
for any issues.
This fix uses gometalinter and enforcing go fmt/lint/vet.
Several reasons:
- gometalinter could handle multiple linters concurrently
- gometalinter supports suppression with `// nolint[: <linter>]`
Previously one reason we didn't enable go lint was due to the
```
warning: context.Context should be the first parameter of a function (golint)
```
this is now possible with gometalinter and `// nolint: golint` (See changes).
This fix also discovered several go vet issues and fixes it.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Fix several issues reported by gometalinter (go vet)
This commit fixes several issues reported by gometalinter (go vet).
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Increase deadline
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* 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
* cleanup: go vet and golint run
Various cleanups trickered by go vet and golint.
* Fix tests and lowercase all errors
Lowercase all errors, some tests in kubernetes use errors from
kubernetes which do start with a capital letter.