From 700fc0ea40297da1f49d369f646d3f1c31c806e3 Mon Sep 17 00:00:00 2001 From: benbierens Date: Mon, 15 Apr 2024 07:57:13 +0200 Subject: [PATCH] Sets quota for codex nodes. Sets loglevel for bootstrap node. --- Framework/Utils/NumberSource.cs | 9 +++++++-- .../CodexTests/ScalabilityTests/ScalabilityTests.cs | 13 +++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Framework/Utils/NumberSource.cs b/Framework/Utils/NumberSource.cs index 2c7266f..69d5189 100644 --- a/Framework/Utils/NumberSource.cs +++ b/Framework/Utils/NumberSource.cs @@ -2,6 +2,7 @@ { public class NumberSource { + private readonly object @lock = new object(); private int number; public NumberSource(int start) @@ -11,8 +12,12 @@ public int GetNextNumber() { - var n = number; - number++; + var n = -1; + lock (@lock) + { + n = number; + number++; + } return n; } } diff --git a/Tests/CodexTests/ScalabilityTests/ScalabilityTests.cs b/Tests/CodexTests/ScalabilityTests/ScalabilityTests.cs index 79fa145..3fa7e21 100644 --- a/Tests/CodexTests/ScalabilityTests/ScalabilityTests.cs +++ b/Tests/CodexTests/ScalabilityTests/ScalabilityTests.cs @@ -23,9 +23,14 @@ public class ScalabilityTests : CodexDistTest { CodexContainerRecipe.DockerImageOverride = usePatchedImage ? PatchedImage : MasterImage; - var bootstrap = AddCodex(); - var nodes = AddCodex(numberOfNodes - 1, - s => s.WithBootstrapNode(bootstrap).WithLogLevel(CodexLogLevel.Info)).ToList(); + var logLevel = CodexLogLevel.Info; + + var bootstrap = AddCodex(s => s.WithLogLevel(logLevel)); + var nodes = AddCodex(numberOfNodes - 1, s => s + .WithBootstrapNode(bootstrap) + .WithLogLevel(logLevel) + .WithStorageQuota((fileSizeInMb + 50).MB()) + ).ToList(); var uploader = nodes.PickOneRandom(); var downloader = nodes.PickOneRandom(); @@ -43,4 +48,4 @@ public class ScalabilityTests : CodexDistTest downloadedFile!.AssertIsEqual(testFile); } -} \ No newline at end of file +}