@@ -198,18 +198,32 @@ Updates to 4[.][0-9]*:
198
198
o .Expect (err ).NotTo (o .HaveOccurred ())
199
199
})
200
200
201
- g .It ("runs successfully with conditional recommendations to the --version target" , func () {
202
- out , err := oc .Run ("adm" , "upgrade" , "recommend" , "--version" , fmt .Sprintf ("4.%d.0" , currentVersion .Minor + 1 )).EnvVar ("OC_ENABLE_CMD_UPGRADE_RECOMMEND" , "true" ).EnvVar ("OC_ENABLE_CMD_UPGRADE_RECOMMEND_PRECHECK" , "true" ).EnvVar ("OC_ENABLE_CMD_UPGRADE_RECOMMEND_ACCEPT" , "true" ).Output ()
201
+ g .It ("runs successfully with an accepted conditional recommendations to the --version target" , func () {
202
+ // alert retrieval requires a token-based kubeconfig to avoid:
203
+ // Failed to check for at least some preconditions: failed to get alerts from Thanos: no token is currently in use for this session
204
+ o .Expect (oc .Run ("create" ).Args ("serviceaccount" , "test" ).Execute ()).To (o .Succeed ())
205
+ o .Expect (oc .Run ("create" ).Args ("clusterrolebinding" , "test" , "--clusterrole=cluster-admin" , fmt .Sprintf ("--serviceaccount=%s:test" , oc .Namespace ())).Execute ()).To (o .Succeed ())
206
+ token , err := oc .Run ("create" ).Args ("token" , "test" ).Output ()
203
207
o .Expect (err ).NotTo (o .HaveOccurred ())
204
- err = matchRegexp (out , `Upstream update service: http://.*
208
+
209
+ oc .WithKubeConfigCopy (func (oc * exutil.CLI ) {
210
+ o .Expect (oc .Run ("config" , "set-credentials" ).Args ("test" , "--token" , token ).Execute ()).To (o .Succeed ())
211
+ o .Expect (oc .Run ("config" , "set-context" ).Args ("--current" , "--user" , "test" ).Execute ()).To (o .Succeed ())
212
+
213
+ out , err := oc .Run ("adm" , "upgrade" , "recommend" , "--version" , fmt .Sprintf ("4.%d.0" , currentVersion .Minor + 1 ), "--accept" , "ConditionalUpdateRisk" ).EnvVar ("OC_ENABLE_CMD_UPGRADE_RECOMMEND" , "true" ).EnvVar ("OC_ENABLE_CMD_UPGRADE_RECOMMEND_PRECHECK" , "true" ).EnvVar ("OC_ENABLE_CMD_UPGRADE_RECOMMEND_ACCEPT" , "true" ).Output ()
214
+ o .Expect (err ).To (o .HaveOccurred ())
215
+ err = matchRegexp (out , `The following conditions found no cause for concern in updating this cluster to later releases.*
216
+
217
+ Upstream update service: http://.*
205
218
Channel: test-channel [(]available channels: other-channel, test-channel[)]
206
219
207
220
Update to 4[.][0-9]*[.]0 Recommended=False:
208
221
Image: example.com/test@sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
209
222
Release URL: https://example.com/release/4[.][0-9]*[.]0
210
223
Reason: (TestRiskA|MultipleReasons)
211
224
Message: (?s:.*)This is a test risk. https://example.com/testRiskA` )
212
- o .Expect (err ).NotTo (o .HaveOccurred ())
225
+ o .Expect (err ).NotTo (o .HaveOccurred ())
226
+ })
213
227
})
214
228
})
215
229
})
0 commit comments