Skip to content

Commit

Permalink
chore(acceptance): make the tests more robust against time related co…
Browse files Browse the repository at this point in the history
…mplexities
  • Loading branch information
anilhelvaci committed Oct 5, 2024
1 parent f2437b7 commit 65bfdc0
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 353 deletions.
178 changes: 0 additions & 178 deletions a3p-integration/proposals/n:upgrade-next/lib/vaults.js

This file was deleted.

59 changes: 31 additions & 28 deletions a3p-integration/proposals/n:upgrade-next/performAction.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
#!/usr/bin/env node

import { GOV1ADDR, GOV2ADDR, CHAINID, agd, agopsInter, addPreexistingOracles, pushPrices, agoric } from "@agoric/synthetic-chain";
import {
GOV1ADDR,
CHAINID,
agd,
agopsInter,
addUser,
waitForBlock,
provisionSmartWallet,
ATOM_DENOM,
} from '@agoric/synthetic-chain';

export const bankSend = (from, addr, wanted) => {
const chain = ['--chain-id', CHAINID];
const fromArg = ['--from', from];
const testKeyring = ['--keyring-backend', 'test'];
const noise = [...fromArg, ...chain, ...testKeyring, '--yes'];
const chain = ['--chain-id', CHAINID];
const fromArg = ['--from', from];
const testKeyring = ['--keyring-backend', 'test'];
const noise = [...fromArg, ...chain, ...testKeyring, '--yes'];

return agd.tx('bank', 'send', from, addr, wanted, ...noise);
return agd.tx('bank', 'send', from, addr, wanted, ...noise);
};

const setupOracles = async () => {
const oraclesByBrand = new Map();
const round = await agoric.follow(
'-lF',
':published.priceFeed.ATOM-USD_price_feed.latestRound',
);
await addPreexistingOracles('ATOM', oraclesByBrand);

await pushPrices(9.99, 'ATOM', oraclesByBrand, parseInt(round.roundId) + 1);
};

// await setupOracles();
await bankSend(GOV1ADDR, GOV2ADDR, `80000000uist`);

const bidder = await addUser('long-living-bidder');
console.log('BIDDDER', bidder);
await bankSend(GOV1ADDR, bidder, `80000000uist`);
console.log('IST sent');
await provisionSmartWallet(bidder, `20000000ubld,100000000${ATOM_DENOM}`);
console.log('Provision sent');
await waitForBlock(3);
console.log('Wait For Block done. Sending bid offer');
agopsInter(
'bid',
'by-discount',
`--discount 10`,
`--give 80IST`,
'--from',
GOV2ADDR,
'--keyring-backend test',
`--offer-id gov-2-bid-for-acceptance`,
'bid',
'by-price',
`--price 49.0`,
`--give 80IST`,
'--from',
bidder,
'--keyring-backend test',
`--offer-id long-living-bid-for-acceptance`,
);
2 changes: 1 addition & 1 deletion a3p-integration/proposals/n:upgrade-next/use.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e

source /usr/src/upgrade-test-scripts/env_setup.sh

./performAction.js
./performAction.js
Loading

0 comments on commit 65bfdc0

Please sign in to comment.