From 84ec780ffcf7f4712184803c5ede2473957f0b66 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 20 Jul 2018 19:45:17 +0100 Subject: 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 --- plugin/loop/loop_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugin/loop/loop_test.go (limited to 'plugin/loop/loop_test.go') 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()) + } +} -- cgit v1.2.3