@@ -38,6 +38,7 @@ func TestOperatorResolver(t *testing.T) {
3838 "olm.package" : "{\" packageName\" :\" packageA\" ,\" version\" :\" 2.0.0\" }" ,
3939 }),
4040 }
41+
4142 testEntitySource := input .NewCacheQuerier (testEntityCache )
4243
4344 testResource := []client.Object {
@@ -64,14 +65,19 @@ func TestOperatorResolver(t *testing.T) {
6465 Client client.Client
6566 EntitySource input.EntitySource
6667 SelectedVariableCnt int
68+ SelectedVariables []deppy.Identifier
6769 ExpectedError error
6870 }{
6971 {
7072 Name : "should resolve the packages described by the available Operator resources" ,
7173 Client : FakeClient (testResource ... ),
7274 EntitySource : testEntitySource ,
7375 SelectedVariableCnt : 4 ,
74- ExpectedError : nil ,
76+ SelectedVariables : []deppy.Identifier {"operatorhub/packageA/2.0.0" ,
77+ "operatorhub/prometheus/0.47.0" ,
78+ "required package packageA" ,
79+ "required package prometheus" },
80+ ExpectedError : nil ,
7581 },
7682 {
7783 Name : "should not return an error if there are no Operator resources" ,
@@ -104,12 +110,8 @@ func TestOperatorResolver(t *testing.T) {
104110 assert .Nil (t , solution )
105111 } else {
106112 assert .Len (t , solution .SelectedVariables (), tt .SelectedVariableCnt )
107- if len (solution .SelectedVariables ()) == 4 {
108- assert .True (t , solution .IsSelected ("operatorhub/packageA/2.0.0" ))
109- assert .True (t , solution .IsSelected ("operatorhub/prometheus/0.47.0" ))
110- assert .True (t , solution .IsSelected ("required package packageA" ))
111- assert .True (t , solution .IsSelected ("required package prometheus" ))
112- assert .False (t , solution .IsSelected ("operatorhub/prometheus/0.37.0" ))
113+ for _ , identifier := range tt .SelectedVariables {
114+ assert .True (t , solution .IsSelected (identifier ))
113115 }
114116 assert .NoError (t , err )
115117 }
0 commit comments