Skip to content

[test-quarantine] Improve reliability of HubConnectionTests.LongPollingUsesHttp2ByDefault - #68222

Draft
vendasankarsf3945 wants to merge 2 commits into
dotnet:mainfrom
vendasankarsf3945:50180-longpolling-http2-test
Draft

[test-quarantine] Improve reliability of HubConnectionTests.LongPollingUsesHttp2ByDefault#68222
vendasankarsf3945 wants to merge 2 commits into
dotnet:mainfrom
vendasankarsf3945:50180-longpolling-http2-test

Conversation

@vendasankarsf3945

Copy link
Copy Markdown
Contributor

Improve reliability of HubConnectionTests.LongPollingUsesHttp2ByDefault

Description

This PR fixes a flaky failure in HubConnectionTests.LongPollingUsesHttp2ByDefault when running the LongPolling transport over HTTPS with HTTP/2 enabled.

The test already verified the expected negotiate, poll, send, and delete requests, but the teardown path could race with asynchronous log emission. That meant the server could be disposed before the expected HTTP/2 log entries were observed, causing intermittent failures even though the transport behavior was correct.

The fix adds a narrowly scoped synchronization point that waits for the expected HTTP/2 request logs before server disposal and removes the [QuarantinedTest] attribute from the now-stable test.

Validation / Investigation

  1. The flakiness was isolated to HubConnectionTests.LongPollingUsesHttp2ByDefault in HubConnectionTests.cs.
  2. The test behavior itself was correct; the intermittent failure came from timing around log delivery during shutdown.
  3. LongPolling over HTTPS still performs negotiate, poll, send, and delete requests over HTTP/2 as expected.
  4. Waiting for the expected request logs before server disposal removes the race without broadening the test's assertions.

Changes

  1. Added an event-based synchronization point to wait for the expected HTTP/2 request logs before disposing the server.
  2. Kept the log filter narrow so the test still verifies the specific LongPolling HTTP/2 requests.
  3. Removed the [QuarantinedTest] attribute from LongPollingUsesHttp2ByDefault.

Fixes #50180

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Aug 5, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @vendasankarsf3945. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@vendasankarsf3945 vendasankarsf3945 changed the title Improve reliability of HubConnectionTests.LongPollingUsesHttp2ByDefault [test-quarantine] Improve reliability of HubConnectionTests.LongPollingUsesHttp2ByDefault Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarantine LongPollingUsesHttp2ByDefault

1 participant