From 7b5e802efba139a533fe60a094d13b9f278dc94b Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 13 Jun 2024 08:51:52 +0200 Subject: [PATCH] Applies delete in scalability tests --- ProjectPlugins/CodexPlugin/CodexAccess.cs | 16 ++++++++++++++++ ProjectPlugins/CodexPlugin/CodexNode.cs | 12 ++++++++++++ .../ScalabilityTests/ScalabilityTests.cs | 8 +++++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ProjectPlugins/CodexPlugin/CodexAccess.cs b/ProjectPlugins/CodexPlugin/CodexAccess.cs index a99a2ec..4d7ca22 100644 --- a/ProjectPlugins/CodexPlugin/CodexAccess.cs +++ b/ProjectPlugins/CodexPlugin/CodexAccess.cs @@ -141,6 +141,22 @@ namespace CodexPlugin } } + public void DeleteRepoFolder() + { + try + { + var containerNumber = Container.Containers.First().Recipe.Number; + var dataDir = $"datadir{containerNumber}"; + var workflow = tools.CreateWorkflow(); + workflow.ExecuteCommand(Container.Containers.First(), "rm", "-Rfv", $"/codex/{dataDir}/repo"); + Log("Deleted repo folder."); + } + catch (Exception e) + { + Log("Unable to delete repo folder: " + e); + } + } + private T OnCodex(Func> action) { var result = tools.CreateHttp(CheckContainerCrashed).OnClient(client => CallCodex(client, action)); diff --git a/ProjectPlugins/CodexPlugin/CodexNode.cs b/ProjectPlugins/CodexPlugin/CodexNode.cs index f0e064b..fd6d1f7 100644 --- a/ProjectPlugins/CodexPlugin/CodexNode.cs +++ b/ProjectPlugins/CodexPlugin/CodexNode.cs @@ -26,6 +26,13 @@ namespace CodexPlugin CrashWatcher CrashWatcher { get; } PodInfo GetPodInfo(); ITransferSpeeds TransferSpeeds { get; } + + /// + /// Warning! The node is not usable after this. + /// TODO: Replace with delete-blocks debug call once available in Codex. + /// + void DeleteRepoFolder(); + void Stop(bool waitTillStopped); } @@ -164,6 +171,11 @@ namespace CodexPlugin return CodexAccess.GetPodInfo(); } + public void DeleteRepoFolder() + { + CodexAccess.DeleteRepoFolder(); + } + public void Stop(bool waitTillStopped) { Log("Stopping..."); diff --git a/Tests/CodexLongTests/ScalabilityTests/ScalabilityTests.cs b/Tests/CodexLongTests/ScalabilityTests/ScalabilityTests.cs index 14f363b..c3b05f7 100644 --- a/Tests/CodexLongTests/ScalabilityTests/ScalabilityTests.cs +++ b/Tests/CodexLongTests/ScalabilityTests/ScalabilityTests.cs @@ -20,14 +20,13 @@ public class ScalabilityTests : CodexDistTest [WaitForCleanup] public void ShouldMaintainFileInNetwork( [Values(4, 5, 6)] int numberOfNodes, // TODO: include 10, 40, 80 and 100, not 5 - [Values(2000, 2200, 2500, 2800, 3000, 3200, 3500, 3800, 4200, 4500, 4800, 5000)] int fileSizeInMb // TODO: include 100, 1000, 5000, 10000 + [Values(4000, 5000, 6000, 7000, 8000, 9000, 10000)] int fileSizeInMb ) { var logLevel = CodexLogLevel.Trace; var bootstrap = StartCodex(s => s.WithLogLevel(logLevel)); var nodes = StartCodex(numberOfNodes - 1, s => s - //.EnableMetrics() .WithBootstrapNode(bootstrap) .WithLogLevel(logLevel) .WithStorageQuota((fileSizeInMb + 50).MB()) @@ -35,7 +34,6 @@ public class ScalabilityTests : CodexDistTest var uploader = nodes.PickOneRandom(); var downloader = nodes.PickOneRandom(); - //var metrics = Ci.GetMetricsFor(uploader, downloader); var testFile = GenerateTestFile(fileSizeInMb.MB()); @@ -49,12 +47,16 @@ public class ScalabilityTests : CodexDistTest downloadedFile!.AssertIsEqual(testFile); + uploader.DeleteRepoFolder(); uploader.Stop(true); var otherDownloader = nodes.PickOneRandom(); downloadedFile = otherDownloader.DownloadContent(contentId); downloadedFile!.AssertIsEqual(testFile); + + downloader.DeleteRepoFolder(); + otherDownloader.DeleteRepoFolder(); } ///