Skip to content

Commit

Permalink
fix: do not use solo version for fst-chart-version by default (#67)
Browse files Browse the repository at this point in the history
Signed-off-by: Lenin Mehedy <[email protected]>
  • Loading branch information
leninmehedy authored and jeromy-cannon committed Feb 27, 2024
1 parent 52082fd commit bcd6666
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 35 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/zxc-compile-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ jobs:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Checkout Helm Charts
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }}
with:
repository: hashgraph/full-stack-testing
sparse-checkout: charts
path: helm-charts

- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
Expand Down Expand Up @@ -138,10 +130,6 @@ jobs:
if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }}
run: docker image pull kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72

- name: Stage Helm Charts
if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }}
run: mv -vf helm-charts/charts/ ./ && rm -rf helm-charts

- name: Setup E2E Tests
if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }}
run: |
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,23 @@ kubectx <context-name>
* In this case, ensure your Docker engine has enough resources (e.g. Memory >=8Gb, CPU: >=4).

First, use the following command to set up the environment variables:

```
export SOLO_CLUSTER_NAME=solo
export SOLO_NAMESPACE=solo
export SOLO_CLUSTER_SETUP_NAMESPACE=solo-cluster
```

Then run the following command to set the kubectl context to the new cluster:

```
kind create cluster -n "${SOLO_CLUSTER_NAME}"
kubectl create ns "${SOLO_NAMESPACE}"
kubectl create ns "${SOLO_CLUSTER_SETUP_NAMESPACE}"
```

and the command output should look like this:

