Skip to content

Commit

Permalink
test: increase attempts for rewards available condition (#9974)
Browse files Browse the repository at this point in the history
refs: #9934

## Description
- Increases overall timeout from 40s to 90s for "rewards available" condition in `/multichain-testing` staking flows test. This check happens after delegations are observed on the remote chain, but before we make an attempt to `WithdrawRewards`.

### Security Considerations
n/a

### Scaling Considerations
n/a

### Documentation Considerations
n/a

### Testing Considerations
Goal is to minimize observed CI flakes.

### Upgrade Considerations
n/a
  • Loading branch information
mergify[bot] committed Aug 29, 2024
2 parents 12c0dab + 17a23a7 commit ecc38fc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
24 changes: 19 additions & 5 deletions multichain-testing/test/stake-ica.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<SetupContextWithWallets>;

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
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion multichain-testing/tools/sleep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const sleep = (
setTimeout(resolve, ms);
});

type RetryOptions = {
export type RetryOptions = {
maxRetries?: number;
retryIntervalMs?: number;
} & SleepOptions;
Expand Down

0 comments on commit ecc38fc

Please sign in to comment.