From 52b907e52e32527033eb1982c6d498efb3eb3550 Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:04:37 +1000 Subject: [PATCH] Add LogLevelWithTopics, Get simulate proof failures test running --- DistTestCore/Codex/CodexContainerRecipe.cs | 33 ++++++++----------- DistTestCore/Codex/CodexStartupConfig.cs | 10 ++++++ DistTestCore/CodexSetup.cs | 16 ++++----- DistTestCore/DistTestCore.csproj | 4 --- .../CodexContractsContainerRecipe.cs | 1 + 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/DistTestCore/Codex/CodexContainerRecipe.cs b/DistTestCore/Codex/CodexContainerRecipe.cs index d6e3e41..08cca75 100644 --- a/DistTestCore/Codex/CodexContainerRecipe.cs +++ b/DistTestCore/Codex/CodexContainerRecipe.cs @@ -6,7 +6,7 @@ namespace DistTestCore.Codex { public class CodexContainerRecipe : DefaultContainerRecipe { - public const string DockerImage = "codexstorage/nim-codex:sha-1d161d3"; + public const string DockerImage = "codexstorage/nim-codex:sha-dd67b74"; public const string MetricsPortTag = "metrics_port"; public const string DiscoveryPortTag = "discovery-port"; @@ -37,12 +37,7 @@ namespace DistTestCore.Codex AddVolume($"codex/{dataDir}", GetVolumeCapacity(config)); AddInternalPortAndVar("CODEX_DISC_PORT", DiscoveryPortTag); - - var level = config.LogLevel.ToString()!.ToUpperInvariant(); - if (config.LogTopics != null && config.LogTopics.Count() > 0){ - level = $"INFO;{level}: {string.Join(",", config.LogTopics.Where(s => !string.IsNullOrEmpty(s)))}"; - } - AddEnvVar("CODEX_LOG_LEVEL", level); + AddEnvVar("CODEX_LOG_LEVEL", config.LogLevelWithTopics()); // This makes the node announce itself to its local (pod) IP address. AddEnvVar("NAT_IP_AUTO", "true"); @@ -84,11 +79,11 @@ namespace DistTestCore.Codex { AddEnvVar("CODEX_SIMULATE_PROOF_FAILURES", config.SimulateProofFailures.ToString()!); } - if (config.EnableValidator == true) - { - AddEnvVar("CODEX_VALIDATOR", "true"); - } - if (config.MarketplaceConfig != null || config.EnableValidator == true) + // if (config.EnableValidator == true) + // { + // AddEnvVar("CODEX_VALIDATOR", "true"); + // } + if (config.MarketplaceConfig != null) { var gethConfig = startupConfig.Get(); var companionNode = gethConfig.CompanionNode; @@ -103,14 +98,14 @@ namespace DistTestCore.Codex AddEnvVar("CODEX_MARKETPLACE_ADDRESS", gethConfig.MarketplaceNetwork.Marketplace.Address); AddEnvVar("CODEX_PERSISTENCE", "true"); - //if (config.MarketplaceConfig.IsValidator) - //{ - // AddEnvVar("CODEX_VALIDATOR", "true"); - //} - } - if (config.MarketplaceConfig != null) { - AddEnvVar("CODEX_PERSISTENCE", "true"); + if (config.MarketplaceConfig.IsValidator) + { + AddEnvVar("CODEX_VALIDATOR", "true"); + } } + // if (config.MarketplaceConfig != null) { + // AddEnvVar("CODEX_PERSISTENCE", "true"); + // } if(!string.IsNullOrEmpty(config.NameOverride)) { AddEnvVar("CODEX_NODENAME", config.NameOverride); diff --git a/DistTestCore/Codex/CodexStartupConfig.cs b/DistTestCore/Codex/CodexStartupConfig.cs index f02dca7..0ca738d 100644 --- a/DistTestCore/Codex/CodexStartupConfig.cs +++ b/DistTestCore/Codex/CodexStartupConfig.cs @@ -12,6 +12,16 @@ namespace DistTestCore.Codex LogLevel = logLevel; } + public string LogLevelWithTopics() + { + var level = LogLevel.ToString()!.ToUpperInvariant(); + if (LogTopics != null && LogTopics.Count() > 0) + { + level = $"INFO;{level}: {string.Join(",", LogTopics.Where(s => !string.IsNullOrEmpty(s)))}"; + } + return level; + } + public string? NameOverride { get; set; } public Location Location { get; set; } public CodexLogLevel LogLevel { get; set; } diff --git a/DistTestCore/CodexSetup.cs b/DistTestCore/CodexSetup.cs index 3dbc1d0..83dc11c 100644 --- a/DistTestCore/CodexSetup.cs +++ b/DistTestCore/CodexSetup.cs @@ -31,7 +31,7 @@ namespace DistTestCore /// /// Enables the validation module in the node /// - ICodexSetup WithValidator(); + // ICodexSetup WithValidator(); } public class CodexSetup : CodexStartupConfig, ICodexSetup @@ -127,11 +127,11 @@ namespace DistTestCore return this; } - public ICodexSetup WithValidator() - { - EnableValidator = true; - return this; - } + // public ICodexSetup WithValidator() + // { + // EnableValidator = true; + // return this; + // } public string Describe() { @@ -141,11 +141,11 @@ namespace DistTestCore private IEnumerable DescribeArgs() { - yield return $"LogLevel={LogLevel}"; + yield return $"LogLevel={LogLevelWithTopics()}"; if (BootstrapSpr != null) yield return $"BootstrapNode={BootstrapSpr}"; if (StorageQuota != null) yield return $"StorageQuota={StorageQuota}"; if (SimulateProofFailures != null) yield return $"SimulateProofFailures={SimulateProofFailures}"; - if (EnableValidator != null) yield return $"EnableValidator={EnableValidator}"; + if (MarketplaceConfig != null) yield return $"IsValidator={MarketplaceConfig.IsValidator}"; } } } diff --git a/DistTestCore/DistTestCore.csproj b/DistTestCore/DistTestCore.csproj index 94a2271..89d4b1f 100644 --- a/DistTestCore/DistTestCore.csproj +++ b/DistTestCore/DistTestCore.csproj @@ -5,10 +5,6 @@ DistTestCore enable enable - true - - - Arm64 diff --git a/DistTestCore/Marketplace/CodexContractsContainerRecipe.cs b/DistTestCore/Marketplace/CodexContractsContainerRecipe.cs index bd2c906..8de0bc7 100644 --- a/DistTestCore/Marketplace/CodexContractsContainerRecipe.cs +++ b/DistTestCore/Marketplace/CodexContractsContainerRecipe.cs @@ -4,6 +4,7 @@ namespace DistTestCore.Marketplace { public class CodexContractsContainerRecipe : DefaultContainerRecipe { + public const string DockerImage = "codexstorage/dist-tests-codex-contracts-eth:sha-b4e4897"; public const string MarketplaceAddressFilename = "/hardhat/deployments/codexdisttestnetwork/Marketplace.json"; public const string MarketplaceArtifactFilename = "/hardhat/artifacts/contracts/Marketplace.sol/Marketplace.json";