summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/agent/confgroup/registry_test.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/go/collectors/go.d.plugin/agent/confgroup/registry_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/agent/confgroup/registry_test.go b/src/go/collectors/go.d.plugin/agent/confgroup/registry_test.go
new file mode 100644
index 000000000..a63c0ceb1
--- /dev/null
+++ b/src/go/collectors/go.d.plugin/agent/confgroup/registry_test.go
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package confgroup
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestRegistry_Register(t *testing.T) {
+ name := "module"
+ defaults := Default{
+ MinUpdateEvery: 1,
+ UpdateEvery: 1,
+ AutoDetectionRetry: 1,
+ Priority: 1,
+ }
+ expected := Registry{
+ name: defaults,
+ }
+
+ actual := Registry{}
+ actual.Register(name, defaults)
+
+ assert.Equal(t, expected, actual)
+}
+
+func TestRegistry_Lookup(t *testing.T) {
+ name := "module"
+ expected := Default{
+ MinUpdateEvery: 1,
+ UpdateEvery: 1,
+ AutoDetectionRetry: 1,
+ Priority: 1,
+ }
+ reg := Registry{}
+ reg.Register(name, expected)
+
+ actual, ok := reg.Lookup("module")
+
+ assert.True(t, ok)
+ assert.Equal(t, expected, actual)
+}