2023-05-10 07:55:36 +00:00
|
|
|
|
using DistTestCore;
|
2023-05-18 08:42:04 +00:00
|
|
|
|
using DistTestCore.Codex;
|
2023-05-29 07:13:38 +00:00
|
|
|
|
using DistTestCore.Helpers;
|
2023-05-10 06:53:57 +00:00
|
|
|
|
using NUnit.Framework;
|
2023-05-18 08:42:04 +00:00
|
|
|
|
using Utils;
|
2023-05-10 06:53:57 +00:00
|
|
|
|
|
|
|
|
|
namespace Tests.PeerDiscoveryTests
|
|
|
|
|
{
|
2023-05-10 07:09:31 +00:00
|
|
|
|
[TestFixture]
|
2023-05-10 06:53:57 +00:00
|
|
|
|
public class PeerDiscoveryTests : AutoBootstrapDistTest
|
|
|
|
|
{
|
|
|
|
|
[TestCase(2)]
|
|
|
|
|
[TestCase(3)]
|
|
|
|
|
[TestCase(10)]
|
|
|
|
|
public void VariableNodes(int number)
|
|
|
|
|
{
|
2023-05-10 07:55:36 +00:00
|
|
|
|
SetupCodexNodes(number);
|
2023-05-10 06:53:57 +00:00
|
|
|
|
|
2023-05-10 07:55:36 +00:00
|
|
|
|
AssertAllNodesConnected();
|
2023-05-10 06:53:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase(2)]
|
|
|
|
|
[TestCase(3)]
|
|
|
|
|
[TestCase(10)]
|
|
|
|
|
public void VariableNodesInPods(int number)
|
|
|
|
|
{
|
|
|
|
|
for (var i = 0; i < number; i++)
|
|
|
|
|
{
|
2023-05-10 07:55:36 +00:00
|
|
|
|
SetupCodexNode();
|
2023-05-10 06:53:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-10 07:55:36 +00:00
|
|
|
|
AssertAllNodesConnected();
|
2023-05-10 06:53:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-12 07:11:05 +00:00
|
|
|
|
[TestCase(3, 3)]
|
|
|
|
|
[TestCase(3, 5)]
|
|
|
|
|
[TestCase(3, 10)]
|
2023-05-18 08:42:04 +00:00
|
|
|
|
[TestCase(5, 10)]
|
|
|
|
|
[TestCase(3, 20)]
|
|
|
|
|
[TestCase(5, 20)]
|
2023-05-12 07:11:05 +00:00
|
|
|
|
public void StagedVariableNodes(int numberOfNodes, int numberOfStages)
|
|
|
|
|
{
|
|
|
|
|
for (var i = 0; i < numberOfStages; i++)
|
|
|
|
|
{
|
2023-05-18 08:42:04 +00:00
|
|
|
|
SetupCodexNodes(numberOfNodes, s => s.WithLogLevel(CodexLogLevel.Trace));
|
2023-05-12 07:11:05 +00:00
|
|
|
|
|
|
|
|
|
AssertAllNodesConnected();
|
|
|
|
|
}
|
2023-05-18 08:42:04 +00:00
|
|
|
|
|
2023-05-29 06:35:46 +00:00
|
|
|
|
for (int i = 0; i < 5; i++)
|
2023-05-18 08:42:04 +00:00
|
|
|
|
{
|
|
|
|
|
Time.Sleep(TimeSpan.FromSeconds(30));
|
|
|
|
|
AssertAllNodesConnected();
|
|
|
|
|
}
|
2023-05-12 07:11:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-10 07:55:36 +00:00
|
|
|
|
private void AssertAllNodesConnected()
|
2023-05-10 06:53:57 +00:00
|
|
|
|
{
|
2023-05-29 07:13:38 +00:00
|
|
|
|
PeerConnectionTestHelpers.AssertFullyConnected(GetAllOnlineCodexNodes());
|
2023-05-10 06:53:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|