Skip to content

Commit 2b343b5

Browse files
committed
test(e2e): testing CRD upgrades shouldn't create a new subscription
instead, updates should be simulated - in this case, by switching to a channel that contains an update.
1 parent 6b92879 commit 2b343b5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/e2e/installplan_e2e_test.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,8 @@ func TestInstallPlanWithCRDSchemaChange(t *testing.T) {
962962
require.NoError(t, err)
963963

964964
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()
967967

968968
subscription, err := fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
969969
require.NoError(t, err)
@@ -1010,15 +1010,18 @@ func TestInstallPlanWithCRDSchemaChange(t *testing.T) {
10101010
// Attempt to get the catalog source before creating install plan(s)
10111011
_, err = fetchCatalogSource(t, crc, mainCatalogSourceName, testNamespace, catalogSourceRegistryPodSynced)
10121012
require.NoError(t, err)
1013+
10131014
// 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)
10151016
require.NoError(t, err)
1017+
require.NotNil(t, subscription)
10161018

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)
10201022

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()))
10221025
require.NoError(t, err)
10231026
require.NotNil(t, subscription)
10241027

0 commit comments

Comments
 (0)