add network/file scalability test
This commit is contained in:
parent
899d775873
commit
7db9360ba4
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue