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

test: rename all sim test files to camelCase #6643

Merged
merged 5 commits into from
Apr 8, 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
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"lint:fix": "yarn run lint --fix",
"test:unit": "vitest --run --dir test/unit/",
"test:e2e": "vitest --run --config vitest.e2e.config.ts --dir test/e2e/",
"test:sim:multifork": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/multi_fork.test.ts",
"test:sim:mixedclient": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/mixed_client.test.ts",
"test:sim:multifork": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/multiFork.test.ts",
"test:sim:mixedclient": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/mixedClient.test.ts",
"test:sim:endpoints": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/endpoints.test.ts",
"test:sim:deneb": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/deneb.test.ts",
"test:sim:backup_eth_provider": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/backup_eth_provider.test.ts",
"test:sim:backup_eth_provider": "LODESTAR_PRESET=minimal DOTENV_CONFIG_PATH=../../.env.test node -r dotenv/config --loader ts-node/esm test/sim/backupEthProvider.test.ts",
"test": "yarn test:unit && yarn test:e2e",
"check-readme": "typescript-docs-verifier"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/scripts/e2e_test_env.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import path from "node:path";
import {BeaconClient, ExecutionClient} from "../utils/simulation/interfaces.js";
import {SimulationEnvironment} from "../utils/simulation/SimulationEnvironment.js";
import {SimulationEnvironment} from "../utils/simulation/simulationEnvironment.js";
import {defineSimTestConfig, logFilesDir} from "../utils/simulation/utils/index.js";
import {connectAllNodes} from "../utils/simulation/utils/network.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import path from "node:path";
import {activePreset} from "@lodestar/params";
import {SimulationEnvironment} from "../utils/simulation/SimulationEnvironment.js";
import {SimulationEnvironment} from "../utils/simulation/simulationEnvironment.js";
import {nodeAssertion} from "../utils/simulation/assertions/nodeAssertion.js";
import {AssertionMatch, BeaconClient, ExecutionClient} from "../utils/simulation/interfaces.js";
import {defineSimTestConfig, logFilesDir, replaceIpFromUrl} from "../utils/simulation/utils/index.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/sim/deneb.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import path from "node:path";
import {activePreset} from "@lodestar/params";
import {SimulationEnvironment} from "../utils/simulation/SimulationEnvironment.js";
import {SimulationEnvironment} from "../utils/simulation/simulationEnvironment.js";
import {nodeAssertion} from "../utils/simulation/assertions/nodeAssertion.js";
import {AssertionMatch, BeaconClient, ExecutionClient} from "../utils/simulation/interfaces.js";
import {defineSimTestConfig, logFilesDir} from "../utils/simulation/utils/index.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/sim/endpoints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from "node:path";
import assert from "node:assert";
import {toHexString} from "@chainsafe/ssz";
import {ApiError, routes} from "@lodestar/api";
import {SimulationEnvironment} from "../utils/simulation/SimulationEnvironment.js";
import {SimulationEnvironment} from "../utils/simulation/simulationEnvironment.js";
import {BeaconClient, ExecutionClient} from "../utils/simulation/interfaces.js";
import {defineSimTestConfig, logFilesDir} from "../utils/simulation/utils/index.js";
import {waitForSlot} from "../utils/simulation/utils/network.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import path from "node:path";
import {SimulationEnvironment} from "../utils/simulation/SimulationEnvironment.js";
import {SimulationEnvironment} from "../utils/simulation/simulationEnvironment.js";
import {nodeAssertion} from "../utils/simulation/assertions/nodeAssertion.js";
import {AssertionMatch, BeaconClient, ExecutionClient, ValidatorClient} from "../utils/simulation/interfaces.js";
import {defineSimTestConfig, logFilesDir} from "../utils/simulation/utils/index.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import path from "node:path";
import {AssertionMatch, BeaconClient, ExecutionClient, ValidatorClient} from "../utils/simulation/interfaces.js";
import {SimulationEnvironment} from "../utils/simulation/SimulationEnvironment.js";
import {SimulationEnvironment} from "../utils/simulation/simulationEnvironment.js";
import {defineSimTestConfig, logFilesDir} from "../utils/simulation/utils/index.js";
import {connectAllNodes, waitForSlot} from "../utils/simulation/utils/network.js";
import {nodeAssertion} from "../utils/simulation/assertions/nodeAssertion.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {writeFile} from "node:fs/promises";
import {BeaconStateAllForks} from "@lodestar/state-transition";
import {EL_ENGINE_BASE_PORT, SHARED_JWT_SECRET} from "../constants.js";
import {AtLeast, BeaconClient, BeaconGeneratorOptions, BeaconNode} from "../interfaces.js";
import {makeUniqueArray} from "../utils/index.js";
import {ensureDirectories} from "../utils/paths.js";
import {EL_ENGINE_BASE_PORT, SHARED_JWT_SECRET} from "../../constants.js";
import {AtLeast, BeaconClient, BeaconGeneratorOptions, BeaconNode} from "../../interfaces.js";
import {makeUniqueArray} from "../../utils/index.js";
import {ensureDirectories} from "../../utils/paths.js";
import {generateLighthouseBeaconNode} from "./lighthouse.js";
import {generateLodestarBeaconNode} from "./lodestar.js";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import yaml from "js-yaml";
import {HttpClient} from "@lodestar/api";
import {getClient} from "@lodestar/api/beacon";
import {chainConfigToJson} from "@lodestar/config";
import {BeaconClient, BeaconNodeGenerator, LighthouseAPI, RunnerType} from "../interfaces.js";
import {getNodeMountedPaths} from "../utils/paths.js";
import {getNodePorts} from "../utils/ports.js";
import {BeaconClient, BeaconNodeGenerator, LighthouseAPI, RunnerType} from "../../interfaces.js";
import {getNodeMountedPaths} from "../../utils/paths.js";
import {getNodePorts} from "../../utils/ports.js";

