@@ -962,8 +962,8 @@ func TestInstallPlanWithCRDSchemaChange(t *testing.T) {
962
962
require .NoError (t , err )
963
963
964
964
subscriptionName := genName ("sub-nginx-alpha-" )
965
- // this subscription will be cleaned up below without the clean up function
966
- createSubscriptionForCatalog ( t , crc , testNamespace , subscriptionName , mainCatalogSourceName , mainPackageName , stableChannel , "" , v1alpha1 . ApprovalAutomatic )
965
+ cleanupSubscription := createSubscriptionForCatalog ( t , crc , testNamespace , subscriptionName , mainCatalogSourceName , mainPackageName , stableChannel , "" , v1alpha1 . ApprovalAutomatic )
966
+ defer cleanupSubscription ( )
967
967
968
968
subscription , err := fetchSubscription (t , crc , testNamespace , subscriptionName , subscriptionHasInstallPlanChecker )
969
969
require .NoError (t , err )
@@ -1010,15 +1010,18 @@ func TestInstallPlanWithCRDSchemaChange(t *testing.T) {
1010
1010
// Attempt to get the catalog source before creating install plan(s)
1011
1011
_ , err = fetchCatalogSource (t , crc , mainCatalogSourceName , testNamespace , catalogSourceRegistryPodSynced )
1012
1012
require .NoError (t , err )
1013
+
1013
1014
// Update the subscription resource to point to the beta CSV
1014
- err = crc . OperatorsV1alpha1 (). Subscriptions ( testNamespace ). DeleteCollection ( metav1 . NewDeleteOptions ( 0 ), metav1. ListOptions {} )
1015
+ subscription , err = fetchSubscription ( t , crc , testNamespace , subscriptionName , subscriptionHasInstallPlanChecker )
1015
1016
require .NoError (t , err )
1017
+ require .NotNil (t , subscription )
1016
1018
1017
- // existing cleanup should remove this
1018
- subscriptionName = genName ( "sub-nginx-beta" )
1019
- createSubscriptionForCatalog (t , crc , testNamespace , subscriptionName , mainCatalogSourceName , mainPackageName , betaChannel , "" , v1alpha1 . ApprovalAutomatic )
1019
+ subscription . Spec . Channel = betaChannel
1020
+ subscription , err = crc . OperatorsV1alpha1 (). Subscriptions ( testNamespace ). Update ( subscription )
1021
+ require . NoError (t , err )
1020
1022
1021
- subscription , err = fetchSubscription (t , crc , testNamespace , subscriptionName , subscriptionHasInstallPlanChecker )
1023
+ // Wait for subscription to have a new installplan
1024
+ subscription , err = fetchSubscription (t , crc , testNamespace , subscriptionName , subscriptionHasInstallPlanDifferentChecker (fetchedInstallPlan .GetName ()))
1022
1025
require .NoError (t , err )
1023
1026
require .NotNil (t , subscription )
1024
1027
0 commit comments