@@ -934,8 +934,6 @@ var _ = Describe("Install Plan", func() {
934934 mainPackageDelta := fmt .Sprintf ("%s-delta" , mainPackageName )
935935
936936 stableChannel := "stable"
937- betaChannel := "beta"
938- deltaChannel := "delta"
939937
940938 // Create manifests
941939 mainManifests := []registry.PackageManifest {
@@ -998,30 +996,17 @@ var _ = Describe("Install Plan", func() {
998996 {
999997 PackageName : mainPackageName ,
1000998 Channels : []registry.PackageChannel {
1001- {Name : stableChannel , CurrentCSVName : mainPackageStable },
1002- {Name : betaChannel , CurrentCSVName : mainPackageBeta },
999+ {Name : stableChannel , CurrentCSVName : mainPackageBeta },
10031000 },
1004- DefaultChannelName : betaChannel ,
1001+ DefaultChannelName : stableChannel ,
10051002 },
10061003 }
10071004
10081005 updateInternalCatalog (GinkgoT (), c , crc , mainCatalogSourceName , testNamespace , []apiextensions.CustomResourceDefinition {* tt .intermediateCRD }, []operatorsv1alpha1.ClusterServiceVersion {mainStableCSV , mainBetaCSV }, mainManifests )
1009-
10101006 // Attempt to get the catalog source before creating install plan(s)
10111007 _ , err = fetchCatalogSourceOnStatus (crc , mainCatalogSourceName , testNamespace , catalogSourceRegistryPodSynced )
10121008 require .NoError (GinkgoT (), err )
1013-
1014- // Update the subscription resource to point to the beta CSV
1015- err = crc .OperatorsV1alpha1 ().Subscriptions (testNamespace ).DeleteCollection (context .TODO (), * metav1 .NewDeleteOptions (0 ), metav1.ListOptions {})
1016- require .NoError (GinkgoT (), err )
1017-
1018- // Delete orphaned csv
1019- require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().ClusterServiceVersions (testNamespace ).Delete (context .TODO (), mainStableCSV .GetName (), metav1.DeleteOptions {}))
1020-
1021- // existing cleanup should remove this
1022- createSubscriptionForCatalog (crc , testNamespace , subscriptionName , mainCatalogSourceName , mainPackageName , betaChannel , "" , operatorsv1alpha1 .ApprovalAutomatic )
1023-
1024- subscription , err = fetchSubscription (crc , testNamespace , subscriptionName , subscriptionHasInstallPlanChecker )
1009+ subscription , err = fetchSubscription (crc , testNamespace , subscriptionName , subscriptionHasInstallPlanDifferentChecker (installPlanName ))
10251010 require .NoError (GinkgoT (), err )
10261011 require .NotNil (GinkgoT (), subscription )
10271012
@@ -1047,35 +1032,21 @@ var _ = Describe("Install Plan", func() {
10471032 validateCRDVersions (GinkgoT (), c , tt .oldCRD .GetName (), expectedVersions )
10481033
10491034 // Update the manifest
1050- mainBetaCSV = newCSV (mainPackageBeta , testNamespace , "" , semver .MustParse ("0.2.0" ), []apiextensions.CustomResourceDefinition {* tt .intermediateCRD }, nil , mainNamedStrategy )
10511035 mainManifests = []registry.PackageManifest {
10521036 {
10531037 PackageName : mainPackageName ,
10541038 Channels : []registry.PackageChannel {
1055- {Name : betaChannel , CurrentCSVName : mainPackageBeta },
1056- {Name : deltaChannel , CurrentCSVName : mainPackageDelta },
1039+ {Name : stableChannel , CurrentCSVName : mainPackageDelta },
10571040 },
1058- DefaultChannelName : deltaChannel ,
1041+ DefaultChannelName : stableChannel ,
10591042 },
10601043 }
10611044
1062- updateInternalCatalog (GinkgoT (), c , crc , mainCatalogSourceName , testNamespace , []apiextensions.CustomResourceDefinition {* tt .newCRD }, []operatorsv1alpha1.ClusterServiceVersion {mainBetaCSV , mainDeltaCSV }, mainManifests )
1063-
1045+ updateInternalCatalog (GinkgoT (), c , crc , mainCatalogSourceName , testNamespace , []apiextensions.CustomResourceDefinition {* tt .newCRD }, []operatorsv1alpha1.ClusterServiceVersion {mainStableCSV , mainBetaCSV , mainDeltaCSV }, mainManifests )
10641046 // Attempt to get the catalog source before creating install plan(s)
10651047 _ , err = fetchCatalogSourceOnStatus (crc , mainCatalogSourceName , testNamespace , catalogSourceRegistryPodSynced )
10661048 require .NoError (GinkgoT (), err )
1067-
1068- // Update the subscription resource to point to the beta CSV
1069- err = crc .OperatorsV1alpha1 ().Subscriptions (testNamespace ).DeleteCollection (context .TODO (), * metav1 .NewDeleteOptions (0 ), metav1.ListOptions {})
1070- require .NoError (GinkgoT (), err )
1071-
1072- // Delete orphaned csv
1073- require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().ClusterServiceVersions (testNamespace ).Delete (context .TODO (), mainBetaCSV .GetName (), metav1.DeleteOptions {}))
1074-
1075- // existing cleanup should remove this
1076- createSubscriptionForCatalog (crc , testNamespace , subscriptionName , mainCatalogSourceName , mainPackageName , deltaChannel , "" , operatorsv1alpha1 .ApprovalAutomatic )
1077-
1078- subscription , err = fetchSubscription (crc , testNamespace , subscriptionName , subscriptionHasInstallPlanChecker )
1049+ subscription , err = fetchSubscription (crc , testNamespace , subscriptionName , subscriptionHasInstallPlanDifferentChecker (installPlanName ))
10791050 require .NoError (GinkgoT (), err )
10801051 require .NotNil (GinkgoT (), subscription )
10811052
@@ -1710,6 +1681,7 @@ var _ = Describe("Install Plan", func() {
17101681 mainPackageName := genName ("nginx-update-" )
17111682
17121683 mainPackageStable := fmt .Sprintf ("%s-stable" , mainPackageName )
1684+ mainPackageBeta := fmt .Sprintf ("%s-beta" , mainPackageName )
17131685
17141686 stableChannel := "stable"
17151687
@@ -1769,6 +1741,7 @@ var _ = Describe("Install Plan", func() {
17691741 }
17701742
17711743 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 )
17721745
17731746 c := newKubeClient ()
17741747 crc := newCRClient ()
@@ -1797,7 +1770,7 @@ var _ = Describe("Install Plan", func() {
17971770 _ , err := fetchCatalogSourceOnStatus (crc , mainCatalogName , testNamespace , catalogSourceRegistryPodSynced )
17981771 require .NoError (GinkgoT (), err )
17991772
1800- subscriptionName := genName ("sub-nginx-update-before- " )
1773+ subscriptionName := genName ("sub-nginx-update-" )
18011774 createSubscriptionForCatalog (crc , testNamespace , subscriptionName , mainCatalogName , mainPackageName , stableChannel , "" , operatorsv1alpha1 .ApprovalAutomatic )
18021775
18031776 subscription , err := fetchSubscription (crc , testNamespace , subscriptionName , subscriptionHasInstallPlanChecker )
@@ -1825,19 +1798,19 @@ var _ = Describe("Install Plan", func() {
18251798 _ , err = awaitCSV (GinkgoT (), crc , testNamespace , mainCSV .GetName (), csvAnyChecker )
18261799 require .NoError (GinkgoT (), err )
18271800
1828- updateInternalCatalog (GinkgoT (), c , crc , mainCatalogName , testNamespace , []apiextensions.CustomResourceDefinition {updatedCRD }, []operatorsv1alpha1.ClusterServiceVersion {mainCSV }, mainManifests )
1829-
1830- // Update the subscription resource
1831- err = crc .OperatorsV1alpha1 ().Subscriptions (testNamespace ).DeleteCollection (context .TODO (), * metav1 .NewDeleteOptions (0 ), metav1.ListOptions {})
1832- require .NoError (GinkgoT (), err )
1833-
1834- // existing cleanup should remove this
1835- subscriptionName = genName ("sub-nginx-update-after-" )
1836- subscriptionCleanup := createSubscriptionForCatalog (crc , testNamespace , subscriptionName , mainCatalogName , mainPackageName , stableChannel , "" , operatorsv1alpha1 .ApprovalAutomatic )
1837- 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+ }
18381810
1811+ updateInternalCatalog (GinkgoT (), c , crc , mainCatalogName , testNamespace , []apiextensions.CustomResourceDefinition {updatedCRD }, []operatorsv1alpha1.ClusterServiceVersion {mainCSV , betaCSV }, mainManifests )
18391812 // Wait for subscription to update
1840- updatedSubscription , err := fetchSubscription (crc , testNamespace , subscriptionName , subscriptionHasInstallPlanChecker )
1813+ updatedSubscription , err := fetchSubscription (crc , testNamespace , subscriptionName , subscriptionHasInstallPlanDifferentChecker ( fetchedInstallPlan . GetName ()) )
18411814 require .NoError (GinkgoT (), err )
18421815
18431816 // Verify installplan created and installed
@@ -1846,7 +1819,7 @@ var _ = Describe("Install Plan", func() {
18461819 require .NotEqual (GinkgoT (), fetchedInstallPlan .GetName (), fetchedUpdatedInstallPlan .GetName ())
18471820
18481821 // Wait for csv to update
1849- _ , err = awaitCSV (GinkgoT (), crc , testNamespace , mainCSV .GetName (), csvAnyChecker )
1822+ _ , err = awaitCSV (GinkgoT (), crc , testNamespace , betaCSV .GetName (), csvAnyChecker )
18501823 require .NoError (GinkgoT (), err )
18511824
18521825 // Get the CRD to see if it is updated
0 commit comments