mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-30 19:54:46 +00:00
apis/nfd: add more tests for templates
test that NodeFeatureRule templates work with empty MatchFeatures, but with MatchAny. this test would fail, higligting an issue which is fixed in next commit. see #864. Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
This commit is contained in:
parent
da3eed5101
commit
4375e08e39
1 changed files with 10 additions and 0 deletions
|
@ -297,6 +297,11 @@ var-2=
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test with empty MatchFeatures, but with MatchAny
|
||||||
|
r3 := r1.DeepCopy()
|
||||||
|
r3.MatchAny = []MatchAnyElem{{MatchFeatures: r3.MatchFeatures}}
|
||||||
|
r3.MatchFeatures = nil
|
||||||
|
|
||||||
expectedLabels := map[string]string{
|
expectedLabels := map[string]string{
|
||||||
"label-1": "label-val-1",
|
"label-1": "label-val-1",
|
||||||
"label-2": "",
|
"label-2": "",
|
||||||
|
@ -325,6 +330,11 @@ var-2=
|
||||||
assert.Equal(t, expectedLabels, m.Labels, "instances should have matched")
|
assert.Equal(t, expectedLabels, m.Labels, "instances should have matched")
|
||||||
assert.Equal(t, expectedVars, m.Vars, "instances should have matched")
|
assert.Equal(t, expectedVars, m.Vars, "instances should have matched")
|
||||||
|
|
||||||
|
m, err = r3.Execute(f)
|
||||||
|
assert.Nilf(t, err, "unexpected error: %v", err)
|
||||||
|
assert.Equal(t, expectedLabels, m.Labels, "instances should have matched")
|
||||||
|
assert.Equal(t, expectedVars, m.Vars, "instances should have matched")
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test error cases
|
// Test error cases
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Reference in a new issue