Skip to content

Commit 7cca020

Browse files
committed
fix: remove global Retry(3) from InvokableTestBase to stop masking flaky tests
The global [Retry(3)] on InvokableTestBase silently retried all ~50 engine test classes, hiding intermittent failures. Remove it and apply [Retry(3)] only to the four test classes that are genuinely timing- sensitive (cancellation hooks, external cancellation, parallelism validation, constraint-key scheduler concurrency). Closes #4878
1 parent c0a521c commit 7cca020

5 files changed

Lines changed: 4 additions & 1 deletion

File tree

TUnit.Engine.Tests/CancellationAfterHooksTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace TUnit.Engine.Tests;
88
/// Validates that After hooks execute even when tests are cancelled (Issue #3882).
99
/// These tests run the cancellation test scenarios and verify that After hooks created marker files.
1010
/// </summary>
11+
[Retry(3)]
1112
public class CancellationAfterHooksTests(TestMode testMode) : InvokableTestBase(testMode)
1213
{
1314
private static readonly string TempPath = Path.GetTempPath();

TUnit.Engine.Tests/ExternalCancellationTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace TUnit.Engine.Tests;
1717
/// See: https://github.com/Tyrrrz/CliWrap/issues/47
1818
/// </remarks>
1919
[ExcludeOn(OS.Windows)]
20+
[Retry(3)]
2021
public class ExternalCancellationTests(TestMode testMode) : InvokableTestBase(testMode)
2122
{
2223
private static readonly string TempPath = Path.GetTempPath();

TUnit.Engine.Tests/InvokableTestBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace TUnit.Engine.Tests;
99

1010
[MethodDataSource(nameof(GetTestModes))]
11-
[Retry(3)]
1211
public abstract class InvokableTestBase(TestMode testMode)
1312
{
1413
public static IEnumerable<TestMode> GetTestModes()

TUnit.Engine.Tests/ParallelismValidationEngineTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace TUnit.Engine.Tests;
1010
/// 2. ParallelLimiter correctly limits concurrency
1111
/// 3. Different parallel limiters work independently
1212
/// </summary>
13+
[Retry(3)]
1314
public class ParallelismValidationEngineTests(TestMode testMode) : InvokableTestBase(testMode)
1415
{
1516
[Test]

TUnit.Engine.Tests/Scheduling/ConstraintKeySchedulerConcurrencyTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace TUnit.Engine.Tests.Scheduling;
1010
/// 2. No deadlocks occur under high contention
1111
/// 3. Tests complete within reasonable timeout
1212
/// </summary>
13+
[Retry(3)]
1314
public class ConstraintKeySchedulerConcurrencyTests(TestMode testMode) : InvokableTestBase(testMode)
1415
{
1516
[Test]

0 commit comments

Comments
 (0)