Commit graph

17 commits

Author SHA1 Message Date
Miek Gieben
d8714e64e4 Remove the word middleware (#1067)
* 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-09-14 09:36:06 +01:00
Miek Gieben
7f46df6d27 tests: add SortAndCheck helper (#926)
There was quite some code duplication in a lot of tests to check if
an answer was considered Ok. Created a test.SortAndCheck helper function
that takes care of this.
2017-08-16 15:30:58 +01:00
Miek Gieben
00f5c7797e mw/kubernetes: remove federation and cidr (#916)
* mw/kubernetes: remove federation and cidr

Remove both as we have a corefile syntax change that handles cidr and
remove federation because that is going to be its own middleware.

* backwards incompat changes

This PR:
* removes cidr from kubernetes (core Corefile feature now)
* removes federation from kubernets (comes back as new middleware)
* [remove autopath - which was already gone, so that already was
  backwards incompat]
* adds `fallthrough` to the *etcd* middleware and makes you enable it.
* Fail on unknown properties
* documentation
* Disable TestHealthCheck as it uses realtime and fails
2017-08-14 08:49:26 +01:00
Yong Tang
81af74aad0 Fix import path github.com/miekg/coredns -> github.com/coredns/coredns (#547)
This fix fixes import path from
`github.com/miekg/coredns`
->
`github.com/coredns/coredns`
2017-02-22 06:51:47 +00:00
Miek Gieben
d1f17fa7e0 Cleanup: put middleware helper functions in pkgs (#245)
Move all (almost all) Go files in middleware into their
own packages. This makes for better naming and discoverability.

Lot of changes elsewhere to make this change.

The middleware.State was renamed to request.Request which is better,
but still does not cover all use-cases. It was also moved out middleware
because it is used by `dnsserver` as well.

A pkg/dnsutil packages was added for shared, handy, dns util functions.

All normalize functions are now put in normalize.go
2016-09-07 11:10:16 +01:00
Miek Gieben
9ac3cab1b7 Make CoreDNS a server type plugin for Caddy (#220)
* Make CoreDNS a server type plugin for Caddy

Remove code we don't need and port all middleware over. Fix all tests
and rework the documentation.

Also make `go generate` build a caddy binary which we then copy into
our directory. This means `go build`-builds remain working as-is.

And new etc instances in each etcd test for better isolation.
Fix more tests and rework test.Server with the newer support Caddy offers.

Fix Makefile to support new mode of operation.
2016-08-19 17:14:17 -07:00
Miek Gieben
34ffb2b314 Fix TestStubLookup and TestLookup (#213)
Changes large parts of proxy lookup mechanism.

The duplicate zone checking erroneous added a nameserver for each
zone we are auth. for, creating to many backend hosts. So even when a
host was determined do be Down() we still got an (identical) new one
from the list.

The Down() and failure checking for upstream hosts had data race in the
uh.Fails check - we now use atomic.LoadInt32 for that.

Use and debug the test/server.go test servers implementation in the
TestStubLookup test to prevent going out to the internet.

Also delete the stub cycle test. That test was wrong and did not test
what it needed to be testing.  Deleted for now.
2016-08-14 12:57:49 -06:00
Miek Gieben
ad76aef5fc Fix stubzone retention (#198)
Make the receiver a pointer so that the uptdateStubZones map update will
retain the stubzones found, unlike the current case where the update
will be applied and then promptly forgotten, because it is working on a
copy.

Add test/etcd_test.go to test a large part of the code. This didn't
catch the chaos middleware hack though. The chaos middleware zones are
now *not* automatically added. You have to take care of that by yourself
(docs updates).

When using debug queries and falling through to the next middleware in
etcd, restore the original (with o-o.debug) query before passing it on.
2016-08-08 19:18:55 -07:00
Joe Blow
2882991000 Tidy up most errors and warnings from lint tools. (#165) 2016-06-10 23:00:47 +01:00
Miek Gieben
a1e6cb7cf4 middleware/etcd: Use the correct endpoint
The endpoint for etcd as wrongly set if a proxy was configured.
Clean up some documentation in the process as well.
2016-04-19 12:52:05 +00:00
Miek Gieben
31ce53f514 better (#104) 2016-04-11 10:22:27 +01:00
Miek Gieben
4829b40efa Rename middleware/testing (#103)
Rename to test and name the toplevel tests dir to test for consitency.
2016-04-11 07:56:38 +01:00
Miek Gieben
0ea2a6088d Add TestServer (#102)
Add a fullblown testing server. This allows us to do integration tests.

Also add a basic proxy test. Further tests will test etcd proxy
and stub zone communication and other "wildish" configurations.
Redo the server startup, so we can access the ports it listens on when
it has started up (with dns.ActivateAndServer).

Extend the .travis file to download etcd and test for that as well.

Put integration tests in test dir
2016-04-10 18:50:11 +01:00
Miek Gieben
84dfdab584 Cache elements of State
Cache the size and the do bit whenever someone asked for it. We can

probably add more:



PASS

BenchmarkStateDo-4  	100000000	        11.9 ns/op

BenchmarkStateSize-4	 5000000	       265 ns/op

ok  	github.com/miekg/coredns/middleware	2.828s



PASS

BenchmarkStateDo-4  	1000000000	         2.86 ns/op

BenchmarkStateSize-4	500000000	         3.10 ns/op

ok  	github.com/miekg/coredns/middleware	5.032s



This PR also includes some testing cleanups as well.
2016-04-04 08:19:06 +01:00
Miek Gieben
48f7d55f27 Get positive dnssec stuff going 2016-03-30 13:25:45 +00:00
Miek Gieben
6eae17b0bd Add testing package
This already includes a bunch of helper functions that aid in testing.
Factor out etcd and file testing to use this package.

Fixes: #50
2016-03-28 10:49:28 +01:00
Miek Gieben
e8982dc99c Add tests for multi zone support
Working as intended and now tested.
2016-03-25 16:24:43 +00:00