mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-06 15:33:11 +00:00
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
namespace DistTestCore
|
|
{
|
|
public class AutoBootstrapDistTest : DistTest
|
|
{
|
|
private IOnlineCodexNode? bootstrapNode;
|
|
|
|
public override IOnlineCodexNode SetupCodexBootstrapNode(Action<ICodexSetup> setup)
|
|
{
|
|
throw new Exception("AutoBootstrapDistTest creates and attaches a single boostrap node for you. " +
|
|
"If you want to control the bootstrap node from your test, please use DistTest instead.");
|
|
}
|
|
|
|
public override ICodexNodeGroup SetupCodexNodes(int numberOfNodes, Action<ICodexSetup> setup)
|
|
{
|
|
var codexSetup = new CodexSetup(numberOfNodes);
|
|
setup(codexSetup);
|
|
codexSetup.WithBootstrapNode(EnsureBootstapNode());
|
|
return BringOnline(codexSetup);
|
|
}
|
|
|
|
protected IOnlineCodexNode BootstrapNode
|
|
{
|
|
get
|
|
{
|
|
return EnsureBootstapNode();
|
|
}
|
|
}
|
|
|
|
private IOnlineCodexNode EnsureBootstapNode()
|
|
{
|
|
if (bootstrapNode == null)
|
|
{
|
|
bootstrapNode = base.SetupCodexBootstrapNode(s => { });
|
|
}
|
|
return bootstrapNode;
|
|
}
|
|
}
|
|
}
|