Adds involvedpods, error, and duration in seconds to status logs for continuous tests.

This commit is contained in:
benbierens 2023-11-14 12:56:47 +01:00
parent ee319a6d0f
commit 5996c0fa63
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
4 changed files with 11 additions and 6 deletions

View File

@ -98,7 +98,7 @@ namespace ContinuousTests
private void WaitUntilFinished(LogSplitter overviewLog, StatusLog statusLog, DateTime startTime, TestLoop[] testLoops)
{
var testDuration = Time.FormatDuration(DateTime.UtcNow - startTime);
var testDuration = (DateTime.UtcNow - startTime).TotalSeconds.ToString();
var testData = FormatTestRuns(testLoops);
overviewLog.Log("Total duration: " + testDuration);

View File

@ -191,6 +191,12 @@ namespace ContinuousTests
result.Add("teststart", testStart.ToString("o"));
result.Add("testname", testName);
result.Add("message", message);
result.Add("involvedpods", string.Join(",", nodes.Select(n => n.GetName())));
var error = message.Split(Environment.NewLine).First();
if (error.Contains(":")) error = error.Substring(1 + error.LastIndexOf(":"));
result.Add("error", error);
return result;
}

View File

@ -1,6 +1,6 @@
using Logging;
using Newtonsoft.Json;
using Utils;
using System.Globalization;
namespace DistTestCore.Logs
{
@ -20,7 +20,7 @@ namespace DistTestCore.Logs
public void ConcludeTest(string resultStatus, TimeSpan testDuration, Dictionary<string, string> data)
{
ConcludeTest(resultStatus, Time.FormatDuration(testDuration), data);
ConcludeTest(resultStatus, testDuration.TotalSeconds.ToString(CultureInfo.InvariantCulture), data);
}
public void ConcludeTest(string resultStatus, string testDuration, Dictionary<string, string> data)

View File

@ -58,10 +58,9 @@ namespace DistTestCore
return entryPoint.GetPluginMetadata();
}
public string GetTestDuration()
public TimeSpan GetTestDuration()
{
var testDuration = DateTime.UtcNow - testStart;
return Time.FormatDuration(testDuration);
return DateTime.UtcNow - testStart;
}
public void OnContainersStarted(RunningContainers rc)