diff options
author | 2019-04-01 14:28:01 +0800 | |
---|---|---|
committer | 2019-04-01 07:28:01 +0100 | |
commit | cb96ab9f4fe8e4c7a99cdd2a7f7af315f98231a9 (patch) | |
tree | 685a047089ad4554751e0747cd37650eec3e8ecc /plugin/auto/setup_test.go | |
parent | 99c3d065bcfe9172ac86d9e18639e4a574707514 (diff) | |
download | coredns-cb96ab9f4fe8e4c7a99cdd2a7f7af315f98231a9.tar.gz coredns-cb96ab9f4fe8e4c7a99cdd2a7f7af315f98231a9.tar.zst coredns-cb96ab9f4fe8e4c7a99cdd2a7f7af315f98231a9.zip |
Fully deprecate TIMEOUT and NO_RELOAD (#2742)
* Fully deprecate NO_RELOAD
Signed-off-by: Xiao An <hac@zju.edu.cn>
* Fully deprecate TIMEOUT
Signed-off-by: Xiao An <hac@zju.edu.cn>
* Update CI tests to adapt to the deprecation of TIMEOUT
Signed-off-by: Xiao An <hac@zju.edu.cn>
* Add documents for directive transfer in plugin auto
Signed-off-by: Xiao An <hac@zju.edu.cn>
Diffstat (limited to 'plugin/auto/setup_test.go')
-rw-r--r-- | plugin/auto/setup_test.go | 67 |
1 files changed, 25 insertions, 42 deletions
diff --git a/plugin/auto/setup_test.go b/plugin/auto/setup_test.go index bc6b94f37..3ea50eb99 100644 --- a/plugin/auto/setup_test.go +++ b/plugin/auto/setup_test.go @@ -15,7 +15,6 @@ func TestAutoParse(t *testing.T) { expectedTempl string expectedRe string expectedReloadInterval time.Duration - expectedDuration time.Duration expectedTo []string }{ { @@ -23,46 +22,33 @@ func TestAutoParse(t *testing.T) { directory /tmp transfer to 127.0.0.1 }`, - false, "/tmp", "${1}", `db\.(.*)`, 60 * time.Second, 60 * time.Second, []string{"127.0.0.1:53"}, + false, "/tmp", "${1}", `db\.(.*)`, 60 * time.Second, []string{"127.0.0.1:53"}, }, { `auto 10.0.0.0/24 { directory /tmp }`, - false, "/tmp", "${1}", `db\.(.*)`, 60 * time.Second, 60 * time.Second, nil, + false, "/tmp", "${1}", `db\.(.*)`, 60 * time.Second, nil, }, { `auto { directory /tmp - no_reload + reload 0 }`, - false, "/tmp", "${1}", `db\.(.*)`, 0 * time.Second, 0 * time.Second, nil, + false, "/tmp", "${1}", `db\.(.*)`, 0 * time.Second, nil, }, { `auto { directory /tmp (.*) bliep }`, - false, "/tmp", "bliep", `(.*)`, 60 * time.Second, 60 * time.Second, nil, - }, - { - `auto { - directory /tmp (.*) bliep 10 - }`, - false, "/tmp", "bliep", `(.*)`, 10 * time.Second, 10 * time.Second, nil, + false, "/tmp", "bliep", `(.*)`, 60 * time.Second, nil, }, { `auto { directory /tmp (.*) bliep reload 10s }`, - false, "/tmp", "bliep", `(.*)`, 10 * time.Second, 10 * time.Second, nil, - }, - { - `auto { - directory /tmp (.*) bliep 20 - reload 10s - }`, - false, "/tmp", "bliep", `(.*)`, 10 * time.Second, 20 * time.Second, nil, + false, "/tmp", "bliep", `(.*)`, 10 * time.Second, nil, }, { `auto { @@ -71,44 +57,44 @@ func TestAutoParse(t *testing.T) { transfer to 127.0.0.2 upstream 8.8.8.8 }`, - false, "/tmp", "bliep", `(.*)`, 60 * time.Second, 60 * time.Second, []string{"127.0.0.1:53", "127.0.0.2:53"}, + false, "/tmp", "bliep", `(.*)`, 60 * time.Second, []string{"127.0.0.1:53", "127.0.0.2:53"}, }, // errors + // NO_RELOAD has been deprecated. { - `auto example.org { - directory - }`, - true, "", "${1}", `db\.(.*)`, 60 * time.Second, 60 * time.Second, nil, - }, - { - `auto example.org { - directory /tmp * {1} + `auto { + directory /tmp + no_reload }`, - true, "", "${1}", ``, 60 * time.Second, 60 * time.Second, nil, + true, "/tmp", "${1}", `db\.(.*)`, 0 * time.Second, nil, }, + // TIMEOUT has been deprecated. { - `auto example.org { - directory /tmp * {1} aa + `auto { + directory /tmp (.*) bliep 10 }`, - true, "", "${1}", ``, 60 * time.Second, 60 * time.Second, nil, + true, "/tmp", "bliep", `(.*)`, 10 * time.Second, nil, }, + // no directory specified. { `auto example.org { - directory /tmp .* {1} + directory }`, - true, "", "${1}", ``, 60 * time.Second, 60 * time.Second, nil, + true, "", "${1}", `db\.(.*)`, 60 * time.Second, nil, }, + // illegal REGEXP. { `auto example.org { - directory /tmp .* {1} + directory /tmp * {1} }`, - true, "", "${1}", ``, 60 * time.Second, 60 * time.Second, nil, + true, "/tmp", "${1}", ``, 60 * time.Second, nil, }, + // unexpected argument. { `auto example.org { - directory /tmp .* {1} + directory /tmp (.*) {1} aa }`, - true, "", "${1}", ``, 60 * time.Second, 60 * time.Second, nil, + true, "/tmp", "${1}", ``, 60 * time.Second, nil, }, } @@ -133,9 +119,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 a.loader.duration != test.expectedDuration { - t.Fatalf("Test %d expected %v, got %v", i, test.expectedDuration, a.loader.duration) - } if test.expectedTo != nil { for j, got := range a.loader.transferTo { if got != test.expectedTo[j] { |