export const generateLighthouseBeaconNode: BeaconNodeGenerator<BeaconClient.Lighthouse> = (opts, runner) => {
if (!process.env.LIGHTHOUSE_BINARY_PATH && !process.env.LIGHTHOUSE_DOCKER_IMAGE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import got from "got";
import {getClient} from "@lodestar/api/beacon";
import {chainConfigToJson} from "@lodestar/config";
import {LogLevel} from "@lodestar/utils";
import {BeaconArgs} from "../../../../src/cmds/beacon/options.js";
import {GlobalArgs} from "../../../../src/options/globalOptions.js";
import {LODESTAR_BINARY_PATH} from "../constants.js";
import {BeaconClient, BeaconNodeGenerator, RunnerType} from "../interfaces.js";
import {getNodePorts} from "../utils/ports.js";
import {BeaconArgs} from "../../../../../src/cmds/beacon/options.js";
import {GlobalArgs} from "../../../../../src/options/globalOptions.js";
import {LODESTAR_BINARY_PATH} from "../../constants.js";
import {BeaconClient, BeaconNodeGenerator, RunnerType} from "../../interfaces.js";
import {getNodePorts} from "../../utils/ports.js";

export const generateLodestarBeaconNode: BeaconNodeGenerator<BeaconClient.Lodestar> = (opts, runner) => {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
EL_GENESIS_SECRET_KEY,
SHARED_JWT_SECRET,
SIM_ENV_NETWORK_ID,
} from "../constants.js";
import {Eth1ProviderWithAdmin} from "../Eth1ProviderWithAdmin.js";
import {ExecutionClient, ExecutionNodeGenerator, ExecutionStartMode, JobOptions, RunnerType} from "../interfaces.js";
import {getNodeMountedPaths} from "../utils/paths.js";
import {getNodePorts} from "../utils/ports.js";
} from "../../constants.js";
import {Eth1ProviderWithAdmin} from "../../eth1ProviderWithAdmin.js";
import {ExecutionClient, ExecutionNodeGenerator, ExecutionStartMode, JobOptions, RunnerType} from "../../interfaces.js";
import {getNodeMountedPaths} from "../../utils/paths.js";
import {getNodePorts} from "../../utils/ports.js";

export const generateGethNode: ExecutionNodeGenerator<ExecutionClient.Geth> = (opts, runner) => {
if (!process.env.GETH_BINARY_DIR && !process.env.GETH_DOCKER_IMAGE) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {writeFile} from "node:fs/promises";
import {SHARED_JWT_SECRET, CLIQUE_SEALING_PERIOD} from "../constants.js";
import {SHARED_JWT_SECRET, CLIQUE_SEALING_PERIOD} from "../../constants.js";
import {
AtLeast,
ExecutionClient,
ExecutionGeneratorOptions,
ExecutionGenesisOptions,
ExecutionNode,
ExecutionStartMode,
} from "../interfaces.js";
import {getEstimatedForkTime} from "../utils/index.js";
import {getGethGenesisBlock} from "../utils/execution_genesis.js";
import {ensureDirectories} from "../utils/paths.js";
} from "../../interfaces.js";
import {getEstimatedForkTime} from "../../utils/index.js";
import {getGethGenesisBlock} from "../../utils/executionGenesis.js";
import {ensureDirectories} from "../../utils/paths.js";
import {generateGethNode} from "./geth.js";
import {generateMockNode} from "./mock.js";
import {generateNethermindNode} from "./nethermind.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {SHARED_JWT_SECRET} from "../constants.js";
import {ExecutionClient, ExecutionNodeGenerator} from "../interfaces.js";
import {getNodePorts} from "../utils/ports.js";
import {SHARED_JWT_SECRET} from "../../constants.js";
import {ExecutionClient, ExecutionNodeGenerator} from "../../interfaces.js";
import {getNodePorts} from "../../utils/ports.js";

export const generateMockNode: ExecutionNodeGenerator<ExecutionClient.Mock> = (opts, runner) => {
const {id, ttd, nodeIndex} = opts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {writeFile} from "node:fs/promises";
import path from "node:path";
import got from "got";
import {ZERO_HASH} from "@lodestar/state-transition";
import {Eth1ProviderWithAdmin} from "../Eth1ProviderWithAdmin.js";
import {ExecutionClient, ExecutionNodeGenerator, JobOptions, RunnerType} from "../interfaces.js";
import {getNethermindChainSpec} from "../utils/execution_genesis.js";
import {getNodeMountedPaths} from "../utils/paths.js";
import {SHARED_JWT_SECRET} from "../constants.js";
import {getNodePorts} from "../utils/ports.js";
import {Eth1ProviderWithAdmin} from "../../eth1ProviderWithAdmin.js";
import {ExecutionClient, ExecutionNodeGenerator, JobOptions, RunnerType} from "../../interfaces.js";
import {getNethermindChainSpec} from "../../utils/executionGenesis.js";
import {getNodeMountedPaths} from "../../utils/paths.js";
import {SHARED_JWT_SECRET} from "../../constants.js";
import {getNodePorts} from "../../utils/ports.js";

export const generateNethermindNode: ExecutionNodeGenerator<ExecutionClient.Nethermind> = (opts, runner) => {
if (!process.env.NETHERMIND_DOCKER_IMAGE) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {writeFile} from "node:fs/promises";
import {SHARED_JWT_SECRET, SHARED_VALIDATOR_PASSWORD, BN_REST_BASE_PORT} from "../constants.js";
import {AtLeast, BeaconClient, ValidatorClient, ValidatorGeneratorOptions, ValidatorNode} from "../interfaces.js";
import {makeUniqueArray} from "../utils/index.js";
import {createKeystores} from "../utils/keys.js";
import {ensureDirectories} from "../utils/paths.js";
import {SHARED_JWT_SECRET, SHARED_VALIDATOR_PASSWORD, BN_REST_BASE_PORT} from "../../constants.js";
import {AtLeast, BeaconClient, ValidatorClient, ValidatorGeneratorOptions, ValidatorNode} from "../../interfaces.js";
import {makeUniqueArray} from "../../utils/index.js";
import {createKeystores} from "../../utils/keys.js";
import {ensureDirectories} from "../../utils/paths.js";
import {generateLodestarValidatorNode} from "./lodestar.js";
import {generateLighthouseValidatorNode} from "./lighthouse.js";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import got, {RequestError} from "got";
import yaml from "js-yaml";
import {getClient as keyManagerGetClient} from "@lodestar/api/keymanager";
import {chainConfigToJson} from "@lodestar/config";
import {RunnerType, ValidatorClient, ValidatorNodeGenerator} from "../interfaces.js";
import {updateKeystoresPath} from "../utils/keys.js";
import {getNodeMountedPaths} from "../utils/paths.js";
import {getNodePorts} from "../utils/ports.js";
import {RunnerType, ValidatorClient, ValidatorNodeGenerator} from "../../interfaces.js";
import {updateKeystoresPath} from "../../utils/keys.js";
import {getNodeMountedPaths} from "../../utils/paths.js";
import {getNodePorts} from "../../utils/ports.js";

export const generateLighthouseValidatorNode: ValidatorNodeGenerator<ValidatorClient.Lighthouse> = (opts, runner) => {
if (!process.env.LIGHTHOUSE_BINARY_PATH && !process.env.LIGHTHOUSE_DOCKER_IMAGE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {getClient as keyManagerGetClient} from "@lodestar/api/keymanager";
import {chainConfigToJson} from "@lodestar/config";
import {LogLevel} from "@lodestar/utils";
import {defaultOptions} from "@lodestar/validator";
import {IValidatorCliArgs} from "../../../../src/cmds/validator/options.js";
import {GlobalArgs} from "../../../../src/options/globalOptions.js";
import {LODESTAR_BINARY_PATH} from "../constants.js";
import {RunnerType, ValidatorClient, ValidatorNodeGenerator} from "../interfaces.js";
import {getNodePorts} from "../utils/ports.js";
import {IValidatorCliArgs} from "../../../../../src/cmds/validator/options.js";
import {GlobalArgs} from "../../../../../src/options/globalOptions.js";
import {LODESTAR_BINARY_PATH} from "../../constants.js";
import {RunnerType, ValidatorClient, ValidatorNodeGenerator} from "../../interfaces.js";
import {getNodePorts} from "../../utils/ports.js";

export const generateLodestarValidatorNode: ValidatorNodeGenerator<ValidatorClient.Lodestar> = (opts, runner) => {
const {paths, id, keys, forkConfig, genesisTime, nodeIndex, beaconUrls, clientOptions} = opts;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/utils/simulation/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {Logger} from "@lodestar/logger";
import {BeaconArgs} from "../../../src/cmds/beacon/options.js";
import {IValidatorCliArgs} from "../../../src/cmds/validator/options.js";
import {GlobalArgs} from "../../../src/options/index.js";
import {EpochClock} from "./EpochClock.js";
import {Eth1ProviderWithAdmin} from "./Eth1ProviderWithAdmin.js";
import {EpochClock} from "./epochClock.js";
import {Eth1ProviderWithAdmin} from "./eth1ProviderWithAdmin.js";

export type NodeId = string;

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/utils/simulation/runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {EventEmitter} from "node:events";
import path from "node:path";
import {Logger} from "@lodestar/logger";
import {IRunner, Job, JobOptions, RunnerEvent, RunnerType} from "../interfaces.js";
import {ChildProcessRunner} from "./ChildProcessRunner.js";
import {DockerRunner} from "./DockerRunner.js";
import {ChildProcessRunner} from "./childProcessRunner.js";
import {DockerRunner} from "./dockerRunner.js";

export class Runner implements IRunner {
readonly logger: Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {BeaconStateAllForks, interopSecretKey} from "@lodestar/state-transition"
import {prettyMsToTime} from "@lodestar/utils";
import {LogLevel, TimestampFormatCode} from "@lodestar/logger";
import {getNodeLogger, LoggerNode} from "@lodestar/logger/node";
import {EpochClock, MS_IN_SEC} from "./EpochClock.js";
import {ExternalSignerServer} from "./ExternalSignerServer.js";
import {SimulationTracker} from "./SimulationTracker.js";
import {createBeaconNode} from "./beacon_clients/index.js";
import {createValidatorNode, getValidatorForBeaconNode} from "./validator_clients/index.js";
import {EpochClock, MS_IN_SEC} from "./epochClock.js";
import {ExternalSignerServer} from "./externalSignerServer.js";
import {SimulationTracker} from "./simulationTracker.js";
import {createBeaconNode} from "./clients/beacon/index.js";
import {createValidatorNode, getValidatorForBeaconNode} from "./clients/validator/index.js";
import {MOCK_ETH1_GENESIS_HASH} from "./constants.js";
import {createExecutionNode} from "./execution_clients/index.js";
import {createExecutionNode} from "./clients/execution/index.js";
import {
BeaconClient,
ValidatorClientKeys,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {ChainForkConfig} from "@lodestar/config";
import {Epoch, Slot} from "@lodestar/types";
import {LoggerNode} from "@lodestar/logger/node";
import {isNullish} from "../../utils.js";
import {EpochClock} from "./EpochClock.js";
import {EpochClock} from "./epochClock.js";
import {
AssertionMatch,
AtLeast,
Expand All @@ -20,7 +20,7 @@ import {
StoreTypes,
} from "./interfaces.js";
import {defaultAssertions} from "./assertions/defaults/index.js";
import {TableReporter} from "./TableReporter.js";
import {TableReporter} from "./tableReporter.js";
import {fetchBlock} from "./utils/network.js";

const debug = createDebug("lodestar:sim:tracker");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {isNullish} from "../../utils.js";
import {HeadSummary} from "./assertions/defaults/headAssertion.js";
import {defaultAssertions} from "./assertions/defaults/index.js";
import {SimulationReporter} from "./interfaces.js";
import {TableRenderer} from "./TableRenderer.js";
import {TableRenderer} from "./tableRenderer.js";
import {arrayGroupBy, avg, isSingletonArray} from "./utils/index.js";

export class TableReporter extends SimulationReporter<typeof defaultAssertions> {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/utils/simulation/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SIM_ENV_NETWORK_ID,
SIM_TESTS_SECONDS_PER_SLOT,
} from "../constants.js";
import {SimulationEnvironment} from "../SimulationEnvironment.js";
import {SimulationEnvironment} from "../simulationEnvironment.js";

export const logFilesDir = "test-logs";

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/utils/simulation/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {ApiError} from "@lodestar/api";
import {Slot, allForks} from "@lodestar/types";
import {sleep} from "@lodestar/utils";
import {BeaconClient, BeaconNode, ExecutionClient, ExecutionNode, NodePair} from "../interfaces.js";
import {SimulationEnvironment} from "../SimulationEnvironment.js";
import {SimulationTrackerEvent} from "../SimulationTracker.js";
import {SimulationEnvironment} from "../simulationEnvironment.js";
import {SimulationTrackerEvent} from "../simulationTracker.js";

export async function connectAllNodes(nodes: NodePair[]): Promise<void> {
for (const node of nodes) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/utils/simulation/utils/syncing.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {ApiError, routes} from "@lodestar/api";
import {Slot} from "@lodestar/types";
import {sleep, toHex} from "@lodestar/utils";
import type {SimulationEnvironment} from "../SimulationEnvironment.js";
import type {SimulationEnvironment} from "../simulationEnvironment.js";
import {BeaconClient, ExecutionClient, NodePair} from "../interfaces.js";
import {connectNewCLNode, connectNewELNode, connectNewNode, waitForHead, waitForSlot} from "./network.js";

Expand Down
Loading