Skip to content

Commit

Permalink
feat: add separate commands for update (#735)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Jeromy Cannon <[email protected]>
Co-authored-by: Jeromy Cannon <[email protected]>
  • Loading branch information
Ivo-Yankov and jeromy-cannon authored Oct 25, 2024
1 parent 52484a3 commit 44c3132
Show file tree
Hide file tree
Showing 15 changed files with 409 additions and 52 deletions.
1 change: 1 addition & 0 deletions .github/workflows/flow-build-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
- { name: "Node Add Local", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-local-coverage-report }}" }
- { name: "Node Add - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-coverage-report }}" }
- { name: "Node Update", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-update-coverage-report }}" }
- { name: "Node Update - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-update-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-update-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-update-separate-commands-coverage-report }}" }
- { name: "Node Delete", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-delete-coverage-report }}" }
- { name: "Node Delete - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}", 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 }}" }
- { name: "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 }}" }
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/flow-pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
- { name: "Node Add Local", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-local-coverage-report }}" }
- { name: "Node Add - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-coverage-report }}" }
- { name: "Node Update", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-update-coverage-report }}" }
- { name: "Node Update - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-update-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-update-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-update-separate-commands-coverage-report }}" }
- { name: "Node Delete", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-delete-coverage-report }}" }
- { name: "Node Delete - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-delete-separate-commands-test-subdir }}", 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 }}" }
- { name: "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 }}" }
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,22 @@ tests:
mochaPostfix: "'test/e2e/commands/node_add_local.test.ts'"

- name: Node Add - Separate commands
mochaPostfix: "'test/e2e/commands/separate_node_add*.test.ts'"
mochaPostfix: "'test/e2e/commands/separate_node_add.test.ts'"

- name: Node Update
mochaPostfix: "'test/e2e/commands/node_update*.test.ts'"
mochaPostfix: "'test/e2e/commands/node_update.test.ts'"

- name: Node Update - Separate commands
mochaPostfix: "'test/e2e/commands/separate_node_update.test.ts'"

- name: Node Delete
mochaPostfix: "'test/e2e/commands/node_delete*.test.ts'"
mochaPostfix: "'test/e2e/commands/node_delete.test.ts'"

- name: Node Delete - Separate commands
mochaPostfix: "'test/e2e/commands/separate_node_delete*.test.ts'"
mochaPostfix: "'test/e2e/commands/separate_node_delete.test.ts'"

- name: Node Upgrade
mochaPostfix: "'test/e2e/commands/node_upgrade*.test.ts'"
mochaPostfix: "'test/e2e/commands/node_upgrade.test.ts'"

- name: Relay
mochaPostfix: "'test/e2e/commands/relay.test.ts'"
17 changes: 17 additions & 0 deletions .github/workflows/zxc-code-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ on:
type: string
required: false
default: "e2e-node-update"
e2e-node-update-separate-commands-test-subdir:
description: "E2E Node Update - Separate commands Test Subdirectory:"
type: string
required: false
default: "e2e-node-update-separate-commands"
e2e-node-delete-test-subdir:
description: "E2E Node Delete Test Subdirectory:"
type: string
Expand Down Expand Up @@ -185,6 +190,11 @@ on:
type: string
required: false
default: "E2E Node Update Tests Coverage Report"
e2e-node-update-separate-commands-coverage-report:
description: "E2E Node Update - Separate commands Coverage Report:"
type: string
required: false
default: "E2E Node Update - Separate commands Tests Coverage Report"
e2e-node-delete-coverage-report:
description: "E2E Node Delete Coverage Report:"
type: string
Expand Down Expand Up @@ -337,6 +347,13 @@ jobs:
name: ${{ inputs.e2e-node-update-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-update-test-subdir }}'

- name: Download E2E Node Update - Separate commands 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-update-separate-commands-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-update-separate-commands-test-subdir }}'

