2023-09-12 13:43:30 +00:00
|
|
|
|
using CodexPlugin;
|
|
|
|
|
using DistTestCore;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
|
|
namespace Tests.PeerDiscoveryTests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class LayeredDiscoveryTests : DistTest
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TwoLayersTest()
|
|
|
|
|
{
|
2023-09-13 06:55:04 +00:00
|
|
|
|
var root = Ci.SetupCodexNode();
|
|
|
|
|
var l1Source = Ci.SetupCodexNode(s => s.WithBootstrapNode(root));
|
|
|
|
|
var l1Node = Ci.SetupCodexNode(s => s.WithBootstrapNode(root));
|
|
|
|
|
var l2Target = Ci.SetupCodexNode(s => s.WithBootstrapNode(l1Node));
|
2023-09-12 13:43:30 +00:00
|
|
|
|
|
|
|
|
|
AssertAllNodesConnected();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void ThreeLayersTest()
|
|
|
|
|
{
|
2023-09-13 06:55:04 +00:00
|
|
|
|
var root = Ci.SetupCodexNode();
|
|
|
|
|
var l1Source = Ci.SetupCodexNode(s => s.WithBootstrapNode(root));
|
|
|
|
|
var l1Node = Ci.SetupCodexNode(s => s.WithBootstrapNode(root));
|
|
|
|
|
var l2Node = Ci.SetupCodexNode(s => s.WithBootstrapNode(l1Node));
|
|
|
|
|
var l3Target = Ci.SetupCodexNode(s => s.WithBootstrapNode(l2Node));
|
2023-09-12 13:43:30 +00:00
|
|
|
|
|
|
|
|
|
AssertAllNodesConnected();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase(3)]
|
|
|
|
|
[TestCase(5)]
|
|
|
|
|
[TestCase(10)]
|
|
|
|
|
[TestCase(20)]
|
|
|
|
|
public void NodeChainTest(int chainLength)
|
|
|
|
|
{
|
2023-09-13 06:55:04 +00:00
|
|
|
|
var node = Ci.SetupCodexNode();
|
2023-09-12 13:43:30 +00:00
|
|
|
|
for (var i = 1; i < chainLength; i++)
|
|
|
|
|
{
|
2023-09-13 06:55:04 +00:00
|
|
|
|
node = Ci.SetupCodexNode(s => s.WithBootstrapNode(node));
|
2023-09-12 13:43:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AssertAllNodesConnected();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AssertAllNodesConnected()
|
|
|
|
|
{
|
|
|
|
|
//CreatePeerConnectionTestHelpers().AssertFullyConnected(GetAllOnlineCodexNodes());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|