Skip to content

Commit 7b78f02

Browse files
committed
fix(acceptance): fix flakey wallet test
refs: #10565 fix: format fix
1 parent 820badf commit 7b78f02

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

a3p-integration/proposals/z:acceptance/wallet.test.js

+16-9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import { execFileSync } from 'node:child_process';
1515
import { agdWalletUtils } from './test-lib/index.js';
1616
import { getBalances, replaceTemplateValuesInFile } from './test-lib/utils.js';
17+
import { tryISTBalances } from './test-lib/psm-lib.js';
1718

1819
/**
1920
* @param {string} file
@@ -57,10 +58,12 @@ test.serial(`send invitation via namesByAddress`, async t => {
5758
);
5859
});
5960

60-
// FIXME https://github.com/Agoric/agoric-sdk/issues/10565
61-
test.skip('exitOffer tool reclaims stuck payment', async t => {
61+
test.serial('exitOffer tool reclaims stuck payment', async t => {
6262
const istBalanceBefore = await getBalances([GOV1ADDR], 'uist');
63-
t.log('istBalanceBefore', istBalanceBefore);
63+
64+
// Using console.log here because t.log is inconsistent
65+
// when a test fails in CI. See https://github.com/Agoric/agoric-sdk/issues/10565#issuecomment-2561923537
66+
console.log('istBalanceBefore', istBalanceBefore);
6467

6568
const offerId = 'bad-invitation-15'; // offer submitted on proposal upgrade-15 with an incorrect method name
6669
await agdWalletUtils.broadcastBridgeAction(GOV1ADDR, {
@@ -70,16 +73,20 @@ test.skip('exitOffer tool reclaims stuck payment', async t => {
7073

7174
const istBalanceAfter = await retryUntilCondition(
7275
async () => getBalances([GOV1ADDR], 'uist'),
73-
istBalance => istBalance > istBalanceBefore,
74-
'tryExitOffer failed to reclaim stuck payment ',
76+
// We only check gov1's IST balance is changed.
77+
// Because the reclaimed amount (0,015 IST) is less than execution fee (0,2 IST)
78+
// we might end up with less IST than the one before reclaiming the stuck payment.
79+
istBalance => istBalance !== istBalanceBefore,
80+
'tryExitOffer did not end up changing the IST balance',
7581
{ log: t.log, setTimeout, retryIntervalMs: 5000, maxRetries: 15 },
7682
);
7783

78-
t.log('istBalanceAfter', istBalanceAfter);
84+
console.log('istBalanceAfter', istBalanceAfter);
7985

80-
t.true(
81-
istBalanceAfter > istBalanceBefore,
82-
'The IST balance should increase after reclaiming the stuck payment',
86+
await tryISTBalances(
87+
t,
88+
Number(istBalanceAfter),
89+
Number(istBalanceBefore + 15_000n),
8390
);
8491
});
8592

0 commit comments

Comments
 (0)