mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
middleware/file|auto: Notifies and AXFR (#399)
Be more explicit in the logs when a notify fails. New notify error message looks like: 2016/11/07 18:21:42 [ERROR] Notify for zone "example.org." was not accepted by "8.8.8.8:53": rcode was "SERVFAIL" Correctly pick up secondaries When multiple secondary are specified make sure they are picked up. Fixes #393 #398
This commit is contained in:
@@ -13,45 +13,53 @@ func TestAutoParse(t *testing.T) {
|
||||
expectedDirectory string
|
||||
expectedTempl string
|
||||
expectedRe string
|
||||
expectedTo string
|
||||
expectedTo []string
|
||||
}{
|
||||
{
|
||||
`auto example.org {
|
||||
directory /tmp
|
||||
transfer to 127.0.0.1
|
||||
}`,
|
||||
false, "/tmp", "${1}", `db\.(.*)`, "127.0.0.1:53",
|
||||
false, "/tmp", "${1}", `db\.(.*)`, []string{"127.0.0.1:53"},
|
||||
},
|
||||
{
|
||||
`auto {
|
||||
directory /tmp
|
||||
}`,
|
||||
false, "/tmp", "${1}", `db\.(.*)`, "",
|
||||
false, "/tmp", "${1}", `db\.(.*)`, nil,
|
||||
},
|
||||
{
|
||||
`auto {
|
||||
directory /tmp (.*) bliep
|
||||
}`,
|
||||
false, "/tmp", "bliep", `(.*)`, "",
|
||||
false, "/tmp", "bliep", `(.*)`, nil,
|
||||
},
|
||||
{
|
||||
`auto {
|
||||
directory /tmp (.*) bliep
|
||||
transfer to 127.0.0.1
|
||||
transfer to 127.0.0.2
|
||||
}`,
|
||||
false, "/tmp", "bliep", `(.*)`, []string{"127.0.0.1:53", "127.0.0.2:53"},
|
||||
},
|
||||
// errors
|
||||
{
|
||||
`auto example.org {
|
||||
directory
|
||||
}`,
|
||||
true, "", "${1}", `db\.(.*)`, "",
|
||||
true, "", "${1}", `db\.(.*)`, nil,
|
||||
},
|
||||
{
|
||||
`auto example.org {
|
||||
directory /tmp * {1}
|
||||
}`,
|
||||
true, "", "${1}", ``, "",
|
||||
true, "", "${1}", ``, nil,
|
||||
},
|
||||
{
|
||||
`auto example.org {
|
||||
directory /tmp .* {1}
|
||||
}`,
|
||||
true, "", "${1}", ``, "",
|
||||
true, "", "${1}", ``, nil,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -73,8 +81,12 @@ func TestAutoParse(t *testing.T) {
|
||||
if a.loader.re.String() != test.expectedRe {
|
||||
t.Fatalf("Test %d expected %v, got %v", i, test.expectedRe, a.loader.re)
|
||||
}
|
||||
if test.expectedTo != "" && a.loader.transferTo[0] != test.expectedTo {
|
||||
t.Fatalf("Test %d expected %v, got %v", i, test.expectedTo, a.loader.transferTo[0])
|
||||
if test.expectedTo != nil {
|
||||
for j, got := range a.loader.transferTo {
|
||||
if got != test.expectedTo[j] {
|
||||
t.Fatalf("Test %d expected %v, got %v", i, test.expectedTo[j], got)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user