Cleanup continuous tests nicely even if no tests were selected for running.

This commit is contained in:
benbierens 2023-10-31 15:33:00 +01:00
parent fcb5a527a9
commit 49300273e0
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
1 changed files with 15 additions and 12 deletions

View File

@ -53,8 +53,10 @@ namespace ContinuousTests
if (!filteredTests.Any()) if (!filteredTests.Any())
{ {
overviewLog.Log("No tests selected."); overviewLog.Log("No tests selected.");
return; Cancellation.Cts.Cancel();
} }
else
{
var testLoops = filteredTests.Select(t => new TestLoop(entryPointFactory, taskFactory, config, overviewLog, t.GetType(), t.RunTestEvery, startupChecker, cancelToken)).ToArray(); var testLoops = filteredTests.Select(t => new TestLoop(entryPointFactory, taskFactory, config, overviewLog, t.GetType(), t.RunTestEvery, startupChecker, cancelToken)).ToArray();
foreach (var testLoop in testLoops) foreach (var testLoop in testLoops)
@ -69,6 +71,7 @@ namespace ContinuousTests
overviewLog.Log("Finished launching test-loops."); overviewLog.Log("Finished launching test-loops.");
WaitUntilFinished(overviewLog, statusLog, startTime, testLoops); WaitUntilFinished(overviewLog, statusLog, startTime, testLoops);
overviewLog.Log("Stopping all test-loops..."); overviewLog.Log("Stopping all test-loops...");
}
taskFactory.WaitAll(); taskFactory.WaitAll();
overviewLog.Log("All tasks cancelled."); overviewLog.Log("All tasks cancelled.");