Skip to content

Let REPL test readiness wait cover a cold container image pull - #21916

Merged
Mitch Denny (mitchdenny) merged 1 commit into
mainfrom
aspireagent/postgres-repl-readiness-timeout
Nov 8, 2026
Merged

Mitch Denny (mitchdenny) merged 1 commit into
mainfrom
aspireagent/postgres-repl-readiness-timeout

Conversation

@davidfowl

@davidfowl David Fowler (davidfowl) commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Description

PostgresReplCommandTests.ReplExecutesAuthenticatedQuery failed on main in run 42152057806 (Hosting.PostgreSQL job). The shared REPL test base (tests/Shared/ContainerReplCommandTestBase.cs) gave the resource 1 minute to become healthy. StartAsync returns before DCP pulls the image, so that minute also had to cover a cold pull. The postgres pull alone took about 55s in that run, which left too little time for the container to start.

Failure stats (14d, attempt 1)

CI workflow on microsoft/aspire, runs created 2026-10-25 06:28 → 2026-11-08 06:28 UTC, attempt 1 only. Denominator: attempt-1 jobs that ran (success or failure). Hits: the failed job's log matches the signature. Jobs that lost their runner, which have no log, are excluded. Main runs have no reruns, so their flake check is the next main run of the job.

Signature PostgresReplCommandTests.ReplExecutesAuthenticatedQuery failed with Resource 'postgres' failed to become healthy before the operation was cancelled
Job Hosting.PostgreSQL (ubuntu + windows)
main pushes: hits / runs 1 / 316 (0.32%)
main pushes, 30d: hits / runs 1 / 546 (0.18%). The 16 days before the 14d window add 0 hits.
PR runs: hits / runs 0 / 921 (0.00%); 1 PR-caused excluded
Combined rate 1 / 1237 = 0.08%
Flake check main: next main run of the job passed 1/1
First / last hit 2026-11-06 / 2026-11-06
Still hitting main? Last main hit: 2026-11-06. 44 main runs since the last hit (2026-11-06), with 0 hits
Fix evidence Local: FakeTimeProvider budget test 5/5 fail → 5/5 pass. Real Docker REPL suites pass (Postgres 24/24). This PR's CI: Hosting.PostgreSQL ubuntu + windows passed 1/1.

Failing attempt-1 jobs, most recent first (1 of 1 log-verified hits):

Date (UTC) Branch Job Signature excerpt
2026-11-06 02:42 main Hosting.PostgreSQL (ubuntu-latest) Resource 'postgres' failed to become healthy before the operation was cancelled

Verdict: WEAK. Only 1 non-PR-caused hit (main, 2026-11-06). The 1 PR hit came from the in-flight WSLC-on-Windows PR and is excluded. The other 7 failures of this test had different errors (Terminal … has already, CliPath options validation, Polly timeout, Stopped waiting). Across all shared-base REPL tests (Postgres/Redis/Valkey/MongoDB/SqlServer), the same healthy-timeout hit 2/1580 main jobs, and 11 more PR hits were all on the WSLC PR. A timeout increase is low risk, but the data does not show a recurring flake.

The fix moves the readiness wait into a WaitForReplResourceHealthyAsync helper that uses TestConstants.ExtraLongTimeoutTimeSpan (180s locally, 360s on CI). That constant already exists and is documented as sized for image pulls. This raises a timeout to match a measured cold pull. It does not add retries or sleeps, and the assertions are unchanged. The helper takes a TimeProvider so the budget can be tested. The Redis, MongoDB and SqlServer test projects now link AsyncTestHelpers.cs, because they share the base class.

