diff --git a/.github/workflows/flow-pull-request-checks.yaml b/.github/workflows/flow-pull-request-checks.yaml index bf2b38add..3fc8c15b5 100644 --- a/.github/workflows/flow-pull-request-checks.yaml +++ b/.github/workflows/flow-pull-request-checks.yaml @@ -81,9 +81,11 @@ jobs: - { name: "Node PEM Kill", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-pem-kill-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-pem-kill-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-pem-kill-coverage-report }}" } - { name: "Node Local Hedera", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-local-hedera-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-local-hedera-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-local-hedera-coverage-report }}" } - { name: "Node Local PTT", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-local-ptt-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-local-ptt-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-local-ptt-coverage-report }}" } - - { name: "Node Add", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-coverage-report }}" } - - { 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 }}" } + # Node Add tests are disabled and are not viable for the amount of memory available. The teacher crashes during + # the reconnect attempt. + #- { name: "Node Add", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-coverage-report }}" } + #- { 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 }}" } diff --git a/src/commands/node/tasks.ts b/src/commands/node/tasks.ts index 1e9b422f2..c002afd81 100644 --- a/src/commands/node/tasks.ts +++ b/src/commands/node/tasks.ts @@ -524,15 +524,15 @@ export class NodeCommandTasks { const { upgradeZipHash } = ctx const { nodeClient, freezeAdminPrivateKey } = ctx.config try { - // transfer some tiny amount to the freeze admin account - // await this.accountManager.transferAmount(constants.TREASURY_ACCOUNT_ID, FREEZE_ADMIN_ACCOUNT, 100000) - // query the balance const balance = await new AccountBalanceQuery() .setAccountId(FREEZE_ADMIN_ACCOUNT) .execute(nodeClient) this.logger.debug(`Freeze admin account balance: ${balance.hbars}`) + // transfer some tiny amount to the freeze admin account + await this.accountManager.transferAmount(constants.TREASURY_ACCOUNT_ID, FREEZE_ADMIN_ACCOUNT, 100000) + // set operator of freeze transaction as freeze admin account nodeClient.setOperator(FREEZE_ADMIN_ACCOUNT, freezeAdminPrivateKey) diff --git a/src/core/account_manager.ts b/src/core/account_manager.ts index f09eeaeef..0c855dfe9 100644 --- a/src/core/account_manager.ts +++ b/src/core/account_manager.ts @@ -214,25 +214,19 @@ export class AccountManager { * @returns a node client that can be used to call transactions */ async _getNodeClient (namespace: string, networkNodeServicesMap: Map, operatorId: string, - operatorKey: string) { - const nodes = {} + operatorKey: string, useFirstNodeOnly = true) { + let nodes = {} try { let localPort = constants.LOCAL_NODE_START_PORT for (const networkNodeService of networkNodeServicesMap.values()) { - const usePortForward = this.shouldUseLocalHostPortForward(networkNodeService) - const host = usePortForward ? '127.0.0.1' : networkNodeService.haProxyLoadBalancerIp as string - const port = +networkNodeService.haProxyGrpcPort - const targetPort = usePortForward ? localPort : port + const addlNode = await this.configureNodeAccess(networkNodeService, localPort, networkNodeServicesMap.size) + nodes = { ...nodes, ...addlNode } + localPort++ - if (usePortForward && this._portForwards.length < networkNodeServicesMap.size) { - this._portForwards.push(await this.k8.portForward(networkNodeService.haProxyPodName, localPort, port)) + if (useFirstNodeOnly) { + break } - - // @ts-ignore - nodes[`${host}:${targetPort}`] = AccountId.fromString((networkNodeService.accountId as string)) - await this.k8.testConnection(host, targetPort) - localPort++ } this.logger.debug(`creating client from network configuration: ${JSON.stringify(nodes)}`) @@ -250,6 +244,23 @@ export class AccountManager { } } + private async configureNodeAccess (networkNodeService: NetworkNodeServices, localPort: number, totalNodes: number) { + const obj = {} + const usePortForward = this.shouldUseLocalHostPortForward(networkNodeService) + const host = usePortForward ? '127.0.0.1' : networkNodeService.haProxyLoadBalancerIp as string + const port = +networkNodeService.haProxyGrpcPort + const targetPort = usePortForward ? localPort : port + + if (usePortForward && this._portForwards.length < totalNodes) { + this._portForwards.push(await this.k8.portForward(networkNodeService.haProxyPodName, localPort, port)) + } + + await this.k8.testConnection(host, targetPort) + obj[`${host}:${targetPort}`] = AccountId.fromString((networkNodeService.accountId as string)) + + return obj + } + /** * Gets a Map of the Hedera node services and the attributes needed * @param namespace - the namespace of the solo network deployment