Commit graph

2870 commits

Author SHA1 Message Date
Miek Gieben
296c5a0c1c mw/errors: doc (#1057)
Remove the [FILE] option from the docs, we still allow it, but this one
value that we allow now *stdout* isn't shown anymore.

Also test the snippet with readme_test.go by adding `~~ corefile`.
2017-09-11 06:51:24 +01:00
Miek Gieben
176e0916fe mw/chaos: update docs (#1055)
* mw/chaos: update docs

Fix/update the documentation: make the corefile snippets tested and
expand them a little. Show `dig` example.

Fixes #1050

* dot
2017-09-10 21:01:49 +01:00
Miek Gieben
2cff9291e5 mw/whoami: update docs (#1054)
* mw/whoami: update docs

Parse the corefile in the readme_test.go and other tweaks to the docs.

Fixes #1049

* trailing

* remove the 53 port
2017-09-10 20:46:25 +01:00
Miek Gieben
2785f01db5 core: readme test: new port for every instance (#1056)
Use a new port for every instance.
2017-09-10 20:29:38 +01:00
John Belamaric
257889825f Initial adopters list (#1036)
* Initial adopters list

* Remove one until approved

* Fix typo
2017-09-10 19:52:36 +01:00
Miek Gieben
6e3eec1e72 documention: test README snippets (#1043)
If a README has a corefile snippet that is annotated with `corefile`,
this test will parse the instance and checks the snippet is legal.
This means a) we will get better docs b) we know for sure everything
still parses.

The test parses everything in middleware/*/README.md, it does not check
for README presence, just Corefile snippets. The port used is 10053 and
overrides whatever port is set in the docs.

The secondary middleware was used as an example and adds two examples
that should parse.

failures show up as:

~~~
--- FAIL: TestReadme (0.04s)
	readme_test.go:50: Testing ../middleware/secondary/README.md, with 100 byte snippet
	readme_test.go:50: Testing ../middleware/secondary/README.md, with 93 byte snippet
	readme_test.go:53: Failed to start server for input "middleware/secondary: Corefile:3 - Error during parsing: unknown property 'transfeT'":
		. {
		    secondary example.net {
		        transfeT from 10.1.2.1
		        transfer to *
		    }
		}
FAIL
~~~
2017-09-10 19:52:15 +01:00
Miek Gieben
1b60688dc8 Release 011 2017-09-10 19:26:47 +01:00
Miek Gieben
e4170150c7 mw/secondary: more tests in setup_test.go (#1039)
Improve the syntax tests for this middleware.
2017-09-09 11:11:07 +01:00
Thong Huynh
8e5d0a23fa Add EDNS0_SUBNET rewrite (#1022)
* Add EDNS0_SUBNET rewrite

* Fix review comments

* Update comment

* Fix according to review comments

* Add ResponseWriter6 instead of parameterized the existing ResponseWriter
2017-09-08 21:36:09 +01:00
Miek Gieben
bcdc99ab11 mw/etcd: fix 'fallthrough' (#1026)
* mw/etcd: revert 'add fallthrough'

This removes 'fallthrough' for *etcd* which is not needed. This was
added in 00f5c7797 but is totally not needed and creates backwards
incompat behavior even.

Thanks to @johnbelamaric for pointing this out in #925.

* remove here as well

* Revert "remove here as well"

This reverts commit 9d44397827.

* Revert "mw/etcd: revert 'add fallthrough'"

This reverts commit 0cfe3cb1ab.

* mw/{etcd,kubernetes}: use fallthrough correctly

reverts of reverts, will rebase and squash later.
2017-09-07 13:21:37 -04:00
Miek Gieben
594c6d7522 mw/federation: use original qname in all responses (#1033)
Maybe a fix for #1031 ?
2017-09-07 08:47:58 -04:00
Miek Gieben
48806fe8a6 mw/kubernetes: document stubDomain proxy (#1032)
Mention stubdomains in the documentation, give an example  and fix a few
typos.

Fixes #1028
2017-09-07 10:48:26 +01:00
Miek Gieben
9528777fc5 mw/autopath: correct type for type switch (#1029)
* mw/autopath: correct type for type switch

Use pointer to kubernetes as that is what is registered. Fix up
federation which had the same mistake.

* here
2017-09-06 18:28:41 -04:00
Miek Gieben
c514197d6b mw/federation: correct parse (#1027)
Fix parse error and add testcase when a ZONE is specified.

Fixes #1024
2017-09-06 22:25:05 +01:00
Miek Gieben
9452a0a3bc mw/kubernetes: test cleanup (#1020)
Move tests infra to look like all other middleware, and some small
cleanups.
2017-09-02 18:49:50 +02:00
Miek Gieben
9bcddc5c16 mw/proxy: simplify google code (#1019)
* mw/proxy: simplify google code

Minimize bootstrap code a bit, and block on the first resolve of the
google https endpont. Add more logging and include actual error in the
returned errors.

Also re-resolve every 120 seconds, instead of 300 (might eventually make
this an option).

* fix test
2017-09-02 18:43:52 +02:00
Brad Beam
3a96d1ab77 Cleaning up dnssec docs (#1016) 2017-09-02 18:41:52 +02:00
Yong Tang
4b14243e9b Add k8s tags to related tests (#1018)
, so that `make test` will pass by default.

Also fixed several ineffassign and golint issues.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-09-01 19:21:05 +02:00
Yong Tang
6493858893 Use context.TODO() in tests for go vet fix (#1017)
See #997 #1000.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-09-01 18:45:39 +02:00
Miek Gieben
778fb73177 mw/dnssec: improve docs (#1015)
* mw/dnssec: improve docs

Improve the docs: add example and details the perrils of having multiple
*dnssec* middlewares in one zone.

* better
2017-09-01 15:54:51 +02:00
varyoo
345dee82ed IP endpoint for dnstap (#1002)
* adds the option to log to a remote endpoint

* examples

* tests

* tcp:// or default to unix://

* cosmetic update

* bad naked returns
2017-09-01 14:07:21 +02:00
varyoo
c5efd45720 middleware/proxy: dnstap (#786)
* experimental dnstap support into proxy

* proxy reports dnstap errors

* refactoring

* add a message builder for less dnstap code

* msg lint

* context

* proxy by DNS: dnstap comments

* TapBuilder

* resolves conflict

* dnstap into ServeDNS

* testing

* more tests

* `go lint`

* doc update
2017-09-01 12:41:41 +02:00
Mohammed Naser
8f77566cdd Add test for SRV on root (#1010) 2017-09-01 08:55:09 +02:00
Miek Gieben
7d47af4f06 mw/kubernetes: move fallthrough tests out (#1008)
* mw/kubernetes: move fallthrough tests out

Remove the testcase duplication and put fallthrough tests in separate
file.

Also make some names shorter and more descriptive.

* fix test build

* fix corefile
2017-09-01 08:53:42 +02:00
Miek Gieben
a08a4beec4 mw/dnssec: warn when keys don't sign zones (#1011)
fail startup when dnssec middleware has keys configured that can't be
used to sign any of the responses it should sign.

More tests added, including ones that actually trigger setup failures.
2017-09-01 08:52:13 +02:00
Miek Gieben
5eccfa2d1e core: harden request.Request (#1009)
Check for a nil message and if we have a question section. Request is
usually called with an external Msg that already saw validation checks,
but we may also call it from message we create of our own, that may or
may not adhire to this. Just be more robust in this case.

This PR reverts a previous commit that was applied to master.
2017-08-31 16:24:11 +02:00
Miek Gieben
c72084187c core: add nil check (#1005)
Check if msg is nil in DefaultErrorFunc. If this is the case log this
and short cut the function.

Hoping to get more insight in #925
2017-08-31 08:20:13 +02:00
Miek Gieben
3974071f48 mw/kubernetes: split integration tests (#1004)
* mw/kubernetes: split integration tests

* separate file and test for api fallthrough, does not need all other
  servers to be started.
* more split ups: make it clear when or when not we need an upstream server,
  as just needlessly start it in doIntegrationTests.
* use identifiers from dns package -> "TypeSRV" -> dns.TypeSRV, as there
  is no need to reinvent these.

* updates

* deploy work-around

* re-add weird sleep
2017-08-30 17:04:19 +02:00
Miek Gieben
7b8cf9df90 mw/health: call Shutdown on FinalShutdown (#1003)
Reloading caddy won't kill the health handler. Only on final shutdown
we stop the handler.

Currently when reloading CoreDNS with -SIGUSR1 the health handler stops
answering - there is a test for this but it doesn't capture whole
process reloading, sadly. This PR keeps the handler alive during reloads
and only stops on process shutdown.
2017-08-29 21:23:13 +02:00
Miek Gieben
7e63bdbee8 dep ensure -update (#1001)
* dep ensure -update

Run "dep ensure -update` to update all dependencies.

No code changes; just the dependencies.

* dep prune

* add new venderod
2017-08-28 08:49:28 -07:00
Miek Gieben
558f4bea41 mw/health: poll other middleware (#976)
This add the infrastructure to let other middleware report their health
status back to the health middleware. A health.Healther interface is
introduced and a middleware needs to implement that. A middleware
that supports healthchecks is statically configured.

Every second each supported middleware is queried and the global health
state is updated.

Actual tests have been disabled as no other middleware implements this
at the moment.
2017-08-27 13:33:38 -07:00
Miek Gieben
9c56805d38 mw/etcd: use context.TODO() in tests (#1000)
Go vet warning: fix use of context.

Fixes #997

Also make *auto*'s reload test less flaky by retrying
and then giving up.
2017-08-27 07:39:44 +01:00
Yong Tang
53d9b52d68 Update DockerHub build hook with golang 1.9 (#998)
To align with #992

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-26 17:47:43 -07:00
Miek Gieben
4049ed4f4b mw/kubernetes: add configurable TTL (#995)
* mw/kubernetes: add configurable TTL

Add ttl option to kubernetes. This defaults to 5s but allows
configuration to go up to 3600.

Configure the tests so that a few actually check for the 5s, while the
rest use the TTL of 303 which is ignored by the checking code.

Fixes #935

* fix tests

* and more
2017-08-26 17:32:46 -07:00
Yong Tang
01f6e8cba5 Cleanup in go vet and misspell (#996)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-26 17:32:16 -07:00
Miek Gieben
1bb836b793 mw/health: add reload test (#980)
Start CoreDNS instance in call Restart() on it.
2017-08-26 17:39:43 +01:00
Miek Gieben
afad8abef3 travis: enable go 1.9 (#992) 2017-08-26 17:05:56 +01:00
varyoo
d5b636bca6 changes in Caddy caused mw/root tests to fail: 4cce8c7b6b (#990) 2017-08-26 16:58:04 +01:00
Yong Tang
3a9cb4fcf8 Reduce the test cases for kubernetes API proxy (#989)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-25 11:04:21 -07:00
Miek Gieben
55dafe6f59 core: block CH queries earlier (#973)
block chaos queries, unless the chaos or proxy middleware is loaded. We
respond with REFUSED.

This removes the need for each middleware to do this class != ClassINET
if-then.

Also make config.Registry non-public.
2017-08-25 08:55:53 +01:00
Miek Gieben
932639ac99 Remove createTestServer (#981)
* Remove createTestServer

* more cleanups

* comment tweak

* sort

* sigh
2017-08-24 20:59:27 +01:00
Miek Gieben
e06863d2be mw/kubernetes: split up tests cases (#971)
Split up the handler_test in four files that all tests their specific
bits. Removed the CNAME sort as there was only 1 answer with a CNAME
and that was a single one.

See #942, this fixes (a bit) the tests in middleware.
2017-08-24 19:42:45 +01:00
Thong Huynh
3f05f7e6c0 Add set EDNS0 with variable substitution (#937)
* Add set EDNS0 with variable substitution

* Change variable from $ to {}. Un-export constants

* Update README

* Change getRuleData() to ruleData(); Change to use string match from regexp
2017-08-24 17:34:07 +01:00
Sandeep Rajan
5e9991556e Middleware/Kubernetes: Add RR check to K8s integration tests (#884) 2017-08-24 11:05:16 -04:00
Miek Gieben
f901b0cefa tests: CoreDNSServerAndPorts (#972)
* 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-08-24 11:35:14 +01:00
Miek Gieben
ea53f8c219 auto: test (#978)
Increate the sleep duration; this is not a proper fix. The problem here
is that this is in test that just starts a CoreDNS instance and thus we
don't have levers to make "time speed up". It might be worth checking if
there is some LD_PRELOAD hackery that fakes time for the entire test?

Fixes #945 (not really, but closing with this)
2017-08-24 09:18:27 +01:00
Miek Gieben
9c62ddaa01 Small golint cleanup (#977)
* Small golint cleanup

Mostly docs in autopath.

* duh
2017-08-24 08:56:48 +01:00
Miek Gieben
10b7221067 mw/kubernetes: revert if-else for health (#970)
Do the return early and dedent the rest of the function.
2017-08-23 08:30:19 -07:00
Miek Gieben
4b105c761e Parse fix (#974)
* mw/kubernetes: add apex test

This adds small test case for apex queries: SOA and HINFO.

Fix (obvious) parse bug in parse.go.

* Test Ns request also here
2017-08-23 14:07:10 +01:00
Miek Gieben
61fc672e19 mw/kubernetes: remove kPod and kServices (#969)
Based up on: #939, but redone in a new PR with some cherry-picked
commits:
aacb91ef0b
5dc34247b7

This removes kPod and Kservice and creates []msg.Service from k.findPods
and k.findServices.

Updated few tests which I *think* are correct; they look correct to me.
2017-08-23 07:19:41 +01:00