Skip to content

test: fix three deterministically-failing Outerloop tests - #18250

Merged
Ankit Jain (radical) merged 3 commits into
microsoft:mainfrom
radical:radical/fix-outerloop-tests
Jun 16, 2026
Merged

test: fix three deterministically-failing Outerloop tests#18250
Ankit Jain (radical) merged 3 commits into
microsoft:mainfrom
radical:radical/fix-outerloop-tests

Conversation

@radical

Copy link
Copy Markdown
Member

Consolidates three small [OuterloopTest] fixes for tests that fail every scheduled Outerloop run (flagged in the workflow-health report #18223). Supersedes #18248, #18246, #18249 — none were approved, so combining them into one review/CI cycle. Each fix is an independent test-only change to a different assembly.

1. AspireNew_WithAgentInit_InstallsPlaywrightWithoutErrors (CLI e2e)

Symptom. The test drove the aspire agent init skill-selection menu with hardcoded positional space/down keystrokes. When the skill bundle gained a new skill, the keystrokes landed on aspire-orchestration instead of playwright-cli, so playwright-cli was never installed and the later playwright-cli --version check exited 127.

Fix. Pass --skill-locations claudecode --skills playwright-cli to aspire new; the flags are forwarded to the chained agent init and bypass the interactive prompts, making selection deterministic regardless of bundle contents. All verification steps are preserved.

tests/Aspire.Cli.EndToEnd.Tests/NewWithAgentInitTests.cs

2. BrowserToken_QueryStringToken_HttpsThenHttp_WebKit_Success (dashboard)

Symptom. The class fixture threw in InitializeAsync before any test body ran:

Class fixture type 'BrowserTokenDashboardServerWithHttpAndHttpsFixture' threw in InitializeAsync

Root cause. The fixture bound the frontend to https://localhost:0;http://localhost:0. Kestrel doesn't support dynamic-port (:0) binding on the localhost hostname — the constraint is hostname-based, not scheme-based. The base DashboardServerFixture already binds 127.0.0.1:0.

Fix. Bind to https://127.0.0.1:0;http://127.0.0.1:0. The WebKit test navigates to the resolved address with IgnoreHTTPSErrors, so the loopback IP is fine.

tests/Aspire.Dashboard.Tests/Integration/Playwright/BrowserTokenAuthenticationTests.cs

3. ProxylessContainerCanBeReferenced + WithEndpointProxySupportDisablesProxies (hosting)

Symptom. Both [OuterloopTest] + Docker-required tests fail deterministically on the Linux Hosting job (pass on Windows). They assert on a proxyless service's Status.EffectivePort immediately after startup.

Root cause. #17924 made Aspire pre-assign the proxyless host port synchronously (Service.Spec.Port) and excluded proxyless services from the DCP startup address-wait, so Status.EffectivePort can still be null right after startup — a race.

Fix. Wait for the proxyless service's EffectivePort to be populated (via KubernetesHelper.GetResourceByNameAsync) before asserting.

tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs

Validation

Outerloop Tests workflow dispatched against the combined change; the net diff is identical to what's under review here.

Fixes #8773
Refs #18223

Copilot AI and others added 3 commits June 16, 2026 15:51
…of positional keystrokes

Co-authored-by: radical <1472+radical@users.noreply.github.com>
The BrowserTokenDashboardServerWithHttpAndHttpsFixture bound the dashboard
frontend to "https://localhost:0;http://localhost:0". Kestrel rejects
dynamic-port (":0") binding on the "localhost" hostname:

  System.InvalidOperationException: Dynamic port binding is not supported
  when binding to localhost. You must either bind to 127.0.0.1:0 or
  [::1]:0, or both.

So the fixture threw in InitializeAsync and
BrowserToken_QueryStringToken_HttpsThenHttp_WebKit_Success failed every
scheduled Outerloop run. Bind to 127.0.0.1:0 instead, matching the base
DashboardServerFixture. The WebKit test navigates to the resolved address
with IgnoreHTTPSErrors, so the loopback IP is fine.

Broken since the fixture was introduced in microsoft#17368.

Refs microsoft#18223

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ProxylessContainerCanBeReferenced and WithEndpointProxySupportDisablesProxies
([OuterloopTest], Docker-required) failed every scheduled Outerloop run on the
Hosting (8-core-ubuntu-latest) job while passing on Windows:

    Assert.IsType() Failure: Value is null
    Expected: typeof(int)
    Actual:   null
      at ...AssertAllocatedProxylessPort(Service service) line 2319
      at ...ProxylessContainerCanBeReferenced() line 1835

Both assert on the redisNoPort proxyless service's Status.EffectivePort.
PR microsoft#17924 made Aspire pre-assign the proxyless host port synchronously
(Service.Spec.Port) and deliberately excluded proxyless services from the
startup address-wait in DcpExecutor, since connection strings use the
Aspire-assigned Spec.Port immediately. DCP still echoes the bound port back
asynchronously via Status.EffectivePort. On a fast Linux agent the test reads
the service list before DCP populates EffectivePort, so the assertion sees
null; on Windows the update lands first, so it passes. The unit-test fake sets
EffectivePort = Spec.Port synchronously, hiding the race.

Fix is test-side: wait for the proxyless service to report a non-null
EffectivePort (via KubernetesHelper.GetResourceByNameAsync, the existing
watch-based waiter) before asserting, instead of reading a once-fetched
service list. No product change - the orchestrator behavior is correct.

Fixes microsoft#8773

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18250

Or

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

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.

Pull request overview

This PR fixes three deterministically-failing Outerloop tests that caused the scheduled Outerloop Tests workflow to fail 7/7 runs per week (as reported in #18223). It consolidates the fixes from three individual PRs (#18248, #18246, #18249) into a single review/CI cycle.

Changes:

  • Replace fragile positional keystrokes in the CLI E2E agent-init test with explicit --skill-locations/--skills CLI flags, making skill selection deterministic regardless of bundle contents.
  • Fix Kestrel dynamic-port binding failure in the dashboard Playwright fixture by using 127.0.0.1:0 instead of localhost:0.
  • Fix a race condition in two Hosting tests by waiting for DCP to populate Status.EffectivePort on proxyless services instead of asserting on a potentially-null value from a one-time list fetch.

Reviewed changes

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

File Description
tests/Aspire.Cli.EndToEnd.Tests/NewWithAgentInitTests.cs Passes --skill-locations claudecode --skills playwright-cli to bypass interactive prompts; removes ~23 lines of fragile keystroke navigation
tests/Aspire.Dashboard.Tests/Integration/Playwright/BrowserTokenAuthenticationTests.cs Changes frontend URL binding from localhost:0 to 127.0.0.1:0 with an explanatory comment
tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs Replaces GetEndpointService with WaitForAllocatedProxylessServiceAsync that uses the watch-based KubernetesHelper.GetResourceByNameAsync to wait for EffectivePort to be populated

@radical
Ankit Jain (radical) marked this pull request as ready for review June 16, 2026 20:06
@radical Ankit Jain (radical) added the area-engineering-systems infrastructure helix infra engineering repo stuff label Jun 16, 2026
@radical Ankit Jain (radical) added the automated Opened by bots or tools label Jun 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@radical
Ankit Jain (radical) merged commit 003ca64 into microsoft:main Jun 16, 2026
679 of 684 checks passed
@github-actions github-actions Bot added this to the 13.5 milestone Jun 16, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-engineering-systems infrastructure helix infra engineering repo stuff automated Opened by bots or tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Failing test]: ProxylessContainerCanBeReferenced

4 participants