Skip to content

Commit

Permalink
feat: Separate network upgrade and freeze from node update/add/delete…
Browse files Browse the repository at this point in the history
… command (#628)

Signed-off-by: Ivo Yankov <[email protected]>
  • Loading branch information
Ivo-Yankov authored Oct 3, 2024
1 parent 5b9d19d commit 9b17937
Show file tree
Hide file tree
Showing 31 changed files with 927 additions and 466 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/autogen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The Solo autogen tool is used to add e2e test cases that need to be ran independ
## Usage

from solo root directory:

```bash
cd .github/workflows/autogen
npm install
Expand All @@ -16,17 +17,20 @@ npm run autogen
Use git to detect file changes and validate that they are correct.

The templates need to be maintained, you can either make changes directly to the templates and then run the tool, or make changes in both the workflow yaml files and the templates. Should the templates fall out of sync, then you can update the templates so that when autogen runs again, the git diff will better match.

```bash
template.flow-build-application.yaml
template.flow-pull-request-checks.yaml
template.zxc-code-analysis.yaml
template.zxc-env-vars.yaml
```
```

For new e2e test jobs update the `<solo-root>/.github/workflows/templates/config.yaml`, adding a new item to the tests object with a name and jestPostfix attribute.

NOTE: IntelliJ copy/paste will alter the escape sequences, you might have to manually type it in, clone a line, or use an external text editor.

e.g.:

```yaml
- name: Mirror Node
jestPostfix: --testRegex=\".*\\/e2e\\/commands\\/mirror_node\\.test\\.mjs\"
Expand All @@ -36,6 +40,7 @@ e.g.:
## Development

To run lint fix:

```bash
cd .github/workflows/autogen
eslint --fix .
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/flow-build-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,19 @@ jobs:
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-coverage-report }}

e2e-node-upgrade-tests:
name: E2E Tests
if: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
uses: ./.github/workflows/zxc-e2e-test.yaml
needs:
- env-vars
- code-style
with:
custom-job-label: Node Upgrade
npm-test-script: test-${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-upgrade-coverage-report }}

e2e-relay-tests:
name: E2E Tests
if: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
Expand Down Expand Up @@ -223,6 +236,7 @@ jobs:
- e2e-node-update-tests
- e2e-node-delete-tests
- e2e-node-delete-separate-commands-tests
- e2e-node-upgrade-tests
- e2e-relay-tests
if: ${{ (github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' || github.event.inputs.enable-e2e-tests == 'true') && !failure() && !cancelled() }}
with:
Expand All @@ -241,6 +255,7 @@ jobs:
e2e-node-update-test-subdir: ${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}
e2e-node-delete-test-subdir: ${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}
e2e-node-delete-separate-commands-test-subdir: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}
e2e-node-upgrade-test-subdir: ${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
e2e-standard-coverage-report: ${{ needs.env-vars.outputs.e2e-standard-coverage-report }}
e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
Expand All @@ -252,6 +267,7 @@ jobs:
e2e-node-update-coverage-report: ${{ needs.env-vars.outputs.e2e-node-update-coverage-report }}
e2e-node-delete-coverage-report: ${{ needs.env-vars.outputs.e2e-node-delete-coverage-report }}
e2e-node-delete-separate-commands-coverage-report: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-coverage-report }}
e2e-node-upgrade-coverage-report: ${{ needs.env-vars.outputs.e2e-node-upgrade-coverage-report }}
e2e-relay-coverage-report: ${{ needs.env-vars.outputs.e2e-relay-coverage-report }}
secrets:
snyk-token: ${{ secrets.SNYK_TOKEN }}
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/flow-pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,19 @@ jobs:
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-coverage-report }}

