Cleanup and rename

This commit is contained in:
ThatBen 2025-05-30 08:59:43 +02:00
parent 4a86342633
commit a8c094e735
No known key found for this signature in database
GPG Key ID: 62C543548433D43E
8 changed files with 26 additions and 23 deletions

View File

@ -1,5 +1,5 @@
using System.Security.Cryptography;
using CodexReleaseTests.MarketTests;
using CodexReleaseTests.Utils;
using Nethereum.JsonRpc.Client;
using NUnit.Framework;
using Utils;

View File

@ -1,10 +1,11 @@
using CodexClient;
using CodexReleaseTests.Utils;
using NUnit.Framework;
using Utils;
namespace CodexReleaseTests.MarketTests
{
public class ContractFailedTest : MarketplaceAutoBootstrapDistTest
public class FailTest : MarketplaceAutoBootstrapDistTest
{
protected override int NumberOfHosts => 4;
protected override int NumberOfClients => 1;
@ -13,8 +14,7 @@ namespace CodexReleaseTests.MarketTests
private readonly TestToken pricePerBytePerSecond = 10.TstWei();
[Test]
[Ignore("Disabled for now: Test is unstable.")]
public void ContractFailed()
public void Fail()
{
var hosts = StartHosts();
var client = StartClients().Single();

View File

@ -1,4 +1,5 @@
using CodexClient;
using CodexReleaseTests.Utils;
using NUnit.Framework;
using Utils;
@ -6,9 +7,9 @@ namespace CodexReleaseTests.MarketTests
{
[TestFixture(5, 3, 1)]
[TestFixture(10, 20, 10)]
public class ContractSuccessfulTest : MarketplaceAutoBootstrapDistTest
public class FinishTest : MarketplaceAutoBootstrapDistTest
{
public ContractSuccessfulTest(int hosts, int slots, int tolerance)
public FinishTest(int hosts, int slots, int tolerance)
{
this.hosts = hosts;
this.slots = slots;
@ -27,7 +28,8 @@ namespace CodexReleaseTests.MarketTests
protected override TimeSpan HostAvailabilityMaxDuration => Get8TimesConfiguredPeriodDuration() * 12;
[Test]
public void ContractSuccessful()
[Repeat(16)]
public void Finish()
{
var hosts = StartHosts();
var client = StartClients().Single();

View File

@ -1,4 +1,5 @@
using CodexClient;
using CodexReleaseTests.Utils;
using Nethereum.Hex.HexConvertors.Extensions;
using NUnit.Framework;
using Utils;
@ -49,6 +50,7 @@ namespace CodexReleaseTests.MarketTests
{
var hosts = StartHosts().ToList();
var client = StartClients().Single();
StartValidator();
var contract = CreateStorageRequest(client);
contract.WaitForStorageContractStarted();
@ -178,7 +180,7 @@ namespace CodexReleaseTests.MarketTests
MinRequiredNumberOfNodes = Slots,
NodeFailureTolerance = Tolerance,
PricePerBytePerSecond = 10.TstWei(),
ProofProbability = 20,
ProofProbability = 1, // One proof every period. Free slot as quickly as possible.
CollateralPerByte = 1.TstWei()
});
}

View File

@ -1,14 +1,15 @@
using CodexClient;
using CodexPlugin;
using CodexReleaseTests.Utils;
using NUnit.Framework;
using Utils;
namespace CodexReleaseTests.MarketTests
{
[TestFixture(12, 48, 12)]
public class MultipleContractsTest : MarketplaceAutoBootstrapDistTest
public class SequentialContracts : MarketplaceAutoBootstrapDistTest
{
public MultipleContractsTest(int hosts, int slots, int tolerance)
public SequentialContracts(int hosts, int slots, int tolerance)
{
this.hosts = hosts;
this.slots = slots;
@ -28,7 +29,7 @@ namespace CodexReleaseTests.MarketTests
[Test]
[Combinatorial]
public void MultipleContractGenerations(
public void Sequential(
[Values(10)] int numGenerations)
{
var hosts = StartHosts();
@ -88,7 +89,7 @@ namespace CodexReleaseTests.MarketTests
MinRequiredNumberOfNodes = (uint)slots,
NodeFailureTolerance = (uint)tolerance,
PricePerBytePerSecond = pricePerBytePerSecond,
ProofProbability = 1000,
ProofProbability = 10000,
CollateralPerByte = 1.TstWei()
});
}

View File

@ -1,11 +1,12 @@
using CodexClient;
using CodexReleaseTests.Utils;
using NUnit.Framework;
using Utils;
namespace CodexReleaseTests.MarketTests
{
[TestFixture]
public class ContractsStartTest : MarketplaceAutoBootstrapDistTest
public class StartTest : MarketplaceAutoBootstrapDistTest
{
private const int FilesizeMb = 10;
private readonly TestToken pricePerBytePerSecond = 10.TstWei();
@ -16,11 +17,8 @@ namespace CodexReleaseTests.MarketTests
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)
[Repeat(16)]
public void Start()
{
var hosts = StartHosts();
var client = StartClients().Single();

View File

@ -2,7 +2,7 @@
using CodexContractsPlugin.ChainMonitor;
using Logging;
namespace CodexReleaseTests.MarketTests
namespace CodexReleaseTests.Utils
{
public class ChainMonitor
{

View File

@ -9,7 +9,7 @@ using Nethereum.Hex.HexConvertors.Extensions;
using NUnit.Framework;
using Utils;
namespace CodexReleaseTests.MarketTests
namespace CodexReleaseTests.Utils
{
public abstract class MarketplaceAutoBootstrapDistTest : AutoBootstrapDistTest
{
@ -45,7 +45,7 @@ namespace CodexReleaseTests.MarketTests
protected TimeSpan GetPeriodDuration()
{
var config = GetContracts().Deployment.Config;
return TimeSpan.FromSeconds(((double)config.Proofs.Period));
return TimeSpan.FromSeconds(config.Proofs.Period);
}
protected abstract int NumberOfHosts { get; }
@ -320,7 +320,7 @@ namespace CodexReleaseTests.MarketTests
private DateTime GetContractOnChainSubmittedUtc(IStoragePurchaseContract contract)
{
return Time.Retry<DateTime>(() =>
return Time.Retry(() =>
{
var events = GetContracts().GetEvents(GetTestRunTimeRange());
var submitEvent = events.GetStorageRequests().SingleOrDefault(e => e.RequestId.ToHex(false) == contract.PurchaseId);
@ -395,7 +395,7 @@ namespace CodexReleaseTests.MarketTests
// failed a sufficient number of proofs.
float n = requiredNumMissedProofs;
return gracePeriod + (periodDuration * n * GetDowntimeFactor(config));
return gracePeriod + periodDuration * n * GetDowntimeFactor(config);
}
private float GetDowntimeFactor(MarketplaceConfig config)