@@ -2131,6 +2131,73 @@ var _ = Describe("Subscription", func() {
2131
2131
}).ShouldNot (Succeed ())
2132
2132
})
2133
2133
})
2134
+
2135
+ When ("there exists a Subscription to an operator having dependency candidates in both default and nondefault channels" , func () {
2136
+ var (
2137
+ teardown func ()
2138
+ )
2139
+
2140
+ BeforeEach (func () {
2141
+ teardown = func () {}
2142
+
2143
+ packages := []registry.PackageManifest {
2144
+ {
2145
+ PackageName : "dependency" ,
2146
+ Channels : []registry.PackageChannel {
2147
+ {Name : "default" , CurrentCSVName : "csv-dependency" },
2148
+ {Name : "nondefault" , CurrentCSVName : "csv-dependency" },
2149
+ },
2150
+ DefaultChannelName : "default" ,
2151
+ },
2152
+ {
2153
+ PackageName : "root" ,
2154
+ Channels : []registry.PackageChannel {
2155
+ {Name : "unimportant" , CurrentCSVName : "csv-root" },
2156
+ },
2157
+ DefaultChannelName : "unimportant" ,
2158
+ },
2159
+ }
2160
+
2161
+ crds := []apiextensions.CustomResourceDefinition {newCRD (genName ("crd-" ))}
2162
+ csvs := []operatorsv1alpha1.ClusterServiceVersion {
2163
+ newCSV ("csv-dependency" , testNamespace , "" , semver .MustParse ("1.0.0" ), crds , nil , nil ),
2164
+ newCSV ("csv-root" , testNamespace , "" , semver .MustParse ("1.0.0" ), nil , crds , nil ),
2165
+ }
2166
+
2167
+ _ , teardown = createInternalCatalogSource (ctx .Ctx ().KubeClient (), ctx .Ctx ().OperatorClient (), "test-catalog" , testNamespace , packages , crds , csvs )
2168
+
2169
+ createSubscriptionForCatalog (ctx .Ctx ().OperatorClient (), testNamespace , "test-subscription" , "test-catalog" , "root" , "unimportant" , "" , operatorsv1alpha1 .ApprovalAutomatic )
2170
+ })
2171
+
2172
+ AfterEach (func () {
2173
+ teardown ()
2174
+ })
2175
+
2176
+ It ("should create a Subscription using the candidate's default channel" , func () {
2177
+ Eventually (func () ([]operatorsv1alpha1.Subscription , error ) {
2178
+ var list operatorsv1alpha1.SubscriptionList
2179
+ if err := ctx .Ctx ().Client ().List (context .TODO (), & list ); err != nil {
2180
+ return nil , err
2181
+ }
2182
+ return list .Items , nil
2183
+ }).Should (ContainElement (WithTransform (
2184
+ func (in operatorsv1alpha1.Subscription ) operatorsv1alpha1.SubscriptionSpec {
2185
+ return operatorsv1alpha1.SubscriptionSpec {
2186
+ CatalogSource : in .Spec .CatalogSource ,
2187
+ CatalogSourceNamespace : in .Spec .CatalogSourceNamespace ,
2188
+ Package : in .Spec .Package ,
2189
+ Channel : in .Spec .Channel ,
2190
+ }
2191
+ },
2192
+ Equal (operatorsv1alpha1.SubscriptionSpec {
2193
+ CatalogSource : "test-catalog" ,
2194
+ CatalogSourceNamespace : testNamespace ,
2195
+ Package : "dependency" ,
2196
+ Channel : "default" ,
2197
+ }),
2198
+ )))
2199
+ })
2200
+ })
2134
2201
})
2135
2202
2136
2203
const (
0 commit comments