mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-05-27 19:49:46 +00:00
68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using LogosStorageClient;
|
|
using StoragePlugin;
|
|
using LogosStorageTests;
|
|
using FileUtils;
|
|
using NUnit.Framework;
|
|
using Utils;
|
|
|
|
namespace LogosStorageReleaseTests.DataTests
|
|
{
|
|
[TestFixture]
|
|
public class TheseusTest : AutoBootstrapDistTest
|
|
{
|
|
private readonly List<IStorageNode> nodes = new List<IStorageNode>();
|
|
private TrackedFile file = null!;
|
|
private ContentId cid = new ContentId();
|
|
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
file = GenerateTestFile(10.MB());
|
|
}
|
|
|
|
[Test]
|
|
[Combinatorial]
|
|
public void Theseus(
|
|
[Values(1, 2)] int remainingNodes,
|
|
[Values(5)] int steps)
|
|
{
|
|
Assert.That(remainingNodes, Is.GreaterThan(0));
|
|
Assert.That(steps, Is.GreaterThan(remainingNodes + 1));
|
|
|
|
nodes.AddRange(
|
|
StartLogosStorage(
|
|
remainingNodes + 1,
|
|
s => s.WithLogFormat(LogosStorageLogFormat.Json)
|
|
)
|
|
);
|
|
|
|
cid = nodes.First().UploadFile(file);
|
|
|
|
AllNodesHaveFile();
|
|
|
|
for (var i = 0; i < steps; i++)
|
|
{
|
|
Log($"{nameof(Theseus)} step {i}");
|
|
nodes[0].Stop(waitTillStopped: true);
|
|
nodes.RemoveAt(0);
|
|
|
|
nodes.Add(StartLogosStorage(s => s.WithLogFormat(LogosStorageLogFormat.Json)));
|
|
|
|
AllNodesHaveFile();
|
|
}
|
|
}
|
|
|
|
private void AllNodesHaveFile()
|
|
{
|
|
Log($"{nameof(AllNodesHaveFile)} {nodes.Names()}");
|
|
foreach (var n in nodes) HasFile(n);
|
|
}
|
|
|
|
private void HasFile(IStorageNode n)
|
|
{
|
|
var downloaded = n.DownloadContent(cid);
|
|
file.AssertIsEqual(downloaded);
|
|
}
|
|
}
|
|
}
|