Skip to content

Tests: Strengthen simulator failure and retry regressions - #5137

Draft
paulmedynski wants to merge 3 commits into
mainfrom
dev/automation/test-maintenance-review-fixes
Draft

paulmedynski wants to merge 3 commits into
mainfrom
dev/automation/test-maintenance-review-fixes

Conversation

@paulmedynski

Copy link
Copy Markdown
Contributor

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.

  • Preserve unexpected handler and log-writer I/O failures during simulator disposal. Only failures identified at the physical transport boundary and explicitly expected TLS rejection are tolerated; add handler-I/O and diagnostic-logging regressions.
  • Add a session-specific simulator abort hook that closes only the selected transport without joining its worker or stopping the listener. Verify cleanup and unexpected failures remain observable.
  • Adapt the existing TLS-stalling fixture to stop through an actual marked transport failure rather than manufacturing a handler IOException; preserve all handshake timeout assertions.
  • Replace the misleading delayed-open retry scenario with a first-connection transport abort and a second, distinct pre-login session gate. Cover sync/async open and both MultiSubnetFailover settings, assert exactly one retry event, two pre-logins, and one successful LOGIN7. Use an explicit configurable network-error retry policy: ConnectRetryCount does not retry a pre-login reset. Retain flaky and add probation; these cases are not promoted into ordinary CI.
  • Pin the pool-wait regression to the legacy wait-budget policy in the serialized AppContext collection and observe actual pool-wait admission before measuring the held-slot interval.
  • Update the simulator and pool-regression guidance.

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

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>

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.

🟡 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

@paulmedynski paulmedynski added the Area\Tests Issues that are targeted to tests or test projects label Nov 24, 2026
@paulmedynski paulmedynski moved this from To triage to In progress in SqlClient Board Nov 24, 2026
@paulmedynski paulmedynski added this to the 8.1.0-preview1 milestone Nov 24, 2026
@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.47%. Comparing base (17bef7b) to head (5433532).
⚠️ Report is 37 commits behind head on main.

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     
Flag Coverage Δ
CI-SqlClient ?
sqlclient-pr 70.47% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 24, 2026 13:37

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.

🔵 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

@paulmedynski paulmedynski changed the title [Test only] Strengthen simulator failure and retry regressions Tests: Strengthen simulator failure and retry regressions Nov 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 24, 2026 13:56

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.

🔵 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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Tests Issues that are targeted to tests or test projects

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants