Skip to content

Commit

Permalink
tests: fix fuel test race condition (#1147)
Browse files Browse the repository at this point in the history
* tests: fix fuel test race condition

* try pausing interest

* fix missing unsub
  • Loading branch information
crispheaney committed Jul 17, 2024
1 parent 7454ad1 commit 391e25a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/fuel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ describe("fuelin'", () => {
'->',
fuelDictRmStake['insuranceFuel'].toNumber()
);

await takerDriftClient.unsubscribe();
await takerDriftClientUser.unsubscribe();
});

it('fuel for perp taker/maker/position', async () => {
Expand Down Expand Up @@ -697,6 +700,8 @@ describe("fuelin'", () => {
assert(!makerDriftClientUser.getOrderByUserOrderId(2).postOnly);

await fillerDriftClient.updateSpotMarketFuel(1, null, null, 100, 200);
// paused cumulative interest to avoid test failing due to race
await fillerDriftClient.updateSpotMarketPausedOperations(1, 1);

await takerDriftClient.placeSpotOrder(
getLimitOrderParams({
Expand Down Expand Up @@ -734,6 +739,8 @@ describe("fuelin'", () => {

bankrunContextWrapper.connection.printTxLogs(fillTx);

await makerDriftClientUser.fetchAccounts();

const makerUSDCAmount = makerDriftClient.getQuoteAssetTokenAmount();
const makerSolAmount = makerDriftClient.getTokenAmount(1);
console.log(makerUSDCAmount.toString(), makerSolAmount.toString());
Expand Down

0 comments on commit 391e25a

Please sign in to comment.