Skip to content

Commit 8eb59fa

Browse files
vhvb1989Copilot
andauthored
ci: rerun failed integration tests once to handle flaky failures (#9118)
The nightly `azure-dev - cli` pipeline has been red on nearly every run because integration tests provision live Azure resources and fail intermittently for environmental reasons that rotate night to night (credential token expiry during long provisioning, transient Azure service capacity such as App Service "No available instances to satisfy this request", and teardown races). With no retry, a single such blip fails the whole nightly. Enable gotestsum's rerun of failed integration tests (once), so flaky failures are retried while genuine regressions still fail: - --rerun-fails=1: re-run each failed test one time. - --rerun-fails-max-failures=5: if the initial run has more than 5 failures, don't rerun anything (a mass failure is a real regression, not flake). - --rerun-fails-report: record which tests were rerun so flaky tests stay visible for triage. - --packages "./...": required by --rerun-fails (the package list can no longer be passed positionally after --). Only the integration test invocation is changed; unit tests are fast and deterministic and keep running without retry. Fixes #8386 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c9f44e1 commit 8eb59fa

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

cli/azd/ci-test.ps1

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ param(
44
[string] $IntegrationTestTimeout = '120m',
55
[string] $IntegrationTestCoverageDir = 'cover-int',
66
[string] $UnitTestTimingFile = 'test-timing-unit.json',
7-
[string] $IntegrationTestTimingFile = 'test-timing-int.json'
7+
[string] $IntegrationTestTimingFile = 'test-timing-int.json',
8+
[string] $IntegrationTestRerunReport = 'test-rerun-int.txt'
89
)
910

1011
$ErrorActionPreference = 'Stop'
@@ -62,7 +63,22 @@ $env:GOCOVERDIR = $intCoverDir.FullName
6263
$env:GOEXPERIMENT=""
6364

6465
try {
65-
& $gotestsum --jsonfile $IntegrationTestTimingFile -- ./... -v -timeout $IntegrationTestTimeout
66+
# Integration tests provision live Azure resources and are prone to flaky, environmental
67+
# failures (credential token expiry during long provisioning, transient Azure service
68+
# capacity such as App Service "No available instances", teardown races). A single such
69+
# blip currently reds the whole nightly run. Re-run failed tests once to distinguish flaky
70+
# failures from real regressions. See https://github.com/Azure/azure-dev/issues/8386
71+
#
72+
# --rerun-fails requires the package list to be passed via --packages instead of positionally.
73+
# --rerun-fails-max-failures caps reruns so a mass failure (a genuine regression) is not masked.
74+
# --rerun-fails-report records which tests were rerun so flaky tests remain visible for triage.
75+
& $gotestsum `
76+
--jsonfile $IntegrationTestTimingFile `
77+
--rerun-fails=1 `
78+
--rerun-fails-max-failures=5 `
79+
--rerun-fails-report $IntegrationTestRerunReport `
80+
--packages "./..." `
81+
-- -v -timeout $IntegrationTestTimeout
6682
if ($LASTEXITCODE) {
6783
exit $LASTEXITCODE
6884
}

0 commit comments

Comments
 (0)