Skip to content

Commit

Permalink
fix: e2e test for inconclusive analysisrun
Browse files Browse the repository at this point in the history
Signed-off-by: Yurii Popivniak <[email protected]>
  • Loading branch information
ypopivniak-cg authored and zachaller committed Dec 6, 2024
1 parent b306401 commit 36a86ba
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
5 changes: 4 additions & 1 deletion rollout/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ func needsNewAnalysisRun(currentAr *v1alpha1.AnalysisRun, rollout *v1alpha1.Roll
// is set and then seeing if the last status was inconclusive.
// There is an additional check for the BlueGreen Pause because the prepromotion analysis always has the BlueGreen
// Pause and that causes controllerPause to be set. The extra check for the BlueGreen Pause ensures that a new Analysis
// Run is created only when the previous AnalysisRun is inconclusive
// Run is created only when the previous AnalysisRun is inconclusive.
// Additional check for the Canary Pause prevents Canary promotion when AnalysisRun is inconclusive and reached
// inconclusiveLimit. Otherwise, another AnalysisRun will be spawned and can cause Success status,
// because of termination when the AnalysisRun is still in-flight.
if rollout.Status.ControllerPause &&
getPauseCondition(rollout, v1alpha1.PauseReasonCanaryPauseStep) == nil &&
getPauseCondition(rollout, v1alpha1.PauseReasonBlueGreenPause) == nil {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/analysis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ func (s *AnalysisSuite) TestCanaryInconclusiveBackgroundAnalysis() {
When().
UpdateSpec().
WaitForRolloutStatus("Paused").
WaitForBackgroundAnalysisRunPhase("Running").
Then().
ExpectAnalysisRunCount(1).
ExpectBackgroundAnalysisRunPhase("Running").
When().
WaitForBackgroundAnalysisRunPhase("Inconclusive").
WaitForRolloutMessage("InconclusiveAnalysisRun").
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# A dummy web metric which uses the kubernetes version endpoint as a metric provider
# A web metric which uses the httpbin service as a metric provider
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: web-background-inconclusive
spec:
args:
- name: url-val
value: "https://kubernetes.default.svc/version"
value: "https://httpbin.org/anything"
metrics:
- name: web
interval: 7s
inconclusiveLimit: 3
successCondition: result.major == '2000'
failureCondition: result.major == '1000'
provider:
web:
url: "{{args.url-val}}"
insecure: true
- name: web
interval: 7s
inconclusiveLimit: 3
successCondition: result.status == "success"
failureCondition: result.status == "failure"
provider:
web:
url: "{{args.url-val}}"
method: POST
jsonBody:
status: "inconclusive"
jsonPath: "{$.json}"

0 comments on commit 36a86ba

Please sign in to comment.