mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-15 04:57:56 +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
dd91b709a0
commit
18c314df68
1 changed files with 10 additions and 0 deletions
|
@ -300,6 +300,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{
|
||||
"label-1": "label-val-1",
|
||||
"label-2": "",
|
||||
|
@ -328,6 +333,11 @@ var-2=
|
|||
assert.Equal(t, expectedLabels, m.Labels, "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
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue