Skip to content

Commit 6e4bff6

Browse files
committed
Add node label matcher test
Signed-off-by: Markus Blaschke <[email protected]>
1 parent f871df7 commit 6e4bff6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

config/config_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,25 @@ func Test_NodeRegexp(t *testing.T) {
7272
t.Error("Expected not matching, but matching node")
7373
}
7474
}
75+
76+
77+
func Test_NodeLabelMatcher(t *testing.T) {
78+
node := buildNode()
79+
80+
pool := PoolConfig{
81+
Name: "testing",
82+
Selector: []PoolConfigSelector{
83+
{
84+
Path: "{.metadata.labels.node\\.kubernetes\\.io/role}",
85+
Match: stringPtr("worker"),
86+
},
87+
},
88+
}
89+
matching, err := pool.IsMatchingNode(node)
90+
if err != nil {
91+
t.Errorf("Unexpected error: %v", err)
92+
}
93+
if !matching {
94+
t.Error("Expected matching, but not matching node")
95+
}
96+
}

0 commit comments

Comments
 (0)