cs-codex-dist-tests/Tests/PeerDiscoveryTests/PeerDiscoveryTests.cs

41 lines
998 B
C#
Raw Normal View History

using DistTestCore;
using DistTestCore.Helpers;
2023-05-10 06:53:57 +00:00
using NUnit.Framework;
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
{
[Test]
public void CanReportUnknownPeerId()
{
var unknownId = "16Uiu2HAkv2CHWpff3dj5iuVNERAp8AGKGNgpGjPexJZHSqUstfsK";
var node = SetupCodexNode();
var result = node.GetDebugPeer(unknownId);
Assert.That(result.IsPeerFound, Is.False);
}
2023-05-10 06:53:57 +00:00
[TestCase(2)]
[TestCase(3)]
[TestCase(10)]
[TestCase(20)]
2023-05-10 06:53:57 +00:00
public void VariableNodesInPods(int number)
{
for (var i = 0; i < number; i++)
{
SetupCodexNode();
2023-05-10 06:53:57 +00:00
}
AssertAllNodesConnected();
2023-05-10 06:53:57 +00:00
}
private void AssertAllNodesConnected()
2023-05-10 06:53:57 +00:00
{
PeerConnectionTestHelpers.AssertFullyConnected(GetAllOnlineCodexNodes());
2023-05-10 06:53:57 +00:00
}
}
}