This commit is contained in:
Ben 2024-03-15 13:50:39 +01:00
parent 188f765b5c
commit f757e64ba4
No known key found for this signature in database
GPG Key ID: 541B9D8C9F1426A1
3 changed files with 8 additions and 165 deletions

View File

@ -9,7 +9,8 @@ namespace CodexPlugin
{
private readonly MarketplaceStarter marketplaceStarter = new MarketplaceStarter();
private const string DefaultDockerImage = "codexstorage/nim-codex:latest-dist-tests";
private const string DefaultDockerImage = "thatbenbierens/nim-codex:prover2";
//"codexstorage/nim-codex:latest-dist-tests";
public const string ApiPortTag = "codex_api_port";
public const string ListenPortTag = "codex_listen_port";
public const string MetricsPortTag = "codex_metrics_port";

View File

@ -74,7 +74,7 @@ namespace CodexTests.BasicTests
size: 10.GB(),
minPriceForTotalSpace: 1.TestTokens(),
maxCollateral: 20.TestTokens(),
maxDuration: TimeSpan.FromMinutes(3));
maxDuration: TimeSpan.FromMinutes(30));
var testFile = GenerateTestFile(fileSize);
@ -91,7 +91,7 @@ namespace CodexTests.BasicTests
requiredCollateral: 10.TestTokens(),
minRequiredNumberOfNodes: 1,
proofProbability: 5,
duration: TimeSpan.FromMinutes(1));
duration: TimeSpan.FromMinutes(5));
purchaseContract.WaitForStorageContractStarted(fileSize);
@ -108,7 +108,7 @@ namespace CodexTests.BasicTests
AssertBalance(contracts, buyer, Is.LessThan(buyerInitialBalance), "Buyer was not charged for storage.");
Assert.That(contracts.GetRequestState(request), Is.EqualTo(RequestState.Finished));
// waiting for block retransmit fix: CheckLogForErrors(seller, buyer);
CheckLogForErrors(seller, buyer);
}
[Test]

View File

@ -1,6 +1,4 @@
using CodexContractsPlugin;
using CodexPlugin;
using GethPlugin;
using CodexPlugin;
using NUnit.Framework;
using Utils;
@ -9,162 +7,6 @@ namespace CodexTests.BasicTests
[TestFixture]
public class TwoClientTests : CodexDistTest
{
[Test]
[Combinatorial]
public void TwoClient(
[Values(0, 1, 2, 3)] int upmode,
[Values(0, 1, 2, 3)] int downmode)
{
var geth = Ci.StartGethNode(g => g.IsMiner());
var contracts = Ci.StartCodexContracts(geth);
var uploader = AddCodex(s =>
{
s.WithName("Uploader");
s.WithStorageQuota(10.GB());
if (upmode == 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens());
if (upmode > 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens(), s => s.AsStorageNode());
});
var downloader = AddCodex(s =>
{
s.WithName("Downloader");
s.WithStorageQuota(10.GB());
s.WithBootstrapNode(uploader);
if (downmode == 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens());
if (downmode > 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens(), s => s.AsStorageNode());
});
if (upmode == 3)
{
uploader.Marketplace.MakeStorageAvailable(
size: 2.GB(),
minPriceForTotalSpace: 1.TestTokens(),
maxCollateral: 20.TestTokens(),
maxDuration: TimeSpan.FromMinutes(3));
}
if (downmode == 3)
{
downloader.Marketplace.MakeStorageAvailable(
size: 2.GB(),
minPriceForTotalSpace: 1.TestTokens(),
maxCollateral: 20.TestTokens(),
maxDuration: TimeSpan.FromMinutes(3));
}
PerformTwoClientTest(uploader, downloader);
}
[Test]
[Combinatorial]
public void ConnectivityOverGit(
[Values(0)] int upmode,
[Values(0, 1)] int downmode,
[Values(0, 1, 2, 3, 4, 5, 6)] int gitIndex)
{
var gits = new[]
{
""
};
CodexContainerRecipe.DockerImageOverride = gits[gitIndex];
var geth = Ci.StartGethNode(g => g.IsMiner());
var contracts = Ci.StartCodexContracts(geth);
var uploader = AddCodex(s =>
{
s.WithName("Uploader");
s.WithStorageQuota(10.GB());
if (upmode == 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens());
if (upmode > 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens(), s => s.AsStorageNode());
});
var downloader = AddCodex(s =>
{
s.WithName("Downloader");
s.WithStorageQuota(10.GB());
s.WithBootstrapNode(uploader);
if (downmode == 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens());
if (downmode > 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens(), s => s.AsStorageNode());
});
if (upmode == 3)
{
uploader.Marketplace.MakeStorageAvailable(
size: 2.GB(),
minPriceForTotalSpace: 1.TestTokens(),
maxCollateral: 20.TestTokens(),
maxDuration: TimeSpan.FromMinutes(3));
}
if (downmode == 3)
{
downloader.Marketplace.MakeStorageAvailable(
size: 2.GB(),
minPriceForTotalSpace: 1.TestTokens(),
maxCollateral: 20.TestTokens(),
maxDuration: TimeSpan.FromMinutes(3));
}
CreatePeerConnectionTestHelpers().AssertFullyConnected(new[] { uploader, downloader });
}
[Test]
[Combinatorial]
public void Connectivity(
[Values(0, 1, 2, 3)] int upmode,
[Values(0, 1, 2, 3)] int downmode)
{
var geth = Ci.StartGethNode(g => g.IsMiner());
var contracts = Ci.StartCodexContracts(geth);
var uploader = AddCodex(s =>
{
s.WithName("Uploader");
s.WithStorageQuota(10.GB());
if (upmode == 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens());
if (upmode > 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens(), s => s.AsStorageNode());
});
var downloader = AddCodex(s =>
{
s.WithName("Downloader");
s.WithStorageQuota(10.GB());
s.WithBootstrapNode(uploader);
if (downmode == 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens());
if (downmode > 1) s.EnableMarketplace(geth, contracts, 10.Eth(), 10.TestTokens(), s => s.AsStorageNode());
});
if (upmode == 3)
{
uploader.Marketplace.MakeStorageAvailable(
size: 2.GB(),
minPriceForTotalSpace: 1.TestTokens(),
maxCollateral: 20.TestTokens(),
maxDuration: TimeSpan.FromMinutes(3));
}
if (downmode == 3)
{
downloader.Marketplace.MakeStorageAvailable(
size: 2.GB(),
minPriceForTotalSpace: 1.TestTokens(),
maxCollateral: 20.TestTokens(),
maxDuration: TimeSpan.FromMinutes(3));
}
CreatePeerConnectionTestHelpers().AssertFullyConnected(new[] { uploader, downloader });
}
[Test]
public void TwoClientTest()
{
@ -184,8 +26,8 @@ namespace CodexTests.BasicTests
return;
}
var uploader = Ci.StartCodexNode(s => s.At(locations.Get(0)));
var downloader = Ci.StartCodexNode(s => s.WithBootstrapNode(uploader).At(locations.Get(1)));
var uploader = Ci.StartCodexNode(s => s.WithName("Uploader").At(locations.Get(0)));
var downloader = Ci.StartCodexNode(s => s.WithName("Downloader").WithBootstrapNode(uploader).At(locations.Get(1)));
PerformTwoClientTest(uploader, downloader);
}