@@ -138,17 +138,27 @@ func TestGlobalCatalogUpdateTriggersSubscriptionSync(t *testing.T) {
138
138
Package : mainPackageName ,
139
139
Channel : stableChannel ,
140
140
StartingCSV : mainCSV .GetName (),
141
- InstallPlanApproval : v1alpha1 .ApprovalAutomatic ,
141
+ InstallPlanApproval : v1alpha1 .ApprovalManual ,
142
142
}
143
143
144
144
// Create Subscription
145
145
subscriptionName := genName ("sub-" )
146
146
createSubscriptionForCatalogWithSpec (t , crc , testNamespace , subscriptionName , subscriptionSpec )
147
147
148
- subscription , err := fetchSubscription (t , crc , testNamespace , subscriptionName , subscriptionStateAtLatestChecker )
148
+ subscription , err := fetchSubscription (t , crc , testNamespace , subscriptionName , subscriptionHasInstallPlanChecker )
149
149
require .NoError (t , err )
150
150
require .NotNil (t , subscription )
151
- _ , err = fetchCSV (t , crc , subscription .Status .CurrentCSV , testNamespace , buildCSVConditionChecker (v1alpha1 .CSVPhaseSucceeded ))
151
+
152
+ installPlanName := subscription .Status .Install .Name
153
+ requiresApprovalChecker := buildInstallPlanPhaseCheckFunc (v1alpha1 .InstallPlanPhaseRequiresApproval )
154
+ fetchedInstallPlan , err := fetchInstallPlan (t , crc , installPlanName , requiresApprovalChecker )
155
+ require .NoError (t , err )
156
+
157
+ fetchedInstallPlan .Spec .Approved = true
158
+ _ , err = crc .OperatorsV1alpha1 ().InstallPlans (testNamespace ).Update (fetchedInstallPlan )
159
+ require .NoError (t , err )
160
+
161
+ _ , err = awaitCSV (t , crc , testNamespace , mainCSV .GetName (), csvSucceededChecker )
152
162
require .NoError (t , err )
153
163
154
164
// Update manifest
@@ -166,19 +176,10 @@ func TestGlobalCatalogUpdateTriggersSubscriptionSync(t *testing.T) {
166
176
updateInternalCatalog (t , c , crc , mainCatalogName , globalNS , []apiextensions.CustomResourceDefinition {mainCRD }, []v1alpha1.ClusterServiceVersion {mainCSV , replacementCSV }, mainManifests )
167
177
168
178
// Get updated catalogsource
169
- fetchedUpdatedCatalog , err := fetchCatalogSource (t , crc , mainCatalogName , globalNS , func (catalog * v1alpha1.CatalogSource ) bool {
170
- registry := catalog .Status .RegistryServiceStatus
171
- connState := catalog .Status .GRPCConnectionState
172
- if registry != nil && connState != nil && connState .LastObservedState == "READY" && ! connState .LastConnectTime .IsZero () {
173
- fmt .Printf ("catalog %s pod with address %s\n " , catalog .GetName (), registry .Address ())
174
- return registryPodHealthy (registry .Address ())
175
- }
176
- fmt .Printf ("waiting for catalog pod %v to be available (for sync)\n " , catalog .GetName ())
177
- return false
178
- })
179
+ fetchedUpdatedCatalog , err := fetchCatalogSource (t , crc , mainCatalogName , globalNS , catalogSourceRegistryPodSynced )
179
180
require .NoError (t , err )
180
181
181
- subscription , err = fetchSubscription (t , crc , testNamespace , subscriptionName , subscriptionStateUpgradeAvailableChecker )
182
+ subscription , err = fetchSubscription (t , crc , testNamespace , subscriptionName , subscriptionStateUpgradePendingChecker )
182
183
require .NoError (t , err )
183
184
require .NotNil (t , subscription )
184
185
0 commit comments