Skip to content

Commit

Permalink
add: test case for ordering base on value
Browse files Browse the repository at this point in the history
  • Loading branch information
armandpicard committed Nov 10, 2024
1 parent 5030cd2 commit 547a5fe
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions controllers/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,61 @@ func TestNodeSelectorMerge(t *testing.T) {
},
expected: []corev1.NodeSelectorTerm{},
},
{
tname: "testordersamekey",
policies: []sriovnetworkv1.SriovNetworkNodePolicy{
{
Spec: sriovnetworkv1.SriovNetworkNodePolicySpec{
NodeSelector: map[string]string{
"env": "production",
},
},
},
{
Spec: sriovnetworkv1.SriovNetworkNodePolicySpec{
NodeSelector: map[string]string{
"env": "staging",
},
},
},
{
Spec: sriovnetworkv1.SriovNetworkNodePolicySpec{
NodeSelector: map[string]string{
"env": "dev",
},
},
},
},
expected: []corev1.NodeSelectorTerm{
{
MatchExpressions: []corev1.NodeSelectorRequirement{
{
Operator: corev1.NodeSelectorOpIn,
Key: "env",
Values: []string{"dev"},
},
},
},
{
MatchExpressions: []corev1.NodeSelectorRequirement{
{
Operator: corev1.NodeSelectorOpIn,
Key: "env",
Values: []string{"production"},
},
},
},
{
MatchExpressions: []corev1.NodeSelectorRequirement{
{
Operator: corev1.NodeSelectorOpIn,
Key: "env",
Values: []string{"staging"},
},
},
},
},
},
}

for _, tc := range table {
Expand Down

0 comments on commit 547a5fe

Please sign in to comment.