@@ -311,6 +311,86 @@ func TestNodeValidator(t *testing.T) {
311311 assertOutput (ctx , spec , expectedOutput )
312312 })
313313
314+ Convey ("That contains matchAny and matchFeatures in one spec" , func () {
315+ spec := buildDefaultSpec ([]v1alpha1.Rule {
316+ {
317+ Name : "fake_6" ,
318+ MatchAny : []v1alpha1.MatchAnyElem {
319+ {
320+ MatchFeatures : v1alpha1.FeatureMatcher {
321+ {
322+ Feature : "fake.instance" ,
323+ MatchExpressions : & v1alpha1.MatchExpressionSet {
324+ "name" : & v1alpha1.MatchExpression {Op : v1alpha1 .MatchIn , Value : v1alpha1.MatchValue {"instance_1" }},
325+ },
326+ },
327+ },
328+ },
329+ {
330+ MatchFeatures : v1alpha1.FeatureMatcher {
331+ {
332+ Feature : "fake.instance" ,
333+ MatchExpressions : & v1alpha1.MatchExpressionSet {
334+ "name" : & v1alpha1.MatchExpression {Op : v1alpha1 .MatchIn , Value : v1alpha1.MatchValue {"instance_unknown" }},
335+ },
336+ },
337+ },
338+ },
339+ },
340+ MatchFeatures : v1alpha1.FeatureMatcher {
341+ {
342+ Feature : "fake.attribute" ,
343+ MatchExpressions : & v1alpha1.MatchExpressionSet {
344+ "attr_1" : & v1alpha1.MatchExpression {Op : v1alpha1 .MatchIn , Value : v1alpha1.MatchValue {"true" }},
345+ },
346+ },
347+ },
348+ },
349+ })
350+
351+ expectedOutput := buildDefaultExpectedOutput ([]ProcessedRuleStatus {
352+ {
353+ Name : "fake_6" ,
354+ IsMatch : true ,
355+ MatchedAny : []MatchAnyElem {
356+ {
357+ MatchedExpressions : []MatchedExpression {
358+ {
359+ Feature : "fake.instance" ,
360+ Name : "name" ,
361+ Expression : & v1alpha1.MatchExpression {Op : v1alpha1 .MatchIn , Value : v1alpha1.MatchValue {"instance_1" }},
362+ MatcherType : MatchExpressionType ,
363+ IsMatch : true ,
364+ },
365+ },
366+ },
367+ {
368+ MatchedExpressions : []MatchedExpression {
369+ {
370+ Feature : "fake.instance" ,
371+ Name : "name" ,
372+ Expression : & v1alpha1.MatchExpression {Op : v1alpha1 .MatchIn , Value : v1alpha1.MatchValue {"instance_unknown" }},
373+ MatcherType : MatchExpressionType ,
374+ IsMatch : false ,
375+ },
376+ },
377+ },
378+ },
379+ MatchedExpressions : []MatchedExpression {
380+ {
381+ Feature : "fake.attribute" ,
382+ Name : "attr_1" ,
383+ Expression : & v1alpha1.MatchExpression {Op : v1alpha1 .MatchIn , Value : v1alpha1.MatchValue {"true" }},
384+ MatcherType : MatchExpressionType ,
385+ IsMatch : true ,
386+ },
387+ },
388+ },
389+ })
390+
391+ assertOutput (ctx , spec , expectedOutput )
392+ })
393+
314394 })
315395
316396 Convey ("With multiple compatibility sets" , t , func () {
0 commit comments