summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/agent/vnodes/vnodes_test.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/go/collectors/go.d.plugin/agent/vnodes/vnodes_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/agent/vnodes/vnodes_test.go b/src/go/collectors/go.d.plugin/agent/vnodes/vnodes_test.go
new file mode 100644
index 000000000..fc2c2ef35
--- /dev/null
+++ b/src/go/collectors/go.d.plugin/agent/vnodes/vnodes_test.go
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package vnodes
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestNew(t *testing.T) {
+ assert.NotNil(t, New("testdata"))
+ assert.NotNil(t, New("not_exist"))
+}
+
+func TestVnodes_Lookup(t *testing.T) {
+ req := New("testdata")
+
+ _, ok := req.Lookup("first")
+ assert.True(t, ok)
+
+ _, ok = req.Lookup("second")
+ assert.True(t, ok)
+
+ _, ok = req.Lookup("third")
+ assert.False(t, ok)
+}