Add LogLevelWithTopics, Get simulate proof failures test running

This commit is contained in:
Eric 2023-09-14 15:04:37 +10:00
parent f765933efa
commit 52b907e52e
No known key found for this signature in database
5 changed files with 33 additions and 31 deletions

View File

@ -6,7 +6,7 @@ namespace DistTestCore.Codex
{ {
public class CodexContainerRecipe : DefaultContainerRecipe 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 MetricsPortTag = "metrics_port";
public const string DiscoveryPortTag = "discovery-port"; public const string DiscoveryPortTag = "discovery-port";
@ -37,12 +37,7 @@ namespace DistTestCore.Codex
AddVolume($"codex/{dataDir}", GetVolumeCapacity(config)); AddVolume($"codex/{dataDir}", GetVolumeCapacity(config));
AddInternalPortAndVar("CODEX_DISC_PORT", DiscoveryPortTag); AddInternalPortAndVar("CODEX_DISC_PORT", DiscoveryPortTag);
AddEnvVar("CODEX_LOG_LEVEL", config.LogLevelWithTopics());
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);
// This makes the node announce itself to its local (pod) IP address. // This makes the node announce itself to its local (pod) IP address.
AddEnvVar("NAT_IP_AUTO", "true"); AddEnvVar("NAT_IP_AUTO", "true");
@ -84,11 +79,11 @@ namespace DistTestCore.Codex
{ {
AddEnvVar("CODEX_SIMULATE_PROOF_FAILURES", config.SimulateProofFailures.ToString()!); AddEnvVar("CODEX_SIMULATE_PROOF_FAILURES", config.SimulateProofFailures.ToString()!);
} }
if (config.EnableValidator == true) // if (config.EnableValidator == true)
{ // {
AddEnvVar("CODEX_VALIDATOR", "true"); // AddEnvVar("CODEX_VALIDATOR", "true");
} // }
if (config.MarketplaceConfig != null || config.EnableValidator == true) if (config.MarketplaceConfig != null)
{ {
var gethConfig = startupConfig.Get<GethStartResult>(); var gethConfig = startupConfig.Get<GethStartResult>();
var companionNode = gethConfig.CompanionNode; var companionNode = gethConfig.CompanionNode;
@ -103,14 +98,14 @@ namespace DistTestCore.Codex
AddEnvVar("CODEX_MARKETPLACE_ADDRESS", gethConfig.MarketplaceNetwork.Marketplace.Address); AddEnvVar("CODEX_MARKETPLACE_ADDRESS", gethConfig.MarketplaceNetwork.Marketplace.Address);
AddEnvVar("CODEX_PERSISTENCE", "true"); AddEnvVar("CODEX_PERSISTENCE", "true");
//if (config.MarketplaceConfig.IsValidator) if (config.MarketplaceConfig.IsValidator)
//{ {
// AddEnvVar("CODEX_VALIDATOR", "true"); AddEnvVar("CODEX_VALIDATOR", "true");
//} }
}
if (config.MarketplaceConfig != null) {
AddEnvVar("CODEX_PERSISTENCE", "true");
} }
// if (config.MarketplaceConfig != null) {
// AddEnvVar("CODEX_PERSISTENCE", "true");
// }
if(!string.IsNullOrEmpty(config.NameOverride)) { if(!string.IsNullOrEmpty(config.NameOverride)) {
AddEnvVar("CODEX_NODENAME", config.NameOverride); AddEnvVar("CODEX_NODENAME", config.NameOverride);

View File

@ -12,6 +12,16 @@ namespace DistTestCore.Codex
LogLevel = logLevel; 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 string? NameOverride { get; set; }
public Location Location { get; set; } public Location Location { get; set; }
public CodexLogLevel LogLevel { get; set; } public CodexLogLevel LogLevel { get; set; }

View File

@ -31,7 +31,7 @@ namespace DistTestCore
/// <summary> /// <summary>
/// Enables the validation module in the node /// Enables the validation module in the node
/// </summary> /// </summary>
ICodexSetup WithValidator(); // ICodexSetup WithValidator();
} }
public class CodexSetup : CodexStartupConfig, ICodexSetup public class CodexSetup : CodexStartupConfig, ICodexSetup
@ -127,11 +127,11 @@ namespace DistTestCore
return this; return this;
} }
public ICodexSetup WithValidator() // public ICodexSetup WithValidator()
{ // {
EnableValidator = true; // EnableValidator = true;
return this; // return this;
} // }
public string Describe() public string Describe()
{ {
@ -141,11 +141,11 @@ namespace DistTestCore
private IEnumerable<string> DescribeArgs() private IEnumerable<string> DescribeArgs()
{ {
yield return $"LogLevel={LogLevel}"; yield return $"LogLevel={LogLevelWithTopics()}";
if (BootstrapSpr != null) yield return $"BootstrapNode={BootstrapSpr}"; if (BootstrapSpr != null) yield return $"BootstrapNode={BootstrapSpr}";
if (StorageQuota != null) yield return $"StorageQuota={StorageQuota}"; if (StorageQuota != null) yield return $"StorageQuota={StorageQuota}";
if (SimulateProofFailures != null) yield return $"SimulateProofFailures={SimulateProofFailures}"; if (SimulateProofFailures != null) yield return $"SimulateProofFailures={SimulateProofFailures}";
if (EnableValidator != null) yield return $"EnableValidator={EnableValidator}"; if (MarketplaceConfig != null) yield return $"IsValidator={MarketplaceConfig.IsValidator}";
} }
} }
} }

View File

@ -5,10 +5,6 @@
<RootNamespace>DistTestCore</RootNamespace> <RootNamespace>DistTestCore</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<IsArm64 Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'Arm64'">true</IsArm64>
</PropertyGroup>
<PropertyGroup Condition="'$(IsArm64)'=='true'">
<DefineConstants>Arm64</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="Metrics\dashboard.json" /> <None Remove="Metrics\dashboard.json" />

View File

@ -4,6 +4,7 @@ namespace DistTestCore.Marketplace
{ {
public class CodexContractsContainerRecipe : DefaultContainerRecipe 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 MarketplaceAddressFilename = "/hardhat/deployments/codexdisttestnetwork/Marketplace.json";
public const string MarketplaceArtifactFilename = "/hardhat/artifacts/contracts/Marketplace.sol/Marketplace.json"; public const string MarketplaceArtifactFilename = "/hardhat/artifacts/contracts/Marketplace.sol/Marketplace.json";