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/loop_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/loop_test.go')
-rw-r--r-- | plugin/loop/loop_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugin/loop/loop_test.go b/plugin/loop/loop_test.go new file mode 100644 index 000000000..e7a4b06bb --- /dev/null +++ b/plugin/loop/loop_test.go @@ -0,0 +1,11 @@ +package loop + +import "testing" + +func TestLoop(t *testing.T) { + l := New(".") + l.inc() + if l.seen() != 1 { + t.Errorf("Failed to inc loop, expected %d, got %d", 1, l.seen()) + } +} |