diff --git a/multichain-testing/test/stake-ica.test.ts b/multichain-testing/test/stake-ica.test.ts index 735b65703d4..bbdc74cbb79 100644 --- a/multichain-testing/test/stake-ica.test.ts +++ b/multichain-testing/test/stake-ica.test.ts @@ -3,12 +3,29 @@ import type { TestFn } from 'ava'; import { commonSetup, SetupContextWithWallets } from './support.js'; import { makeDoOffer } from '../tools/e2e-tools.js'; import { makeQueryClient } from '../tools/query.js'; -import { sleep } from '../tools/sleep.js'; +import { sleep, type RetryOptions } from '../tools/sleep.js'; const test = anyTest as TestFn; const accounts = ['user1', 'user2']; +/** + * Wait 90 seconds to ensure staking rewards are available. + * + * While we expect staking rewards to be available after a + * single block (~5-12 seconds for most chains), this provide additional + * padding after observed failures in CI + * (https://github.com/Agoric/agoric-sdk/issues/9934). + * + * A more robust approach might consider Distribution params and the + * {@link FAUCET_POUR} constant to determine how many blocks it should take for + * rewards to be available. + */ +export const STAKING_REWARDS_TIMEOUT: RetryOptions = { + retryIntervalMs: 5000, + maxRetries: 18, +}; + test.before(async t => { const { deleteTestKeys, setupTestKeys, ...rest } = await commonSetup(t); // XXX not necessary for CI, but helpful for unexpected failures in @@ -178,10 +195,7 @@ const stakeScenario = test.macro(async (t, scenario: StakeIcaScenario) => { return Number(total?.[0]?.amount) > 0; }, `rewards available on ${scenario.chain}`, - { - retryIntervalMs: 5000, - maxRetries: 8, - }, + STAKING_REWARDS_TIMEOUT, ); t.log('reward:', total[0]); t.log('WithrawReward offer from continuing inv'); diff --git a/multichain-testing/tools/sleep.ts b/multichain-testing/tools/sleep.ts index df8cb534691..1c4d40bfdec 100644 --- a/multichain-testing/tools/sleep.ts +++ b/multichain-testing/tools/sleep.ts @@ -16,7 +16,7 @@ export const sleep = ( setTimeout(resolve, ms); }); -type RetryOptions = { +export type RetryOptions = { maxRetries?: number; retryIntervalMs?: number; } & SleepOptions;