aboutsummaryrefslogtreecommitdiff
path: root/plugin/loop/setup_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-07-20 19:45:17 +0100
committerGravatar GitHub <noreply@github.com> 2018-07-20 19:45:17 +0100
commit84ec780ffcf7f4712184803c5ede2473957f0b66 (patch)
treef985e6da00800c03862feb3cae7279ab497ad01e /plugin/loop/setup_test.go
parent547f15546563c9d8bb520218cd3c9161394d9d20 (diff)
downloadcoredns-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.go19
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")
+ }
+}