@@ -99,40 +99,6 @@ func TestNamespaceResolver(t *testing.T) {
99
99
},
100
100
},
101
101
{
102
- << << << < HEAD
103
- == == == =
104
- name : "SingleNewSubscription/ResolveOne/BundlePath" ,
105
- clusterState : []runtime.Object {
106
- newSub (namespace , "a" , "alpha" , catalog ),
107
- },
108
- querier : NewFakeSourceQuerier (map [CatalogKey ][]* api.Bundle {
109
- catalog : {
110
- bundle ("a.v1" , "a" , "alpha" , "" , nil , Requires1 , nil , nil ),
111
- stripManifests (withBundlePath (bundle ("b.v1" , "b" , "beta" , "" , Provides1 , nil , nil , nil ), "quay.io/test/bundle@sha256:abcd" )),
112
- },
113
- }),
114
- out : out {
115
- steps : [][]* v1alpha1.Step {
116
- bundleSteps (bundle ("a.v1" , "a" , "alpha" , "" , nil , Requires1 , nil , nil ), namespace , "" , catalog ),
117
- subSteps (namespace , "b.v1" , "b" , "beta" , catalog ),
118
- },
119
- lookups : []v1alpha1.BundleLookup {
120
- {
121
- Path : "quay.io/test/bundle@sha256:abcd" ,
122
- Identifier : "b.v1" ,
123
- CatalogSourceRef : & corev1.ObjectReference {
124
- Namespace : catalog .Namespace ,
125
- Name : catalog .Name ,
126
- },
127
- },
128
- },
129
- subs : []* v1alpha1.Subscription {
130
- updatedSub (namespace , "a.v1" , "a" , "alpha" , catalog ),
131
- },
132
- },
133
- },
134
- {
135
- >> >> >> > fa4b13b9 ... Fix Operator Generation code
136
102
name : "SingleNewSubscription/ResolveOne/AdditionalBundleObjects" ,
137
103
clusterState : []runtime.Object {
138
104
newSub (namespace , "a" , "alpha" , catalog ),
@@ -223,34 +189,6 @@ func TestNamespaceResolver(t *testing.T) {
223
189
},
224
190
},
225
191
{
226
- << << << < HEAD
227
- == == == =
228
- name : "InstalledSub/UpdateAvailable/FromBundlePath" ,
229
- clusterState : []runtime.Object {
230
- existingSub (namespace , "a.v1" , "a" , "alpha" , catalog ),
231
- existingOperator (namespace , "a.v1" , "a" , "alpha" , "" , Provides1 , nil , nil , nil ),
232
- },
233
- querier : NewFakeSourceQuerierCustomReplacement (catalog , stripManifests (withBundlePath (bundle ("a.v2" , "a" , "alpha" , "a.v1" , Provides1 , nil , nil , nil ), "quay.io/test/bundle@sha256:abcd" ))),
234
- out : out {
235
- steps : [][]* v1alpha1.Step {},
236
- lookups : []v1alpha1.BundleLookup {
237
- {
238
- Path : "quay.io/test/bundle@sha256:abcd" ,
239
- Identifier : "a.v2" ,
240
- Replaces : "a.v1" ,
241
- CatalogSourceRef : & corev1.ObjectReference {
242
- Namespace : catalog .Namespace ,
243
- Name : catalog .Name ,
244
- },
245
- },
246
- },
247
- subs : []* v1alpha1.Subscription {
248
- updatedSub (namespace , "a.v2" , "a" , "alpha" , catalog ),
249
- },
250
- },
251
- },
252
- {
253
- >> >> >> > fa4b13b9 ... Fix Operator Generation code
254
192
name : "InstalledSub/NoRunningOperator" ,
255
193
clusterState : []runtime.Object {
256
194
existingSub (namespace , "a.v1" , "a" , "alpha" , catalog ),
@@ -411,6 +349,55 @@ func TestNamespaceResolver(t *testing.T) {
411
349
},
412
350
},
413
351
},
352
+ {
353
+ // This test verifies that ownership of an api can be migrated between two operators
354
+ name : "OwnedAPITransfer" ,
355
+ clusterState : []runtime.Object {
356
+ existingSub (namespace , "a.v1" , "a" , "alpha" , catalog ),
357
+ existingOperator (namespace , "a.v1" , "a" , "alpha" , "" , Provides1 , nil , nil , nil ),
358
+ existingSub (namespace , "b.v1" , "b" , "alpha" , catalog ),
359
+ existingOperator (namespace , "b.v1" , "b" , "alpha" , "" , nil , Requires1 , nil , nil ),
360
+ },
361
+ querier : NewFakeSourceQuerier (map [CatalogKey ][]* api.Bundle {
362
+ catalog : {
363
+ bundle ("a.v2" , "a" , "alpha" , "a.v1" , nil , nil , nil , nil ),
364
+ bundle ("b.v2" , "b" , "alpha" , "b.v1" , Provides1 , nil , nil , nil ),
365
+ },
366
+ }),
367
+ out : out {
368
+ steps : [][]* v1alpha1.Step {
369
+ bundleSteps (bundle ("a.v2" , "a" , "alpha" , "a.v1" , nil , nil , nil , nil ), namespace , "" , catalog ),
370
+ bundleSteps (bundle ("b.v2" , "b" , "alpha" , "b.v1" , Provides1 , nil , nil , nil ), namespace , "" , catalog ),
371
+ },
372
+ subs : []* v1alpha1.Subscription {
373
+ updatedSub (namespace , "a.v2" , "a" , "alpha" , catalog ),
374
+ updatedSub (namespace , "b.v2" , "b" , "alpha" , catalog ),
375
+ },
376
+ },
377
+ },
378
+ {
379
+ name : "PicksOlderProvider" ,
380
+ clusterState : []runtime.Object {
381
+ newSub (namespace , "b" , "alpha" , catalog ),
382
+ },
383
+ querier : NewFakeSourceQuerier (map [CatalogKey ][]* api.Bundle {
384
+ catalog : {
385
+ bundle ("a.v1" , "a" , "alpha" , "" , Provides1 , nil , nil , nil ),
386
+ bundle ("a.v2" , "a" , "alpha" , "a.v1" , nil , nil , nil , nil ),
387
+ bundle ("b.v1" , "b" , "alpha" , "" , nil , Requires1 , nil , nil ),
388
+ },
389
+ }),
390
+ out : out {
391
+ steps : [][]* v1alpha1.Step {
392
+ bundleSteps (bundle ("a.v1" , "a" , "alpha" , "" , Provides1 , nil , nil , nil ), namespace , "" , catalog ),
393
+ bundleSteps (bundle ("b.v1" , "b" , "alpha" , "" , nil , Requires1 , nil , nil ), namespace , "" , catalog ),
394
+ subSteps (namespace , "a.v1" , "a" , "alpha" , catalog ),
395
+ },
396
+ subs : []* v1alpha1.Subscription {
397
+ updatedSub (namespace , "b.v1" , "b" , "alpha" , catalog ),
398
+ },
399
+ },
400
+ },
414
401
{
415
402
name : "InstalledSub/UpdateInHead/SkipRange" ,
416
403
clusterState : []runtime.Object {
0 commit comments