cs-codex-dist-tests/Tests/CodexTests/ScalabilityTests/ScalabilityTests.cs

46 lines
1.4 KiB
C#
Raw Normal View History

2024-04-13 13:27:47 +00:00
using CodexPlugin;
2024-04-13 14:33:21 +00:00
using DistTestCore;
2024-04-13 13:27:47 +00:00
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]
2024-04-13 14:33:21 +00:00
[UseLongTimeouts]
2024-04-14 09:17:59 +00:00
[DontDownloadLogsOnFailure]
2024-04-13 13:27:47 +00:00
public void ShouldMaintainFileInNetwork(
2024-04-14 08:43:06 +00:00
[Values(10, 40, 80, 100)] int numberOfNodes,
2024-04-13 13:27:47 +00:00
[Values(100, 1000, 5000, 10000)] int fileSizeInMb,
[Values(true, false)] bool usePatchedImage
)
{
CodexContainerRecipe.DockerImageOverride = usePatchedImage ? PatchedImage : MasterImage;
2024-04-13 13:36:16 +00:00
2024-04-13 13:27:47 +00:00
var bootstrap = AddCodex();
var nodes = AddCodex(numberOfNodes - 1,
2024-04-13 13:36:16 +00:00
s => s.WithBootstrapNode(bootstrap).WithLogLevel(CodexLogLevel.Info)).ToList();
2024-04-13 13:27:47 +00:00
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);
}
}