Skip to content

Make Basic auth credential-refresh test orchestration deterministic - #134414

Merged
rzikm merged 1 commit into
dotnet:mainfrom
rzikm:rzikm/basic-authentication-refresh-timeout
Sep 24, 2026
Merged

rzikm merged 1 commit into
dotnet:mainfrom
rzikm:rzikm/basic-authentication-refresh-timeout

Conversation

@rzikm

@rzikm rzikm commented Sep 22, 2026

Copy link
Copy Markdown
Member

RefreshesPreAuthCredentialsOnChange waits for the server before observing the client request, which can hide an earlier client failure behind a connection-operation timeout. Its response-before-GOAWAY ordering also lets an authentication retry reuse a connection while the test expects a new one.

This change observes each client request alongside both of its server authentication rounds, sends GOAWAY with the received stream ID before each response, and retains server ownership of accepted connections for failure cleanup. It preserves the credential-mutation barrier and authentication assertions, disposes responses, and adds connection/stream progress diagnostics.

Related to #133098. Controlled experiments reproduced exception masking and same-connection retry, but did not establish the cause of every historical CI timeout. This is a test-only change; credential-cache behavior is unchanged.

Validation

  • Windows x64 clr+libs -rc release baseline and final test build succeeded.
  • BasicAuth and neighboring authentication tests: 108 passed, 4 existing environment-condition skips, 0 failures.
  • Temporary fault injection in the actual test confirmed that client protocol errors and server assertions remain visible, with both peer tasks completed after cleanup. All injection was removed before the final build.
  • Android and NativeAOT were not run.

Note

This pull request was prepared with GitHub Copilot assistance.

Observe client failures alongside both authentication rounds, send GOAWAY before responses, and clean up pending peers without losing the primary failure.

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

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@rzikm
rzikm marked this pull request as ready for review September 23, 2026 08:44
@rzikm
rzikm requested review from a team and a lite review from Copilot September 23, 2026 08:44

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 reviewed test changes have no unresolved approval-blocking issues.

Review effort: Lite
Findings: None

What changed in this PR

This test-only PR makes Basic authentication credential-refresh orchestration deterministic.

Changes:

  • Coordinates client requests with server authentication rounds.
  • Sends GOAWAY before responses to force retry connections.
  • Improves cleanup, response disposal, and diagnostics.
File Description
src/​libraries/​System.Net.Http/​tests/​FunctionalTests/​HttpClientHandlerTest.BasicAuth.cs Updates Basic auth test orchestration and cleanup.

@rzikm

rzikm commented Sep 24, 2026

Copy link
Copy Markdown
Member Author

/ba-g Test failure is unrelated

@rzikm
rzikm merged commit 6c08d38 into dotnet:main Sep 24, 2026
84 of 86 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 25, 2026
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