Skip to content

Conversation

@danegsta
Copy link
Member

Description

Make tests that look for container ID more reliable against slight timing issues in healthy status and container ID being updated.

Copilot AI review requested due to automatic review settings May 23, 2025 04:15
@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label May 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors container ID retrieval in functional tests to improve reliability by centralizing the wait-for-healthy and container ID check into an async helper.

  • Introduces GetContainerIdAsync local functions that await both resource health and the presence of container.id.
  • Updates Postgres and MySQL tests to call GetContainerIdAsync instead of manually awaiting health.
  • Removes redundant WaitForResourceHealthyAsync calls in each test and consolidates the logic.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/Aspire.Hosting.PostgreSQL.Tests/PostgresFunctionalTests.cs Replaced manual health waits with GetContainerIdAsync calls
tests/Aspire.Hosting.MySql.Tests/MySqlFunctionalTests.cs Swapped in GetContainerIdAsync, removed explicit health waits
Comments suppressed due to low confidence (2)

tests/Aspire.Hosting.MySql.Tests/MySqlFunctionalTests.cs:587

  • Remove the extra semicolon at the end of this line to avoid redundant syntax.
var phpMyAdminId = await GetContainerIdAsync(rns, "phpmyadmin", cts.Token);;

tests/Aspire.Hosting.MySql.Tests/MySqlFunctionalTests.cs:589

  • Consider adding a timeout to WaitAsync (e.g., .WaitAsync(TimeSpan.FromMinutes(1), cts.Token)) to prevent the test from hanging indefinitely and align with the PostgreSQL tests.
await app.StopAsync(cts.Token).WaitAsync(cts.Token);

@danegsta danegsta merged commit 607fc51 into dotnet:main May 23, 2025
255 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants