mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-05-28 03:59:27 +00:00
Cleanup marketplace tests
This commit is contained in:
parent
830c392995
commit
de49328573
@ -5,8 +5,7 @@ using Utils;
|
||||
namespace CodexReleaseTests.MarketTests
|
||||
{
|
||||
[TestFixture(5, 3, 1)]
|
||||
//[TestFixture(10, 6, 3)]
|
||||
//[TestFixture(10, 20, 10)]
|
||||
[TestFixture(10, 20, 10)]
|
||||
public class ContractSuccessfulTest : MarketplaceAutoBootstrapDistTest
|
||||
{
|
||||
public ContractSuccessfulTest(int hosts, int slots, int tolerance)
|
||||
|
||||
68
Tests/CodexReleaseTests/MarketTests/ContractsStartTest.cs
Normal file
68
Tests/CodexReleaseTests/MarketTests/ContractsStartTest.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using CodexClient;
|
||||
using NUnit.Framework;
|
||||
using Utils;
|
||||
|
||||
namespace CodexReleaseTests.MarketTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ContractsStartTest : MarketplaceAutoBootstrapDistTest
|
||||
{
|
||||
private const int FilesizeMb = 10;
|
||||
private readonly TestToken pricePerBytePerSecond = 10.TstWei();
|
||||
|
||||
protected override int NumberOfHosts => 5;
|
||||
protected override int NumberOfClients => 1;
|
||||
protected override ByteSize HostAvailabilitySize => (5 * FilesizeMb).MB();
|
||||
protected override TimeSpan HostAvailabilityMaxDuration => Get8TimesConfiguredPeriodDuration() * 12;
|
||||
|
||||
[Test]
|
||||
[Combinatorial]
|
||||
public void ContractStarts(
|
||||
[Values(1, 2, 3)] int rerunA,
|
||||
[Values(1, 2, 3)] int rerunB,
|
||||
[Values(1, 2, 3)] int rerunC)
|
||||
{
|
||||
var hosts = StartHosts();
|
||||
var client = StartClients().Single();
|
||||
|
||||
var request = CreateStorageRequest(client);
|
||||
|
||||
request.WaitForStorageContractSubmitted();
|
||||
AssertContractIsOnChain(request);
|
||||
|
||||
WaitForContractStarted(request);
|
||||
AssertContractSlotsAreFilledByHosts(request, hosts);
|
||||
}
|
||||
|
||||
private IStoragePurchaseContract CreateStorageRequest(ICodexNode client)
|
||||
{
|
||||
var cid = client.UploadFile(GenerateTestFile(FilesizeMb.MB()));
|
||||
var config = GetContracts().Deployment.Config;
|
||||
return client.Marketplace.RequestStorage(new StoragePurchaseRequest(cid)
|
||||
{
|
||||
Duration = GetContractDuration(),
|
||||
Expiry = GetContractExpiry(),
|
||||
MinRequiredNumberOfNodes = 3,
|
||||
NodeFailureTolerance = 1,
|
||||
PricePerBytePerSecond = pricePerBytePerSecond,
|
||||
ProofProbability = 20,
|
||||
CollateralPerByte = 100.TstWei()
|
||||
});
|
||||
}
|
||||
|
||||
private TimeSpan GetContractExpiry()
|
||||
{
|
||||
return GetContractDuration() / 2;
|
||||
}
|
||||
|
||||
private TimeSpan GetContractDuration()
|
||||
{
|
||||
return Get8TimesConfiguredPeriodDuration();
|
||||
}
|
||||
|
||||
private TimeSpan Get8TimesConfiguredPeriodDuration()
|
||||
{
|
||||
return GetPeriodDuration() * 8.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,11 +5,7 @@ using Utils;
|
||||
|
||||
namespace CodexReleaseTests.MarketTests
|
||||
{
|
||||
//[TestFixture(8, 3, 1)]
|
||||
[TestFixture(12, 48, 12)]
|
||||
//[TestFixture(10, 5, 1)]
|
||||
//[TestFixture(10, 6, 1)]
|
||||
//[TestFixture(10, 6, 3)]
|
||||
public class MultipleContractsTest : MarketplaceAutoBootstrapDistTest
|
||||
{
|
||||
public MultipleContractsTest(int hosts, int slots, int tolerance)
|
||||
@ -33,7 +29,7 @@ namespace CodexReleaseTests.MarketTests
|
||||
[Test]
|
||||
[Combinatorial]
|
||||
public void MultipleContractGenerations(
|
||||
[Values(50)] int numGenerations)
|
||||
[Values(10)] int numGenerations)
|
||||
{
|
||||
var hosts = StartHosts();
|
||||
var clients = StartClients();
|
||||
@ -58,10 +54,6 @@ namespace CodexReleaseTests.MarketTests
|
||||
});
|
||||
|
||||
All(requests, WaitForContractStarted);
|
||||
|
||||
// for the time being, we're only interested in whether these contracts start.
|
||||
//All(requests, r => AssertContractSlotsAreFilledByHosts(r, hosts));
|
||||
//All(requests, r => r.WaitForStorageContractFinished());
|
||||
}
|
||||
|
||||
private void All<T>(T[] items, Action<T> action)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user