UNPKG

@hashgraph/solo

Version:

An opinionated CLI tool to deploy and manage private Hedera Networks.

63 lines 2.77 kB
// SPDX-License-Identifier: Apache-2.0 import { describe, before, beforeEach, after } from 'mocha'; import fs from 'node:fs'; import { container } from 'tsyringe-neo'; import { Duration } from '../../../src/core/time/duration.js'; import { DEFAULT_LOCAL_CONFIG_FILE } from '../../../src/core/constants.js'; import { PathEx } from '../../../src/business/utils/path-ex.js'; import { InjectTokens } from '../../../src/core/dependency-injection/inject-tokens.js'; import { resetForTest } from '../../test-container.js'; import { EndToEndTestSuiteBuilder } from '../end-to-end-test-suite-builder.js'; import { InitTest } from './tests/init-test.js'; import { ClusterReferenceTest } from './tests/cluster-reference-test.js'; import { DeploymentTest } from './tests/deployment-test.js'; import { CacheTest } from './tests/cache-test.js'; const testName = 'cache-command-test'; const endToEndTestSuite = new EndToEndTestSuiteBuilder() .withTestName(testName) .withTestSuiteName('Cache Command E2E Test Suite') .withNamespace(testName) .withDeployment(`${testName}-deployment`) .withClusterCount(1) .withConsensusNodesCount(1) .withLoadBalancerEnabled(false) .withPinger(false) .withTestSuiteCallback((options, preDestroy) => { describe('Cache Command E2E Test', () => { const { testCacheDirectory, namespace, contexts } = options; before(async () => { fs.rmSync(testCacheDirectory, { recursive: true, force: true }); try { fs.rmSync(PathEx.joinWithRealPath(testCacheDirectory, '..', DEFAULT_LOCAL_CONFIG_FILE), { force: true, }); } catch { // allowed to fail if file is absent } resetForTest(namespace.name, testCacheDirectory, false); for (const item of contexts) { const k8Client = container.resolve(InjectTokens.K8Factory).getK8(item); await k8Client.namespaces().delete(namespace); } }).timeout(Duration.ofMinutes(5).toMillis()); after(async () => { await preDestroy(endToEndTestSuite); }).timeout(Duration.ofMinutes(5).toMillis()); beforeEach(async () => { resetForTest(namespace.name, testCacheDirectory, false); }); InitTest.init(options); ClusterReferenceTest.connect(options); DeploymentTest.create(options); DeploymentTest.addCluster(options); CacheTest.pull(options); CacheTest.list(options); CacheTest.status(options); CacheTest.load(options); CacheTest.clear(options); }); }) .build(); endToEndTestSuite.runTestSuite(); //# sourceMappingURL=cache-command.test.js.map