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 <ypopivniak@cargurus.com>
  • Loading branch information
ypopivniak-cg authored and zachaller committed Oct 29, 2024
1 parent afa4570 commit b833028
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 b833028

Please sign in to comment.