Skip to content

Commit

Permalink
test: reduce test suit interdependence
Browse files Browse the repository at this point in the history
  • Loading branch information
penovicp committed Dec 6, 2023
1 parent 7e0cffa commit 2954e6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
# TODO - periodically check if conditional services are supported; https://github.com/actions/runner/issues/822
services:
devnet:
image: ${{ inputs.use-rpc-devnet && 'shardlabs/starknet-devnet-rs:d04cbd73800793bcaf09e708a937a5df08987d98-amd-seed0' || inputs.use-seq-devnet && 'shardlabs/starknet-devnet:0.6.3-seed0' || '' }}
image: ${{ inputs.use-rpc-devnet && 'shardlabs/starknet-devnet-rs:0c82d023f35bb77c4b5f4afd885ab14e44b73130-amd-seed0' || inputs.use-seq-devnet && 'shardlabs/starknet-devnet:0.6.3-seed0' || '' }}
# image: ${{ (inputs.use-rpc-devnet || inputs.use-seq-devnet) && 'shardlabs/starknet-devnet:0.6.3-seed0' || '' }}
# image: shardlabs/starknet-devnet-rs:d04cbd73800793bcaf09e708a937a5df08987d98-amd-seed0
# image: shardlabs/starknet-devnet-rs:0c82d023f35bb77c4b5f4afd885ab14e44b73130-amd-seed0
ports:
- 5050:5050

Expand Down
5 changes: 5 additions & 0 deletions __tests__/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export const getTestAccount = (provider: ProviderInterface) => {
);
};

export const createBlockForDevnet = async (): Promise<void> => {
if (!(process.env.IS_RPC_DEVNET === 'true')) return;
await fetch(new URL('/create_block', process.env.TEST_RPC_URL), { method: 'POST' });
};

const describeIf = (condition: boolean) => (condition ? describe : describe.skip);
export const describeIfSequencer = describeIf(process.env.IS_SEQUENCER === 'true');
export const describeIfRpc = describeIf(process.env.IS_RPC === 'true');
Expand Down
2 changes: 2 additions & 0 deletions __tests__/rpcProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
compiledErc20Echo,
compiledL1L2,
compiledOpenZeppelinAccount,
createBlockForDevnet,
describeIfDevnet,
describeIfNotDevnet,
describeIfRpc,
Expand All @@ -27,6 +28,7 @@ describeIfRpc('RPCProvider', () => {
expect(account).toBeInstanceOf(Account);
const accountKeyPair = utils.randomPrivateKey();
accountPublicKey = getStarkKey(accountKeyPair);
await createBlockForDevnet();
});

test('getChainId', async () => {
Expand Down

0 comments on commit 2954e6c

Please sign in to comment.