mirror of
https://github.com/codex-storage/cs-codex-dist-tests.git
synced 2025-02-10 11:06:42 +00:00
Updates autobootstrap fixture for parallel running.
This commit is contained in:
parent
c4b6d01530
commit
2d90349b7b
@ -7,7 +7,7 @@ namespace CodexPlugin
|
|||||||
{
|
{
|
||||||
public class CodexContainerRecipe : ContainerRecipeFactory
|
public class CodexContainerRecipe : ContainerRecipeFactory
|
||||||
{
|
{
|
||||||
private const string DefaultDockerImage = "codexstorage/nim-codex:sha-cda52af-dist-tests";
|
private const string DefaultDockerImage = "codexstorage/nim-codex:sha-032d7e7-dist-tests";
|
||||||
public const string ApiPortTag = "codex_api_port";
|
public const string ApiPortTag = "codex_api_port";
|
||||||
public const string ListenPortTag = "codex_listen_port";
|
public const string ListenPortTag = "codex_listen_port";
|
||||||
public const string MetricsPortTag = "codex_metrics_port";
|
public const string MetricsPortTag = "codex_metrics_port";
|
||||||
|
@ -244,6 +244,11 @@ namespace CodexPlugin
|
|||||||
Version = debugInfo.Version;
|
Version = debugInfo.Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"CodexNode:{GetName()}";
|
||||||
|
}
|
||||||
|
|
||||||
private string[] GetPeerMultiAddresses(CodexNode peer, DebugInfo peerInfo)
|
private string[] GetPeerMultiAddresses(CodexNode peer, DebugInfo peerInfo)
|
||||||
{
|
{
|
||||||
// The peer we want to connect is in a different pod.
|
// The peer we want to connect is in a different pod.
|
||||||
|
@ -1,28 +1,46 @@
|
|||||||
using CodexPlugin;
|
using CodexPlugin;
|
||||||
|
using DistTestCore;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace CodexTests
|
namespace CodexTests
|
||||||
{
|
{
|
||||||
public class AutoBootstrapDistTest : CodexDistTest
|
public class AutoBootstrapDistTest : CodexDistTest
|
||||||
{
|
{
|
||||||
|
private readonly Dictionary<TestLifecycle, ICodexNode> bootstrapNodes = new Dictionary<TestLifecycle, ICodexNode>();
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUpBootstrapNode()
|
public void SetUpBootstrapNode()
|
||||||
{
|
{
|
||||||
BootstrapNode = StartCodex(s => s.WithName("BOOTSTRAP"));
|
var tl = Get();
|
||||||
|
if (!bootstrapNodes.ContainsKey(tl))
|
||||||
|
{
|
||||||
|
bootstrapNodes.Add(tl, StartCodex(s => s.WithName("BOOTSTRAP_" + tl.TestNamespace)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public void TearDownBootstrapNode()
|
public void TearDownBootstrapNode()
|
||||||
{
|
{
|
||||||
BootstrapNode = null;
|
bootstrapNodes.Remove(Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnCodexSetup(ICodexSetup setup)
|
protected override void OnCodexSetup(ICodexSetup setup)
|
||||||
{
|
{
|
||||||
if (BootstrapNode != null) setup.WithBootstrapNode(BootstrapNode);
|
var node = BootstrapNode;
|
||||||
|
if (node != null) setup.WithBootstrapNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICodexNode? BootstrapNode { get; private set; }
|
protected ICodexNode? BootstrapNode
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var tl = Get();
|
||||||
|
if (bootstrapNodes.TryGetValue(tl, out var node))
|
||||||
|
{
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace CodexTests.BasicTests
|
|||||||
public void PyramidTest()
|
public void PyramidTest()
|
||||||
{
|
{
|
||||||
var size = 5.MB();
|
var size = 5.MB();
|
||||||
var numberOfLayers = 4;
|
var numberOfLayers = 3;
|
||||||
|
|
||||||
var bottomLayer = StartLayers(numberOfLayers);
|
var bottomLayer = StartLayers(numberOfLayers);
|
||||||
|
|
||||||
|
@ -22,24 +22,6 @@ namespace CodexTests.BasicTests
|
|||||||
testFile.AssertIsEqual(downloadedFile);
|
testFile.AssertIsEqual(downloadedFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
[CreateTranscript(nameof(SwarmTest))]
|
|
||||||
public void SwarmTest()
|
|
||||||
{
|
|
||||||
var uploader = StartCodex(s => s.WithName("uploader"));
|
|
||||||
var downloaders = StartCodex(5, s => s.WithName("downloader"));
|
|
||||||
|
|
||||||
var file = GenerateTestFile(100.MB());
|
|
||||||
var cid = uploader.UploadFile(file);
|
|
||||||
|
|
||||||
var result = Parallel.ForEach(downloaders, d =>
|
|
||||||
{
|
|
||||||
d.DownloadContent(cid);
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.That(result.IsCompleted);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DownloadingUnknownCidDoesNotCauseCrash()
|
public void DownloadingUnknownCidDoesNotCauseCrash()
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@ namespace DistTestCore
|
|||||||
Log = log;
|
Log = log;
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
TimeSet = timeSet;
|
TimeSet = timeSet;
|
||||||
|
TestNamespace = testNamespace;
|
||||||
TestStart = DateTime.UtcNow;
|
TestStart = DateTime.UtcNow;
|
||||||
|
|
||||||
entryPoint = new EntryPoint(log, configuration.GetK8sConfiguration(timeSet, this, testNamespace), configuration.GetFileManagerFolder(), timeSet);
|
entryPoint = new EntryPoint(log, configuration.GetK8sConfiguration(timeSet, this, testNamespace), configuration.GetFileManagerFolder(), timeSet);
|
||||||
@ -36,6 +37,7 @@ namespace DistTestCore
|
|||||||
public TestLog Log { get; }
|
public TestLog Log { get; }
|
||||||
public Configuration Configuration { get; }
|
public Configuration Configuration { get; }
|
||||||
public ITimeSet TimeSet { get; }
|
public ITimeSet TimeSet { get; }
|
||||||
|
public string TestNamespace { get; }
|
||||||
public bool WaitForCleanup { get; }
|
public bool WaitForCleanup { get; }
|
||||||
public CoreInterface CoreInterface { get; }
|
public CoreInterface CoreInterface { get; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user