2
0
mirror of synced 2025-02-04 20:54:09 +00:00

48 lines
1.4 KiB
C#
Raw Normal View History

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