Repository navigation
Tests: Strengthen simulator failure and retry regressions - #5137
paulmedynski wants to merge 3 commits into
Conversation
Report handler and diagnostic I/O failures, prove physical network retries, and observe actual pool-wait admission. Preserve quarantine routing and adapt TLS stall teardown to the stricter simulator contract. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The connection test uses a prohibited sync/async selection flag and must be split into separate Open and OpenAsync theories while preserving the gate, retry-count assertions, and flaky/probation traits.
1 open issue
What changed in this PR
This test-only PR strengthens SqlClient’s simulated-server failure handling and retry regressions, addressing gaps found during the release-backport reviews. Production driver behavior, public APIs, dependencies, and pipelines are unchanged.
Changes:
- Distinguish expected transport/TLS failures from unexpected handler and logging errors, with lifecycle regressions.
- Add session-specific transport aborts and verify actual connection retries while retaining quarantine and adding probation.
- Make pool-wait regression timing depend on observed wait admission and document the updated contracts.
| File | Description |
|---|---|
| TESTGUIDE.md | Documents failure classification, aborts, retries, and pool-wait checks. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ServerLifecycleTests.cs | Adds handler/logging failure and selective-abort regressions. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/Fixtures/TlsHandshakeStallingTdsServer.cs | Ends stalled handshakes through a physical transport failure. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/Fixtures/GatedTdsServer.cs | Aborts the first session and tracks the gated retry session. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionTests.cs | Verifies configurable retries across sync/async and failover settings. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/ConnectionPool/DbConnectionPoolInstrumentationTest.cs | Pins the wait-budget policy and observes pool-wait admission. |
| src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.Servers/GenericTdsServer.cs | Exposes a protected session-abort hook. |
| src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TransportStream.cs | Marks failures originating at the physical transport boundary. |
| src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPointConnection.cs | Implements transport aborts and preserves unexpected processing/logging failures. |
| src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSServerEndPoint.cs | Routes abort requests to the selected session’s connection. |
| src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDSParser.cs | Marks explicitly expected TLS authentication failures. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5137 +/- ##
==========================================
+ Coverage 68.99% 70.47% +1.47%
==========================================
Files 314 315 +1
Lines 45857 70159 +24302
==========================================
+ Hits 31638 49442 +17804
- Misses 14219 20717 +6498
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The shared simulator’s transport/TLS failure handling and socket-reset teardown require human review of still-pending Windows/native-SNI and .NET Framework CI results.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Shared simulator teardown and TLS failure handling affect multiple platform variants, but execution evidence covers only managed net10.0, leaving Windows/native-SNI and .NET Framework behavior unverified and requiring human review of platform CI and close/reset behavior.
No open issues 🎉
Review effort: Balanced

Summary
Fix inherited test-maintenance gaps identified while reviewing the consolidated release backports (#5132, #5133, #5134, and #5135). These are test infrastructure and regression-test changes only; no production driver behavior, public API, dependency versions, or pipelines change.
Validation
Focused main net10.0 run: 37 passed, zero failures/skips, covering the four network-retry cases, lifecycle/transport failure cases, four TLS-timeout cases, and both held-slot pool cases.
Broader main simulator run: 825 passed, zero failures/skips. Integrated-auth execution was excluded, and the existing failover-partner regression was excluded only after its identical connection-reset failure was reproduced on pristine main at 329df05. This is not a claimed complete-suite pass.
Mutation checks: restoring the 15 ms harness budget fails the WaitHandle regression; removing the first physical abort fails all four retry cases; restoring the broad simulator I/O filter fails the handler-I/O regressions. All mutations were removed.
UnitTests net462 compilation passed with zero warnings/errors. Windows/native SNI and .NET Framework execution remain for CI; these are not claimed as local passes.
Existing release-specific quarantines are retained in the companion backports, including the restored 7.0 failover class quarantine. Probation begins independently only when the effective fix and traits merge.
Tests added or updated
Public API changes documented (not applicable)
Verified against customer repro (not applicable; test-maintenance changes)
Ensure no breaking changes introduced