Skip to content

Commit

Permalink
chore(tests): Increase nodes startup time threshold in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skambalin committed Sep 12, 2024
1 parent 4049642 commit 2c8bafc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions tests/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export const DDC_BLOCK_SIZE = 16 * 1024;
export const ROOT_USER_SEED = 'hybrid label reunion only dawn maze asset draft cousin height flock nation';
export const ROOT_ACCOUNT_TYPE = 'sr25519';
export const BLOCKCHAIN_MAX_BLOCK_WEIGHT = 2_000_000_000_000;
export const STORAGE_NODE_MAX_STARTUP_TIME = 60_000;
export const BLOCKCHAIN_NODE_MAX_STARTUP_TIME = 30_000;
8 changes: 6 additions & 2 deletions tests/setup/environment/blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as path from 'path';
import * as fs from 'fs';
import { DockerComposeEnvironment, StartedDockerComposeEnvironment, Wait } from 'testcontainers';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import { Blockchain, ClusterId, ClusterNodeKind } from '@cere-ddc-sdk/blockchain';

import {
createBlockhainApi,
Expand All @@ -14,8 +15,8 @@ import {
BLOCKCHAIN_RPC_URL,
getHostIP,
getStorageNodes,
BLOCKCHAIN_NODE_MAX_STARTUP_TIME,
} from '../../helpers';
import { Blockchain, ClusterId, ClusterNodeKind } from '@cere-ddc-sdk/blockchain';

export type BlockchainConfig = BlockchainState & {
apiUrl: string;
Expand Down Expand Up @@ -49,7 +50,10 @@ export const startBlockchain = async (): Promise<BlockchainConfig> => {
.withEnvironment({
BC_CAHCHE_DIR: bcCachePath,
})
.withWaitStrategy('cere-chain', Wait.forLogMessage(/Running JSON-RPC server/gi))
.withWaitStrategy(
'cere-chain',
Wait.forLogMessage(/Running JSON-RPC server/gi).withStartupTimeout(BLOCKCHAIN_NODE_MAX_STARTUP_TIME),
)
.up();

const blockchainState: BlockchainState = !process.env.CI && chachedState ? chachedState : await setupBlockchain();
Expand Down
5 changes: 3 additions & 2 deletions tests/setup/environment/ddc.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { DockerComposeEnvironment, StartedDockerComposeEnvironment, Wait } from 'testcontainers';
import type { BlockchainConfig } from './blockchain';
import { getHostIP } from '../../helpers';
import { getHostIP, STORAGE_NODE_MAX_STARTUP_TIME } from '../../helpers';

let environment: StartedDockerComposeEnvironment | undefined;

const uuid = { nextUuid: () => 'ddc' };
const waitStrategy = () => Wait.forLogMessage(/Start GRPC server on port \d+/).withStartupTimeout(10000);
const waitStrategy = () =>
Wait.forLogMessage(/Start GRPC server on port \d+/).withStartupTimeout(STORAGE_NODE_MAX_STARTUP_TIME);

export const startDDC = async (bc: BlockchainConfig) => {
console.group('DDC');
Expand Down

0 comments on commit 2c8bafc

Please sign in to comment.