From 78fb165b126c52b7e8da1ce8c65016d3e259f55c Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Tue, 27 Feb 2024 10:36:11 +0100 Subject: [PATCH] integration: fix parameters of marketplace payouts test --- tests/integration/testmarketplace.nim | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/integration/testmarketplace.nim b/tests/integration/testmarketplace.nim index 61c7f47b..8bbaebf0 100644 --- a/tests/integration/testmarketplace.nim +++ b/tests/integration/testmarketplace.nim @@ -19,16 +19,16 @@ marketplacesuite "Marketplace payouts": .some, providers: - CodexConfigs.init(nodes=5) + CodexConfigs.init(nodes=1) # .debug() # uncomment to enable console log output .withLogFile() # uncomment to output log file to tests/integration/logs/ //_.log .withLogTopics("node", "marketplace", "sales", "reservations", "node", "proving", "clock") .some, ): let reward = 400.u256 - let duration = 100.periods + let duration = 10.periods let collateral = 200.u256 - let expiry = 4.periods + let expiry = 3.periods let datasetSizeInBlocks = 8 let data = await RandomChunker.example(blocks=datasetSizeInBlocks) let client = clients()[0] @@ -37,15 +37,12 @@ marketplacesuite "Marketplace payouts": let providerApi = provider.client let startBalanceProvider = await token.balanceOf(provider.ethAccount) let startBalanceClient = await token.balanceOf(client.ethAccount) - # dataset size = 8 block, with 5 nodes, the slot size = 4 blocks, give each - # node enough availability to fill one slot only - let slotSize = (DefaultBlockSize * 4.NBytes).Natural.u256 # provider makes storage available discard providerApi.postAvailability( - # make availability size large enough to only fill 1 slot, thus causing a - # cancellation - size=slotSize, + # make availability size small enough that we can't fill all the slots, + # thus causing a cancellation + size=(data.len div 2).u256, duration=duration.u256, minPrice=reward, maxCollateral=collateral) @@ -58,7 +55,7 @@ marketplacesuite "Marketplace payouts": let subscription = await marketplace.subscribe(SlotFilled, onSlotFilled) - # client requests storage but requires two nodes to host the content + # client requests storage but requires five slots to host the content let id = await clientApi.requestStorage( cid, duration=duration, @@ -71,13 +68,13 @@ marketplacesuite "Marketplace payouts": ) # wait until one slot is filled - check eventually slotIdxFilled.isSome + check eventually(slotIdxFilled.isSome, timeout=expiry.int * 1000) # wait until sale is cancelled without requestId =? clientApi.requestId(id): fail() let slotId = slotId(requestId, !slotIdxFilled) - check eventually(providerApi.saleStateIs(slotId, "SaleCancelled")) + check eventually(providerApi.saleStateIs(slotId, "SaleCancelled"), timeout=expiry.int * 1000) check eventually ( let endBalanceProvider = (await token.balanceOf(provider.ethAccount));