e2e-node-upgrade-tests:
name: E2E Tests
if: ${{ !cancelled() && always() }}
uses: ./.github/workflows/zxc-e2e-test.yaml
needs:
- env-vars
- code-style
with:
custom-job-label: Node Upgrade
npm-test-script: test-${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
coverage-subdirectory: ${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
coverage-report-name: ${{ needs.env-vars.outputs.e2e-node-upgrade-coverage-report }}

e2e-relay-tests:
name: E2E Tests
if: ${{ !cancelled() && always() }}
Expand Down Expand Up @@ -221,6 +234,7 @@ jobs:
- e2e-node-update-tests
- e2e-node-delete-tests
- e2e-node-delete-separate-commands-tests
- e2e-node-upgrade-tests
- e2e-relay-tests
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
with:
Expand All @@ -237,6 +251,7 @@ jobs:
e2e-node-update-test-subdir: ${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}
e2e-node-delete-test-subdir: ${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}
e2e-node-delete-separate-commands-test-subdir: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}
e2e-node-upgrade-test-subdir: ${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
e2e-standard-coverage-report: ${{ needs.env-vars.outputs.e2e-standard-coverage-report }}
e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
Expand All @@ -248,6 +263,7 @@ jobs:
e2e-node-update-coverage-report: ${{ needs.env-vars.outputs.e2e-node-update-coverage-report }}
e2e-node-delete-coverage-report: ${{ needs.env-vars.outputs.e2e-node-delete-coverage-report }}
e2e-node-delete-separate-commands-coverage-report: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-coverage-report }}
e2e-node-upgrade-coverage-report: ${{ needs.env-vars.outputs.e2e-node-upgrade-coverage-report }}
e2e-relay-coverage-report: ${{ needs.env-vars.outputs.e2e-relay-coverage-report }}
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -268,6 +284,7 @@ jobs:
- e2e-node-update-tests
- e2e-node-delete-tests
- e2e-node-delete-separate-commands-tests
- e2e-node-upgrade-tests
- e2e-relay-tests
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
with:
Expand All @@ -284,6 +301,7 @@ jobs:
e2e-node-update-test-subdir: ${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}
e2e-node-delete-test-subdir: ${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}
e2e-node-delete-separate-commands-test-subdir: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}
e2e-node-upgrade-test-subdir: ${{ needs.env-vars.outputs.e2e-node-upgrade-test-subdir }}
e2e-relay-test-subdir: ${{ needs.env-vars.outputs.e2e-relay-test-subdir }}
e2e-standard-coverage-report: ${{ needs.env-vars.outputs.e2e-standard-coverage-report }}
e2e-mirror-node-coverage-report: ${{ needs.env-vars.outputs.e2e-mirror-node-coverage-report }}
Expand All @@ -295,6 +313,7 @@ jobs:
e2e-node-update-coverage-report: ${{ needs.env-vars.outputs.e2e-node-update-coverage-report }}
e2e-node-delete-coverage-report: ${{ needs.env-vars.outputs.e2e-node-delete-coverage-report }}
e2e-node-delete-separate-commands-coverage-report: ${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-coverage-report }}
e2e-node-upgrade-coverage-report: ${{ needs.env-vars.outputs.e2e-node-upgrade-coverage-report }}
e2e-relay-coverage-report: ${{ needs.env-vars.outputs.e2e-relay-coverage-report }}
secrets:
codacy-project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ tests:
jestPostfix: --testRegex=\".*\\/e2e\\/commands\\/node_delete.*\\.test\\.mjs\"
- name: Node Delete - Separate commands
jestPostfix: --testRegex=\".*\\/e2e\\/commands\\/separate_node_delete.*\\.test\\.mjs\"
- name: Node Upgrade
jestPostfix: --testRegex=\".*\\/e2e\\/commands\\/node_upgrade.*\\.test\\.mjs\"
- name: Relay
jestPostfix: --testRegex=\".*\\/e2e\\/commands\\/relay\\.test\\.mjs\"
17 changes: 17 additions & 0 deletions .github/workflows/zxc-code-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ on:
type: string
required: false
default: "e2e-node-delete-separate-commands"
e2e-node-upgrade-test-subdir:
description: "E2E Node Upgrade Test Subdirectory:"
type: string
required: false
default: "e2e-node-upgrade"
e2e-relay-test-subdir:
description: "E2E Relay Test Subdirectory:"
type: string
Expand Down Expand Up @@ -160,6 +165,11 @@ on:
type: string
required: false
default: "E2E Node Delete - Separate commands Tests Coverage Report"
e2e-node-upgrade-coverage-report:
description: "E2E Node Upgrade Coverage Report:"
type: string
required: false
default: "E2E Node Upgrade Tests Coverage Report"
e2e-relay-coverage-report:
description: "E2E Relay Coverage Report:"
type: string
Expand Down Expand Up @@ -285,6 +295,13 @@ jobs:
name: ${{ inputs.e2e-node-delete-separate-commands-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-delete-separate-commands-test-subdir }}'

- name: Download E2E Node Upgrade Coverage Report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
with:
name: ${{ inputs.e2e-node-upgrade-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-upgrade-test-subdir }}'

