2023-05-01 09:14:42 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-10 06:53:57 +00:00
|
|
|
|
protected IOnlineCodexNode BootstrapNode
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return EnsureBootstapNode();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-01 09:14:42 +00:00
|
|
|
|
private IOnlineCodexNode EnsureBootstapNode()
|
|
|
|
|
{
|
|
|
|
|
if (bootstrapNode == null)
|
|
|
|
|
{
|
|
|
|
|
bootstrapNode = base.SetupCodexBootstrapNode(s => { });
|
|
|
|
|
}
|
|
|
|
|
return bootstrapNode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|