Skip to content

Commit

Permalink
feat: optimise run time for integration tests (#390)
Browse files Browse the repository at this point in the history
- closes #389
  • Loading branch information
viraj124 authored Feb 24, 2025
1 parent b82c00b commit 9c0a068
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 51 deletions.
6 changes: 6 additions & 0 deletions .changeset/fair-gorillas-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@fuel-bridge/solidity-contracts': minor
'@fuel-bridge/test-utils': minor
---

optimise run time for integration tests"
2 changes: 1 addition & 1 deletion .github/workflows/upgrade-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
working-directory: docker/envs
- name: Run integration tests on a L1 fork after upgrading contracts
run: |
pnpm run test:integration:fork
pnpm run test:integration:fork
7 changes: 1 addition & 6 deletions packages/integration-tests/fork-tests/bridge_erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import type {
Provider,
} from 'fuels';

import { startContainers, stopEnvironment } from '../docker-setup/docker';
import { startContainers } from '../docker-setup/docker';
import { fundWithdrawalTransactionWithBaseAssetResource } from '../utils/utils';

const { expect } = chai;
Expand Down Expand Up @@ -726,9 +726,4 @@ describe('Bridging ERC20 tokens', async function () {
).to.be.true;
});
});

// stopping containers post the test
after(async () => {
await stopEnvironment();
});
});
5 changes: 1 addition & 4 deletions packages/integration-tests/fork-tests/transfer_eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type {
Provider,
} from 'fuels';

import { startContainers, stopEnvironment } from '../docker-setup/docker';
import { stopEnvironment } from '../docker-setup/docker';

const { expect } = chai;

Expand Down Expand Up @@ -133,9 +133,6 @@ describe('Transferring ETH', async function () {
}

before(async () => {
// spinning up all docker containers
await startContainers();

env = await setupEnvironment({});
BASE_ASSET_ID = env.fuel.provider.getBaseAssetId();
});
Expand Down
4 changes: 4 additions & 0 deletions packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
"scripts": {
"test": "pnpm mocha -b -r ts-node/register 'tests/**/*.ts'",
"test-fork": "pnpm mocha -b -r ts-node/register 'fork-tests/**/*.ts'",
"test:fork:erc20": "pnpm mocha -b -r ts-node/register 'fork-tests/bridge_erc20.ts'",
"test:fork:transfer": "pnpm mocha -b -r ts-node/register 'fork-tests/transfer_eth.ts'",
"test:erc20": "pnpm mocha -b -r ts-node/register 'tests/bridge_erc20.ts'",
"test:erc721": "pnpm mocha -b -r ts-node/register 'tests/bridge_erc721.ts'",
"test:transfer": "pnpm mocha -b -r ts-node/register 'tests/transfer_eth.ts'",
"test:bridge_mainnet_tokens": "pnpm mocha -b -r ts-node/register 'tests/bridge_mainnet_tokens.ts'",
"test:bridge_proxy": "pnpm mocha -b -r ts-node/register 'tests/bridge_proxy.ts'",
"depositETH": "pnpm ts-node scripts/depositETH.ts",
"bridgeETH": "pnpm ts-node scripts/bridgeETH.ts",
"bridgeERC20": "pnpm ts-node scripts/bridgeERC20.ts",
Expand Down
7 changes: 1 addition & 6 deletions packages/integration-tests/tests/bridge_erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import type {
MessageProof,
} from 'fuels';

import { startContainers, stopEnvironment } from '../docker-setup/docker';
import { startContainers } from '../docker-setup/docker';
import { fundWithdrawalTransactionWithBaseAssetResource } from '../utils/utils';

const { expect } = chai;
Expand Down Expand Up @@ -880,9 +880,4 @@ describe('Bridging ERC20 tokens', async function () {
).to.be.true;
});
});

// stopping containers post the test
after(async () => {
await stopEnvironment();
});
});
10 changes: 0 additions & 10 deletions packages/integration-tests/tests/bridge_erc721.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import type {
MessageProof,
} from 'fuels';

import { startContainers, stopEnvironment } from '../docker-setup/docker';

const { expect } = chai;

// TODO: develop new version of ERC721 gateway
Expand All @@ -50,9 +48,6 @@ describe.skip('Bridging ERC721 tokens', async function () {
this.timeout(DEFAULT_TIMEOUT_MS);

before(async () => {
// spinning up all docker containers
await startContainers();

env = await setupEnvironment({});
eth_testToken = await getOrDeployERC721Contract(env);
eth_testTokenAddress = (await eth_testToken.getAddress()).toLowerCase();
Expand Down Expand Up @@ -268,9 +263,4 @@ describe.skip('Bridging ERC721 tokens', async function () {
);
});
});

// stopping containers post the test
after(async () => {
await stopEnvironment();
});
});
9 changes: 0 additions & 9 deletions packages/integration-tests/tests/bridge_mainnet_tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import type {
MessageProof,
} from 'fuels';

import { startContainers, stopEnvironment } from '../docker-setup/docker';
import { fundWithdrawalTransactionWithBaseAssetResource } from '../utils/utils';

const { expect } = chai;
Expand Down Expand Up @@ -161,9 +160,6 @@ describe('Bridge mainnet tokens', function () {
}

before(async () => {
// spinning up all docker containers
await startContainers();

env = await setupEnvironment({});
eth_erc20GatewayAddress = (
await env.eth.fuelERC20Gateway.getAddress()
Expand Down Expand Up @@ -741,9 +737,4 @@ describe('Bridge mainnet tokens', function () {
});
});
}

// stopping containers post the test
after(async () => {
await stopEnvironment();
});
});
10 changes: 0 additions & 10 deletions packages/integration-tests/tests/bridge_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { setupEnvironment, getOrDeployL2Bridge } from '@fuel-bridge/test-utils';
import chai from 'chai';
import type { Contract, FuelError } from 'fuels';

import { startContainers, stopEnvironment } from '../docker-setup/docker';

const { expect } = chai;

describe('Proxy', async function () {
Expand All @@ -18,9 +16,6 @@ describe('Proxy', async function () {
let fuel_proxy: Proxy;

before(async () => {
// spinning up all docker containers
await startContainers();

env = await setupEnvironment({});

const { proxy, implementation } = await getOrDeployL2Bridge(
Expand Down Expand Up @@ -182,9 +177,4 @@ describe('Proxy', async function () {
expect(message).contains('NotOwner');
});
});

// stopping containers post the test
after(async () => {
await stopEnvironment();
});
});
5 changes: 1 addition & 4 deletions packages/integration-tests/tests/transfer_eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {
MessageProof,
} from 'fuels';

import { startContainers, stopEnvironment } from '../docker-setup/docker';
import { stopEnvironment } from '../docker-setup/docker';

const { expect } = chai;

Expand Down Expand Up @@ -95,9 +95,6 @@ describe('Transferring ETH', async function () {
}

before(async () => {
// spinning up all docker containers
await startContainers();

env = await setupEnvironment({});
BASE_ASSET_ID = env.fuel.provider.getBaseAssetId();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/src/utils/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,4 @@ export async function setupEnvironment(
signers: [fuel_signer1, fuel_signer2],
},
};
}
}

0 comments on commit 9c0a068

Please sign in to comment.