Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): Increase nodes startup time threshold in tests #266

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading