Debugs AutoBootstrapDistTest

This commit is contained in:
benbierens 2023-05-10 09:09:31 +02:00
parent 1d224cf2d3
commit 2a55328d11
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
2 changed files with 9 additions and 17 deletions

View File

@ -1,9 +1,9 @@
namespace DistTestCore using NUnit.Framework;
namespace DistTestCore
{ {
public class AutoBootstrapDistTest : DistTest public class AutoBootstrapDistTest : DistTest
{ {
private IOnlineCodexNode? bootstrapNode;
public override IOnlineCodexNode SetupCodexBootstrapNode(Action<ICodexSetup> setup) public override IOnlineCodexNode SetupCodexBootstrapNode(Action<ICodexSetup> setup)
{ {
throw new Exception("AutoBootstrapDistTest creates and attaches a single boostrap node for you. " + throw new Exception("AutoBootstrapDistTest creates and attaches a single boostrap node for you. " +
@ -14,25 +14,16 @@
{ {
var codexSetup = new CodexSetup(numberOfNodes); var codexSetup = new CodexSetup(numberOfNodes);
setup(codexSetup); setup(codexSetup);
codexSetup.WithBootstrapNode(EnsureBootstapNode()); codexSetup.WithBootstrapNode(BootstrapNode);
return BringOnline(codexSetup); return BringOnline(codexSetup);
} }
protected IOnlineCodexNode BootstrapNode [SetUp]
public void SetUpBootstrapNode()
{ {
get BootstrapNode = BringOnline(new CodexSetup(1))[0];
{
return EnsureBootstapNode();
}
} }
private IOnlineCodexNode EnsureBootstapNode() protected IOnlineCodexNode BootstrapNode { get; private set; } = null!;
{
if (bootstrapNode == null)
{
bootstrapNode = base.SetupCodexBootstrapNode(s => { });
}
return bootstrapNode;
}
} }
} }

View File

@ -5,6 +5,7 @@ using Utils;
namespace Tests.PeerDiscoveryTests namespace Tests.PeerDiscoveryTests
{ {
[TestFixture]
public class PeerDiscoveryTests : AutoBootstrapDistTest public class PeerDiscoveryTests : AutoBootstrapDistTest
{ {
[Test] [Test]