wip
This commit is contained in:
parent
188f765b5c
commit
f757e64ba4
|
@ -9,7 +9,8 @@ namespace CodexPlugin
|
||||||
{
|
{
|
||||||
private readonly MarketplaceStarter marketplaceStarter = new MarketplaceStarter();
|
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 ApiPortTag = "codex_api_port";
|
||||||
public const string ListenPortTag = "codex_listen_port";
|
public const string ListenPortTag = "codex_listen_port";
|
||||||
public const string MetricsPortTag = "codex_metrics_port";
|
public const string MetricsPortTag = "codex_metrics_port";
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace CodexTests.BasicTests
|
||||||
size: 10.GB(),
|
size: 10.GB(),
|
||||||
minPriceForTotalSpace: 1.TestTokens(),
|
minPriceForTotalSpace: 1.TestTokens(),
|
||||||
maxCollateral: 20.TestTokens(),
|
maxCollateral: 20.TestTokens(),
|
||||||
maxDuration: TimeSpan.FromMinutes(3));
|
maxDuration: TimeSpan.FromMinutes(30));
|
||||||
|
|
||||||
var testFile = GenerateTestFile(fileSize);
|
var testFile = GenerateTestFile(fileSize);
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ namespace CodexTests.BasicTests
|
||||||
requiredCollateral: 10.TestTokens(),
|
requiredCollateral: 10.TestTokens(),
|
||||||
minRequiredNumberOfNodes: 1,
|
minRequiredNumberOfNodes: 1,
|
||||||
proofProbability: 5,
|
proofProbability: 5,
|
||||||
duration: TimeSpan.FromMinutes(1));
|
duration: TimeSpan.FromMinutes(5));
|
||||||
|
|
||||||
purchaseContract.WaitForStorageContractStarted(fileSize);
|
purchaseContract.WaitForStorageContractStarted(fileSize);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ namespace CodexTests.BasicTests
|
||||||
AssertBalance(contracts, buyer, Is.LessThan(buyerInitialBalance), "Buyer was not charged for storage.");
|
AssertBalance(contracts, buyer, Is.LessThan(buyerInitialBalance), "Buyer was not charged for storage.");
|
||||||
Assert.That(contracts.GetRequestState(request), Is.EqualTo(RequestState.Finished));
|
Assert.That(contracts.GetRequestState(request), Is.EqualTo(RequestState.Finished));
|
||||||
|
|
||||||
// waiting for block retransmit fix: CheckLogForErrors(seller, buyer);
|
CheckLogForErrors(seller, buyer);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using CodexContractsPlugin;
|
using CodexPlugin;
|
||||||
using CodexPlugin;
|
|
||||||
using GethPlugin;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Utils;
|
using Utils;
|
||||||
|
|
||||||
|
@ -9,162 +7,6 @@ namespace CodexTests.BasicTests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TwoClientTests : CodexDistTest
|
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]
|
[Test]
|
||||||
public void TwoClientTest()
|
public void TwoClientTest()
|
||||||
{
|
{
|
||||||
|
@ -184,8 +26,8 @@ namespace CodexTests.BasicTests
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uploader = Ci.StartCodexNode(s => s.At(locations.Get(0)));
|
var uploader = Ci.StartCodexNode(s => s.WithName("Uploader").At(locations.Get(0)));
|
||||||
var downloader = Ci.StartCodexNode(s => s.WithBootstrapNode(uploader).At(locations.Get(1)));
|
var downloader = Ci.StartCodexNode(s => s.WithName("Downloader").WithBootstrapNode(uploader).At(locations.Get(1)));
|
||||||
|
|
||||||
PerformTwoClientTest(uploader, downloader);
|
PerformTwoClientTest(uploader, downloader);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue