Skip to content

Commit f5a62e4

Browse files
committed
Fix UpdateSingleExistingCRDOwner test case
Signed-off-by: Vu Dinh <[email protected]>
1 parent 7378578 commit f5a62e4

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
@@ -1681,6 +1681,7 @@ var _ = Describe("Install Plan", func() {
16811681
mainPackageName := genName("nginx-update-")
16821682

16831683
mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName)
1684+
mainPackageBeta := fmt.Sprintf("%s-beta", mainPackageName)
16841685

16851686
stableChannel := "stable"
16861687

@@ -1740,6 +1741,7 @@ var _ = Describe("Install Plan", func() {
17401741
}
17411742

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

17441746
c := newKubeClient()
17451747
crc := newCRClient()
@@ -1768,7 +1770,7 @@ var _ = Describe("Install Plan", func() {
17681770
_, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, testNamespace, catalogSourceRegistryPodSynced)
17691771
require.NoError(GinkgoT(), err)
17701772

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

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

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

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

18141816
// Verify installplan created and installed
@@ -1817,7 +1819,7 @@ var _ = Describe("Install Plan", func() {
18171819
require.NotEqual(GinkgoT(), fetchedInstallPlan.GetName(), fetchedUpdatedInstallPlan.GetName())
18181820

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

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

0 commit comments

Comments
 (0)