From 659cce14111b7c176fac68a86020b376161a5f85 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 12 Aug 2025 15:23:12 +0200 Subject: [PATCH] shuts down uploader client in repair test before host cycling starts --- Tests/CodexReleaseTests/MarketTests/RepairTest.cs | 15 ++++++++++++--- Tests/CodexReleaseTests/Utils/ChainMonitor.cs | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Tests/CodexReleaseTests/MarketTests/RepairTest.cs b/Tests/CodexReleaseTests/MarketTests/RepairTest.cs index 04929659..8b823286 100644 --- a/Tests/CodexReleaseTests/MarketTests/RepairTest.cs +++ b/Tests/CodexReleaseTests/MarketTests/RepairTest.cs @@ -33,8 +33,10 @@ namespace CodexReleaseTests.MarketTests [Combinatorial] public void RollingRepairSingleFailure( [Rerun] int rerun, - [Values(5)] int numFailures) + [Values(10)] int numFailures) { + Assert.That(numFailures, Is.GreaterThan(NumberOfHosts)); + var hosts = StartHosts().ToList(); var client = StartClients().Single(); StartValidator(); @@ -43,9 +45,12 @@ namespace CodexReleaseTests.MarketTests contract.WaitForStorageContractStarted(); // All slots are filled. + client.Stop(waitTillStopped: true); + for (var i = 0; i < numFailures; i++) { Log($"Failure step: {i}"); + Log($"Running hosts: [{string.Join(", ", hosts.Select(h => h.GetName()))}]"); // Start a new host. Add it to the back of the list: hosts.Add(StartOneHost()); @@ -66,10 +71,11 @@ namespace CodexReleaseTests.MarketTests private void WaitForSlotFreedEvent(IStoragePurchaseContract contract, ulong slotIndex) { - Log(nameof(WaitForSlotFreedEvent)); var start = DateTime.UtcNow; var timeout = CalculateContractFailTimespan(); + Log($"{nameof(WaitForSlotFreedEvent)} {Time.FormatDuration(timeout)} requestId: '{contract.PurchaseId.ToLowerInvariant()}' slotIndex: {slotIndex}"); + while (DateTime.UtcNow < start + timeout) { var events = GetContracts().GetEvents(GetTestRunTimeRange()); @@ -78,7 +84,10 @@ namespace CodexReleaseTests.MarketTests foreach (var free in slotsFreed) { - if (free.RequestId.ToHex().ToLowerInvariant() == contract.PurchaseId.ToLowerInvariant()) + var freedId = free.RequestId.ToHex().ToLowerInvariant(); + Log($"Free for requestId '{freedId}' slotIndex: {free.SlotIndex}"); + + if (freedId == contract.PurchaseId.ToLowerInvariant()) { if (free.SlotIndex == slotIndex) { diff --git a/Tests/CodexReleaseTests/Utils/ChainMonitor.cs b/Tests/CodexReleaseTests/Utils/ChainMonitor.cs index cc24ad18..9a2a7683 100644 --- a/Tests/CodexReleaseTests/Utils/ChainMonitor.cs +++ b/Tests/CodexReleaseTests/Utils/ChainMonitor.cs @@ -1,6 +1,7 @@ using CodexContractsPlugin; using CodexContractsPlugin.ChainMonitor; using Logging; +using Utils; namespace CodexReleaseTests.Utils { @@ -44,7 +45,7 @@ namespace CodexReleaseTests.Utils var state = new ChainState(log, contracts, new DoNothingThrowingChainEventHandler(), startUtc, doProofPeriodMonitoring: true); Thread.Sleep(updateInterval); - log.Log("Chain monitoring started"); + log.Log($"Chain monitoring started. Update interval: {Time.FormatDuration(updateInterval)}"); while (!cts.IsCancellationRequested) { try