Fixes incorrect log message when test run gets cancelled.

This commit is contained in:
benbierens 2023-10-02 09:24:01 +02:00
parent da855b8d0d
commit 73c49b42c6
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
1 changed files with 11 additions and 7 deletions

View File

@ -59,9 +59,9 @@ namespace ContinuousTests
overviewLog.Log("Finished launching test-loops.");
WaitUntilFinished(overviewLog, statusLog, startTime, testLoops);
overviewLog.Log("Cancelling all test-loops...");
overviewLog.Log("Stopping all test-loops...");
taskFactory.WaitAll();
overviewLog.Log("All tasks cancelled.");
overviewLog.Log("All tasks finished.");
}
private void WaitUntilFinished(LogSplitter overviewLog, StatusLog statusLog, DateTime startTime, TestLoop[] testLoops)
@ -72,16 +72,20 @@ namespace ContinuousTests
if (config.TargetDurationSeconds > 0)
{
var targetDuration = TimeSpan.FromSeconds(config.TargetDurationSeconds);
cancelToken.WaitHandle.WaitOne(targetDuration);
Cancellation.Cts.Cancel();
overviewLog.Log($"Congratulations! The targer duration has been reached! ({Time.FormatDuration(targetDuration)})");
statusLog.ConcludeTest("Passed", testDuration, testData);
var wasCancelled = cancelToken.WaitHandle.WaitOne(targetDuration);
if (!wasCancelled)
{
Cancellation.Cts.Cancel();
overviewLog.Log($"Congratulations! The targer duration has been reached! ({Time.FormatDuration(targetDuration)})");
statusLog.ConcludeTest("Passed", testDuration, testData);
return;
}
}
else
{
cancelToken.WaitHandle.WaitOne();
statusLog.ConcludeTest("Failed", testDuration, testData);
}
statusLog.ConcludeTest("Failed", testDuration, testData);
}
private Dictionary<string, string> FormatTestRuns(TestLoop[] testLoops)