From a4ba1fbe2cdb98e4920b4b4a5e8bcccd636dfe6f Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 18 Dec 2024 09:21:45 +0100 Subject: [PATCH] Restores parallel settings, fixes filename test-args formatting --- Tests/CodexReleaseTests/Parallelism.cs | 2 +- Tests/DistTestCore/Configuration.cs | 2 +- Tests/DistTestCore/NameUtils.cs | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Tests/CodexReleaseTests/Parallelism.cs b/Tests/CodexReleaseTests/Parallelism.cs index cd0a429..a1b26c7 100644 --- a/Tests/CodexReleaseTests/Parallelism.cs +++ b/Tests/CodexReleaseTests/Parallelism.cs @@ -1,6 +1,6 @@ using NUnit.Framework; -[assembly: LevelOfParallelism(10)] +[assembly: LevelOfParallelism(1)] namespace CodexReleaseTests.DataTests { } diff --git a/Tests/DistTestCore/Configuration.cs b/Tests/DistTestCore/Configuration.cs index e7e5082..3fa34b5 100644 --- a/Tests/DistTestCore/Configuration.cs +++ b/Tests/DistTestCore/Configuration.cs @@ -14,7 +14,7 @@ namespace DistTestCore kubeConfigFile = GetNullableEnvVarOrDefault("KUBECONFIG", null); logPath = GetEnvVarOrDefault("LOGPATH", "CodexTestLogs"); dataFilesPath = GetEnvVarOrDefault("DATAFILEPATH", "TestDataFiles"); - AlwaysDownloadContainerLogs = true; // !string.IsNullOrEmpty(GetEnvVarOrDefault("ALWAYS_LOGS", "")); + AlwaysDownloadContainerLogs = !string.IsNullOrEmpty(GetEnvVarOrDefault("ALWAYS_LOGS", "")); } public Configuration(string? kubeConfigFile, string logPath, string dataFilesPath) diff --git a/Tests/DistTestCore/NameUtils.cs b/Tests/DistTestCore/NameUtils.cs index dc529b5..5e1f8a9 100644 --- a/Tests/DistTestCore/NameUtils.cs +++ b/Tests/DistTestCore/NameUtils.cs @@ -55,12 +55,23 @@ namespace DistTestCore private static string FormatArguments(TestContext.TestAdapter test) { if (test.Arguments == null || !test.Arguments.Any()) return ""; - return $"[{string.Join(',', test.Arguments)}]"; + return $"[{string.Join(',', test.Arguments.Select(FormatArgument).ToArray())}]"; + } + + private static string FormatArgument(object? obj) + { + if (obj == null) return ""; + var str = obj.ToString(); + if (string.IsNullOrEmpty(str)) return ""; + return ReplaceInvalidCharacters(str); } private static string ReplaceInvalidCharacters(string name) { - return name.Replace(":", "_"); + return name + .Replace(":", "_") + .Replace("/", "_") + .Replace("\\", "_"); } private static string DetermineFolder(LogConfig config, DateTime start)