Makes default run id static.

This commit is contained in:
benbierens 2023-09-28 08:53:01 +02:00
parent 8caa7ab4fa
commit dabf836838
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
1 changed files with 9 additions and 3 deletions

View File

@ -5,6 +5,14 @@ namespace DistTestCore
{ {
public static class NameUtils public static class NameUtils
{ {
private static readonly string defaultRunId;
static NameUtils()
{
var now = DateTime.UtcNow;
defaultRunId = now.ToString("yyyyMMdd-hhmmss");
}
public static string GetTestMethodName(string name = "") public static string GetTestMethodName(string name = "")
{ {
if (!string.IsNullOrEmpty(name)) return name; if (!string.IsNullOrEmpty(name)) return name;
@ -42,9 +50,7 @@ namespace DistTestCore
public static string GetRunId() public static string GetRunId()
{ {
var now = DateTime.UtcNow; return GetEnvVar("RUNID", defaultRunId);
var defaultValue = now.ToString("yyyyMMdd-hhmmss");
return GetEnvVar("RUNID", defaultValue);
} }
private static string GetEnvVar(string name, string defaultValue) private static string GetEnvVar(string name, string defaultValue)