Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions TUnit.Engine/Scheduling/TestRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Microsoft.Testing.Platform.Extensions.Messages;
using System.Collections.Concurrent;
using TUnit.Core;
using TUnit.Core.Data;
using TUnit.Engine.Interfaces;
using TUnit.Engine.Logging;
using TUnit.Engine.Services.TestExecution;
Expand Down Expand Up @@ -36,13 +35,17 @@ internal TestRunner(
_testStateManager = testStateManager;
}

private readonly ThreadSafeDictionary<string, TaskCompletionSource<bool>> _executingTests = new();
private readonly ConcurrentDictionary<string, TaskCompletionSource<bool>> _executingTests = new();
private Exception? _firstFailFastException;

public ValueTask ExecuteTestAsync(AbstractExecutableTest test, CancellationToken cancellationToken)
{
if (_executingTests.TryGetValue(test.TestId, out var existingTcs))
{
return new ValueTask(existingTcs.Task);
}
var tcs = new TaskCompletionSource<bool>();
var existingTcs = _executingTests.GetOrAdd(test.TestId, _ => tcs);
existingTcs = _executingTests.GetOrAdd(test.TestId, tcs);

if (existingTcs != tcs)
{
Expand Down
Loading