mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-05-28 12:09:35 +00:00
Trying to log slot reservation calls
This commit is contained in:
parent
69cf4283fa
commit
b3d35933a8
@ -10,7 +10,7 @@ namespace CodexPlugin
|
||||
public class ApiChecker
|
||||
{
|
||||
// <INSERT-OPENAPI-YAML-HASH>
|
||||
private const string OpenApiYamlHash = "FD-C8-0F-19-5E-14-09-C9-05-93-17-4A-97-50-1D-7E-37-50-B2-30-B2-E6-66-37-23-FA-35-F5-AB-A0-C6-BD";
|
||||
private const string OpenApiYamlHash = "06-B9-41-E8-C8-6C-DE-01-86-83-F3-9A-E4-AC-E7-30-D9-E6-64-60-E0-21-81-9E-4E-C5-93-77-2C-71-79-14";
|
||||
private const string OpenApiFilePath = "/codex/openapi.yaml";
|
||||
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";
|
||||
|
||||
|
||||
@ -31,8 +31,7 @@ namespace GethPlugin
|
||||
List<EventLog<TEvent>> GetEvents<TEvent>(string address, TimeRange timeRange) where TEvent : IEventDTO, new();
|
||||
BlockInterval ConvertTimeRangeToBlockRange(TimeRange timeRange);
|
||||
BlockTimeEntry GetBlockForNumber(ulong number);
|
||||
void IterateFunctionCalls<TFunc>(BlockInterval blockInterval, Action<TFunc> onCall) where TFunc : FunctionMessage;
|
||||
|
||||
void IterateFunctionCalls<TFunc>(BlockInterval blockInterval, Action<TFunc> onCall) where TFunc : FunctionMessage, new();
|
||||
}
|
||||
|
||||
public class DeploymentGethNode : BaseGethNode, IGethNode
|
||||
@ -199,8 +198,11 @@ namespace GethPlugin
|
||||
|
||||
foreach (var t in blk.Transactions)
|
||||
{
|
||||
var func = t.DecodeTransactionToFunctionMessage<TFunc>();
|
||||
if (func != null) onCall(func);
|
||||
if (t.IsTransactionForFunctionMessage<TFunc>())
|
||||
{
|
||||
var func = t.DecodeTransactionToFunctionMessage<TFunc>();
|
||||
if (func != null) onCall(func);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,6 @@ namespace CodexReleaseTests.MarketTests
|
||||
|
||||
request.WaitForStorageContractSubmitted();
|
||||
AssertContractIsOnChain(request);
|
||||
WaitUntilSlotReservationsFull(request);
|
||||
|
||||
WaitForContractStarted(request);
|
||||
AssertContractSlotsAreFilledByHosts(request, hosts);
|
||||
|
||||
@ -345,39 +345,6 @@ namespace CodexReleaseTests.MarketTests
|
||||
}, nameof(AssertContractIsOnChain));
|
||||
}
|
||||
|
||||
protected void WaitUntilSlotReservationsFull(IStoragePurchaseContract contract)
|
||||
{
|
||||
var requestId = contract.PurchaseId.ToLowerInvariant();
|
||||
var slots = contract.Purchase.MinRequiredNumberOfNodes;
|
||||
|
||||
var timeout = TimeSpan.FromMinutes(1.0);
|
||||
var start = DateTime.UtcNow;
|
||||
var fullIndices = new List<ulong>();
|
||||
|
||||
while (DateTime.UtcNow - start < timeout)
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(3.0));
|
||||
|
||||
var fullEvents = GetContracts().GetEvents(GetTestRunTimeRange()).GetSlotReservationsFullEvents();
|
||||
foreach (var e in fullEvents)
|
||||
{
|
||||
if (e.RequestId.ToHex().ToLowerInvariant() == requestId)
|
||||
{
|
||||
if (!fullIndices.Contains(e.SlotIndex))
|
||||
{
|
||||
fullIndices.Add(e.SlotIndex);
|
||||
if (fullIndices.Count == slots) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Assert.Fail(
|
||||
$"Slot reservations were not full after {Time.FormatDuration(timeout)}." +
|
||||
$" Slots: {slots} Filled: {string.Join(",", fullIndices.Select(i => i.ToString()))}"
|
||||
);
|
||||
}
|
||||
|
||||
protected void AssertOnChainEvents(Action<ICodexContractsEvents> onEvents, string description)
|
||||
{
|
||||
Time.Retry(() =>
|
||||
|
||||
@ -57,7 +57,6 @@ namespace CodexReleaseTests.MarketTests
|
||||
AssertContractIsOnChain(r);
|
||||
});
|
||||
|
||||
All(requests, WaitUntilSlotReservationsFull);
|
||||
All(requests, WaitForContractStarted);
|
||||
|
||||
// for the time being, we're only interested in whether these contracts start.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user