Skip to content

Commit

Permalink
wip: advance fail test with connection info
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Feb 9, 2025
1 parent 3899813 commit 82d456a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
1 change: 0 additions & 1 deletion multichain-testing/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ test.serial('advance failed', async t => {
nobleTools.mockCctpMint(mintAmt, userForwardingAddr);

await assertTxStatus(evidence.txHash, 'FORWARD_FAILED');
await sleep(5000, { log: t.log, setTimeout });
});

test.serial('lp withdraws', async t => {
Expand Down
20 changes: 20 additions & 0 deletions multichain-testing/test/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,26 @@ export const commonSetup = async (
const unreachableChain: CosmosChainInfo = {
chainId: 'unreachable-chain',
bech32Prefix: 'unreachable',
connections: {
noblelocal: {
client_id: '07-tendermint-898989',
counterparty: {
client_id: '07-tendermint-989898',
connection_id: 'connection-767676',
},
id: 'connection-424242',
state: 3,
transferChannel: {
channelId: 'channel-242424',
counterPartyChannelId: 'channel-656565',
counterPartyPortId: 'transfer',
ordering: 0,
portId: 'transfer',
state: 3,
version: 'ics20-1',
},
},
},
};

const chainInfo = {
Expand Down
27 changes: 19 additions & 8 deletions multichain-testing/tools/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,25 @@ type BlockHeaderPartial = {
// TODO: inject fetch
export function makeQueryClient(apiUrl: string) {
const query = async <T>(path: string): Promise<T> => {
try {
const res = await fetch(`${apiUrl}${path}`);
const json = await res.json();
return json as T;
} catch (err) {
console.error(err);
throw err;
}
const maxRetries = 5;
const retryDelayMS = 500;
return new Promise<T>((resolve, reject) => {
const doFetch = async retries => {
try {
const response = await fetch(`${apiUrl}${path}`);
const json = await response.json();
resolve(json as T);
} catch (err) {
if (retries === maxRetries) {
console.error(err);
reject(err);
return;
}
setTimeout(() => doFetch(retries + 1), retryDelayMS);
}
};
doFetch(0);
});
};

return {
Expand Down

0 comments on commit 82d456a

Please sign in to comment.