From 9a117cca7021e7f0d7e991141d4ef058569a442e Mon Sep 17 00:00:00 2001 From: benbierens Date: Wed, 23 Aug 2023 08:29:16 +0200 Subject: [PATCH] rigs continuous testnet for holdmybeer test. --- CodexNetDeployer/CodexNodeStarter.cs | 8 ++++++++ CodexNetDeployer/Configuration.cs | 7 +++++++ CodexNetDeployer/Deployer.cs | 5 ++++- CodexNetDeployer/deploy-continuous-testnet.sh | 4 +++- ContinuousTests/Tests/HoldMyBeerTest.cs | 10 ++++++++-- DistTestCore/Codex/CodexDeployment.cs | 8 +++++++- 6 files changed, 37 insertions(+), 5 deletions(-) diff --git a/CodexNetDeployer/CodexNodeStarter.cs b/CodexNetDeployer/CodexNodeStarter.cs index 836e8f8..39bc1f9 100644 --- a/CodexNetDeployer/CodexNodeStarter.cs +++ b/CodexNetDeployer/CodexNodeStarter.cs @@ -90,6 +90,14 @@ namespace CodexNetDeployer { codexStart.BlockTTL = config.BlockTTL; } + if (config.BlockMI != Configuration.TenMinutes) + { + codexStart.BlockMaintenanceInterval = TimeSpan.FromSeconds(config.BlockMI); + } + if (config.BlockMN != 1000) + { + codexStart.BlockMaintenanceNumber = config.BlockMN; + } return codexStart; } diff --git a/CodexNetDeployer/Configuration.cs b/CodexNetDeployer/Configuration.cs index 0257389..4df18be 100644 --- a/CodexNetDeployer/Configuration.cs +++ b/CodexNetDeployer/Configuration.cs @@ -7,6 +7,7 @@ namespace CodexNetDeployer public class Configuration { public const int SecondsIn1Day = 24 * 60 * 60; + public const int TenMinutes = 10 * 60; [Uniform("kube-config", "kc", "KUBECONFIG", false, "Path to Kubeconfig file. Use 'null' (default) to use local cluster.")] public string KubeConfigFile { get; set; } = "null"; @@ -44,6 +45,12 @@ namespace CodexNetDeployer [Uniform("block-ttl", "bt", "BLOCKTTL", false, "Block timeout in seconds. Default is 24 hours.")] public int BlockTTL { get; set; } = SecondsIn1Day; + [Uniform("block-mi", "bmi", "BLOCKMI", false, "Block maintenance interval in seconds. Default is 10 minutes.")] + public int BlockMI { get; set; } = TenMinutes; + + [Uniform("block-mn", "bmn", "BLOCKMN", false, "Number of blocks maintained per interval. Default is 1000 blocks.")] + public int BlockMN { get; set; } = 1000; + [Uniform("metrics", "m", "METRICS", false, "[None*, Record, Dashboard]. Determines if metrics will be recorded and if a dashboard service will be created.")] public MetricsMode Metrics { get; set; } = MetricsMode.None; diff --git a/CodexNetDeployer/Deployer.cs b/CodexNetDeployer/Deployer.cs index 859defd..55ad4fe 100644 --- a/CodexNetDeployer/Deployer.cs +++ b/CodexNetDeployer/Deployer.cs @@ -106,7 +106,10 @@ namespace CodexNetDeployer initialTestTokens: config.InitialTestTokens, minPrice: config.MinPrice, maxCollateral: config.MaxCollateral, - maxDuration: config.MaxDuration); + maxDuration: config.MaxDuration, + blockTTL: config.BlockTTL, + blockMI: config.BlockMI, + blockMN: config.BlockMN); } private void Log(string msg) diff --git a/CodexNetDeployer/deploy-continuous-testnet.sh b/CodexNetDeployer/deploy-continuous-testnet.sh index c0460c8..25a67c7 100644 --- a/CodexNetDeployer/deploy-continuous-testnet.sh +++ b/CodexNetDeployer/deploy-continuous-testnet.sh @@ -9,5 +9,7 @@ dotnet run \ --min-price=1024 \ --max-collateral=1024 \ --max-duration=3600000 \ - --block-ttl=300 \ + --block-ttl=180 \ + --block-mi=120 \ + --block-mn=10000 \ --metrics=Dashboard diff --git a/ContinuousTests/Tests/HoldMyBeerTest.cs b/ContinuousTests/Tests/HoldMyBeerTest.cs index a755e9d..09c2338 100644 --- a/ContinuousTests/Tests/HoldMyBeerTest.cs +++ b/ContinuousTests/Tests/HoldMyBeerTest.cs @@ -16,13 +16,19 @@ namespace ContinuousTests.Tests [TestMoment(t: Zero)] public void UploadTestFile() { - var filesize = 80.MB(); + var metadata = Configuration.CodexDeployment.Metadata; + var maxQuotaUseMb = metadata.StorageQuotaMB / 2; + var safeTTL = Math.Max(metadata.BlockTTL, metadata.BlockMI) + 30; + var runsPerTtl = Convert.ToInt32(safeTTL / RunTestEvery.TotalSeconds); + var filesizePerUploadMb = Math.Min(80, maxQuotaUseMb / runsPerTtl); + // This filesize should keep the quota below 50% of the node's max. + + var filesize = filesizePerUploadMb.MB(); double codexDefaultBlockSize = 31 * 64 * 33; var numberOfBlocks = Convert.ToInt64(Math.Ceiling(filesize.SizeInBytes / codexDefaultBlockSize)); var sizeInBytes = filesize.SizeInBytes; Assert.That(numberOfBlocks, Is.EqualTo(1282)); - file = FileManager.GenerateTestFile(filesize); cid = UploadFile(Nodes[0], file); diff --git a/DistTestCore/Codex/CodexDeployment.cs b/DistTestCore/Codex/CodexDeployment.cs index b22c77a..0595a9a 100644 --- a/DistTestCore/Codex/CodexDeployment.cs +++ b/DistTestCore/Codex/CodexDeployment.cs @@ -23,7 +23,7 @@ namespace DistTestCore.Codex public class DeploymentMetadata { - public DeploymentMetadata(string kubeNamespace, int numberOfCodexNodes, int numberOfValidators, int storageQuotaMB, CodexLogLevel codexLogLevel, int initialTestTokens, int minPrice, int maxCollateral, int maxDuration) + public DeploymentMetadata(string kubeNamespace, int numberOfCodexNodes, int numberOfValidators, int storageQuotaMB, CodexLogLevel codexLogLevel, int initialTestTokens, int minPrice, int maxCollateral, int maxDuration, int blockTTL, int blockMI, int blockMN) { DeployDateTimeUtc = DateTime.UtcNow; KubeNamespace = kubeNamespace; @@ -35,6 +35,9 @@ namespace DistTestCore.Codex MinPrice = minPrice; MaxCollateral = maxCollateral; MaxDuration = maxDuration; + BlockTTL = blockTTL; + BlockMI = blockMI; + BlockMN = blockMN; } public DateTime DeployDateTimeUtc { get; } @@ -47,5 +50,8 @@ namespace DistTestCore.Codex public int MinPrice { get; } public int MaxCollateral { get; } public int MaxDuration { get; } + public int BlockTTL { get; } + public int BlockMI { get; } + public int BlockMN { get; } } }