diff options
author | 2018-07-20 19:45:17 +0100 | |
---|---|---|
committer | 2018-07-20 19:45:17 +0100 | |
commit | 84ec780ffcf7f4712184803c5ede2473957f0b66 (patch) | |
tree | f985e6da00800c03862feb3cae7279ab497ad01e /plugin/loop/setup_test.go | |
parent | 547f15546563c9d8bb520218cd3c9161394d9d20 (diff) | |
download | coredns-84ec780ffcf7f4712184803c5ede2473957f0b66.tar.gz coredns-84ec780ffcf7f4712184803c5ede2473957f0b66.tar.zst coredns-84ec780ffcf7f4712184803c5ede2473957f0b66.zip |
New plugin: loop (#1989)
* New plugin: loop
Add a plugin that detects loops. It does this by sending an unique query
to our selves. If we see the query more than twice we stop the process.
If there isn't a loop, the plugin disables it self and becomes a noop
plugin.
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/loop/setup_test.go')
-rw-r--r-- | plugin/loop/setup_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugin/loop/setup_test.go b/plugin/loop/setup_test.go new file mode 100644 index 000000000..2a3c6846f --- /dev/null +++ b/plugin/loop/setup_test.go @@ -0,0 +1,19 @@ +package loop + +import ( + "testing" + + "github.com/mholt/caddy" +) + +func TestSetup(t *testing.T) { + c := caddy.NewTestController("dns", `loop`) + if err := setup(c); err != nil { + t.Fatalf("Expected no errors, but got: %v", err) + } + + c = caddy.NewTestController("dns", `loop argument`) + if err := setup(c); err == nil { + t.Fatal("Expected errors, but got none") + } +} |