From dabf836838d2972eeda04b8c4677cf44c26ae091 Mon Sep 17 00:00:00 2001 From: benbierens Date: Thu, 28 Sep 2023 08:53:01 +0200 Subject: [PATCH] Makes default run id static. --- Tests/DistTestCore/NameUtils.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Tests/DistTestCore/NameUtils.cs b/Tests/DistTestCore/NameUtils.cs index c306514..58b0b51 100644 --- a/Tests/DistTestCore/NameUtils.cs +++ b/Tests/DistTestCore/NameUtils.cs @@ -5,6 +5,14 @@ namespace DistTestCore { 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 = "") { if (!string.IsNullOrEmpty(name)) return name; @@ -42,9 +50,7 @@ namespace DistTestCore public static string GetRunId() { - var now = DateTime.UtcNow; - var defaultValue = now.ToString("yyyyMMdd-hhmmss"); - return GetEnvVar("RUNID", defaultValue); + return GetEnvVar("RUNID", defaultRunId); } private static string GetEnvVar(string name, string defaultValue)