Skip to content

Commit

Permalink
test(e2e): testing CRD upgrades shouldn't create a new subscription
Browse files Browse the repository at this point in the history
instead, updates should be simulated  - in this case, by switching
to a channel that contains an update.
  • Loading branch information
ecordell committed Nov 6, 2019
1 parent 78f8192 commit 5ec7830
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test/e2e/installplan_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,8 +961,8 @@ func TestInstallPlanWithCRDSchemaChange(t *testing.T) {
require.NoError(t, err)

subscriptionName := genName("sub-nginx-alpha-")
// this subscription will be cleaned up below without the clean up function
createSubscriptionForCatalog(t, crc, testNamespace, subscriptionName, mainCatalogSourceName, mainPackageName, stableChannel, "", v1alpha1.ApprovalAutomatic)
cleanupSubscription := createSubscriptionForCatalog(t, crc, testNamespace, subscriptionName, mainCatalogSourceName, mainPackageName, stableChannel, "", v1alpha1.ApprovalAutomatic)
defer cleanupSubscription()

subscription, err := fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
require.NoError(t, err)
Expand Down Expand Up @@ -1009,15 +1009,18 @@ func TestInstallPlanWithCRDSchemaChange(t *testing.T) {
// Attempt to get the catalog source before creating install plan(s)
_, err = fetchCatalogSource(t, crc, mainCatalogSourceName, testNamespace, catalogSourceRegistryPodSynced)
require.NoError(t, err)

// Update the subscription resource to point to the beta CSV
err = crc.OperatorsV1alpha1().Subscriptions(testNamespace).DeleteCollection(metav1.NewDeleteOptions(0), metav1.ListOptions{})
subscription, err = fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
require.NoError(t, err)
require.NotNil(t, subscription)

// existing cleanup should remove this
subscriptionName = genName("sub-nginx-beta")
createSubscriptionForCatalog(t, crc, testNamespace, subscriptionName, mainCatalogSourceName, mainPackageName, betaChannel, "", v1alpha1.ApprovalAutomatic)
subscription.Spec.Channel = betaChannel
subscription, err = crc.OperatorsV1alpha1().Subscriptions(testNamespace).Update(subscription)
require.NoError(t, err)

subscription, err = fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
// Wait for subscription to have a new installplan
subscription, err = fetchSubscription(t, crc, testNamespace, subscriptionName, subscriptionHasInstallPlanDifferentChecker(fetchedInstallPlan.GetName()))
require.NoError(t, err)
require.NotNil(t, subscription)

Expand Down

0 comments on commit 5ec7830

Please sign in to comment.