diff --git a/README.md b/README.md index 7d4ce6738..5e80e2856 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ An opinionated CLI tool to deploy and manage standalone test networks. ### Hardware Requirements -To run a three-node network, you will need to set up Docker Desktop with at least 8GB of memory and 4 CPUs. +To run a three-node network, you will need to set up Docker Desktop with at least 8GB of memory and 4 CPUs. ![alt text](/docs/content/User/DockerDesktop.png) diff --git a/docs/content/User/Env.md b/docs/content/User/Env.md index 8a6b5f35e..65ea18411 100644 --- a/docs/content/User/Env.md +++ b/docs/content/User/Env.md @@ -35,10 +35,3 @@ User can configure the following environment variables to customize the behavior | `RELAY_PODS_READY_MAX_ATTEMPTS` | The maximum number of attempts to check if relay pods are ready. | `100` | | `RELAY_PODS_READY_DELAY` | The interval between attempts to check if relay pods are ready, in the unit of milliseconds. | `120` | | `NETWORK_DESTROY_WAIT_TIMEOUT` | The period of time to wait for network to be destroyed, in the unit of milliseconds. | `60000` | - - - - - - - diff --git a/docs/content/User/FAQ.md b/docs/content/User/FAQ.md index d10869d58..9824d48f1 100644 --- a/docs/content/User/FAQ.md +++ b/docs/content/User/FAQ.md @@ -4,11 +4,12 @@ You can run `solo account init` anytime after `solo node start` ### Where can I find the default account keys ? -It is the well known default genesis key [Link](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/data/onboard/GenesisPrivKey.txt) +It is the well known default genesis key [Link](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/data/onboard/GenesisPrivKey.txt) ### How do I get the key for an account? Use the following command to get account balance and private key of the account `0.0.1007`: + ```bash # get account info of 0.0.1007 and also show the private key solo account get --account-id 0.0.1007 -n solo-e2e --private-key diff --git a/docs/content/User/GetStarted.md b/docs/content/User/GetStarted.md index 297936e07..90ef4926a 100644 --- a/docs/content/User/GetStarted.md +++ b/docs/content/User/GetStarted.md @@ -21,6 +21,7 @@ For Hedera extended users: * [Using Environment Variables](Env.md) FAQ: + * [Frequently Asked Questions](FAQ.md) For curious mind: diff --git a/eslint.config.mjs b/eslint.config.mjs index 33b92c046..34e6011a2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -147,13 +147,6 @@ export default [ '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/ban-types': 'off', '@typescript-eslint/camelcase': 'off', - '@typescript-eslint/consistent-type-imports': [ - // optional: assists in reducing circular dependencies - 'error', - { - fixStyle: 'inline-type-imports', - }, - ], '@typescript-eslint/no-explicit-any': 'warn', // TODO remove (771 errors) '@typescript-eslint/no-this-alias': [ 'error', diff --git a/src/commands/base.ts b/src/commands/base.ts index 6543950cc..3b08fc669 100644 --- a/src/commands/base.ts +++ b/src/commands/base.ts @@ -31,7 +31,6 @@ import {type CommandFlag} from '../types/flag_types.js'; import {type Lease} from '../core/lease/lease.js'; import {Listr} from 'listr2'; import path from 'path'; -import {container, injectable} from "tsyringe-neo"; export interface CommandHandlers { parent: BaseCommand; diff --git a/src/core/account_manager.ts b/src/core/account_manager.ts index 5fd6a14d9..9ddf512b7 100644 --- a/src/core/account_manager.ts +++ b/src/core/account_manager.ts @@ -47,7 +47,7 @@ import {K8} from './k8.js'; import {type AccountIdWithKeyPairObject, type ExtendedNetServer} from '../types/index.js'; import {type NodeAlias, type PodName} from '../types/aliases.js'; import {IGNORED_NODE_ACCOUNT_ID} from './constants.js'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; const REASON_FAILED_TO_GET_KEYS = 'failed to get keys for accountId'; const REASON_SKIPPED = 'skipped since it does not have a genesis key'; diff --git a/src/core/certificate_manager.ts b/src/core/certificate_manager.ts index 773cd9cc9..e3e0e457d 100644 --- a/src/core/certificate_manager.ts +++ b/src/core/certificate_manager.ts @@ -25,7 +25,7 @@ import {K8} from './k8.js'; import {SoloLogger} from './logging.js'; import type {ListrTaskWrapper} from 'listr2'; import type {NodeAlias} from '../types/aliases.js'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; /** * Used to handle interactions with certificates data and inject it into the K8s cluster secrets diff --git a/src/core/chart_manager.ts b/src/core/chart_manager.ts index 42e6616be..191435eb1 100644 --- a/src/core/chart_manager.ts +++ b/src/core/chart_manager.ts @@ -19,7 +19,7 @@ import {Helm} from './helm.js'; import chalk from 'chalk'; import {SoloError} from './errors.js'; import {SoloLogger} from './logging.js'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; @autoInjectable() export class ChartManager { diff --git a/src/core/config/local_config.ts b/src/core/config/local_config.ts index f9d263c63..fd56818e3 100644 --- a/src/core/config/local_config.ts +++ b/src/core/config/local_config.ts @@ -27,7 +27,7 @@ import {ConfigManager} from '../config_manager.js'; import type {EmailAddress, Namespace} from './remote/types.js'; import {Templates} from '../templates.js'; import {ErrorMessages} from '../error_messages.js'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; @autoInjectable() export class LocalConfig implements LocalConfigData { diff --git a/src/core/config/remote/remote_config_manager.ts b/src/core/config/remote/remote_config_manager.ts index 6633ef35d..a1f9f673c 100644 --- a/src/core/config/remote/remote_config_manager.ts +++ b/src/core/config/remote/remote_config_manager.ts @@ -33,7 +33,7 @@ import {type ContextClusterStructure} from '../../../types/config_types.js'; import {type EmptyContextConfig, type Optional, type SoloListrTask} from '../../../types/index.js'; import type * as k8s from '@kubernetes/client-node'; import {StatusCodes} from 'http-status-codes'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; interface ListrContext { config: {contextCluster: ContextClusterStructure}; diff --git a/src/core/config_manager.ts b/src/core/config_manager.ts index a0c33bd11..4fe075db9 100644 --- a/src/core/config_manager.ts +++ b/src/core/config_manager.ts @@ -11,10 +11,10 @@ * distributed under the License is distributed on an ""AS IS"" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the Licen}se. + * limitations under the License. * */ -import {SoloError, MissingArgumentError, IllegalArgumentError} from './errors.js'; +import {SoloError, MissingArgumentError} from './errors.js'; import {SoloLogger} from './logging.js'; import {Flags, Flags as flags} from '../commands/flags.js'; import * as paths from 'path'; @@ -22,7 +22,7 @@ import * as helpers from './helpers.js'; import type * as yargs from 'yargs'; import {type CommandFlag} from '../types/flag_types.js'; import {type ListrTaskWrapper} from 'listr2'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; /** * ConfigManager cache command flag values so that user doesn't need to enter the same values repeatedly. diff --git a/src/core/container_init.ts b/src/core/container_init.ts index 3bdb65a40..9aaaa880a 100644 --- a/src/core/container_init.ts +++ b/src/core/container_init.ts @@ -1,24 +1,39 @@ -import {container} from "tsyringe-neo"; -import {SoloLogger} from "./logging.js"; -import {PackageDownloader} from "./package_downloader.js"; -import {Zippy} from "./zippy.js"; -import {DependencyManager, HelmDependencyManager} from "./dependency_managers/index.js"; -import * as constants from "./constants.js"; -import {Helm} from "./helm.js"; -import {ChartManager} from "./chart_manager.js"; -import {ConfigManager} from "./config_manager.js"; -import {K8} from "./k8.js"; -import {AccountManager} from "./account_manager.js"; -import {PlatformInstaller} from "./platform_installer.js"; -import {KeyManager} from "./key_manager.js"; -import {ProfileManager} from "./profile_manager.js"; -import type {LeaseRenewalService} from "./lease/lease.js"; -import {IntervalLeaseRenewalService} from "./lease/interval_lease_renewal.js"; -import {LeaseManager} from "./lease/lease_manager.js"; -import {CertificateManager} from "./certificate_manager.js"; -import path from "path"; -import {LocalConfig} from "./config/local_config.js"; -import {RemoteConfigManager} from "./config/remote/remote_config_manager.js"; +/** + * Copyright (C) 2024 Hedera Hashgraph, LLC + * + * Licensed under the Apache License, Version 2.0 (the ""License""); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an ""AS IS"" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +import {container} from 'tsyringe-neo'; +import {SoloLogger} from './logging.js'; +import {PackageDownloader} from './package_downloader.js'; +import {Zippy} from './zippy.js'; +import {DependencyManager, HelmDependencyManager} from './dependency_managers/index.js'; +import * as constants from './constants.js'; +import {Helm} from './helm.js'; +import {ChartManager} from './chart_manager.js'; +import {ConfigManager} from './config_manager.js'; +import {K8} from './k8.js'; +import {AccountManager} from './account_manager.js'; +import {PlatformInstaller} from './platform_installer.js'; +import {KeyManager} from './key_manager.js'; +import {ProfileManager} from './profile_manager.js'; +import {IntervalLeaseRenewalService} from './lease/interval_lease_renewal.js'; +import {LeaseManager} from './lease/lease_manager.js'; +import {CertificateManager} from './certificate_manager.js'; +import path from 'path'; +import {LocalConfig} from './config/local_config.js'; +import {RemoteConfigManager} from './config/remote/remote_config_manager.js'; container.register(SoloLogger, {useValue: new SoloLogger('debug', false)}); container.register(PackageDownloader, {useValue: new PackageDownloader()}); @@ -33,11 +48,13 @@ container.register(AccountManager, {useValue: new AccountManager container.register(PlatformInstaller, {useValue: new PlatformInstaller()}); container.register(KeyManager, {useValue: new KeyManager()}); container.register(ProfileManager, {useValue: new ProfileManager()}); -container.register(IntervalLeaseRenewalService, {useValue: new IntervalLeaseRenewalService()}); -container.register(LeaseManager, {useValue: new LeaseManager(container.resolve(IntervalLeaseRenewalService))}); +container.register(IntervalLeaseRenewalService, { + useValue: new IntervalLeaseRenewalService(), +}); +container.register(LeaseManager, { + useValue: new LeaseManager(container.resolve(IntervalLeaseRenewalService)), +}); container.register(CertificateManager, {useValue: new CertificateManager()}); - const localConfigPath = path.join(constants.SOLO_CACHE_DIR, constants.DEFAULT_LOCAL_CONFIG_FILE); container.register(LocalConfig, {useValue: new LocalConfig(localConfigPath)}); - -const remoteConfigManager = container.resolve(RemoteConfigManager); +container.register(RemoteConfigManager, {useValue: new RemoteConfigManager()}); diff --git a/src/core/dependency_managers/dependency_manager.ts b/src/core/dependency_managers/dependency_manager.ts index 48cad96f4..fc69e3208 100644 --- a/src/core/dependency_managers/dependency_manager.ts +++ b/src/core/dependency_managers/dependency_manager.ts @@ -19,8 +19,8 @@ import {SoloError} from '../errors.js'; import {ShellRunner} from '../shell_runner.js'; import {HelmDependencyManager} from './helm_dependency_manager.js'; import {type ListrTask} from 'listr2'; -import {autoInjectable} from "tsyringe-neo"; -import * as constants from "../constants.js"; +import {autoInjectable} from 'tsyringe-neo'; +import * as constants from '../constants.js'; @autoInjectable() export class DependencyManager extends ShellRunner { diff --git a/src/core/dependency_managers/helm_dependency_manager.ts b/src/core/dependency_managers/helm_dependency_manager.ts index 92f76fcd3..1f5c56fc9 100644 --- a/src/core/dependency_managers/helm_dependency_manager.ts +++ b/src/core/dependency_managers/helm_dependency_manager.ts @@ -18,7 +18,7 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; import * as util from 'util'; -import {IllegalArgumentError, MissingArgumentError} from '../errors.js'; +import {MissingArgumentError} from '../errors.js'; import * as helpers from '../helpers.js'; import * as constants from '../constants.js'; import {PackageDownloader} from '../package_downloader.js'; @@ -28,8 +28,7 @@ import * as version from '../../../version.js'; import {ShellRunner} from '../shell_runner.js'; import * as semver from 'semver'; import {OS_WIN32, OS_WINDOWS} from '../constants.js'; -import {type SoloLogger} from '../logging.js'; -import {autoInjectable, container, singleton} from "tsyringe-neo"; +import {container, singleton} from 'tsyringe-neo'; // constants required by HelmDependencyManager const HELM_RELEASE_BASE_URL = 'https://get.helm.sh'; diff --git a/src/core/helm.ts b/src/core/helm.ts index 33bf885af..b986e2bfc 100644 --- a/src/core/helm.ts +++ b/src/core/helm.ts @@ -18,15 +18,13 @@ import os from 'os'; import * as constants from './constants.js'; import {ShellRunner} from './shell_runner.js'; import {Templates} from './templates.js'; -import {singleton} from "tsyringe-neo"; +import {singleton} from 'tsyringe-neo'; @singleton() export class Helm extends ShellRunner { private readonly helmPath: string; - constructor( - private readonly osPlatform: NodeJS.Platform = os.platform(), - ) { + constructor(private readonly osPlatform: NodeJS.Platform = os.platform()) { super(); this.helmPath = Templates.installationPath(constants.HELM, this.osPlatform); } diff --git a/src/core/k8.ts b/src/core/k8.ts index 3676fa558..2f1739782 100644 --- a/src/core/k8.ts +++ b/src/core/k8.ts @@ -37,7 +37,7 @@ import {type PodName, type TarCreateFilter} from '../types/aliases.js'; import type {ExtendedNetServer, LocalContextObject} from '../types/index.js'; import {HEDERA_HAPI_PATH, ROOT_CONTAINER, SOLO_LOGS_DIR} from './constants.js'; import {Duration} from './time/duration.js'; -import {autoInjectable, container} from "tsyringe-neo"; +import {autoInjectable, container} from 'tsyringe-neo'; interface TDirectoryData { directory: boolean; diff --git a/src/core/key_manager.ts b/src/core/key_manager.ts index e0561e0fa..2be8a0921 100644 --- a/src/core/key_manager.ts +++ b/src/core/key_manager.ts @@ -27,7 +27,7 @@ import chalk from 'chalk'; import {type NodeAlias, type NodeAliases} from '../types/aliases.js'; import {type NodeKeyObject, type PrivateKeyAndCertificateObject} from '../types/index.js'; import type {ListrTask} from 'listr2'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; // @ts-ignore x509.cryptoProvider.set(crypto); diff --git a/src/core/lease/interval_lease_renewal.ts b/src/core/lease/interval_lease_renewal.ts index 9dc2d01f2..23c63c147 100644 --- a/src/core/lease/interval_lease_renewal.ts +++ b/src/core/lease/interval_lease_renewal.ts @@ -16,7 +16,7 @@ */ import {type Lease, type LeaseRenewalService} from './lease.js'; import {Duration} from '../time/duration.js'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; /** * Implements a lease renewal service which utilizes a setInterval() based approach to renew leases at regular intervals. diff --git a/src/core/lease/lease_manager.ts b/src/core/lease/lease_manager.ts index d2def5a8b..7d941035c 100644 --- a/src/core/lease/lease_manager.ts +++ b/src/core/lease/lease_manager.ts @@ -22,7 +22,7 @@ import {type Lease, LeaseRenewalService} from './lease.js'; import {IntervalLease} from './interval_lease.js'; import {LeaseHolder} from './lease_holder.js'; import {LeaseAcquisitionError} from './lease_errors.js'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; /** * Manages the acquisition and renewal of leases. @@ -41,7 +41,7 @@ export class LeaseManager { private readonly _renewalService?: LeaseRenewalService, private readonly _logger?: SoloLogger, private readonly k8?: K8, - private readonly configManager?: ConfigManager + private readonly configManager?: ConfigManager, ) {} /** diff --git a/src/core/logging.ts b/src/core/logging.ts index ac6f25366..65de71cff 100644 --- a/src/core/logging.ts +++ b/src/core/logging.ts @@ -20,7 +20,7 @@ import * as util from 'util'; import chalk from 'chalk'; import path from 'path'; import * as constants from './constants.js'; -import {injectable, singleton} from "tsyringe-neo"; +import {singleton} from 'tsyringe-neo'; const customFormat = winston.format.combine( winston.format.label({label: 'SOLO', message: false}), diff --git a/src/core/package_downloader.ts b/src/core/package_downloader.ts index 496b23a66..ea910c743 100644 --- a/src/core/package_downloader.ts +++ b/src/core/package_downloader.ts @@ -32,7 +32,7 @@ import {Templates} from './templates.js'; import * as constants from './constants.js'; import {SoloLogger} from './logging.js'; import {StatusCodes} from 'http-status-codes'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; @autoInjectable() export class PackageDownloader { diff --git a/src/core/platform_installer.ts b/src/core/platform_installer.ts index 4e1168334..224f92606 100644 --- a/src/core/platform_installer.ts +++ b/src/core/platform_installer.ts @@ -30,12 +30,16 @@ import {SoloLogger} from './logging.js'; import type {NodeAlias, NodeAliases, PodName} from '../types/aliases.js'; import {Duration} from './time/duration.js'; import {sleep} from './helpers.js'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; /** PlatformInstaller install platform code in the root-container of a network pod */ @autoInjectable() export class PlatformInstaller { - constructor(private logger?: SoloLogger, private k8?: K8, private configManager?: ConfigManager) {} + constructor( + private logger?: SoloLogger, + private k8?: K8, + private configManager?: ConfigManager, + ) {} private _getNamespace(): string { const ns = this.configManager.getFlag(flags.namespace) as string; diff --git a/src/core/profile_manager.ts b/src/core/profile_manager.ts index 72c80e71d..aa51666d0 100644 --- a/src/core/profile_manager.ts +++ b/src/core/profile_manager.ts @@ -31,7 +31,7 @@ import * as helpers from './helpers.js'; import {getNodeAccountMap} from './helpers.js'; import {SoloLogger} from './logging.js'; import type {NodeAlias, NodeAliases} from '../types/aliases.js'; -import {container, singleton} from "tsyringe-neo"; +import {container, singleton} from 'tsyringe-neo'; const consensusSidecars = [ 'recordStreamUploader', diff --git a/src/core/shell_runner.ts b/src/core/shell_runner.ts index 64844d82a..336b16c8c 100644 --- a/src/core/shell_runner.ts +++ b/src/core/shell_runner.ts @@ -17,7 +17,7 @@ import {spawn} from 'child_process'; import chalk from 'chalk'; import {SoloLogger} from './logging.js'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; @autoInjectable() export class ShellRunner { diff --git a/src/core/zippy.ts b/src/core/zippy.ts index 303e6926a..a35605469 100644 --- a/src/core/zippy.ts +++ b/src/core/zippy.ts @@ -21,7 +21,7 @@ import * as tar from 'tar'; import chalk from 'chalk'; import path from 'path'; import {SoloLogger} from './logging.js'; -import {autoInjectable} from "tsyringe-neo"; +import {autoInjectable} from 'tsyringe-neo'; @autoInjectable() export class Zippy { diff --git a/src/index.ts b/src/index.ts index 6257bcb09..efca8f117 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,8 +19,8 @@ import yargs from 'yargs'; import {hideBin} from 'yargs/helpers'; import 'dotenv/config'; import path from 'path'; -import "reflect-metadata"; -import './core/container_init.js' +import 'reflect-metadata'; +import './core/container_init.js'; import {ListrLogger} from 'listr2'; import {Flags as flags} from './commands/flags.js'; @@ -46,11 +46,11 @@ import {CustomProcessOutput} from './core/process_output.js'; import {type Opts} from './types/command_types.js'; import {IntervalLeaseRenewalService} from './core/lease/interval_lease_renewal.js'; import {type LeaseRenewalService} from './core/lease/lease.js'; -import {container} from "tsyringe-neo"; -import {SoloLogger} from "./core/logging.js"; +import {container} from 'tsyringe-neo'; +import {SoloLogger} from './core/logging.js'; export function main(argv: any) { - const logger = container.resolve(SoloLogger) + const logger = container.resolve(SoloLogger); constants.LISTR_DEFAULT_RENDERER_OPTION.logger = new ListrLogger({processOutput: new CustomProcessOutput(logger)}); if (argv.length >= 3 && ['-version', '--version', '-v', '--v'].includes(argv[2])) { logger.showUser(chalk.cyan('\n******************************* Solo *********************************************')); @@ -61,19 +61,16 @@ export function main(argv: any) { try { // prepare dependency manger registry - const downloader = container.resolve(PackageDownloader) - const zippy = container.resolve(Zippy) - const helmDepManager = container.resolve(HelmDependencyManager) - const depManager = container.resolve(DependencyManager) - const helm = container.resolve(Helm) + const downloader = container.resolve(PackageDownloader); + const depManager = container.resolve(DependencyManager); + const helm = container.resolve(Helm); const chartManager = container.resolve(ChartManager); - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); const k8 = container.resolve(K8); const accountManager = container.resolve(AccountManager); const platformInstaller = container.resolve(PlatformInstaller); const keyManager = container.resolve(KeyManager); const profileManager = container.resolve(ProfileManager); - const leaseRenewalService: LeaseRenewalService = container.resolve(IntervalLeaseRenewalService); const leaseManager = container.resolve(LeaseManager); const certificateManager = container.resolve(CertificateManager); const localConfigPath = path.join(constants.SOLO_CACHE_DIR, constants.DEFAULT_LOCAL_CONFIG_FILE); diff --git a/test/e2e/e2e_node_util.ts b/test/e2e/e2e_node_util.ts index b5b17aedb..fd6585eae 100644 --- a/test/e2e/e2e_node_util.ts +++ b/test/e2e/e2e_node_util.ts @@ -36,7 +36,7 @@ import {type K8} from '../../src/core/k8.js'; import {type NodeCommand} from '../../src/commands/node/index.js'; import {Duration} from '../../src/core/time/duration.js'; import {StatusCodes} from 'http-status-codes'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; export function e2eNodeKeyRefreshTest(testName: string, mode: string, releaseTag = HEDERA_PLATFORM_VERSION_TAG) { const namespace = testName; @@ -192,7 +192,7 @@ export function e2eNodeKeyRefreshTest(testName: string, mode: string, releaseTag async function nodeRefreshTestSetup(argv: Record, testName: string, k8: K8, nodeAliases: string) { argv[flags.nodeAliasesUnparsed.name] = nodeAliases; - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); configManager.update(argv); const podArray = await k8.getPodsByLabel([`app=network-${nodeAliases}`, 'solo.hedera.com/type=network-node']); diff --git a/test/e2e/integration/commands/init.test.ts b/test/e2e/integration/commands/init.test.ts index 72fdcd8d5..53c23c911 100644 --- a/test/e2e/integration/commands/init.test.ts +++ b/test/e2e/integration/commands/init.test.ts @@ -36,7 +36,7 @@ import {IntervalLeaseRenewalService} from '../../../../src/core/lease/interval_l import path from 'path'; import {BASE_TEST_DIR} from '../../../test_util.js'; import {Duration} from '../../../../src/core/time/duration.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const testLogger = logging.NewLogger('debug', true); describe('InitCommand', () => { @@ -50,7 +50,7 @@ describe('InitCommand', () => { const helm = container.resolve(Helm); const chartManager = container.resolve(ChartManager); - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); let k8: K8; let localConfig: LocalConfig; diff --git a/test/e2e/integration/core/chart_manager.test.ts b/test/e2e/integration/core/chart_manager.test.ts index 2c47a235c..72399eed9 100644 --- a/test/e2e/integration/core/chart_manager.test.ts +++ b/test/e2e/integration/core/chart_manager.test.ts @@ -21,7 +21,7 @@ import * as constants from '../../../../src/core/constants.js'; import {Helm} from '../../../../src/core/helm.js'; import {ChartManager} from '../../../../src/core/chart_manager.js'; import {testLogger} from '../../../test_util.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; describe('ChartManager', () => { const chartManager = container.resolve(ChartManager); diff --git a/test/e2e/integration/core/dependency_managers/helm_dependency_manager.test.ts b/test/e2e/integration/core/dependency_managers/helm_dependency_manager.test.ts index 188aa784c..bba2fea42 100644 --- a/test/e2e/integration/core/dependency_managers/helm_dependency_manager.test.ts +++ b/test/e2e/integration/core/dependency_managers/helm_dependency_manager.test.ts @@ -73,11 +73,7 @@ describe('HelmDependencyManager', () => { // input.osPlatform, // input.osArch, // ); - const helmDependencyManager = new HelmDependencyManager( - tmpDir, - input.osPlatform, - input.osArch, - ); + const helmDependencyManager = new HelmDependencyManager(tmpDir, input.osPlatform, input.osArch); if (fs.existsSync(tmpDir)) { fs.rmSync(tmpDir, {recursive: true}); diff --git a/test/e2e/integration/core/k8_e2e.test.ts b/test/e2e/integration/core/k8_e2e.test.ts index 7cfe4dadc..95f513f2d 100644 --- a/test/e2e/integration/core/k8_e2e.test.ts +++ b/test/e2e/integration/core/k8_e2e.test.ts @@ -47,7 +47,7 @@ import { import crypto from 'crypto'; import type {PodName} from '../../../../src/types/aliases.js'; import {Duration} from '../../../../src/core/time/duration.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const defaultTimeout = Duration.ofMinutes(2).toMillis(); @@ -81,7 +81,7 @@ async function createPod( describe('K8', () => { const testLogger = logging.NewLogger('debug', true); - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); const k8 = container.resolve(K8); const testNamespace = 'k8-e2e'; const argv = []; diff --git a/test/e2e/integration/core/lease.test.ts b/test/e2e/integration/core/lease.test.ts index d0e3b4ee2..773733f5a 100644 --- a/test/e2e/integration/core/lease.test.ts +++ b/test/e2e/integration/core/lease.test.ts @@ -25,14 +25,14 @@ import {sleep} from '../../../../src/core/helpers.js'; import {LeaseRelinquishmentError} from '../../../../src/core/lease/lease_errors.js'; import {NoopLeaseRenewalService} from './noop_lease_renewal_service.test.js'; import {Duration} from '../../../../src/core/time/duration.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const defaultTimeout = Duration.ofMinutes(2).toMillis(); const leaseDuration = 4; describe('Lease', async () => { const testLogger = logging.NewLogger('debug', true); - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); const k8 = container.resolve(K8); const testNamespace = 'lease-e2e'; const renewalService = new NoopLeaseRenewalService(); diff --git a/test/e2e/integration/core/lease_renewal.test.ts b/test/e2e/integration/core/lease_renewal.test.ts index d55460186..e1e508e20 100644 --- a/test/e2e/integration/core/lease_renewal.test.ts +++ b/test/e2e/integration/core/lease_renewal.test.ts @@ -25,14 +25,14 @@ import {sleep} from '../../../../src/core/helpers.js'; import {IntervalLeaseRenewalService} from '../../../../src/core/lease/interval_lease_renewal.js'; import {type V1Lease} from '@kubernetes/client-node'; import {Duration} from '../../../../src/core/time/duration.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const defaultTimeout = Duration.ofMinutes(2).toMillis(); const leaseDuration = 4; describe('LeaseRenewalService', async () => { const testLogger = logging.NewLogger('debug', true); - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); const k8 = container.resolve(K8); const renewalService = container.resolve(IntervalLeaseRenewalService); const testNamespace = 'lease-renewal-e2e'; diff --git a/test/e2e/integration/core/remote_config_manager.test.ts b/test/e2e/integration/core/remote_config_manager.test.ts index 0f2607e83..e42160265 100644 --- a/test/e2e/integration/core/remote_config_manager.test.ts +++ b/test/e2e/integration/core/remote_config_manager.test.ts @@ -29,7 +29,7 @@ import path from 'path'; import {SoloError} from '../../../../src/core/errors.js'; import {RemoteConfigDataWrapper} from '../../../../src/core/config/remote/remote_config_data_wrapper.js'; import {Duration} from '../../../../src/core/time/duration.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const defaultTimeout = Duration.ofSeconds(20).toMillis(); diff --git a/test/e2e/integration/core/remote_config_validator.test.ts b/test/e2e/integration/core/remote_config_validator.test.ts index ae7485f29..6e9987a00 100644 --- a/test/e2e/integration/core/remote_config_validator.test.ts +++ b/test/e2e/integration/core/remote_config_validator.test.ts @@ -36,12 +36,12 @@ import {MirrorNodeExplorerComponent} from '../../../../src/core/config/remote/co import {EnvoyProxyComponent} from '../../../../src/core/config/remote/components/envoy_proxy_component.js'; import type {NodeAlias, NodeAliases} from '../../../../src/types/aliases.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; describe('RemoteConfigValidator', () => { const namespace = 'remote-config-validator'; - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); configManager.update({[flags.namespace.name]: namespace}); const k8 = container.resolve(K8); diff --git a/test/test_util.ts b/test/test_util.ts index a3a51db9b..24db4d826 100644 --- a/test/test_util.ts +++ b/test/test_util.ts @@ -60,7 +60,7 @@ import {Zippy} from '../src/core/zippy.js'; import {HEDERA_PLATFORM_VERSION} from '../version.js'; import {IntervalLeaseRenewalService} from '../src/core/lease/interval_lease_renewal.js'; import {Duration} from '../src/core/time/duration.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; export const testLogger = logging.NewLogger('debug', true); export const TEST_CLUSTER = 'solo-e2e'; @@ -138,7 +138,7 @@ export function bootstrapTestVariables( ): BootstrapResponse { const namespace: string = argv[flags.namespace.name] || 'bootstrap-ns'; const cacheDir: string = argv[flags.cacheDir.name] || getTestCacheDir(testName); - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); configManager.update(argv); const downloader = container.resolve(PackageDownloader); diff --git a/test/unit/commands/base.test.ts b/test/unit/commands/base.test.ts index 2918b3883..1514411fe 100644 --- a/test/unit/commands/base.test.ts +++ b/test/unit/commands/base.test.ts @@ -16,13 +16,10 @@ */ import {expect} from 'chai'; -import {HelmDependencyManager, DependencyManager} from '../../../src/core/dependency_managers/index.js'; +import {DependencyManager} from '../../../src/core/dependency_managers/index.js'; import {Helm} from '../../../src/core/helm.js'; import {ChartManager} from '../../../src/core/chart_manager.js'; import {ConfigManager} from '../../../src/core/config_manager.js'; -import {PackageDownloader} from '../../../src/core/package_downloader.js'; -import {Zippy} from '../../../src/core/zippy.js'; -import * as constants from '../../../src/core/constants.js'; import {LocalConfig} from '../../../src/core/config/local_config.js'; import {RemoteConfigManager} from '../../../src/core/config/remote/remote_config_manager.js'; import {K8} from '../../../src/core/k8.js'; @@ -32,14 +29,14 @@ import {Flags as flags} from '../../../src/commands/flags.js'; import sinon from 'sinon'; import path from 'path'; import {BASE_TEST_DIR} from '../../test_util.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const testLogger = logging.NewLogger('debug', true); describe('BaseCommand', () => { const helm = container.resolve(Helm); const chartManager = container.resolve(ChartManager); - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); const depManager = container.resolve(DependencyManager); const localConfig = new LocalConfig(path.join(BASE_TEST_DIR, 'local-config.yaml')); diff --git a/test/unit/commands/cluster.test.ts b/test/unit/commands/cluster.test.ts index f0a824b5a..bb2af11ff 100644 --- a/test/unit/commands/cluster.test.ts +++ b/test/unit/commands/cluster.test.ts @@ -29,7 +29,7 @@ import {ChartManager} from '../../../src/core/chart_manager.js'; import {Helm} from '../../../src/core/helm.js'; import {ROOT_DIR} from '../../../src/core/constants.js'; import path from 'path'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const getBaseCommandOpts = () => ({ logger: sinon.stub(), diff --git a/test/unit/commands/network.test.ts b/test/unit/commands/network.test.ts index f8c4eb736..ead8d3f25 100644 --- a/test/unit/commands/network.test.ts +++ b/test/unit/commands/network.test.ts @@ -40,7 +40,7 @@ import {ProfileManager} from '../../../src/core/profile_manager.js'; import {KeyManager} from '../../../src/core/key_manager.js'; import {ROOT_DIR} from '../../../src/core/constants.js'; import {ListrLease} from '../../../src/core/lease/listr_lease.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const getBaseCommandOpts = () => ({ logger: sinon.stub(), @@ -102,7 +102,7 @@ describe('NetworkCommand unit tests', () => { opts.profileManager.prepareValuesForSoloChart = sinon.stub(); opts.certificateManager = sinon.stub(); - opts.chartManager = container.resolve(ChartManager) + opts.chartManager = container.resolve(ChartManager); opts.chartManager.isChartInstalled = sinon.stub().returns(true); opts.chartManager.isChartInstalled.onSecondCall().returns(false); diff --git a/test/unit/core/certificate_manager.test.ts b/test/unit/core/certificate_manager.test.ts index 94b1915cb..5c5159853 100644 --- a/test/unit/core/certificate_manager.test.ts +++ b/test/unit/core/certificate_manager.test.ts @@ -24,7 +24,7 @@ import {CertificateManager} from '../../../src/core/certificate_manager.js'; import {Flags as flags} from '../../../src/commands/flags.js'; import {testLogger} from '../../test_util.js'; import {SoloError} from '../../../src/core/errors.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; describe('Certificate Manager', () => { const argv = {}; @@ -36,10 +36,10 @@ describe('Certificate Manager', () => { before(() => { argv[flags.namespace.name] = 'namespace'; - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); configManager.update(argv); k8 = container.resolve(K8); - certificateManager = container.resolve(CertificateManager) + certificateManager = container.resolve(CertificateManager); }); after(() => { diff --git a/test/unit/core/config_manager.test.ts b/test/unit/core/config_manager.test.ts index abd516054..c25cba851 100644 --- a/test/unit/core/config_manager.test.ts +++ b/test/unit/core/config_manager.test.ts @@ -20,12 +20,12 @@ import {describe, it} from 'mocha'; import {ConfigManager} from '../../../src/core/config_manager.js'; import {Flags as flags} from '../../../src/commands/flags.js'; import {testLogger} from '../../test_util.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; describe('ConfigManager', () => { describe('update values using argv', () => { it('should update string flag value', () => { - const cm = container.resolve(ConfigManager) + const cm = container.resolve(ConfigManager); const argv = {}; argv[flags.releaseTag.name] = 'v0.42.5'; @@ -41,7 +41,7 @@ describe('ConfigManager', () => { }); it('should update number flag value', () => { - const cm = container.resolve(ConfigManager) + const cm = container.resolve(ConfigManager); const argv = {}; argv[flags.replicaCount.name] = 1; @@ -57,7 +57,7 @@ describe('ConfigManager', () => { }); it('should update boolean flag value', () => { - const cm = container.resolve(ConfigManager) + const cm = container.resolve(ConfigManager); // boolean values should work const argv = {}; @@ -88,7 +88,7 @@ describe('ConfigManager', () => { it('should take user input as the first preference', () => { // Given: config has value, argv has a different value // Expected: argv should retain the value - const cm = container.resolve(ConfigManager) + const cm = container.resolve(ConfigManager); cm.setFlag(flags.devMode, false); expect(cm.getFlag(flags.devMode)).not.to.be.ok; @@ -103,7 +103,7 @@ describe('ConfigManager', () => { it('should take default as the last preference', () => { // Given: neither config nor argv has the flag value set // Expected: argv should inherit the default flag value - const cm = container.resolve(ConfigManager) + const cm = container.resolve(ConfigManager); expect(cm.hasFlag(flags.devMode)).not.to.be.ok; // shouldn't have set const argv = {}; // devMode flag is not set in argv and cached config doesn't have it either diff --git a/test/unit/core/dependency_managers/dependency_manager.test.ts b/test/unit/core/dependency_managers/dependency_manager.test.ts index e3944b340..38d8d4518 100644 --- a/test/unit/core/dependency_managers/dependency_manager.test.ts +++ b/test/unit/core/dependency_managers/dependency_manager.test.ts @@ -17,12 +17,9 @@ import {expect} from 'chai'; import {describe, it} from 'mocha'; -import {DependencyManager, HelmDependencyManager} from '../../../../src/core/dependency_managers/index.js'; -import {PackageDownloader} from '../../../../src/core/package_downloader.js'; -import {Zippy} from '../../../../src/core/zippy.js'; -import * as constants from '../../../../src/core/constants.js'; +import {DependencyManager} from '../../../../src/core/dependency_managers/index.js'; import * as logging from '../../../../src/core/logging.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const testLogger = logging.NewLogger('debug', true); describe('DependencyManager', () => { diff --git a/test/unit/core/k8.test.ts b/test/unit/core/k8.test.ts index b967fdd35..28a46e0f6 100644 --- a/test/unit/core/k8.test.ts +++ b/test/unit/core/k8.test.ts @@ -24,7 +24,7 @@ import {ConfigManager} from '../../../src/core/config_manager.js'; import {testLogger} from '../../test_util.js'; import {Flags as flags} from '../../../src/commands/flags.js'; import {Duration} from '../../../src/core/time/duration.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; function listNamespacedPodMockSetup(k8: K8, numOfFailures: number, result: any) { for (let i = 0; i < numOfFailures - 1; i++) { @@ -73,7 +73,7 @@ describe('K8 Unit Tests', function () { before(() => { argv[flags.namespace.name] = 'namespace'; - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); configManager.update(argv); k8 = container.resolve(K8); k8.kubeClient = { diff --git a/test/unit/core/key_manager.test.ts b/test/unit/core/key_manager.test.ts index abf1f57d0..df32a6d99 100644 --- a/test/unit/core/key_manager.test.ts +++ b/test/unit/core/key_manager.test.ts @@ -25,7 +25,7 @@ import * as constants from '../../../src/core/constants.js'; import * as logging from '../../../src/core/logging.js'; import type {NodeAlias} from '../../../src/types/aliases.js'; import {Duration} from '../../../src/core/time/duration.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; describe('KeyManager', () => { const logger = logging.NewLogger('debug', true); diff --git a/test/unit/core/platform_installer.test.ts b/test/unit/core/platform_installer.test.ts index 235b3a282..c52f5c104 100644 --- a/test/unit/core/platform_installer.test.ts +++ b/test/unit/core/platform_installer.test.ts @@ -27,11 +27,11 @@ import * as logging from '../../../src/core/logging.js'; import {IllegalArgumentError, MissingArgumentError} from '../../../src/core/errors.js'; import {getK8Instance} from '../../test_util.js'; import type {PodName} from '../../../src/types/aliases.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; describe('PackageInstaller', () => { const testLogger = logging.NewLogger('debug', true); - const configManager = container.resolve(ConfigManager) + const configManager = container.resolve(ConfigManager); const k8 = getK8Instance(configManager); diff --git a/test/unit/core/profile_manager.test.ts b/test/unit/core/profile_manager.test.ts index 65d995ece..ea88b6adf 100644 --- a/test/unit/core/profile_manager.test.ts +++ b/test/unit/core/profile_manager.test.ts @@ -27,10 +27,10 @@ import {ProfileManager} from '../../../src/core/profile_manager.js'; import {getTestCacheDir, getTmpDir, testLogger} from '../../test_util.js'; import * as version from '../../../version.js'; import type {NodeAlias} from '../../../src/types/aliases.js'; -import {container} from "tsyringe-neo"; +import {container} from 'tsyringe-neo'; const tmpDir = getTmpDir(); -const configManager = container.resolve(ConfigManager) +const configManager = container.resolve(ConfigManager); const profileManager = new ProfileManager(tmpDir); configManager.setFlag(flags.nodeAliasesUnparsed, 'node1,node2,node4'); const testProfileFile = path.join('test', 'data', 'test-profiles.yaml');