cs-codex-dist-tests/Tests/CodexTests/DownloadConnectivityTests/FullyConnectedDownloadTests.cs

48 lines
1.4 KiB
C#
Raw Normal View History

using CodexContractsPlugin;
2024-06-12 13:28:08 +00:00
using CodexPlugin;
using GethPlugin;
using NUnit.Framework;
2023-09-12 13:43:30 +00:00
using Utils;
2023-11-12 09:36:48 +00:00
namespace CodexTests.DownloadConnectivityTests
2023-09-12 13:43:30 +00:00
{
[TestFixture]
public class FullyConnectedDownloadTests : AutoBootstrapDistTest
{
[Test]
public void MetricsDoesNotInterfereWithPeerDownload()
{
2024-06-12 13:28:08 +00:00
var nodes = StartCodex(2, s => s.EnableMetrics());
2023-09-12 13:43:30 +00:00
2024-06-12 13:28:08 +00:00
AssertAllNodesConnected(nodes);
2023-09-12 13:43:30 +00:00
}
[Test]
public void MarketplaceDoesNotInterfereWithPeerDownload()
{
var geth = Ci.StartGethNode(s => s.IsMiner());
var contracts = Ci.StartCodexContracts(geth);
2024-06-12 13:28:08 +00:00
var nodes = StartCodex(2, s => s.EnableMarketplace(geth, contracts, m => m
.WithInitial(10.Eth(), 1000.TstWei())));
2023-09-12 13:43:30 +00:00
2024-06-12 13:28:08 +00:00
AssertAllNodesConnected(nodes);
2023-09-12 13:43:30 +00:00
}
[Test]
[Combinatorial]
public void FullyConnectedDownloadTest(
2024-02-27 12:55:05 +00:00
[Values(2, 5)] int numberOfNodes,
[Values(1, 10)] int sizeMBs)
2023-09-12 13:43:30 +00:00
{
2024-06-12 13:28:08 +00:00
var nodes = StartCodex(numberOfNodes);
2023-09-12 13:43:30 +00:00
2024-06-12 13:28:08 +00:00
AssertAllNodesConnected(nodes, sizeMBs);
2023-09-12 13:43:30 +00:00
}
2024-06-12 13:28:08 +00:00
private void AssertAllNodesConnected(IEnumerable<ICodexNode> nodes, int sizeMBs = 10)
2023-09-12 13:43:30 +00:00
{
2024-06-12 13:28:08 +00:00
CreatePeerDownloadTestHelpers().AssertFullDownloadInterconnectivity(nodes, sizeMBs.MB());
2023-09-12 13:43:30 +00:00
}
}
}