From 9d3874c88f87000cc7debd0bd6739b401304f0f0 Mon Sep 17 00:00:00 2001 From: benbierens Date: Fri, 23 Jun 2023 10:35:23 +0200 Subject: [PATCH] Runner correctly ingests codex-deployment.json --- ContinuousTests/Configuration.cs | 2 +- DistTestCore/Marketplace/GethStartResult.cs | 5 ++++- KubernetesWorkflow/RunningContainers.cs | 16 ++-------------- KubernetesWorkflow/StartupWorkflow.cs | 17 ++++++++++++++++- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ContinuousTests/Configuration.cs b/ContinuousTests/Configuration.cs index f61c463..e654893 100644 --- a/ContinuousTests/Configuration.cs +++ b/ContinuousTests/Configuration.cs @@ -94,7 +94,7 @@ namespace ContinuousTests throw new Exception($"Unvalid logpath set: '{configuration.LogPath}'"); } - if (configuration.CodexDeployment != null && configuration.CodexDeployment.CodexContainers.Any()) + if (configuration.CodexDeployment == null || !configuration.CodexDeployment.CodexContainers.Any()) { throw new Exception("No Codex deployment found."); } diff --git a/DistTestCore/Marketplace/GethStartResult.cs b/DistTestCore/Marketplace/GethStartResult.cs index 412d288..0ba1e58 100644 --- a/DistTestCore/Marketplace/GethStartResult.cs +++ b/DistTestCore/Marketplace/GethStartResult.cs @@ -1,4 +1,6 @@ -namespace DistTestCore.Marketplace +using Newtonsoft.Json; + +namespace DistTestCore.Marketplace { public class GethStartResult { @@ -9,6 +11,7 @@ CompanionNode = companionNode; } + [JsonIgnore] public IMarketplaceAccessFactory MarketplaceAccessFactory { get; } public MarketplaceNetwork MarketplaceNetwork { get; } public GethCompanionNodeInfo CompanionNode { get; } diff --git a/KubernetesWorkflow/RunningContainers.cs b/KubernetesWorkflow/RunningContainers.cs index 6e2224d..bbfe360 100644 --- a/KubernetesWorkflow/RunningContainers.cs +++ b/KubernetesWorkflow/RunningContainers.cs @@ -23,12 +23,12 @@ namespace KubernetesWorkflow public class RunningContainer { - public RunningContainer(RunningPod pod, ContainerRecipe recipe, Port[] servicePorts, StartupConfig startupConfig, Address clusterExternalAddress, Address clusterInternalAddress) + public RunningContainer(RunningPod pod, ContainerRecipe recipe, Port[] servicePorts, string name, Address clusterExternalAddress, Address clusterInternalAddress) { Pod = pod; Recipe = recipe; ServicePorts = servicePorts; - Name = GetContainerName(recipe, startupConfig); + Name = name; ClusterExternalAddress = clusterExternalAddress; ClusterInternalAddress = clusterInternalAddress; } @@ -39,17 +39,5 @@ namespace KubernetesWorkflow public Port[] ServicePorts { get; } public Address ClusterExternalAddress { get; } public Address ClusterInternalAddress { get; } - - private string GetContainerName(ContainerRecipe recipe, StartupConfig startupConfig) - { - if (!string.IsNullOrEmpty(startupConfig.NameOverride)) - { - return $"<{startupConfig.NameOverride}{recipe.Number}>"; - } - else - { - return $"<{recipe.Name}>"; - } - } } } diff --git a/KubernetesWorkflow/StartupWorkflow.cs b/KubernetesWorkflow/StartupWorkflow.cs index 8a223cf..c7e3bfb 100644 --- a/KubernetesWorkflow/StartupWorkflow.cs +++ b/KubernetesWorkflow/StartupWorkflow.cs @@ -81,13 +81,28 @@ namespace KubernetesWorkflow var servicePorts = runningPod.GetServicePortsForContainerRecipe(r); log.Debug($"{r} -> service ports: {string.Join(",", servicePorts.Select(p => p.Number))}"); - return new RunningContainer(runningPod, r, servicePorts, startupConfig, + var name = GetContainerName(r, startupConfig); + + return new RunningContainer(runningPod, r, servicePorts, name, GetContainerExternalAddress(runningPod, servicePorts), GetContainerInternalAddress(r)); }).ToArray(); } + private string GetContainerName(ContainerRecipe recipe, StartupConfig startupConfig) + { + if (startupConfig == null) return ""; + if (!string.IsNullOrEmpty(startupConfig.NameOverride)) + { + return $"<{startupConfig.NameOverride}{recipe.Number}>"; + } + else + { + return $"<{recipe.Name}>"; + } + } + private Address GetContainerExternalAddress(RunningPod pod, Port[] servicePorts) { return new Address(