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

55 lines
1.4 KiB
C#
Raw Normal View History

using CodexContractsPlugin;
using GethPlugin;
using NUnit.Framework;
2023-09-12 13:43:30 +00:00
2023-11-12 09:36:48 +00:00
namespace CodexTests.PeerDiscoveryTests
2023-09-12 13:43:30 +00:00
{
[TestFixture]
public class PeerDiscoveryTests : AutoBootstrapDistTest
{
[Test]
public void CanReportUnknownPeerId()
{
var unknownId = "16Uiu2HAkv2CHWpff3dj5iuVNERAp8AGKGNgpGjPexJZHSqUstfsK";
var node = AddCodex();
var result = node.GetDebugPeer(unknownId);
Assert.That(result.IsPeerFound, Is.False);
}
[Test]
public void MetricsDoesNotInterfereWithPeerDiscovery()
{
2023-09-13 10:24:46 +00:00
AddCodex(2, s => s.EnableMetrics());
2023-09-12 13:43:30 +00:00
AssertAllNodesConnected();
}
[Test]
public void MarketplaceDoesNotInterfereWithPeerDiscovery()
{
var geth = Ci.StartGethNode(s => s.IsMiner());
var contracts = Ci.StartCodexContracts(geth);
AddCodex(2, s => s.EnableMarketplace(geth, contracts, 10.Eth(), 1000.TestTokens()));
2023-09-12 13:43:30 +00:00
AssertAllNodesConnected();
}
[TestCase(2)]
[TestCase(3)]
[TestCase(10)]
[TestCase(20)]
public void VariableNodes(int number)
{
AddCodex(number);
AssertAllNodesConnected();
}
private void AssertAllNodesConnected()
{
2023-09-13 12:24:43 +00:00
CreatePeerConnectionTestHelpers().AssertFullyConnected(GetAllOnlineCodexNodes());
2023-09-12 13:43:30 +00:00
}
}
}