- name: Download E2E Node Delete 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 @@ -59,6 +59,9 @@ on:
e2e-node-update-test-subdir:
description: "E2E Node Update Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_node_update_test_subdir }}
e2e-node-update-separate-commands-test-subdir:
description: "E2E Node Update - Separate commands Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_node_update_separate_commands_test_subdir }}
e2e-node-delete-test-subdir:
description: "E2E Node Delete Test Subdirectory"
value: ${{ jobs.env-vars.outputs.e2e_node_delete_test_subdir }}
Expand Down Expand Up @@ -104,6 +107,9 @@ on:
e2e-node-update-coverage-report:
description: "E2E Node Update Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_node_update_coverage_report }}
e2e-node-update-separate-commands-coverage-report:
description: "E2E Node Update - Separate commands Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_node_update_separate_commands_coverage_report }}
e2e-node-delete-coverage-report:
description: "E2E Node Delete Tests Coverage Report"
value: ${{ jobs.env-vars.outputs.e2e_node_delete_coverage_report }}
Expand Down Expand Up @@ -140,6 +146,7 @@ jobs:
e2e_node_add_local_test_subdir: e2e-node-add-local
e2e_node_add_separate_commands_test_subdir: e2e-node-add-separate-commands
e2e_node_update_test_subdir: e2e-node-update
e2e_node_update_separate_commands_test_subdir: e2e-node-update-separate-commands
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
Expand All @@ -155,6 +162,7 @@ jobs:
e2e_node_add_local_coverage_report: "E2E Node Add Local Tests Coverage Report"
e2e_node_add_separate_commands_coverage_report: "E2E Node Add - Separate commands Tests Coverage Report"
e2e_node_update_coverage_report: "E2E Node Update Tests Coverage Report"
e2e_node_update_separate_commands_coverage_report: "E2E Node Update - Separate commands 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"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"test-e2e-node-add-local": "cross-env MOCHA_SUITE_NAME=\"Mocha E2E Node Add Local Tests\" c8 --report-dir='coverage/e2e-node-add-local' mocha 'test/e2e/commands/node_add_local.test.ts' --reporter-options configFile=mocha-multi-reporter.json,cmrOutput=mocha-junit-reporter+mochaFile+junit-e2e-node-add-local.xml",
"test-e2e-node-add-separate-commands": "cross-env MOCHA_SUITE_NAME=\"Mocha E2E Node Add - Separate commands Tests\" c8 --report-dir='coverage/e2e-node-add-separate-commands' mocha 'test/e2e/commands/separate_node_add*.test.ts' --reporter-options configFile=mocha-multi-reporter.json,cmrOutput=mocha-junit-reporter+mochaFile+junit-e2e-node-add-separate-commands.xml",
"test-e2e-node-update": "cross-env MOCHA_SUITE_NAME=\"Mocha E2E Node Update Tests\" c8 --report-dir='coverage/e2e-node-update' mocha 'test/e2e/commands/node_update*.test.ts' --reporter-options configFile=mocha-multi-reporter.json,cmrOutput=mocha-junit-reporter+mochaFile+junit-e2e-node-update.xml",
"test-e2e-node-update-separate-commands": "cross-env MOCHA_SUITE_NAME=\"Mocha E2E Node Update - Separate commands Tests\" c8 --report-dir='coverage/e2e-node-update-separate-commands' mocha 'test/e2e/commands/separate_node_update.test.ts' --reporter-options configFile=mocha-multi-reporter.json,cmrOutput=mocha-junit-reporter+mochaFile+junit-e2e-node-update-separate-commands.xml",
"test-e2e-node-delete": "cross-env MOCHA_SUITE_NAME=\"Mocha E2E Node Delete Tests\" c8 --report-dir='coverage/e2e-node-delete' mocha 'test/e2e/commands/node_delete*.test.ts' --reporter-options configFile=mocha-multi-reporter.json,cmrOutput=mocha-junit-reporter+mochaFile+junit-e2e-node-delete.xml",
"test-e2e-node-delete-separate-commands": "cross-env MOCHA_SUITE_NAME=\"Mocha E2E Node Delete - Separate commands Tests\" c8 --report-dir='coverage/e2e-node-delete-separate-commands' mocha 'test/e2e/commands/separate_node_delete*.test.ts' --reporter-options configFile=mocha-multi-reporter.json,cmrOutput=mocha-junit-reporter+mochaFile+junit-e2e-node-delete-separate-commands.xml",
"test-e2e-node-upgrade": "cross-env MOCHA_SUITE_NAME=\"Mocha E2E Node Upgrade Tests\" c8 --report-dir='coverage/e2e-node-upgrade' mocha 'test/e2e/commands/node_upgrade*.test.ts' --reporter-options configFile=mocha-multi-reporter.json,cmrOutput=mocha-junit-reporter+mochaFile+junit-e2e-node-upgrade.xml",
Expand Down
4 changes: 3 additions & 1 deletion src/commands/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,9 @@ export const allFlags: CommandFlag[] = [
tlsPublicKey,
updateAccountKeys,
valuesFile,
mirrorNodeVersion
mirrorNodeVersion,
inputDir,
outputDir
]

