You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Manage SimulatedServer flaky test failures - #4804
Stabilizes two simulated-server unit tests that fail intermittently under CI load. Test-only change; no product code or public API changes.
1. Mark ConnectionFailoverTests.NetworkError_TriggersFailover_ClearsPool as flaky
Adds [Trait("category", "flaky")], consistent with the other flaky simulated-server failover tests, with a comment documenting the observed CI failure. The failover server intermittently records 3 pre-logins instead of the expected 2 after the pool is cleared and the connection is reopened. This appears to be agent-timing sensitivity under CI load.
Failed Microsoft.Data.SqlClient.UnitTests.SimulatedServerTests.ConnectionFailoverTests.NetworkError_TriggersFailover_ClearsPool [7 s]
Assert.Equal() Failure: Values differ
Expected: 2
Actual: 3
at ...ConnectionFailoverTests.NetworkError_TriggersFailover_ClearsPool() in ...ConnectionFailoverTests.cs:line 170
2. Use a fixed setup login timeout in IsolationLevelResetTests.ResetSessionIsolationLevel_UsesOpenBudget
The CI case (1, 30, 1000) timed out during the real connection.Open() pre-login handshake (~999 ms) before the isolation-level reset under test ever ran. The setup connection now uses ConnectTimeout = 30.
ResetSessionIsolationLevel only uses the fake-clock TimeoutTimer passed to it, so the test still covers what it did before:
TimeoutTimer.StartNew(TimeSpan.FromSeconds(connectTimeout), clock) is unchanged.
CommandTimeout = commandTimeout is unchanged.
All InlineData cases and the exhausted-budget and remaining-budget assertions are unchanged.
Issues
N/A — CI flakiness.
Testing
ConnectionFailoverTests: only a test trait and comment were added; not run locally. The test now runs in the flaky test category in CI.
IsolationLevelResetTests: ran locally:
dotnet test src\Microsoft.Data.SqlClient\tests\UnitTests\Microsoft.Data.SqlClient.UnitTests.csproj -f net10.0 --filter "FullyQualifiedName~IsolationLevelResetTests.ResetSessionIsolationLevel_UsesOpenBudget"
Result: passed (5/5, net10.0). net462 was not run locally.
Guidelines
Please review the contribution guidelines before submitting a pull request:
…enBudget
The reset under test consumes the fake-clock TimeoutTimer, so the real setup
connection's ConnectTimeout does not affect coverage. A 1-second setup login
timeout caused CI failures in the pre-login handshake before the reset ran.
Co-authored-by: Copilot App <[email protected]>
Avoid quarantining this pool-clear regression based on the raw pre-login count. GenericTdsServer.cs:150-155 defines abandoned pre-logins specifically for timing-dependent TNIR/failover attempts, and nearby failover tests normalize those attempts; this test's invariant is two completed logins after reopening, not exactly two pre-login attempts. Assert Login7Count (or subtract AbandonedPreLoginCount) at the final assertion and keep the test in regular CI, otherwise a pool-clearing regression is removed from normal coverage.
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.79%. Comparing base (47c815c) to head (25ed340). ⚠️ Report is 2 commits behind head on main.
Retain the target release without isolation-level reset tests; only the failover quarantine from c7ab087 applies.
Co-authored-by: Copilot App <[email protected]>
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
Hotfix 7.1.3PRs targeting main that should be backported to release/7.1 for 7.1.3.
7 participants
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.
Description
Stabilizes two simulated-server unit tests that fail intermittently under CI load. Test-only change; no product code or public API changes.
1. Mark
ConnectionFailoverTests.NetworkError_TriggersFailover_ClearsPoolas flakyAdds
[Trait("category", "flaky")], consistent with the other flaky simulated-server failover tests, with a comment documenting the observed CI failure. The failover server intermittently records 3 pre-logins instead of the expected 2 after the pool is cleared and the connection is reopened. This appears to be agent-timing sensitivity under CI load.2. Use a fixed setup login timeout in
IsolationLevelResetTests.ResetSessionIsolationLevel_UsesOpenBudgetThe CI case
(1, 30, 1000)timed out during the realconnection.Open()pre-login handshake (~999 ms) before the isolation-level reset under test ever ran. The setup connection now usesConnectTimeout = 30.ResetSessionIsolationLevelonly uses the fake-clockTimeoutTimerpassed to it, so the test still covers what it did before:TimeoutTimer.StartNew(TimeSpan.FromSeconds(connectTimeout), clock)is unchanged.CommandTimeout = commandTimeoutis unchanged.InlineDatacases and the exhausted-budget and remaining-budget assertions are unchanged.Issues
N/A — CI flakiness.
Testing
ConnectionFailoverTests: only a test trait and comment were added; not run locally. The test now runs in the flaky test category in CI.IsolationLevelResetTests: ran locally:Guidelines
Please review the contribution guidelines before submitting a pull request: