Skip to content

[6.1] Tests: Backport recent quarantines and stability fixes - #5133

Draft
paulmedynski wants to merge 4 commits into
release/6.1from
dev/automation/quarantine-backports-6.1
Draft

paulmedynski wants to merge 4 commits into
release/6.1from
dev/automation/quarantine-backports-6.1

Conversation

@paulmedynski

@paulmedynski paulmedynski commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Consolidated backport of applicable recent main quarantines and flaky-test improvements to release/6.1, reviewed through 51da3ab3483ab9f5fa3442d4193ae82c1e1c2d24 (November 23). Companion 8.0 backport: #5132.

Applicability and duplication

Do not import absent pool-v2 unit/instrumentation, isolation-reset, isolation-leak, reclaimed-connection reuse, vector metadata, or asynchronous schema scenarios. Existing failover/worker-start quarantines and schema deadlock retries are not duplicated. Inspected open release backports #4979, #5082, #5097, #5103, and #5124. In particular, no PRELOGIN changes from #4979 or NuGet-auditing changes from #5097 are included.

No production driver, public API, dependency, or pipeline changes. Preserve existing release-specific platform conditions and quarantines. Probation remains tracking metadata and starts independently on this branch only when the fix and traits merge.

Validation

  • Focused simulator execution passed all 116 selected cases on each of net8.0 and net9.0, with zero failures/skips in the final runs. Integrated-auth execution is excluded because this Linux host lacks the required Kerberos context. The lifecycle setup was adapted after four original disposal cases exposed an older Debug SNI assertion.

  • ManualTests compiled on net8.0 and net9.0 with zero warnings/errors. Discovery verified affected manual quarantines and confirmed the scheduler regression stays outside quarantine.

  • Certificate scripts passed PowerShell syntax checks; they were not executed. git diff --check passed.

  • Local restore used -p:NuGetAudit=false because vulnerability-feed access failed with NU1900/NU1905. This was a command-line validation workaround only, not a committed policy change or a successful vulnerability audit.

  • net462 validation was blocked by the older Linux restore/framework-selection configuration. The initial explicit restore hit NU1009 for implicit reference-assembly packages; a command-only override allowed restore, but Windows builds/execution remain unverified.

  • Live-SQL manual tests and long-term quarantine stability remain for CI.

  • Tests added or updated

  • Public API changes documented (not applicable)

  • Verified against customer repro (not applicable; test-maintenance backport)

  • Ensure no breaking changes introduced

Review follow-up

Addressed Copilot feedback in f9d0e57; the inherited main fixes are in #5137.

  • Mark physical transport failures and explicitly expected TLS rejection separately from handler exceptions. Handler IOException/SocketException and diagnostic log failures now survive disposal; the original-filter mutation fails the new handler-I/O regressions.
  • Require an actual first physical failure, exactly one configured retry event, and a distinct second-session pre-login gate before success. Cover sync/async opens and both MultiSubnetFailover settings. ConnectRetryCount does not retry a pre-login reset, so the regression uses an explicit configurable network-error retry policy.
  • Adapt 6.1's injection to abort only after observing ClientHello, using the shared certificate-generation fixture and the minimal existing-main TLS-start hook. This avoids the older Debug provider-EOF formatter without changing production code or suppressing assertions. Retain flaky and add probation.
  • Final net8.0 validation: 31 focused cases and all 424 selected broader simulator cases passed, with zero failures/skips. The earlier Debug-injection failures were corrected before this commit. Existing Windows/net462, Kerberos, and live-SQL validation gaps remain as documented above.

Consolidate applicable main quarantines, simulator lifecycle and fault scheduling fixes, MARS teardown assertions, and the pool checkout scheduler regression. Preserve older simulator and certificate APIs and avoid absent feature tests and pending backport work.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 18:34
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Nov 23, 2026
@paulmedynski paulmedynski added the Area\Tests Issues that are targeted to tests or test projects label Nov 23, 2026
@paulmedynski paulmedynski moved this from To triage to In progress in SqlClient Board Nov 23, 2026
@paulmedynski paulmedynski added this to the 6.1.9 milestone Nov 23, 2026

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 exception filter swallows handler-originated IOExceptions even without a shutdown request, leaving ProcessingException unset and allowing disposal to succeed despite a handler failure.

1 open issue
What changed in this PR

Backports applicable test quarantines and stability fixes to release/6.1, adapting them to the branch’s older test infrastructure. No production driver, public API, dependency, or pipeline changes are included.

Changes:

  • Adds applicable flaky-test markings while preserving existing quarantines and adding probation metadata for repaired cases.
  • Stabilizes simulator workers, shutdown, fault handling, pool isolation, and certificate scenarios, with controlled regression tests.
  • Repairs pool-checkout scheduling and MARS fatal-error assertions without importing unsupported newer test scenarios.
