-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: local chart directory not being taken correctly (#983)
Signed-off-by: Jeffrey Tang <[email protected]>
- Loading branch information
1 parent
437bbc6
commit 58e96e1
Showing
13 changed files
with
272 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
# The usage of resources in Solo | ||
## Modify Taskfile.yml, task "network:deploy" | ||
# The usage of resources in Solo | ||
|
||
## Modify Taskfile.yml, task "network:deploy" | ||
|
||
add "--values-file init-containers-values.yaml" | ||
|
||
Example: | ||
|
||
> solo:network:deploy: | ||
> internal: true | ||
> cmds: | ||
> - npm run solo-test -- network deploy --namespace "\${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} --solo-chart-version "\${SOLO_CHART_VERSION}" --settings-txt settings.txt --log4j2-xml log4j2.xml --values-file init-containers-values.yaml --application-properties application.properties | ||
> solo:network:deploy: | ||
> internal: true | ||
> cmds: | ||
> \- npm run solo-test -- network deploy --namespace "${SOLO\_NAMESPACE}" --node-aliases-unparsed {{.node\_identifiers}} --solo-chart-version "${SOLO\_CHART\_VERSION}" --settings-txt settings.txt --log4j2-xml log4j2.xml --values-file init-containers-values.yaml --application-properties application.properties | ||
## Provided examples for Consensus nodes: | ||
|
||
* HashSphere/init-containers-values.yaml (HashSphere on Google Cloud, for 4-core/32Gb 7-node ) | ||
* Latitude/init-containers-values.yaml (Latitude, 128Gb, 10-node) | ||
|
||
## and corresponding NetworkLoadGenerator templates: | ||
|
||
* HashSphere/nlg-values.yaml | ||
* Latitude/nlg-values.yaml | ||
Start as the following: | ||
> helm upgrade --install nlg oci://swirldslabs.jfrog.io/load-generator-helm-release-local/network-load-generator --version 0.2.1 --values nlg-values.yaml -n solo-hashsphere1 | ||
Start as the following: | ||
|
||
> helm upgrade --install nlg oci://swirldslabs.jfrog.io/load-generator-helm-release-local/network-load-generator --version 0.2.1 --values nlg-values.yaml -n solo-hashsphere1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/** | ||
* 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 sinon from 'sinon'; | ||
import {describe, it, beforeEach} from 'mocha'; | ||
import {expect} from 'chai'; | ||
|
||
import {ClusterCommand} from '../../../src/commands/cluster.js'; | ||
import {getDefaultArgv, HEDERA_PLATFORM_VERSION_TAG, TEST_CLUSTER} from '../../test_util.js'; | ||
import {Flags as flags} from '../../../src/commands/flags.js'; | ||
import * as version from '../../../version.js'; | ||
import * as constants from '../../../src/core/constants.js'; | ||
import {ConfigManager} from '../../../src/core/config_manager.js'; | ||
import {SoloLogger} from '../../../src/core/logging.js'; | ||
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'; | ||
|
||
const getBaseCommandOpts = () => ({ | ||
logger: sinon.stub(), | ||
helm: sinon.stub(), | ||
k8: sinon.stub(), | ||
chartManager: sinon.stub(), | ||
configManager: sinon.stub(), | ||
depManager: sinon.stub(), | ||
localConfig: sinon.stub(), | ||
}); | ||
|
||
const testName = 'cluster-cmd-unit'; | ||
const namespace = testName; | ||
const argv = getDefaultArgv(); | ||
|
||
argv[flags.namespace.name] = namespace; | ||
argv[flags.releaseTag.name] = HEDERA_PLATFORM_VERSION_TAG; | ||
argv[flags.nodeAliasesUnparsed.name] = 'node1'; | ||
argv[flags.generateGossipKeys.name] = true; | ||
argv[flags.generateTlsKeys.name] = true; | ||
argv[flags.clusterName.name] = TEST_CLUSTER; | ||
argv[flags.soloChartVersion.name] = version.SOLO_CHART_VERSION; | ||
argv[flags.force.name] = true; | ||
argv[flags.clusterSetupNamespace.name] = constants.SOLO_SETUP_NAMESPACE; | ||
|
||
describe('ClusterCommand unit tests', () => { | ||
describe('Chart Install Function is called correctly', () => { | ||
let opts: any; | ||
|
||
beforeEach(() => { | ||
opts = getBaseCommandOpts(); | ||
opts.logger = new SoloLogger(); | ||
opts.helm = new Helm(opts.logger); | ||
opts.helm.dependency = sinon.stub(); | ||
opts.chartManager = new ChartManager(opts.helm, opts.logger); | ||
opts.chartManager.isChartInstalled = sinon.stub().returns(false); | ||
opts.chartManager.install = sinon.stub().returns(true); | ||
|
||
opts.configManager = new ConfigManager(opts.logger); | ||
opts.remoteConfigManager = sinon.stub(); | ||
}); | ||
|
||
it('Install function is called with expected parameters', async () => { | ||
const clusterCommand = new ClusterCommand(opts); | ||
await clusterCommand.setup(argv); | ||
|
||
expect(opts.chartManager.install.args[0][0]).to.equal(constants.SOLO_SETUP_NAMESPACE); | ||
expect(opts.chartManager.install.args[0][1]).to.equal(constants.SOLO_CLUSTER_SETUP_CHART); | ||
expect(opts.chartManager.install.args[0][2]).to.equal( | ||
constants.SOLO_TESTING_CHART_URL + '/' + constants.SOLO_CLUSTER_SETUP_CHART, | ||
); | ||
expect(opts.chartManager.install.args[0][3]).to.equal(version.SOLO_CHART_VERSION); | ||
}); | ||
|
||
it('Should use local chart directory', async () => { | ||
argv[flags.chartDirectory.name] = 'test-directory'; | ||
argv[flags.force.name] = true; | ||
|
||
const clusterCommand = new ClusterCommand(opts); | ||
await clusterCommand.setup(argv); | ||
|
||
expect(opts.chartManager.install.args[0][2]).to.equal( | ||
path.join(ROOT_DIR, 'test-directory', constants.SOLO_CLUSTER_SETUP_CHART), | ||
); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.