Description
Several tests verify parallel/non-parallel execution by checking DateTime overlaps, which are inherently fragile:
ParallelTests.cs and NotInParallelTests.cs
Use DateTimeRange overlaps to verify parallel/sequential execution. DateTime precision depends on system clock granularity. On slow CI systems, tests might complete too quickly for overlap detection.
TimeoutTests1.cs (Lines 18-19)
Tight timing assertion expecting test to complete between 4-60 seconds. Fragile on resource-constrained CI.
AdaptiveParallelismTests.cs
CPU-intensive loop using DateTime.UtcNow comparisons (system clock dependent). 1000 repetitions × 1s delay = 16+ minutes per test method.
Suggested Fix
- Replace DateTime overlap checks with
Interlocked concurrent execution counters
- Use event-based synchronization (
TaskCompletionSource) instead of hard timeouts
- Widen timing windows with documented rationale
- Separate AdaptiveParallelismTests into a
[Category("Performance")] suite
Description
Several tests verify parallel/non-parallel execution by checking DateTime overlaps, which are inherently fragile:
ParallelTests.cs and NotInParallelTests.cs
Use
DateTimeRangeoverlaps to verify parallel/sequential execution. DateTime precision depends on system clock granularity. On slow CI systems, tests might complete too quickly for overlap detection.TimeoutTests1.cs (Lines 18-19)
Tight timing assertion expecting test to complete between 4-60 seconds. Fragile on resource-constrained CI.
AdaptiveParallelismTests.cs
CPU-intensive loop using
DateTime.UtcNowcomparisons (system clock dependent). 1000 repetitions × 1s delay = 16+ minutes per test method.Suggested Fix
Interlockedconcurrent execution countersTaskCompletionSource) instead of hard timeouts[Category("Performance")]suite