File Description
TESTGUIDE.md Documents simulator lifecycle, pool isolation, and certificate testing.
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​SimulatedServerTests/​ServerLifecycleTests.cs Adds lifecycle, fault-budget, and TLS regressions.
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​SimulatedServerTests/​ServerEndPointConnectionTests.cs Tests transport initialization against concurrent disposal.
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​SimulatedServerTests/​Fixtures/​SimulatedServerPoolScope.cs Isolates and clears scenario-owned pools.
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​SimulatedServerTests/​Fixtures/​GatedTdsServer.cs Adds explicit pre-login response gates.
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​SimulatedServerTests/​ConnectionTests.cs Stabilizes connection scenarios and applies quarantines.
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​SimulatedServerTests/​ConnectionFailoverTests.cs Adds gated failover, pool-identity assertions, and async coverage.
src/​Microsoft.Data.SqlClient/​tests/​tools/​TDS/​TDS/​TDSUtilities.cs Handles omitted encryption metadata without negotiating TLS.
src/​Microsoft.Data.SqlClient/​tests/​tools/​TDS/​TDS.Servers/​TransientTdsErrorTdsServer.cs Reserves transient errors atomically and resets rearmed budgets.
src/​Microsoft.Data.SqlClient/​tests/​tools/​TDS/​TDS.Servers/​TransientDelayTdsServer.cs Reserves delays atomically and cancels them during disposal.
src/​Microsoft.Data.SqlClient/​tests/​tools/​TDS/​TDS.Servers/​TdsServerArguments.cs Adds an explicit expected TLS-failure setting.
src/​Microsoft.Data.SqlClient/​tests/​tools/​TDS/​TDS.Servers/​GenericTdsServer.cs Forwards TLS expectations and atomically detaches disposed endpoints.
src/​Microsoft.Data.SqlClient/​tests/​tools/​TDS/​TDS.EndPoint/​TDSServerEndPointConnection.cs Uses dedicated workers, serialized transport startup, and worker draining.
src/​Microsoft.Data.SqlClient/​tests/​tools/​TDS/​TDS.EndPoint/​TDSServerEndPoint.cs Coordinates listener shutdown, connection ownership, and failure reporting.
src/​Microsoft.Data.SqlClient/​tests/​tools/​TDS/​TDS.EndPoint/​TDSParser.cs Separates expected TLS rejection from certificate setup failures.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​TracingTests/​EventSourceTest.cs Quarantines intermittent listener enumeration failures.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​SqlSchemaInfoTest/​SqlSchemaInfoTest.cs Quarantines the existing synchronous schema theory.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​SplitPacketTest/​SplitPacketTest.cs Quarantines four intermittent split-packet tests.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​MARSTest/​MARSTest.cs Quarantines shared-connection concurrency timeouts.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​ConnectivityTests/​ConnectivityTest.cs Quarantines the async no-retry timing assertion.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​ConnectionTestWithSSLCert/​CertificateTestWithTdsServer.cs Keeps certificates untrusted and strengthens outcome checks and cleanup.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​ConnectionTestWithSSLCert/​CertificateTest.cs Applies quarantines to release-specific certificate methods.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​ConnectionPoolTest/​TransactionPoolTest.cs Quarantines the older transaction-cleanup test.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​ConnectionPoolTest/​PoolBlockPeriodTest.cs Quarantines intermittent blocking-period timing failures.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​ConnectionPoolTest/​ConnectionPoolTest.cs Repairs worker scheduling and adds an ordinary scheduler regression.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​AsyncTest/​MarsReceiveTeardownTest.cs Accepts racing teardown outcomes while requiring a fatal SQL error.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​removecert.ps1 Adds trust-preserving cleanup and corrects the certificate directory.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​makepfxcert.ps1 Adds certificate generation without modifying root trust stores.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​DDBasics/​DDAsyncTest/​DDAsyncTest.cs Quarantines intermittent concurrent list-write failures.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​DataCommon/​ConnectionTestParametersData.cs Corrects a mismatched-certificate matrix case.

Review effort: Balanced

@paulmedynski paulmedynski changed the title Tests: Backport recent quarantines and stability fixes to 6.1 [6.1] Tests: Backport recent quarantines and stability fixes Nov 23, 2026
Report handler and diagnostic I/O failures and prove physical failure followed by an observed configurable retry. Abort the first TLS transport only after ClientHello to avoid the older Debug EOF formatter without suppressing driver assertions.

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

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

Unresolved shutdown races, unreported logging failures, and overly broad constructor-failure cleanup can cause unexpected worker failures or alter unrelated SQL Server settings.

1 open issue
2 previously missed issues

In code that hasn't changed since last review

Medium severity Limit constructor-failure cleanup to simulator resources

src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​SQL/​ConnectionTestWithSSLCert/​CertificateTestWithTdsServer.cs:70

This new constructor-failure path calls the full fixture disposal routine, which also clears the real SQL Server's encryption registry settings and stops/restarts its service on Windows. At this point setup has only attempted to generate a simulator certificate, so a missing PowerShell executable or script timeout now changes an unrelated server configuration; a service-control failure can also replace the original setup exception. Restrict partial-construction cleanup to the generated certificate/files and preserve the original failure.

Medium severity Record connection-close logging failures during teardown

src/​Microsoft.Data.SqlClient/​tests/​tools/​TDS/​TDS.EndPoint/​TDSServerEndPoint.cs:349

If the connection-close log write throws after the connection is removed, the exception faults the worker task without entering _errors. When this happens before Stop() takes its snapshot, disposal can succeed without reporting the failure. Catch and record the logging exception under the existing lock so teardown reports it.

1 resolved since last review

Review effort: Balanced

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.

🟡 Changes recommended

The new certificate fixture leaves persisted private keys on Windows, and the updated PowerShell wrapper no longer matches the existing Pester assertion, causing an orchestration test failure.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Certificate fixture leaves persisted private keys behind

src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​SimulatedServerTests/​ConnectionTests.cs:281

On modern .NET, CertificateFixtureBase.CreateCertificate imports the PFX with PersistKeySet (Common/Fixtures/CertificateFixtureBase.cs:108–122), so disposing the returned certificate leaves its private key on disk on Windows. This new fixture does not delete that key, so repeated quarantine runs accumulate persisted keys. Add an import option that omits PersistKeySet for this socket-only fixture, or explicitly delete its generated key during cleanup.

Review effort: Balanced

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

A critical unpublished finding indicates that listener error logging can let an exception escape and terminate the test host, requiring human assessment.

No open issues 🎉

2 resolved since last review

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