From c1fa3092710ca9880aee818561996087bc133192 Mon Sep 17 00:00:00 2001 From: ThatBen Date: Fri, 20 Jun 2025 08:40:48 +0200 Subject: [PATCH] Applies long timesets for cluster runs --- .../Types/RunningContainer.cs | 2 +- .../CodexReleaseTests/DataTests/DecodeTest.cs | 4 +--- Tests/DistTestCore/DistTest.cs | 20 ++++++++++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Framework/KubernetesWorkflow/Types/RunningContainer.cs b/Framework/KubernetesWorkflow/Types/RunningContainer.cs index 81faf154..fc7d64b2 100644 --- a/Framework/KubernetesWorkflow/Types/RunningContainer.cs +++ b/Framework/KubernetesWorkflow/Types/RunningContainer.cs @@ -27,7 +27,7 @@ namespace KubernetesWorkflow.Types public Address GetAddress(string portTag) { var addresses = Addresses.Where(a => a.PortTag == portTag).ToArray(); - if (!addresses.Any()) throw new Exception("No addresses found for portTag: " + portTag); + if (addresses.Length == 0) throw new Exception("No addresses found for portTag: " + portTag); var select = SelectAddress(addresses); return select.Address; diff --git a/Tests/CodexReleaseTests/DataTests/DecodeTest.cs b/Tests/CodexReleaseTests/DataTests/DecodeTest.cs index 1aaf742f..0720ff10 100644 --- a/Tests/CodexReleaseTests/DataTests/DecodeTest.cs +++ b/Tests/CodexReleaseTests/DataTests/DecodeTest.cs @@ -1,6 +1,4 @@ -using System.Security.Cryptography; -using CodexReleaseTests.Utils; -using Nethereum.JsonRpc.Client; +using CodexReleaseTests.Utils; using NUnit.Framework; using Utils; diff --git a/Tests/DistTestCore/DistTest.cs b/Tests/DistTestCore/DistTest.cs index 4c6cb0af..21053f57 100644 --- a/Tests/DistTestCore/DistTest.cs +++ b/Tests/DistTestCore/DistTest.cs @@ -179,16 +179,34 @@ namespace DistTestCore private IWebCallTimeSet GetWebCallTimeSet() { + if (IsRunningInCluster()) + { + Log(" > Detected we're running in the cluster. Using long webCall timeset."); + return new LongWebCallTimeSet(); + } + if (ShouldUseLongTimeouts()) return new LongWebCallTimeSet(); return new DefaultWebCallTimeSet(); } private IK8sTimeSet GetK8sTimeSet() { + if (IsRunningInCluster()) + { + Log(" > Detected we're running in the cluster. Using long kubernetes timeset."); + return new LongK8sTimeSet(); + } + if (ShouldUseLongTimeouts()) return new LongK8sTimeSet(); return new DefaultK8sTimeSet(); } + private bool IsRunningInCluster() + { + var testType = Environment.GetEnvironmentVariable("TEST_TYPE"); + return testType == "release-tests"; + } + private bool ShouldWaitForCleanup() { return CurrentTestMethodHasAttribute(); @@ -256,7 +274,7 @@ namespace DistTestCore private string GetCurrentTestName() { - return $"[{TestContext.CurrentContext.Test.Name}]"; + return $"[{NameUtils.GetTestMethodName()}]"; } public DistTestResult GetTestResult()