```
Creating cluster "solo" ...
✓ Ensuring node image (kindest/node:v1.27.3) 🖼
Expand Down
1 change: 0 additions & 1 deletion src/commands/cluster.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export class ClusterCommand extends BaseCommand {
await prompts.execute(task, self.configManager, [
flags.clusterSetupNamespace,
flags.chartDirectory,
flags.fstChartVersion,
flags.deployPrometheusStack,
flags.deployMinio,
flags.deployCertManager,
Expand Down
3 changes: 1 addition & 2 deletions src/commands/flags.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
import { constants } from '../core/index.mjs'
import * as core from '../core/index.mjs'
import * as helpers from '../core/helpers.mjs'

/**
* Set flag from the flag option
Expand Down Expand Up @@ -329,7 +328,7 @@ export const fstChartVersion = {
name: 'fst-chart-version',
definition: {
describe: 'Fullstack testing chart version',
defaultValue: helpers.packageVersion(),
defaultValue: '',
type: 'string'
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/commands/init.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ export class InitCommand extends BaseCommand {
flags.clusterSetupNamespace,
flags.cacheDir,
flags.chartDirectory,
flags.keyFormat
flags.keyFormat,
flags.fstChartVersion
)
},
handler: (argv) => {
Expand Down
1 change: 0 additions & 1 deletion src/commands/network.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export class NetworkCommand extends BaseCommand {
flags.namespace,
flags.nodeIDs,
flags.chartDirectory,
flags.fstChartVersion,
flags.valuesFile,
flags.deployMirrorNode,
flags.deployHederaExplorer,
Expand Down
24 changes: 12 additions & 12 deletions src/commands/node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ export class NodeCommand extends BaseCommand {
await prompts.execute(task, self.configManager, [
flags.namespace,
flags.chartDirectory,
flags.fstChartVersion,
flags.nodeIDs,
flags.deployHederaExplorer,
flags.deployMirrorNode,
Expand Down Expand Up @@ -517,6 +516,16 @@ export class NodeCommand extends BaseCommand {
ctx.config.valuesArg
)
}
},
{
title: 'Waiting for explorer pod to be ready',
task: async (ctx, _) => {
if (ctx.config.deployHederaExplorer) {
await this.k8.waitForPod(constants.POD_STATUS_RUNNING, [
'app.kubernetes.io/component=hedera-explorer', 'app.kubernetes.io/name=hedera-explorer'
], 1, 100)
}
}
}
]

Expand All @@ -536,17 +545,8 @@ export class NodeCommand extends BaseCommand {
'skipping special account keys update, special accounts will retain genesis private keys'))
}
}
},
{
title: 'Waiting for explorer pod to be ready',
task: async (ctx, _) => {
if (ctx.config.deployHederaExplorer) {
await this.k8.waitForPod(constants.POD_STATUS_RUNNING, [
'app.kubernetes.io/component=hedera-explorer', 'app.kubernetes.io/name=hedera-explorer'
], 1)
}
}
}], {
}
], {
concurrent: false,
rendererOptions: constants.LISTR_DEFAULT_RENDERER_OPTION
})
Expand Down
1 change: 0 additions & 1 deletion test/e2e/commands/01_node.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ describe.each([
argv[flags.keyFormat.name] = testKeyFormat
argv[flags.nodeIDs.name] = 'node0,node1,node2'
argv[flags.cacheDir.name] = cacheDir
argv[flags.chartDirectory.name] = './charts'
argv[flags.force.name] = false
argv[flags.chainId.name] = constants.HEDERA_CHAIN_ID
argv[flags.generateGossipKeys.name] = false
Expand Down
44 changes: 44 additions & 0 deletions test/e2e/core/chart_manager.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* 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 { beforeAll, describe, expect, it } from '@jest/globals'
import { flags } from '../../../src/commands/index.mjs'
import { ChartManager, ConfigManager, Helm, constants } from '../../../src/core/index.mjs'
import { testLogger } from '../../test_util.js'

describe('ChartManager', () => {
const helm = new Helm(testLogger)
const chartManager = new ChartManager(helm, testLogger)
const configManager = new ConfigManager(testLogger)

beforeAll(() => {
configManager.load()
})

it('should be able to list installed charts', async () => {
const ns = configManager.getFlag(flags.namespace)
expect(ns).not.toBeNull()
const list = await chartManager.getInstalledCharts(ns)
expect(list.length).not.toBe(0)
})

it('should be able to check if a chart is installed', async () => {
const ns = configManager.getFlag(flags.clusterSetupNamespace)
expect(ns).not.toBeNull()
const isInstalled = await chartManager.isChartInstalled(ns, constants.FULLSTACK_CLUSTER_SETUP_CHART)
expect(isInstalled).toBeTruthy()
})
})
4 changes: 2 additions & 2 deletions test/e2e/core/k8_e2e.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ describe('K8', () => {
fs.rmdirSync(tmpDir, { recursive: true })
})

it('should be able to get two persistent volume claims', async () => {
it('should be able to list persistent volume claims', async () => {
const pvcs = await k8.listPvcsByNamespace(k8._getNamespace())
expect(pvcs).toHaveLength(2)
expect(pvcs.length).toBeGreaterThan(0)
})
})
2 changes: 1 addition & 1 deletion test/e2e/setup-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ kind delete cluster -n "${SOLO_CLUSTER_NAME}" || true
kind create cluster -n "${SOLO_CLUSTER_NAME}" --image "${KIND_IMAGE}" || exit 1
kubectl create ns "${SOLO_NAMESPACE}" || exit 1
kubectl create ns "${SOLO_CLUSTER_SETUP_NAMESPACE}" || exit 1
solo init --namespace "${SOLO_NAMESPACE}" -d ./charts -i node0,node1,node2 -t v0.42.5 -s "${SOLO_CLUSTER_SETUP_NAMESPACE}" || exit 1 # cache args for subsequent commands
solo init --namespace "${SOLO_NAMESPACE}" -i node0,node1,node2 -t v0.42.5 -s "${SOLO_CLUSTER_SETUP_NAMESPACE}" || exit 1 # cache args for subsequent commands
solo cluster setup || exit 1
solo network deploy || exit 1
3 changes: 1 addition & 2 deletions test/unit/core/dependency_manager.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
*
*/
import { describe, expect, it } from '@jest/globals'
import { DependencyManager } from '../../../src/core/dependency_manager.mjs'
import { DependencyManager, logging, constants } from '../../../src/core/index.mjs'
import { FullstackTestingError } from '../../../src/core/errors.mjs'
import { logging, constants } from '../../../src/core/index.mjs'

const testLogger = logging.NewLogger('debug')
describe('DependencyManager', () => {
Expand Down

0 comments on commit bcd6666

Please sign in to comment.