aboutsummaryrefslogtreecommitdiff
path: root/plugin/auto/setup_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/auto/setup_test.go')
-rw-r--r--plugin/auto/setup_test.go47
1 files changed, 19 insertions, 28 deletions
diff --git a/plugin/auto/setup_test.go b/plugin/auto/setup_test.go
index 528dce23b..ff3a7c396 100644
--- a/plugin/auto/setup_test.go
+++ b/plugin/auto/setup_test.go
@@ -15,48 +15,38 @@ func TestAutoParse(t *testing.T) {
expectedTempl string
expectedRe string
expectedReloadInterval time.Duration
- expectedTo []string
}{
{
`auto example.org {
directory /tmp
- transfer to 127.0.0.1
}`,
- false, "/tmp", "${1}", `db\.(.*)`, 60 * time.Second, []string{"127.0.0.1:53"},
+ false, "/tmp", "${1}", `db\.(.*)`, 60 * time.Second,
},
{
`auto 10.0.0.0/24 {
directory /tmp
}`,
- false, "/tmp", "${1}", `db\.(.*)`, 60 * time.Second, nil,
+ false, "/tmp", "${1}", `db\.(.*)`, 60 * time.Second,
},
{
`auto {
directory /tmp
reload 0
}`,
- false, "/tmp", "${1}", `db\.(.*)`, 0 * time.Second, nil,
+ false, "/tmp", "${1}", `db\.(.*)`, 0 * time.Second,
},
{
`auto {
directory /tmp (.*) bliep
}`,
- false, "/tmp", "bliep", `(.*)`, 60 * time.Second, nil,
+ false, "/tmp", "bliep", `(.*)`, 60 * time.Second,
},
{
`auto {
directory /tmp (.*) bliep
reload 10s
}`,
- false, "/tmp", "bliep", `(.*)`, 10 * time.Second, nil,
- },
- {
- `auto {
- directory /tmp (.*) bliep
- transfer to 127.0.0.1
- transfer to 127.0.0.2
- }`,
- false, "/tmp", "bliep", `(.*)`, 60 * time.Second, []string{"127.0.0.1:53", "127.0.0.2:53"},
+ false, "/tmp", "bliep", `(.*)`, 10 * time.Second,
},
// errors
// NO_RELOAD has been deprecated.
@@ -65,42 +55,50 @@ func TestAutoParse(t *testing.T) {
directory /tmp
no_reload
}`,
- true, "/tmp", "${1}", `db\.(.*)`, 0 * time.Second, nil,
+ true, "/tmp", "${1}", `db\.(.*)`, 0 * time.Second,
},
// TIMEOUT has been deprecated.
{
`auto {
directory /tmp (.*) bliep 10
}`,
- true, "/tmp", "bliep", `(.*)`, 10 * time.Second, nil,
+ true, "/tmp", "bliep", `(.*)`, 10 * time.Second,
+ },
+ // TRANSFER has been deprecated.
+ {
+ `auto {
+ directory /tmp (.*) bliep 10
+ transfer to 127.0.0.1
+ }`,
+ true, "/tmp", "bliep", `(.*)`, 10 * time.Second,
},
// no template specified.
{
`auto {
directory /tmp (.*)
}`,
- true, "/tmp", "", `(.*)`, 60 * time.Second, nil,
+ true, "/tmp", "", `(.*)`, 60 * time.Second,
},
// no directory specified.
{
`auto example.org {
directory
}`,
- true, "", "${1}", `db\.(.*)`, 60 * time.Second, nil,
+ true, "", "${1}", `db\.(.*)`, 60 * time.Second,
},
// illegal REGEXP.
{
`auto example.org {
directory /tmp * {1}
}`,
- true, "/tmp", "${1}", ``, 60 * time.Second, nil,
+ true, "/tmp", "${1}", ``, 60 * time.Second,
},
// unexpected argument.
{
`auto example.org {
directory /tmp (.*) {1} aa
}`,
- true, "/tmp", "${1}", ``, 60 * time.Second, nil,
+ true, "/tmp", "${1}", ``, 60 * time.Second,
},
}
@@ -125,13 +123,6 @@ func TestAutoParse(t *testing.T) {
if a.loader.ReloadInterval != test.expectedReloadInterval {
t.Fatalf("Test %d expected %v, got %v", i, test.expectedReloadInterval, a.loader.ReloadInterval)
}
- 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)
- }
- }
- }
}
}
}