- name: Download E2E Relay Coverage Report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/zxc-env-vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ on:
e2e-node-delete-separate-commands-test-subdir:
description: "E2E Node Delete - Separate commands Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_node_delete_separate_commands_test_subdir }}
e2e-node-upgrade-test-subdir:
description: "E2E Node Upgrade Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_node_upgrade_test_subdir }}
e2e-relay-test-subdir:
description: "E2E Relay Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_relay_test_subdir }}
Expand Down Expand Up @@ -89,6 +92,9 @@ on:
e2e-node-delete-separate-commands-coverage-report:
description: "E2E Node Delete - Separate commands Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_node_delete_separate_commands_coverage_report }}
e2e-node-upgrade-coverage-report:
description: "E2E Node Upgrade Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_node_upgrade_coverage_report }}
e2e-relay-coverage-report:
description: "E2E Relay Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_relay_coverage_report }}
Expand All @@ -112,6 +118,7 @@ jobs:
e2e_node_update_test_subdir: e2e-node-update
e2e_node_delete_test_subdir: e2e-node-delete
e2e_node_delete_separate_commands_test_subdir: e2e-node-delete-separate-commands
e2e_node_upgrade_test_subdir: e2e-node-upgrade
e2e_relay_test_subdir: e2e-relay
e2e_standard_coverage_report: "E2E Standard Tests Coverage Report"
e2e_mirror_node_coverage_report: "E2E Mirror Node Tests Coverage Report"
Expand All @@ -123,6 +130,7 @@ jobs:
e2e_node_update_coverage_report: "E2E Node Update Tests Coverage Report"
e2e_node_delete_coverage_report: "E2E Node Delete Tests Coverage Report"
e2e_node_delete_separate_commands_coverage_report: "E2E Node Delete - Separate commands Tests Coverage Report"
e2e_node_upgrade_coverage_report: "E2E Node Upgrade Tests Coverage Report"
e2e_relay_coverage_report: "E2E Relay Tests Coverage Report"
steps:
- run: echo "Exposing environment variables to reusable workflows"
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Then run the following command to set the kubectl context to the new cluster:
```bash
kind create cluster -n "${SOLO_CLUSTER_NAME}"
```

Example output

```
Expand All @@ -96,7 +97,6 @@ Have a nice day! 👋

You may now view pods in your cluster using `k9s -A` as below:


```
Context: kind-solo <0> all <a> Attach <ctr… ____ __.________
Cluster: kind-solo <ctrl-d> Delete <l> | |/ _/ __ \______
Expand Down Expand Up @@ -187,13 +187,16 @@ Kubernetes Namespace : solo
✔ Generate gRPC TLS keys
✔ Finalize
```

PEM key files are generated in `~/.solo/keys` directory.

```
hedera-node1.crt hedera-node3.crt s-private-node1.pem s-public-node1.pem unused-gossip-pem
hedera-node1.key hedera-node3.key s-private-node2.pem s-public-node2.pem unused-tls
hedera-node2.crt hedera-node4.crt s-private-node3.pem s-public-node3.pem
hedera-node2.key hedera-node4.key s-private-node4.pem s-public-node4.pem
```

* Setup cluster with shared components

```
Expand Down Expand Up @@ -475,6 +478,7 @@ To set customized `settings.txt` file, edit the file
`~/.solo/cache/templates/settings.txt` after `solo init` command.

Then you can start customized built hedera network with the following command:

