From 6af67a3fa6ebb785d90fc161769527b1939386a6 Mon Sep 17 00:00:00 2001 From: Iliya Savov Date: Tue, 21 Nov 2023 20:43:58 +0200 Subject: [PATCH] update local-node start Signed-off-by: Iliya Savov --- .github/workflows/acceptance-workflow.yml | 34 ++++++++++++++++++- package-lock.json | 6 ++-- .../server/tests/acceptance/index.spec.ts | 32 ++++++++--------- scripts/retry_script.sh | 10 ++++++ 4 files changed, 61 insertions(+), 21 deletions(-) create mode 100755 scripts/retry_script.sh diff --git a/.github/workflows/acceptance-workflow.yml b/.github/workflows/acceptance-workflow.yml index 4310866310..8d259cda4b 100644 --- a/.github/workflows/acceptance-workflow.yml +++ b/.github/workflows/acceptance-workflow.yml @@ -34,7 +34,7 @@ jobs: node-version: 18 - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install packages run: npm ci @@ -48,18 +48,50 @@ jobs: - name: Build Typescript run: npx lerna run build + - name: Install hedera local + run: npm install @hashgraph/hedera-local -g + - name: Set operator id and key env variable if CI is manual if: ${{ inputs.operator_id }} run: | echo "OPERATOR_ID_MAIN=${{ inputs.operator_id }}" >> $GITHUB_ENV echo "OPERATOR_KEY_MAIN=${{ inputs.operator_key }}" >> $GITHUB_ENV + # - name: Setup upterm session + # uses: lhotari/action-upterm@v1 + # with: + # ## limits ssh access and adds the ssh public key for the user which triggered the workflow + # limit-access-to-actor: true + + - name: Run hedera local + run: hedera restart -d + + - name: Stop relay + run: | + docker stop json-rpc-relay json-rpc-relay-ws + + # - name: Run hedera local + # run: hedera restart -d + + # - name: Stop relay + # run: | + # docker stop json-rpc-relay json-rpc-relay-ws + + # - name: Run hedera local + # run: hedera restart -d + + # - name: Stop relay + # run: | + # docker stop json-rpc-relay json-rpc-relay-ws + - name: Run acceptance tests uses: nick-fields/retry@v2 with: max_attempts: 3 timeout_minutes: 20 command: npm run acceptancetest:${{ inputs.testfilter }} + on_retry_command: scripts/retry_script.sh + env: TEST_WS_SERVER: ${{ inputs.test_ws_server }} SUBSCRIPTIONS_ENABLED: ${{ inputs.test_ws_server }} diff --git a/package-lock.json b/package-lock.json index 7e8828bc49..eb85d15e75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19983,8 +19983,7 @@ "packages/relay/node_modules/@types/node": { "version": "17.0.45", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", - "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", - "dev": true + "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==" }, "packages/relay/node_modules/aes-js": { "version": "4.0.0-beta.5", @@ -22086,8 +22085,7 @@ "@types/node": { "version": "17.0.45", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", - "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", - "dev": true + "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==" }, "aes-js": { "version": "4.0.0-beta.5", diff --git a/packages/server/tests/acceptance/index.spec.ts b/packages/server/tests/acceptance/index.spec.ts index 15a73af95f..ba07dd34ae 100644 --- a/packages/server/tests/acceptance/index.spec.ts +++ b/packages/server/tests/acceptance/index.spec.ts @@ -87,7 +87,7 @@ describe('RPC Server Acceptance Tests', function () { logger.info(`E2E_RELAY_HOST: ${process.env.E2E_RELAY_HOST}`); if (USE_LOCAL_NODE === 'true') { - runLocalHederaNetwork(); + // runLocalHederaNetwork(); } if (global.relayIsLocal) { @@ -106,7 +106,7 @@ describe('RPC Server Acceptance Tests', function () { if (USE_LOCAL_NODE === 'true') { // stop local-node logger.info('Shutdown local node'); - shell.exec('hedera stop'); + //shell.exec('hedera stop'); } //stop relay @@ -138,23 +138,23 @@ describe('RPC Server Acceptance Tests', function () { } } - function runLocalHederaNetwork() { - // set env variables for docker images until local-node is updated - process.env['NETWORK_NODE_IMAGE_TAG'] = '0.45.0-alpha.0'; - process.env['HAVEGED_IMAGE_TAG'] = '0.45.0-alpha.0'; - process.env['MIRROR_IMAGE_TAG'] = '0.92.0'; + // function runLocalHederaNetwork() { + // // set env variables for docker images until local-node is updated + // process.env['NETWORK_NODE_IMAGE_TAG'] = '0.45.0-alpha.0'; + // process.env['HAVEGED_IMAGE_TAG'] = '0.45.0-alpha.0'; + // process.env['MIRROR_IMAGE_TAG'] = '0.92.0'; - console.log( - `Docker container versions, services: ${process.env['NETWORK_NODE_IMAGE_TAG']}, mirror: ${process.env['MIRROR_IMAGE_TAG']}`, - ); + // console.log( + // `Docker container versions, services: ${process.env['NETWORK_NODE_IMAGE_TAG']}, mirror: ${process.env['MIRROR_IMAGE_TAG']}`, + // ); - console.log('Installing local node...'); - shell.exec(`npm install @hashgraph/hedera-local -g`); + // console.log('Installing local node...'); + // shell.exec(`npm install @hashgraph/hedera-local -g`); - console.log('Starting local node...'); - shell.exec(`hedera start -d`); - console.log('Hedera Hashgraph local node env started'); - } + // console.log('Starting local node...'); + // shell.exec(`hedera start -d`); + // console.log('Hedera Hashgraph local node env started'); + // } function runLocalRelay() { // start local relay, stop relay instance in local diff --git a/scripts/retry_script.sh b/scripts/retry_script.sh new file mode 100755 index 0000000000..f5478ed2a2 --- /dev/null +++ b/scripts/retry_script.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -v +set +e +hedera stop +sleep 5 +ls -lah $(dirname $(readlink -f $(which hedera)))/../network-logs +sudo rm -rf $(dirname $(readlink -f $(which hedera)))/../network-logs +sleep 5 +hedera restart -d +docker stop json-rpc-relay json-rpc-relay-ws \ No newline at end of file