add network/file scalability test

This commit is contained in:
gmega 2024-04-13 16:27:47 +03:00
parent 899d775873
commit 7db9360ba4
No known key found for this signature in database
GPG Key ID: FFD8DAF00660270F
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
using CodexPlugin;
using NUnit.Framework;
using Utils;
namespace CodexTests.ScalabilityTests;
[TestFixture]
public class ScalabilityTests : CodexDistTest
{
private const string PatchedImage = "codexstorage/nim-codex:sha-9aeac06-dist-tests";
private const string MasterImage = "codexstorage/nim-codex:sha-5380912-dist-tests";
[Test]
[Combinatorial]
public void ShouldMaintainFileInNetwork(
[Values(10, 20, 40, 80, 100)] int numberOfNodes,
[Values(100, 1000, 5000, 10000)] int fileSizeInMb,
[Values(true, false)] bool usePatchedImage
)
{
CodexContainerRecipe.DockerImageOverride = usePatchedImage ? PatchedImage : MasterImage;
var bootstrap = AddCodex();
var nodes = AddCodex(numberOfNodes - 1,
s => s.WithBootstrapNode(bootstrap)).ToList();
var uploader = nodes.PickOneRandom();
var downloader = nodes.PickOneRandom();
var testFile = GenerateTestFile(fileSizeInMb.MB());
var contentId = uploader.UploadFile(testFile);
var downloadedFile = downloader.DownloadContent(contentId);
downloadedFile!.AssertIsEqual(testFile);
uploader.Stop(true);
var otherDownloader = nodes.PickOneRandom();
downloadedFile = otherDownloader.DownloadContent(contentId);
downloadedFile!.AssertIsEqual(testFile);
}
}