Skip to content

Commit 9a138ed

Browse files
committed
Fix UpdateSingleExistingCRDOwner test case
Signed-off-by: Vu Dinh <[email protected]>
1 parent 54b3c81 commit 9a138ed

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

test/e2e/installplan_e2e_test.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,7 @@ var _ = Describe("Install Plan", func() {
16831683
mainPackageName := genName("nginx-update-")
16841684

16851685
mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName)
1686+
mainPackageBeta := fmt.Sprintf("%s-beta", mainPackageName)
16861687

16871688
stableChannel := "stable"
16881689

@@ -1742,6 +1743,7 @@ var _ = Describe("Install Plan", func() {
17421743
}
17431744

17441745
mainCSV := newCSV(mainPackageStable, testNamespace, "", semver.MustParse("0.1.0"), []apiextensions.CustomResourceDefinition{mainCRD}, nil, mainNamedStrategy)
1746+
betaCSV := newCSV(mainPackageBeta, testNamespace, mainPackageStable, semver.MustParse("0.2.0"), []apiextensions.CustomResourceDefinition{updatedCRD}, nil, mainNamedStrategy)
17451747

17461748
c := newKubeClient()
17471749
crc := newCRClient()
@@ -1770,7 +1772,7 @@ var _ = Describe("Install Plan", func() {
17701772
_, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, testNamespace, catalogSourceRegistryPodSynced)
17711773
require.NoError(GinkgoT(), err)
17721774

1773-
subscriptionName := genName("sub-nginx-update-before-")
1775+
subscriptionName := genName("sub-nginx-update-")
17741776
createSubscriptionForCatalog(crc, testNamespace, subscriptionName, mainCatalogName, mainPackageName, stableChannel, "", operatorsv1alpha1.ApprovalAutomatic)
17751777

17761778
subscription, err := fetchSubscription(crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
@@ -1798,19 +1800,19 @@ var _ = Describe("Install Plan", func() {
17981800
_, err = awaitCSV(GinkgoT(), crc, testNamespace, mainCSV.GetName(), csvAnyChecker)
17991801
require.NoError(GinkgoT(), err)
18001802

1801-
updateInternalCatalog(GinkgoT(), c, crc, mainCatalogName, testNamespace, []apiextensions.CustomResourceDefinition{updatedCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}, mainManifests)
1802-
1803-
// Update the subscription resource
1804-
err = crc.OperatorsV1alpha1().Subscriptions(testNamespace).DeleteCollection(context.TODO(), *metav1.NewDeleteOptions(0), metav1.ListOptions{})
1805-
require.NoError(GinkgoT(), err)
1806-
1807-
// existing cleanup should remove this
1808-
subscriptionName = genName("sub-nginx-update-after-")
1809-
subscriptionCleanup := createSubscriptionForCatalog(crc, testNamespace, subscriptionName, mainCatalogName, mainPackageName, stableChannel, "", operatorsv1alpha1.ApprovalAutomatic)
1810-
defer subscriptionCleanup()
1803+
mainManifests = []registry.PackageManifest{
1804+
{
1805+
PackageName: mainPackageName,
1806+
Channels: []registry.PackageChannel{
1807+
{Name: stableChannel, CurrentCSVName: mainPackageBeta},
1808+
},
1809+
DefaultChannelName: stableChannel,
1810+
},
1811+
}
18111812

1813+
updateInternalCatalog(GinkgoT(), c, crc, mainCatalogName, testNamespace, []apiextensions.CustomResourceDefinition{updatedCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV, betaCSV}, mainManifests)
18121814
// Wait for subscription to update
1813-
updatedSubscription, err := fetchSubscription(crc, testNamespace, subscriptionName, subscriptionHasInstallPlanChecker)
1815+
updatedSubscription, err := fetchSubscription(crc, testNamespace, subscriptionName, subscriptionHasInstallPlanDifferentChecker(fetchedInstallPlan.GetName()))
18141816
require.NoError(GinkgoT(), err)
18151817

18161818
// Verify installplan created and installed
@@ -1819,7 +1821,7 @@ var _ = Describe("Install Plan", func() {
18191821
require.NotEqual(GinkgoT(), fetchedInstallPlan.GetName(), fetchedUpdatedInstallPlan.GetName())
18201822

18211823
// Wait for csv to update
1822-
_, err = awaitCSV(GinkgoT(), crc, testNamespace, mainCSV.GetName(), csvAnyChecker)
1824+
_, err = awaitCSV(GinkgoT(), crc, testNamespace, betaCSV.GetName(), csvAnyChecker)
18231825
require.NoError(GinkgoT(), err)
18241826

18251827
// Get the CRD to see if it is updated

0 commit comments

Comments
 (0)