Other recent failures of this test came from in-flight PRs (for example the WSLC Windows work in #21564) and are not addressed here.

Refs #21600

Confidence

  • New regression test ReplReadinessWaitCoversColdImagePull (FakeTimeProvider, no Docker) moves the clock forward 2 minutes, then reports the resource as failed to start. It expects the wait to fail for that reason rather than be cancelled.
    • Before the fix (1-minute budget): 5/5 runs failed with OperationCanceledException.
    • After the fix: 5/5 passed.
  • With real Docker: PostgresReplCommandTests 24/24, RedisReplCommandTests 20/20 and ValkeyReplCommandTests 20/20 passed.
  • All five affected test projects build.
  • Not run locally: the MongoDB and SqlServer REPL container tests. They failed on my machine with No space left on device during image extraction. CI covers them.

How we stop this recurring: container readiness waits in shared test bases should use TestConstants.ExtraLongTimeoutTimeSpan, which accounts for image pulls, instead of hand-picked minute values.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No

🤖 Posted by AspireAgent (AI Agent)

ContainerReplCommandTestBase waited only 1 minute for the resource to
become healthy, but StartAsync returns before DCP pulls the image, so
that minute also had to cover a cold pull (~55s for postgres in CI).
Use TestConstants.ExtraLongTimeoutTimeSpan, which is sized for image
pulls, and add a FakeTimeProvider regression test.

Co-authored-by: Copilot <[email protected]>
@davidfowl David Fowler (davidfowl) added the agent:working An AI agent is actively working on this issue or PR label Nov 8, 2026 — with Copilot SWE Agent
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21916

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21916"

@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Tests selector

6 / 101 PR test projects · 0 PR jobs, from 6 changed files.

Selected PR test projects (6 / 101)

Aspire.Hosting.MongoDB.Tests, Aspire.Hosting.MySql.Tests, Aspire.Hosting.PostgreSQL.Tests, Aspire.Hosting.Redis.Tests, Aspire.Hosting.SqlServer.Tests, Aspire.Hosting.Valkey.Tests

Selected PR jobs (0)

none


How these were chosen — grouped by what changed

🧪 tests/Shared/ContainerReplCommandTestBase.cs (changed test)
→ 2 via the project graph: Aspire.Hosting.MySql.Tests, Aspire.Hosting.Valkey.Tests

🧪 tests/Aspire.Hosting.MongoDB.Tests/Aspire.Hosting.MongoDB.Tests.csproj (changed test)
→ 1 directly: Aspire.Hosting.MongoDB.Tests

🧪 tests/Aspire.Hosting.PostgreSQL.Tests/Aspire.Hosting.PostgreSQL.Tests.csproj (changed test)
→ 1 directly: Aspire.Hosting.PostgreSQL.Tests

🧪 tests/Aspire.Hosting.PostgreSQL.Tests/PostgresReplCommandTests.cs (changed test)
→ 1 directly: Aspire.Hosting.PostgreSQL.Tests

🧪 tests/Aspire.Hosting.Redis.Tests/Aspire.Hosting.Redis.Tests.csproj (changed test)
→ 1 directly: Aspire.Hosting.Redis.Tests

🧪 tests/Aspire.Hosting.SqlServer.Tests/Aspire.Hosting.SqlServer.Tests.csproj (changed test)
→ 1 directly: Aspire.Hosting.SqlServer.Tests

Job reasons

none


Selection computed for commit f006e25.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the test-only change extending container REPL readiness timeouts.

No open issues 🎉

What changed in this PR

This PR extends the shared container REPL test readiness timeout to accommodate cold image pulls, addressing a CI failure without changing product behavior or REPL assertions.

Changes:

  • Uses TestConstants.ExtraLongTimeoutTimeSpan in a shared readiness helper with an injectable TimeProvider.
  • Adds a Docker-free regression test verifying that readiness remains pending after two simulated minutes.
  • Adds the test dependency and shared source links required by affected test projects.
File Description
tests/​Shared/​ContainerReplCommandTestBase.cs Extracts readiness waiting and applies the image-pull-aware timeout.
tests/​Aspire.Hosting.SqlServer.Tests/​Aspire.Hosting.SqlServer.Tests.csproj Links shared timeout helpers.
tests/​Aspire.Hosting.Redis.Tests/​Aspire.Hosting.Redis.Tests.csproj Links shared timeout helpers.
tests/​Aspire.Hosting.PostgreSQL.Tests/​PostgresReplCommandTests.cs Adds fake-time regression coverage for the readiness budget.
tests/​Aspire.Hosting.PostgreSQL.Tests/​Aspire.Hosting.PostgreSQL.Tests.csproj Adds the fake-time testing dependency.
tests/​Aspire.Hosting.MongoDB.Tests/​Aspire.Hosting.MongoDB.Tests.csproj Links shared timeout helpers.

Review effort: Balanced

@davidfowl
David Fowler (davidfowl) marked this pull request as ready for review November 8, 2026 05:05
@davidfowl David Fowler (davidfowl) removed the agent:working An AI agent is actively working on this issue or PR label Nov 8, 2026
@mitchdenny
Mitch Denny (mitchdenny) merged commit 9fcb379 into main Nov 8, 2026
69 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.1 milestone Nov 8, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

docs_optional → test_only. No signals triggered (signal_count == 0). All 6 changed files match tests/** (test projects, PostgresReplCommandTests.cs, tests/Shared/ContainerReplCommandTestBase.cs); the change only adjusts a test health-wait timeout.

Mitch Denny (mitchdenny) pushed a commit that referenced this pull request Nov 10, 2026
## Description

`PostgresReplCommandTests.ReplExecutesAuthenticatedQuery` failed on main
in [run
42152057806](https://github.com/microsoft/aspire/actions/runs/42152057806)
([Hosting.PostgreSQL
job](https://github.com/microsoft/aspire/actions/runs/42152057806/job/127678069176)).
The shared REPL test base
(`tests/Shared/ContainerReplCommandTestBase.cs`) gave the resource 1
minute to become healthy. `StartAsync` returns before DCP pulls the
image, so that minute also had to cover a cold pull. The postgres pull
alone took about 55s in that run, which left too little time for the
container to start.

## Failure stats (14d, attempt 1)

`CI` workflow on microsoft/aspire, runs created 2026-10-25 06:28 →
2026-11-08 06:28 UTC, **attempt 1 only**. Denominator: attempt-1 jobs
that ran (success or failure). Hits: the failed job's log matches the
signature. Jobs that lost their runner, which have no log, are excluded.
Main runs have no reruns, so their flake check is the next main run of
the job.

| | |
|---|---|
| Signature | `PostgresReplCommandTests.ReplExecutesAuthenticatedQuery`
failed with `Resource 'postgres' failed to become healthy before the
operation was cancelled` |
| Job | Hosting.PostgreSQL (ubuntu + windows) |
| main pushes: hits / runs | 1 / 316 (0.32%) |
| main pushes, 30d: hits / runs | 1 / 546 (0.18%). The 16 days before
the 14d window add 0 hits. |
| PR runs: hits / runs | 0 / 921 (0.00%); 1 PR-caused excluded |
| Combined rate | 1 / 1237 = **0.08%** |
| Flake check | main: next main run of the job passed 1/1 |
| First / last hit | 2026-11-06 / 2026-11-06 |
| Still hitting main? | Last main hit: 2026-11-06. 44 main runs since
the last hit (2026-11-06), with 0 hits |
| Fix evidence | Local: FakeTimeProvider budget test 5/5 fail → 5/5
pass. Real Docker REPL suites pass (Postgres 24/24). This PR's CI:
Hosting.PostgreSQL ubuntu + windows passed 1/1. |

Failing attempt-1 jobs, most recent first (1 of 1 log-verified hits):

| Date (UTC) | Branch | Job | Signature excerpt |
|---|---|---|---|
| [2026-11-06
02:42](https://github.com/microsoft/aspire/actions/runs/42152057806/job/127678069176)
| **main** | Hosting.PostgreSQL (ubuntu-latest) | `Resource 'postgres'
failed to become healthy before the operation was cancelled` |

**Verdict: WEAK.** Only **1 non-PR-caused hit** (main, 2026-11-06). The
1 PR hit came from the in-flight WSLC-on-Windows PR and is excluded. The
other 7 failures of this test had different errors (`Terminal … has
already`, `CliPath` options validation, Polly timeout, `Stopped
waiting`). Across all shared-base REPL tests
(Postgres/Redis/Valkey/MongoDB/SqlServer), the same healthy-timeout hit
2/1580 main jobs, and 11 more PR hits were all on the WSLC PR. A timeout
increase is low risk, but the data does not show a recurring flake.

<!-- /failure-stats -->

The fix moves the readiness wait into a
`WaitForReplResourceHealthyAsync` helper that uses
`TestConstants.ExtraLongTimeoutTimeSpan` (180s locally, 360s on CI).
That constant already exists and is documented as sized for image pulls.
This raises a timeout to match a measured cold pull. It does not add
retries or sleeps, and the assertions are unchanged. The helper takes a
`TimeProvider` so the budget can be tested. The Redis, MongoDB and
SqlServer test projects now link `AsyncTestHelpers.cs`, because they
share the base class.

Other recent failures of this test came from in-flight PRs (for example
the WSLC Windows work in #21564) and are not addressed here.

Refs #21600

## Confidence

- New regression test `ReplReadinessWaitCoversColdImagePull`
(FakeTimeProvider, no Docker) moves the clock forward 2 minutes, then
reports the resource as failed to start. It expects the wait to fail for
that reason rather than be cancelled.
- Before the fix (1-minute budget): 5/5 runs failed with
`OperationCanceledException`.
  - After the fix: 5/5 passed.
- With real Docker: `PostgresReplCommandTests` 24/24,
`RedisReplCommandTests` 20/20 and `ValkeyReplCommandTests` 20/20 passed.
- All five affected test projects build.
- **Not run locally:** the MongoDB and SqlServer REPL container tests.
They failed on my machine with `No space left on device` during image
extraction. CI covers them.

**How we stop this recurring:** container readiness waits in shared test
bases should use `TestConstants.ExtraLongTimeoutTimeSpan`, which
accounts for image pulls, instead of hand-picked minute values.

## Checklist

- Is this feature complete?
  - [x] Yes. Ready to ship.
  - [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] Yes
  - [ ] No
- Did you add public API?
  - [ ] Yes
  - [x] No
- Does the change make any security assumptions or guarantees?
  - [ ] Yes
  - [x] No

**🤖 Posted by AspireAgent (AI Agent)**

Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 9fcb379)
Mitch Denny (mitchdenny) pushed a commit that referenced this pull request Nov 10, 2026
## Description

`PostgresReplCommandTests.ReplExecutesAuthenticatedQuery` failed on main
in [run
42152057806](https://github.com/microsoft/aspire/actions/runs/42152057806)
([Hosting.PostgreSQL
job](https://github.com/microsoft/aspire/actions/runs/42152057806/job/127678069176)).
The shared REPL test base
(`tests/Shared/ContainerReplCommandTestBase.cs`) gave the resource 1
minute to become healthy. `StartAsync` returns before DCP pulls the
image, so that minute also had to cover a cold pull. The postgres pull
alone took about 55s in that run, which left too little time for the
container to start.

## Failure stats (14d, attempt 1)

`CI` workflow on microsoft/aspire, runs created 2026-10-25 06:28 →
2026-11-08 06:28 UTC, **attempt 1 only**. Denominator: attempt-1 jobs
that ran (success or failure). Hits: the failed job's log matches the
signature. Jobs that lost their runner, which have no log, are excluded.
Main runs have no reruns, so their flake check is the next main run of
the job.

| | |
|---|---|
| Signature | `PostgresReplCommandTests.ReplExecutesAuthenticatedQuery`
failed with `Resource 'postgres' failed to become healthy before the
operation was cancelled` |
| Job | Hosting.PostgreSQL (ubuntu + windows) |
| main pushes: hits / runs | 1 / 316 (0.32%) |
| main pushes, 30d: hits / runs | 1 / 546 (0.18%). The 16 days before
the 14d window add 0 hits. |
| PR runs: hits / runs | 0 / 921 (0.00%); 1 PR-caused excluded |
| Combined rate | 1 / 1237 = **0.08%** |
| Flake check | main: next main run of the job passed 1/1 |
| First / last hit | 2026-11-06 / 2026-11-06 |
| Still hitting main? | Last main hit: 2026-11-06. 44 main runs since
the last hit (2026-11-06), with 0 hits |
| Fix evidence | Local: FakeTimeProvider budget test 5/5 fail → 5/5
pass. Real Docker REPL suites pass (Postgres 24/24). This PR's CI:
Hosting.PostgreSQL ubuntu + windows passed 1/1. |

Failing attempt-1 jobs, most recent first (1 of 1 log-verified hits):

| Date (UTC) | Branch | Job | Signature excerpt |
|---|---|---|---|
| [2026-11-06
02:42](https://github.com/microsoft/aspire/actions/runs/42152057806/job/127678069176)
| **main** | Hosting.PostgreSQL (ubuntu-latest) | `Resource 'postgres'
failed to become healthy before the operation was cancelled` |

**Verdict: WEAK.** Only **1 non-PR-caused hit** (main, 2026-11-06). The
1 PR hit came from the in-flight WSLC-on-Windows PR and is excluded. The
other 7 failures of this test had different errors (`Terminal … has
already`, `CliPath` options validation, Polly timeout, `Stopped
waiting`). Across all shared-base REPL tests
(Postgres/Redis/Valkey/MongoDB/SqlServer), the same healthy-timeout hit
2/1580 main jobs, and 11 more PR hits were all on the WSLC PR. A timeout
increase is low risk, but the data does not show a recurring flake.

<!-- /failure-stats -->

The fix moves the readiness wait into a
`WaitForReplResourceHealthyAsync` helper that uses
`TestConstants.ExtraLongTimeoutTimeSpan` (180s locally, 360s on CI).
That constant already exists and is documented as sized for image pulls.
This raises a timeout to match a measured cold pull. It does not add
retries or sleeps, and the assertions are unchanged. The helper takes a
`TimeProvider` so the budget can be tested. The Redis, MongoDB and
SqlServer test projects now link `AsyncTestHelpers.cs`, because they
share the base class.

Other recent failures of this test came from in-flight PRs (for example
the WSLC Windows work in #21564) and are not addressed here.

Refs #21600

## Confidence

- New regression test `ReplReadinessWaitCoversColdImagePull`
(FakeTimeProvider, no Docker) moves the clock forward 2 minutes, then
reports the resource as failed to start. It expects the wait to fail for
that reason rather than be cancelled.
- Before the fix (1-minute budget): 5/5 runs failed with
`OperationCanceledException`.
  - After the fix: 5/5 passed.
- With real Docker: `PostgresReplCommandTests` 24/24,
`RedisReplCommandTests` 20/20 and `ValkeyReplCommandTests` 20/20 passed.
- All five affected test projects build.
- **Not run locally:** the MongoDB and SqlServer REPL container tests.
They failed on my machine with `No space left on device` during image
extraction. CI covers them.

**How we stop this recurring:** container readiness waits in shared test
bases should use `TestConstants.ExtraLongTimeoutTimeSpan`, which
accounts for image pulls, instead of hand-picked minute values.

## Checklist

- Is this feature complete?
  - [x] Yes. Ready to ship.
  - [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] Yes
  - [ ] No
- Did you add public API?
  - [ ] Yes
  - [x] No
- Does the change make any security assumptions or guarantees?
  - [ ] Yes
  - [x] No

**🤖 Posted by AspireAgent (AI Agent)**

Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 9fcb379)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants