mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Reproducible output from expression matching
Fix flakyness of unit tests by adding back the sorting of matched
feature elements that was unadvisedly removed in
63c22551df
. This might help debugging some
corner cases in real-life scenarios (when using templating), too.
This commit is contained in:
parent
ed8898de6a
commit
f489ca98b5
1 changed files with 4 additions and 0 deletions
|
@ -308,6 +308,8 @@ func (m *MatchExpressionSet) MatchGetKeys(keys map[string]Nil) (bool, []MatchedE
|
|||
}
|
||||
ret = append(ret, MatchedElement{"Name": n})
|
||||
}
|
||||
// Sort for reproducible output
|
||||
sort.Slice(ret, func(i, j int) bool { return ret[i]["Name"] < ret[j]["Name"] })
|
||||
return true, ret, nil
|
||||
}
|
||||
|
||||
|
@ -333,6 +335,8 @@ func (m *MatchExpressionSet) MatchGetValues(values map[string]string) (bool, []M
|
|||
}
|
||||
ret = append(ret, MatchedElement{"Name": n, "Value": values[n]})
|
||||
}
|
||||
// Sort for reproducible output
|
||||
sort.Slice(ret, func(i, j int) bool { return ret[i]["Name"] < ret[j]["Name"] })
|
||||
return true, ret, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue