2023-06-28 10:01:20 +00:00
|
|
|
|
using DistTestCore;
|
|
|
|
|
using DistTestCore.Codex;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
|
|
namespace ContinuousTests.Tests
|
|
|
|
|
{
|
|
|
|
|
public class TransientNodeTest : ContinuousTest
|
|
|
|
|
{
|
|
|
|
|
public override int RequiredNumberOfNodes => 3;
|
|
|
|
|
public override TimeSpan RunTestEvery => TimeSpan.FromMinutes(10);
|
|
|
|
|
public override TestFailMode TestFailMode => TestFailMode.StopAfterFirstFailure;
|
|
|
|
|
public override string CustomK8sNamespace => nameof(TransientNodeTest).ToLowerInvariant();
|
|
|
|
|
public override int EthereumAccountIndex => 201;
|
|
|
|
|
|
|
|
|
|
private TestFile file = null!;
|
|
|
|
|
private ContentId cid = null!;
|
|
|
|
|
|
|
|
|
|
private CodexNode UploadBootstapNode { get { return Nodes[0]; } }
|
|
|
|
|
private CodexNode DownloadBootstapNode { get { return Nodes[1]; } }
|
|
|
|
|
private CodexNode IntermediateNode { get { return Nodes[2]; } }
|
|
|
|
|
|
|
|
|
|
[TestMoment(t: 0)]
|
|
|
|
|
public void UploadWithTransientNode()
|
|
|
|
|
{
|
|
|
|
|
file = FileManager.GenerateTestFile(10.MB());
|
|
|
|
|
|
|
|
|
|
NodeRunner.RunNode(UploadBootstapNode, (codexAccess, marketplaceAccess) =>
|
|
|
|
|
{
|
|
|
|
|
cid = UploadFile(codexAccess.Node, file)!;
|
|
|
|
|
Assert.That(cid, Is.Not.Null);
|
|
|
|
|
|
2023-06-28 13:11:20 +00:00
|
|
|
|
var resultFile = DownloadFile(IntermediateNode, cid);
|
2023-06-28 10:01:20 +00:00
|
|
|
|
file.AssertIsEqual(resultFile);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMoment(t: MinuteFive)]
|
|
|
|
|
public void DownloadWithTransientNode()
|
|
|
|
|
{
|
|
|
|
|
NodeRunner.RunNode(DownloadBootstapNode, (codexAccess, marketplaceAccess) =>
|
|
|
|
|
{
|
2023-06-28 13:11:20 +00:00
|
|
|
|
var resultFile = DownloadFile(codexAccess.Node, cid);
|
2023-06-28 10:01:20 +00:00
|
|
|
|
file.AssertIsEqual(resultFile);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|