mirror of
https://github.com/coredns/coredns.git
synced 2026-01-10 10:51:20 -05:00
@@ -25,7 +25,7 @@ autopath.Func. Note the searchpath must be ending with the empty string.
|
||||
|
||||
I.e:
|
||||
|
||||
func (m Middleware ) AutoPath(state request.Request) []string {
|
||||
func (m Plugins ) AutoPath(state request.Request) []string {
|
||||
return []string{"first", "second", "last", ""}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -49,8 +49,8 @@ func setup(c *caddy.Controller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// allowedMiddleware has a list of plugin that can be used by autopath.
|
||||
var allowedMiddleware = map[string]bool{
|
||||
// allowedPlugins has a list of plugin that can be used by autopath.
|
||||
var allowedPlugins = map[string]bool{
|
||||
"@kubernetes": true,
|
||||
"@erratic": true,
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func autoPathParse(c *caddy.Controller) (*AutoPath, string, error) {
|
||||
}
|
||||
resolv := zoneAndresolv[len(zoneAndresolv)-1]
|
||||
if resolv[0] == '@' {
|
||||
_, ok := allowedMiddleware[resolv]
|
||||
_, ok := allowedPlugins[resolv]
|
||||
if ok {
|
||||
mw = resolv[1:]
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func TestSetupAutoPath(t *testing.T) {
|
||||
}
|
||||
|
||||
if !test.shouldErr && mw != test.expectedMw {
|
||||
t.Errorf("Test %d, Middleware not correctly set for input %s. Expected: %s, actual: %s", i, test.input, test.expectedMw, mw)
|
||||
t.Errorf("Test %d, Plugin not correctly set for input %s. Expected: %s, actual: %s", i, test.input, test.expectedMw, mw)
|
||||
}
|
||||
if !test.shouldErr && ap.search != nil {
|
||||
if !reflect.DeepEqual(test.expectedSearch, ap.search) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
// Check the ordering of returned cname.
|
||||
func TestCnameLookup(t *testing.T) {
|
||||
etc := newEtcdMiddleware()
|
||||
etc := newEtcdPlugin()
|
||||
|
||||
for _, serv := range servicesCname {
|
||||
set(t, etc, serv.Key, 0, serv)
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGroupLookup(t *testing.T) {
|
||||
etc := newEtcdMiddleware()
|
||||
etc := newEtcdPlugin()
|
||||
|
||||
for _, serv := range servicesGroup {
|
||||
set(t, etc, serv.Key, 0, serv)
|
||||
|
||||
@@ -221,7 +221,7 @@ var dnsTestCases = []test.Case{
|
||||
},
|
||||
}
|
||||
|
||||
func newEtcdMiddleware() *Etcd {
|
||||
func newEtcdPlugin() *Etcd {
|
||||
ctxt = context.TODO()
|
||||
|
||||
endpoints := []string{"http://localhost:2379"}
|
||||
@@ -253,7 +253,7 @@ func delete(t *testing.T, e *Etcd, k string) {
|
||||
}
|
||||
|
||||
func TestLookup(t *testing.T) {
|
||||
etc := newEtcdMiddleware()
|
||||
etc := newEtcdPlugin()
|
||||
for _, serv := range services {
|
||||
set(t, etc, serv.Key, 0, serv)
|
||||
defer delete(t, etc, serv.Key)
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestMultiLookup(t *testing.T) {
|
||||
etc := newEtcdMiddleware()
|
||||
etc := newEtcdPlugin()
|
||||
etc.Zones = []string{"skydns.test.", "miek.nl."}
|
||||
etc.Fallthrough = true
|
||||
etc.Next = test.ErrorHandler()
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestOtherLookup(t *testing.T) {
|
||||
etc := newEtcdMiddleware()
|
||||
etc := newEtcdPlugin()
|
||||
|
||||
for _, serv := range servicesOther {
|
||||
set(t, etc, serv.Key, 0, serv)
|
||||
|
||||
@@ -39,7 +39,7 @@ func TestStubLookup(t *testing.T) {
|
||||
exampleNetStub := &msg.Service{Host: host, Port: port, Key: "a.example.net.stub.dns.skydns.test."}
|
||||
servicesStub = append(servicesStub, exampleNetStub)
|
||||
|
||||
etc := newEtcdMiddleware()
|
||||
etc := newEtcdPlugin()
|
||||
|
||||
for _, serv := range servicesStub {
|
||||
set(t, etc, serv.Key, 0, serv)
|
||||
|
||||
@@ -37,6 +37,6 @@ func (h *health) poll() {
|
||||
h.SetOk(true)
|
||||
}
|
||||
|
||||
// Middleware that implements the Healther interface.
|
||||
// Plugins that implements the Healther interface.
|
||||
// TODO(miek): none yet.
|
||||
var healthers = map[string]bool{}
|
||||
|
||||
@@ -49,7 +49,7 @@ func setup(c *caddy.Controller) error {
|
||||
c.OnStartup(h.Startup)
|
||||
c.OnFinalShutdown(h.Shutdown)
|
||||
|
||||
// Don't do AddMiddleware, as health is not *really* a plugin just a separate webserver running.
|
||||
// Don't do AddPlugin, as health is not *really* a plugin just a separate webserver running.
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user