* 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
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.
* 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
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
* 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.
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.
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.
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
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.