mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-05-08 02:19:31 +00:00
* ci(docker): build dist-tests images * Update to .net 10, kubernetes client 18.0.13 Kubernetes client 18.0.13 is compatible with Kubernetes 1.34.x. The Kubernetes version is selected automatically by kubeadm in docker desktop (v1.34.1). See https://github.com/kubernetes-client/csharp#version-compatibility for a compatibility table. * Updates to support Kubernetes upgrade * bump openapi.yaml to match openapi.yaml in the logos-storage-nim docker image * bump doc to .net 10 * bump docker to .net 10 * Build image with latest tag always Always build an image with a latest tag (as well as a sha commit hash) when there's a push to master * docker image tag as "latest" only when pushing to master * Update docker image to install doctl * Remove doctl install kubeconfig is now created and uses a plain bearer token instead of using doctl as a credential mgr * Rename and remove all instances of Codex * Further remove CodexNetDeployer as it is no longer needed --------- Co-authored-by: Adam Uhlíř <adam@uhlir.dev>
133 lines
3.9 KiB
C#
133 lines
3.9 KiB
C#
using LogosStorageClient;
|
|
using DistTestCore;
|
|
using FileUtils;
|
|
using NUnit.Framework;
|
|
using Utils;
|
|
|
|
namespace LogosStorageTests.ScalabilityTests;
|
|
|
|
[TestFixture]
|
|
public class ScalabilityTests : LogosStorageDistTest
|
|
{
|
|
/// <summary>
|
|
/// We upload a file to node A, then download it with B.
|
|
/// Then we stop node A, and download again with node C.
|
|
/// </summary>
|
|
[Test]
|
|
[Combinatorial]
|
|
[UseLongTimeouts]
|
|
[DontDownloadLogs]
|
|
[WaitForCleanup]
|
|
public void ShouldMaintainFileInNetwork(
|
|
[Values(4, 5, 6)] int numberOfNodes, // TODO: include 10, 40, 80 and 100, not 5
|
|
[Values(4000, 5000, 6000, 7000, 8000, 9000, 10000)] int fileSizeInMb
|
|
)
|
|
{
|
|
var logLevel = LogosStorageLogLevel.Trace;
|
|
|
|
var bootstrap = StartLogosStorage(s => s.WithLogLevel(logLevel));
|
|
var nodes = StartLogosStorage(numberOfNodes - 1, s => s
|
|
.WithBootstrapNode(bootstrap)
|
|
.WithLogLevel(logLevel)
|
|
.WithStorageQuota((fileSizeInMb + 50).MB())
|
|
).ToList();
|
|
|
|
var uploader = nodes.PickOneRandom();
|
|
var downloader = nodes.PickOneRandom();
|
|
|
|
var testFile = GenerateTestFile(fileSizeInMb.MB());
|
|
|
|
LogNodeStatus(uploader);
|
|
var contentId = uploader.UploadFile(testFile);
|
|
LogNodeStatus(uploader);
|
|
|
|
LogNodeStatus(downloader);
|
|
var downloadedFile = downloader.DownloadContent(contentId);
|
|
LogNodeStatus(downloader);
|
|
|
|
downloadedFile!.AssertIsEqual(testFile);
|
|
|
|
uploader.DeleteDataDirFolder();
|
|
uploader.Stop(true);
|
|
|
|
var otherDownloader = nodes.PickOneRandom();
|
|
downloadedFile = otherDownloader.DownloadContent(contentId);
|
|
|
|
downloadedFile!.AssertIsEqual(testFile);
|
|
|
|
downloader.DeleteDataDirFolder();
|
|
otherDownloader.DeleteDataDirFolder();
|
|
}
|
|
|
|
/// <summary>
|
|
/// We upload a file to each node, to put a more wide-spread load on the network.
|
|
/// Then we run the same test as ShouldMaintainFileInNetwork.
|
|
/// </summary>
|
|
[Ignore("Fix ShouldMaintainFileInNetwork for all values first")]
|
|
[Test]
|
|
[Combinatorial]
|
|
[UseLongTimeouts]
|
|
[DontDownloadLogs]
|
|
[WaitForCleanup]
|
|
public void EveryoneGetsAFile(
|
|
[Values(10, 40, 80, 100)] int numberOfNodes,
|
|
[Values(100, 1000, 5000, 10000)] int fileSizeInMb
|
|
)
|
|
{
|
|
var logLevel = LogosStorageLogLevel.Info;
|
|
|
|
var bootstrap = StartLogosStorage(s => s.WithLogLevel(logLevel));
|
|
var nodes = StartLogosStorage(numberOfNodes - 1, s => s
|
|
.WithBootstrapNode(bootstrap)
|
|
.WithLogLevel(logLevel)
|
|
.WithStorageQuota((fileSizeInMb + 50).MB())
|
|
).ToList();
|
|
|
|
var pairTasks = nodes.Select(n =>
|
|
{
|
|
return Task.Run(() =>
|
|
{
|
|
var file = GenerateTestFile(fileSizeInMb.MB());
|
|
var cid = n.UploadFile(file);
|
|
return new NodeFilePair(n, file, cid);
|
|
});
|
|
});
|
|
|
|
var pairs = pairTasks.Select(t => Time.Wait(t)).ToList();
|
|
|
|
RunDoubleDownloadTest(
|
|
pairs.PickOneRandom(),
|
|
pairs.PickOneRandom(),
|
|
pairs.PickOneRandom()
|
|
);
|
|
}
|
|
|
|
private void RunDoubleDownloadTest(NodeFilePair source, NodeFilePair dl1, NodeFilePair dl2)
|
|
{
|
|
var expectedFile = source.File;
|
|
var cid = source.Cid;
|
|
|
|
var file1 = dl1.Node.DownloadContent(cid);
|
|
file1!.AssertIsEqual(expectedFile);
|
|
|
|
source.Node.Stop(true);
|
|
|
|
var file2 = dl2.Node.DownloadContent(cid);
|
|
file2!.AssertIsEqual(expectedFile);
|
|
}
|
|
|
|
public class NodeFilePair
|
|
{
|
|
public NodeFilePair(IStorageNode node, TrackedFile file, ContentId cid)
|
|
{
|
|
Node = node;
|
|
File = file;
|
|
Cid = cid;
|
|
}
|
|
|
|
public IStorageNode Node { get; }
|
|
public TrackedFile File { get; }
|
|
public ContentId Cid { get; }
|
|
}
|
|
}
|