From c0b7d3a7477d9c0479da20d5a6b8cace58763985 Mon Sep 17 00:00:00 2001 From: benbierens Date: Mon, 14 Aug 2023 15:51:03 +0200 Subject: [PATCH] Hooks up block maintenance interval config param. --- DistTestCore/Codex/CodexContainerRecipe.cs | 4 ++++ DistTestCore/Codex/CodexStartupConfig.cs | 1 + DistTestCore/CodexSetup.cs | 7 +++++++ DistTestCore/GrafanaStarter.cs | 1 + Tests/BasicTests/ContinuousSubstitute.cs | 1 + 5 files changed, 14 insertions(+) diff --git a/DistTestCore/Codex/CodexContainerRecipe.cs b/DistTestCore/Codex/CodexContainerRecipe.cs index 2f1f383..0a35afe 100644 --- a/DistTestCore/Codex/CodexContainerRecipe.cs +++ b/DistTestCore/Codex/CodexContainerRecipe.cs @@ -51,6 +51,10 @@ namespace DistTestCore.Codex { AddEnvVar("CODEX_BLOCK_TTL", config.BlockTTL.ToString()!); } + if (config.BlockMaintenanceInterval != null) + { + AddEnvVar("CODEX_BLOCK_MI", Convert.ToInt32(config.BlockMaintenanceInterval.Value.TotalSeconds).ToString()); + } if (config.MetricsMode != Metrics.MetricsMode.None) { AddEnvVar("CODEX_METRICS", "true"); diff --git a/DistTestCore/Codex/CodexStartupConfig.cs b/DistTestCore/Codex/CodexStartupConfig.cs index 5e72755..3dc9218 100644 --- a/DistTestCore/Codex/CodexStartupConfig.cs +++ b/DistTestCore/Codex/CodexStartupConfig.cs @@ -19,5 +19,6 @@ namespace DistTestCore.Codex public MarketplaceInitialConfig? MarketplaceConfig { get; set; } public string? BootstrapSpr { get; set; } public int? BlockTTL { get; set; } + public TimeSpan? BlockMaintenanceInterval { get; set; } } } diff --git a/DistTestCore/CodexSetup.cs b/DistTestCore/CodexSetup.cs index 4aefd39..1eb99d7 100644 --- a/DistTestCore/CodexSetup.cs +++ b/DistTestCore/CodexSetup.cs @@ -11,6 +11,7 @@ namespace DistTestCore ICodexSetup WithBootstrapNode(IOnlineCodexNode node); ICodexSetup WithStorageQuota(ByteSize storageQuota); ICodexSetup WithBlockTTL(TimeSpan duration); + ICodexSetup WithBlockMaintenanceInterval(TimeSpan duration); ICodexSetup EnableMetrics(); ICodexSetup EnableMarketplace(TestToken initialBalance); ICodexSetup EnableMarketplace(TestToken initialBalance, Ether initialEther); @@ -57,6 +58,12 @@ namespace DistTestCore return this; } + public ICodexSetup WithBlockMaintenanceInterval(TimeSpan duration) + { + BlockMaintenanceInterval = duration; + return this; + } + public ICodexSetup EnableMetrics() { MetricsMode = Metrics.MetricsMode.Record; diff --git a/DistTestCore/GrafanaStarter.cs b/DistTestCore/GrafanaStarter.cs index 679122d..978c0f4 100644 --- a/DistTestCore/GrafanaStarter.cs +++ b/DistTestCore/GrafanaStarter.cs @@ -15,6 +15,7 @@ namespace DistTestCore : base(lifecycle) { } + public GrafanaStartInfo StartDashboard(RunningContainer prometheusContainer, CodexSetup codexSetup) { LogStart($"Starting dashboard server"); diff --git a/Tests/BasicTests/ContinuousSubstitute.cs b/Tests/BasicTests/ContinuousSubstitute.cs index 722bb3f..20023e2 100644 --- a/Tests/BasicTests/ContinuousSubstitute.cs +++ b/Tests/BasicTests/ContinuousSubstitute.cs @@ -67,6 +67,7 @@ namespace Tests.BasicTests .EnableMetrics() .EnableMarketplace(100000.TestTokens(), 0.Eth(), isValidator: true) .WithBlockTTL(TimeSpan.FromMinutes(2)) + .WithBlockMaintenanceInterval(TimeSpan.FromMinutes(3)) .WithStorageQuota(3.GB())); var nodes = group.Cast().ToArray();