Skip to content

Commit a1f6dd9

Browse files
Test: Refines RntbdIdleTimer test comments and isolation
Addresses PR #5817 review feedback: - Corrects the .Unwrap() comment to reflect that the timer-fire-count assertion guards continuation-chain reachability, not .Unwrap() presence (the entry trace runs synchronously before any await). - Adds [DoNotParallelize] on the test class and [Timeout(900_000)] on the long-running test method to prevent the 14-minute ThreadPool.SetMinThreads window from poisoning parallel emulator tests or hanging the runner. - Updates stale PR #5722 references to PR #5817. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent af8aa32 commit a1f6dd9

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/RntbdIdleTimerStarvationTests.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests
2424
/// </summary>
2525
[TestClass]
2626
[TestCategory("RntbdIdleTimer")]
27+
[DoNotParallelize]
2728
public class RntbdIdleTimerStarvationTests
2829
{
2930
private const string EndpointEnvVar = "COSMOS_ENDPOINT";
@@ -64,22 +65,25 @@ public async Task SmokeTest_CanReachEndpoint()
6465
Assert.IsFalse(string.IsNullOrWhiteSpace(account.Id), "AccountProperties.Id was empty.");
6566
}
6667

67-
// REGRESSION GUARD for the idle timer fix wiring (issue #4393, PR #5722).
68+
// REGRESSION GUARD for the idle timer fix wiring (issue #4393, PR #5817).
6869
//
6970
// What this test validates:
7071
// - Idle timers arm and fire correctly when the SDK runs against a
7172
// real Cosmos DB account.
72-
// - The .Unwrap() in Dispatcher.ScheduleIdleTimer continues to track
73-
// OnIdleTimerAsync completion correctly. If .Unwrap() is removed
74-
// in the future, the timer-fire-count assertion catches it (the
75-
// production trace at OnIdleTimerAsync entry stops being emitted
76-
// because the continuation chain breaks).
73+
// - The continuation chain from ScheduleIdleTimer still reaches
74+
// OnIdleTimerAsync. This does NOT validate .Unwrap() correctness:
75+
// the TraceInformation at OnIdleTimerAsync entry runs synchronously
76+
// before any await point, so the timer-fire-count assertion would
77+
// still pass even if .Unwrap() were removed. The .Unwrap() safety
78+
// (tracking the full async chain so disposal does not race the
79+
// still-running continuation) is guarded by the inline comment
80+
// in Dispatcher.ScheduleIdleTimer — see there.
7781
// - No thread-count explosion or unhandled exceptions during
7882
// idle-fire at N=50 over an ~13-minute window.
7983
//
8084
// What this test does NOT validate:
8185
// - That the fix prevents thread pool starvation. This was
82-
// investigated extensively (see PR #5722 stages 3.5 - 3.11) and
86+
// investigated extensively (see PR #5817 stages 3.5 - 3.11) and
8387
// the conclusion is that a single test client cannot reliably
8488
// reproduce the production starvation pattern.
8589
//
@@ -106,10 +110,11 @@ public async Task SmokeTest_CanReachEndpoint()
106110
//
107111
// References:
108112
// Issue #4393 (production bug report with stack trace)
109-
// PR #5722 (this fix)
113+
// PR #5817 (this fix)
110114
// DispatcherIdleTimerFixTests.cs (canonical fix evidence)
111115
[DataTestMethod]
112116
[DataRow(50)]
117+
[Timeout(900_000)]
113118
public async Task IdleTimerFire_WiringStillFunctional(int connectionCount)
114119
{
115120
(string endpoint, string key) = ReadCredentialsOrSkip();

0 commit comments

Comments
 (0)