Skip to content

Fix flaky SqlDatabaseProjects test: give each project its own database - #1609

Merged
afscrome merged 2 commits into
mainfrom
afscrome-fix-sql-login-race-06d
Sep 22, 2026
Merged

afscrome merged 2 commits into
mainfrom
afscrome-fix-sql-login-race-06d

Conversation

@afscrome

Copy link
Copy Markdown
Contributor

Fixes the intermittent failure in AppHostTests.ProjectBasedResourceStartsAndRespondsOk seen in this failing job (Login failed for user 'sa').

Root cause: in the example AppHost, sdk-project and chinook were both deploying to the same shared TargetDatabase with no ordering between them. That contention delayed/destabilized the sibling other-sdk-project deployment on the SQL Server container, so the test's verification connection hit a transient login failure right after deployment.

Fix: give each deployed project its own dedicated database (Database1/Database2/Database3) instead of sharing two databases across three deployments, and update AppHostTests to match.

Validation: ran the AppHostTests suite locally under Docker 3 times (9/9 tests passed each run).

…abase

The example AppHost had sdk-project and chinook both deploying to the
shared TargetDatabase with no ordering between them. This caused
contention on the SQL Server container that delayed and destabilized
the sibling other-sdk-project deployment, leading to an intermittent
"Login failed for user 'sa'" error when the test opened its
verification connection right after deployment finished.

Give each deployed project/package its own dedicated database
(Database1/Database2/Database3) so concurrent deployments no longer
contend for the same database, and update AppHostTests accordingly.

Validated by running the SqlDatabaseProjects AppHostTests 3 times
locally under Docker; all passed (9/9 total).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 22, 2026 19:13
@github-actions

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/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1609

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1609"

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Copilot review overview

🟢 Approval recommended

The database assignments and corresponding test expectations are aligned, with no unresolved blocking issues identified.

Review effort: Lite
Findings: None

What changed in this PR

This PR fixes flaky SQL deployment tests by assigning each project its own database and updating test expectations.

Changes:

  • Adds dedicated Database1, Database2, and Database3 resources.
  • Updates database mappings in AppHostTests.
File Summary
tests/​CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects.Tests/​AppHostTests.cs Verifies each project against its dedicated database.
examples/​sql-database-projects/​CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects.AppHost/​Program.cs Assigns separate databases to SQL deployments.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 68% 59% 137 ➖
Summary 68% (267 / 391) 59% (58 / 98) 137 ➖

@afscrome
afscrome deployed to azure-artifacts September 22, 2026 19:22 — with GitHub Actions Active

@Odonno Odonno 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.

LGTM

@afscrome
afscrome merged commit 1e24090 into main Sep 22, 2026
16 checks passed
@afscrome
afscrome deleted the afscrome-fix-sql-login-race-06d branch September 22, 2026 19:32

This branch was successfully deployed

1 active deployment
azure-artifacts — aa5cfd83 Deployed Sep 22, 2026 by afscrome via publish-azure-artifacts #3690
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants