From 3f2c789dd506d5c161184e1eb9e8c9ae865e463c Mon Sep 17 00:00:00 2001 From: benbierens Date: Wed, 4 Oct 2023 09:19:45 +0200 Subject: [PATCH] Fixes issue where boolean arguments can't be set to false. --- Framework/ArgsUniform/ArgsUniform.cs | 3 ++- Tests/CodexContinuousTests/Configuration.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Framework/ArgsUniform/ArgsUniform.cs b/Framework/ArgsUniform/ArgsUniform.cs index 1cb0792..db1a6b2 100644 --- a/Framework/ArgsUniform/ArgsUniform.cs +++ b/Framework/ArgsUniform/ArgsUniform.cs @@ -233,7 +233,8 @@ namespace ArgsUniform private static bool AssignBool(T result, PropertyInfo uniformProperty, object value) { - if (value != null) + var s = value.ToString(); + if (s == "1" || s.ToLowerInvariant() == "true") { uniformProperty.SetValue(result, true); } diff --git a/Tests/CodexContinuousTests/Configuration.cs b/Tests/CodexContinuousTests/Configuration.cs index bc34739..ba4d9aa 100644 --- a/Tests/CodexContinuousTests/Configuration.cs +++ b/Tests/CodexContinuousTests/Configuration.cs @@ -15,7 +15,7 @@ namespace ContinuousTests [Uniform("codex-deployment", "c", "CODEXDEPLOYMENT", true, "Path to codex-deployment JSON file.")] public string CodexDeploymentJson { get; set; } = string.Empty; - [Uniform("keep", "k", "KEEP", false, "Set to '1' to retain logs of successful tests.")] + [Uniform("keep", "k", "KEEP", false, "Set to 1 or 'true' to retain logs of successful tests.")] public bool KeepPassedTestLogs { get; set; } = false; [Uniform("kube-config", "kc", "KUBECONFIG", true, "Path to Kubeconfig file. Use 'null' (default) to use local cluster.")] @@ -30,7 +30,7 @@ namespace ContinuousTests [Uniform("filter", "f", "FILTER", false, "If set, runs only tests whose names contain any of the filter strings. Comma-separated. Case sensitive.")] public string Filter { get; set; } = string.Empty; - [Uniform("cleanup", "cl", "CLEANUP", false, "If set, the kubernetes namespace will be deleted after the test run has finished.")] + [Uniform("cleanup", "cl", "CLEANUP", false, "If set to 1 or 'true', the kubernetes namespace will be deleted after the test run has finished.")] public bool Cleanup { get; set; } = false; public CodexDeployment CodexDeployment { get; set; } = null!;