/** Resets the definition.disablePrompt for all flags */
Expand Down
4 changes: 2 additions & 2 deletions src/commands/node/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export interface NodeUpdateConfigClass {
localBuildPath: string
namespace: string
newAccountNumber: string
newAdminKey: string
newAdminKey: PrivateKey
nodeAlias: NodeAlias
releaseTag: string
tlsPrivateKey: string
Expand All @@ -470,7 +470,7 @@ export interface NodeUpdateConfigClass {
allNodeAliases: NodeAliases
chartPath: string
existingNodeAliases: NodeAliases
freezeAdminPrivateKey: string
freezeAdminPrivateKey: PrivateKey
keysDir: string
nodeClient: any
podNames: Record<NodeAlias, PodName>
Expand Down
54 changes: 45 additions & 9 deletions src/commands/node/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,59 @@ export const DEFAULT_FLAGS = {
optionalFlags: [flags.devMode]
}

const COMMON_UPDATE_FLAGS_REQUIRED_FLAGS = [flags.cacheDir, flags.namespace, flags.releaseTag]
const COMMON_UPDATE_FLAGS_REQUIRED_NO_PROMPT_FLAGS = [
flags.app,
flags.debugNodeAlias,
flags.endpointType,
flags.soloChartVersion,

]
const COMMON_UPDATE_FLAGS_OPTIONAL_FLAGS = [
flags.chartDirectory, flags.devMode, flags.quiet, flags.localBuildPath, flags.force, flags.gossipEndpoints, flags.grpcEndpoints
]

export const UPDATE_FLAGS = {
requiredFlags: [flags.cacheDir, flags.namespace, flags.nodeAlias, flags.releaseTag],
requiredFlags: [...COMMON_UPDATE_FLAGS_REQUIRED_FLAGS, flags.nodeAlias],
requiredFlagsWithDisabledPrompt: [
flags.app,
flags.debugNodeAlias,
flags.endpointType,
flags.soloChartVersion,
...COMMON_UPDATE_FLAGS_REQUIRED_NO_PROMPT_FLAGS,
flags.newAdminKey,
flags.newAccountNumber,
flags.tlsPublicKey,
flags.gossipPrivateKey,
flags.gossipPublicKey,
flags.newAccountNumber,
flags.tlsPrivateKey
],
optionalFlags: COMMON_UPDATE_FLAGS_OPTIONAL_FLAGS
}

export const UPDATE_PREPARE_FLAGS = {
requiredFlags: [...COMMON_UPDATE_FLAGS_REQUIRED_FLAGS, flags.outputDir, flags.nodeAlias],
requiredFlagsWithDisabledPrompt: [
...COMMON_UPDATE_FLAGS_REQUIRED_NO_PROMPT_FLAGS,
flags.newAdminKey,
flags.tlsPrivateKey,
flags.tlsPublicKey
flags.newAccountNumber,
flags.tlsPublicKey,
flags.gossipPrivateKey,
flags.gossipPublicKey,
flags.tlsPrivateKey
],
optionalFlags: [flags.chartDirectory, flags.devMode, flags.quiet, flags.localBuildPath, flags.force, flags.gossipEndpoints, flags.grpcEndpoints]
optionalFlags: [...COMMON_UPDATE_FLAGS_OPTIONAL_FLAGS]
}

export const UPDATE_SUBMIT_TRANSACTIONS_FLAGS = {
requiredFlags: [...COMMON_UPDATE_FLAGS_REQUIRED_FLAGS, flags.inputDir],
requiredFlagsWithDisabledPrompt: [...COMMON_UPDATE_FLAGS_REQUIRED_NO_PROMPT_FLAGS],
optionalFlags: [...COMMON_UPDATE_FLAGS_OPTIONAL_FLAGS]
}

export const UPDATE_EXECUTE_FLAGS = {
requiredFlags: [...COMMON_UPDATE_FLAGS_REQUIRED_FLAGS, flags.inputDir],
requiredFlagsWithDisabledPrompt: [...COMMON_UPDATE_FLAGS_REQUIRED_NO_PROMPT_FLAGS],
optionalFlags: [...COMMON_UPDATE_FLAGS_OPTIONAL_FLAGS]
}


const COMMON_DELETE_REQUIRED_FLAGS = [
flags.cacheDir,
flags.namespace,
Expand Down
Loading

0 comments on commit 44c3132

Please sign in to comment.