```
solo node setup --local-build-path <default path to hedera repo>,node1=<custom build hedera repo>,node2=<custom build repo>
Expand All @@ -484,12 +488,15 @@ solo node setup --local-build-path <default path to hedera repo>,node1=<custom b
## For Developers Working on Platform core

To deploy node with local build PTT jar files, run the following command:

```
solo node setup --local-build-path <default path to hedera repo>,node1=<custom build hedera repo>,node2=<custom build repo> --app PlatformTestingTool.jar --app-config <path-to-test-json1,path-to-test-json2>
# example: solo node setup --local-build-path ../hedera-services/platform-sdk/sdk/data,node1=../hedera-services/platform-sdk/sdk/data,node2=../hedera-services/platform-sdk/sdk/data --app PlatformTestingTool.jar --app-config ../hedera-services/platform-sdk/platform-apps/tests/PlatformTestingTool/src/main/resources/FCMFCQ-Basic-2.5k-5m.json
```

## Logs

You can find log for running solo command under the directory `~/.solo/logs/`
The file `solo.log` contains the logs for the solo command.
The file `hashgraph-sdk.log` contains the logs from Solo client when sending transactions to network nodes.
Expand All @@ -499,6 +506,7 @@ The file `hashgraph-sdk.log` contains the logs from Solo client when sending tra
NOTE: the hedera-services path referenced '../hedera-services/hedera-node/data' may need to be updated based on what directory you are currently in. This also assumes that you have done an assemble/build and the directory contents are up-to-date.

Example 1: attach jvm debugger to a hedera node

```bash
./test/e2e/setup-e2e.sh
solo node keys --gossip-keys --tls-keys
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test-e2e-node-update": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Node Update Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-node-update.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-node-update' --testRegex=\".*\\/e2e\\/commands\\/node_update.*\\.test\\.mjs\"",
"test-e2e-node-delete": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Node Delete Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-node-delete.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-node-delete' --testRegex=\".*\\/e2e\\/commands\\/node_delete.*\\.test\\.mjs\"",
"test-e2e-node-delete-separate-commands": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Node Delete - Separate commands Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-node-delete-separate-commands.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-node-delete-separate-commands' --testRegex=\".*\\/e2e\\/commands\\/separate_node_delete.*\\.test\\.mjs\"",
"test-e2e-node-upgrade": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Node Upgrade Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-node-upgrade.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-node-upgrade' --testRegex=\".*\\/e2e\\/commands\\/node_upgrade.*\\.test\\.mjs\"",
"test-e2e-relay": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Relay Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e-relay.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e-relay' --testRegex=\".*\\/e2e\\/commands\\/relay\\.test\\.mjs\"",
"merge-clean": "rm -rf .nyc_output && mkdir .nyc_output && rm -rf coverage/lcov-report && rm -rf coverage/solo && rm coverage/*.*",
"merge-e2e": "nyc merge ./coverage/e2e/ .nyc_output/coverage.json",
Expand Down
7 changes: 2 additions & 5 deletions src/commands/account.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,10 @@ export class AccountCommand extends BaseCommand {

/**
* Return Yargs command definition for 'node' command
* @param {AccountCommand} accountCmd an instance of NodeCommand
* @returns {{command: string, desc: string, builder: Function}}
*/
static getCommandDefinition (accountCmd) {
if (!accountCmd || !(accountCmd instanceof AccountCommand)) {
throw new IllegalArgumentError('An instance of AccountCommand is required', accountCmd)
}
getCommandDefinition () {
const accountCmd = this
return {
command: 'account',
desc: 'Manage Hedera accounts in solo network',
Expand Down
7 changes: 2 additions & 5 deletions src/commands/cluster.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,10 @@ export class ClusterCommand extends BaseCommand {

/**
* Return Yargs command definition for 'cluster' command
* @param {ClusterCommand} clusterCmd - an instance of ClusterCommand
* @returns {{command: string, desc: string, builder: Function}}
*/
static getCommandDefinition (clusterCmd) {
if (!clusterCmd || !(clusterCmd instanceof ClusterCommand)) {
throw new IllegalArgumentError('Invalid ClusterCommand instance')
}
getCommandDefinition () {
const clusterCmd = this
return {
command: 'cluster',
desc: 'Manage fullstack testing cluster',
Expand Down
14 changes: 7 additions & 7 deletions src/commands/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ function Initialize (opts) {
const mirrorNodeCmd = new MirrorNodeCommand(opts)

return [
InitCommand.getCommandDefinition(initCmd),
ClusterCommand.getCommandDefinition(clusterCmd),
NetworkCommand.getCommandDefinition(networkCommand),
NodeCommand.getCommandDefinition(nodeCmd),
RelayCommand.getCommandDefinition(relayCmd),
AccountCommand.getCommandDefinition(accountCmd),
MirrorNodeCommand.getCommandDefinition(mirrorNodeCmd)
initCmd.getCommandDefinition(),
clusterCmd.getCommandDefinition(),
networkCommand.getCommandDefinition(),
nodeCmd.getCommandDefinition(),
relayCmd.getCommandDefinition(),
accountCmd.getCommandDefinition(),
mirrorNodeCmd.getCommandDefinition()
]
}

Expand Down
7 changes: 2 additions & 5 deletions src/commands/init.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,10 @@ export class InitCommand extends BaseCommand {

/**
* Return Yargs command definition for 'init' command
* @param {InitCommand} initCmd - an instance of InitCommand
* @returns A object representing the Yargs command definition
*/
static getCommandDefinition (initCmd) {
if (!initCmd || !(initCmd instanceof InitCommand)) {
throw new IllegalArgumentError('Invalid InitCommand')
}
getCommandDefinition () {
const initCmd = this
return {
command: 'init',
desc: 'Initialize local environment and default flags',
Expand Down
Loading

0 comments on commit 9b17937

Please sign in to comment.