Mark resource-intensive test fixtures as NonParallelizable#712
Open
Mark resource-intensive test fixtures as NonParallelizable#712
Conversation
ProxyFixture, BadCertificatesTests, and CancellationViaClientProxyFixture deliberately hold sockets and TLS connections open for extended periods while waiting for timeouts or cancellations. Running them concurrently with the full test suite starves other tests of ports and threads, causing spurious failures. Isolating them prevents interference without loosening any assertions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…allelizable-heavy-fixtures
gb-8
approved these changes
May 8, 2026
Contributor
gb-8
left a comment
There was a problem hiding this comment.
✅ Approved!
Curious to see how this impacts overall build time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The test suite runs with
[assembly: Parallelizable(ParallelScope.All)], meaning all fixtures execute concurrently by default. Three fixtures deliberately hold sockets, TLS connections, and threads open for extended periods as part of their test design. When run alongside the full suite they compete for ports and thread-pool threads, causing spurious failures in unrelated tests. This change marks them[NonParallelizable]so they run in isolation.ProxyFixture
Two of the three tests dispose or pause a real HTTP/SOCKS proxy mid-test and then drive the client through its retry loop (
RetryCountLimit = 2,TcpClientConnectTimeout = 5s,PollingRequestQueueTimeout = 10s). Each attempt opens a socket and waits for a connect or read timeout before giving up. The sequence of retries holds file descriptors and OS socket state for ~10–20 seconds per test invocation, a long window during which concurrent tests can exhaust the available ephemeral port range.BadCertificatesTests
Tests repeatedly establish TLS handshakes with mismatched certificates, causing the SSL layer to reject and retry connections in a tight loop. Several tests set
PollingRequestQueueTimeout = TimeSpan.FromSeconds(2000)and useWait.UntilActionSucceedsloops of up to 20 seconds while the wrong-cert client keeps reconnecting. This produces a sustained burst of TLS negotiation work (certificate parsing, crypto operations) and open sockets that can saturate the thread pool and port space when competing with the rest of the suite.CancellationViaClientProxyFixture
Tests use
EnterKillNewAndExistingConnectionsMode()combined withTryAndConnectForALongTime()to hold the client in a connecting loop, and separately hold an RPC call in-flight (blocking on a sentinel file) before cancelling it. Both patterns keep connections and thread-pool work items live for several seconds by design. The in-flight cancellation test also introduces a deliberateTask.Delay(2s)after cancellation to allow propagation, adding to the window of resource contention.Test plan
🤖 Generated with Claude Code