mirror of
https://github.com/coredns/coredns.git
synced 2025-11-15 00:12:16 -05:00
mw/autopath: integration test with erratic (#930)
Add integration test with erratic. For this erratic now also returns an autopath searchpath. This tests the whole chain; i.e registring a searchfunction and calling that from autopath. This tests does a autopathing domain and a non-autopathing one.
This commit is contained in:
@@ -7,6 +7,9 @@ The *erratic* middleware will respond to every A or AAAA query. For any other ty
|
||||
a SERVFAIL response. The reply for A will return 192.0.2.53 (see RFC 5737), for AAAA it returns
|
||||
2001:DB8::53 (see RFC 3849).
|
||||
|
||||
*erratic* can also be used in conjunction with the *autopath* middleware. This is mostly to aid in
|
||||
testing.
|
||||
|
||||
## Syntax
|
||||
|
||||
~~~ txt
|
||||
|
||||
8
middleware/erratic/autopath.go
Normal file
8
middleware/erratic/autopath.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package erratic
|
||||
|
||||
import "github.com/coredns/coredns/request"
|
||||
|
||||
// AutoPath implements the AutoPathFunc call from the autopath middleware.
|
||||
func (e *Erratic) AutoPath(state request.Request) []string {
|
||||
return []string{"a.example.org.", "b.example.org.", ""}
|
||||
}
|
||||
@@ -28,6 +28,9 @@ func setupErratic(c *caddy.Controller) error {
|
||||
return e
|
||||
})
|
||||
|
||||
// Also register erratic for use in autopath.
|
||||
dnsserver.GetConfig(c).RegisterHandler(e)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user