Skip to content

Commit

Permalink
chore(test): additional fix to avoid protocol balance race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Feb 21, 2025
1 parent d478824 commit d819d18
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/monitor/monitor.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('setup', () => {
let records;
let vaults;
let supplyData;
let protocolBalance;

before(async () => {
compose = await new DockerComposeEnvironment(
Expand All @@ -42,6 +43,9 @@ describe('setup', () => {
.up();

// fetch all these at the beginning to avoid race conditions
protocolBalance = await io.getBalance({
address: processId,
});
supplyData = await io.getTokenSupply();
balances = await getBalances();
gateways = await getGateways();
Expand Down Expand Up @@ -333,10 +337,6 @@ describe('setup', () => {
`Delegated supply is undefined: ${supplyData.delegated}`,
);

const protocolBalance = await io.getBalance({
address: processId,
});

assert(
protocolBalance === supplyData.protocolBalance,
`Protocol balance is not equal to the balance provided by the contract: ${protocolBalance} !== ${supplyData.protocolBalance}`,
Expand Down

0 comments on commit d819d18

Please sign in to comment.