From d8202b8bd057d5dd3d3c4af3aca185e468778089 Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 16 Oct 2024 13:44:56 +0530 Subject: [PATCH 1/6] setup zus-cli-st --- deploy-0chain/action.yml | 26 ++++++++++++++++++++++++-- run-system-tests/action.yml | 30 +++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/deploy-0chain/action.yml b/deploy-0chain/action.yml index 1a6b4aff..d6c2e11e 100644 --- a/deploy-0chain/action.yml +++ b/deploy-0chain/action.yml @@ -56,6 +56,10 @@ inputs: required: false description: '0Wallet CLI (branch or commit SHA) which the tests will use' default: '' + zus_cli_branch: + required: false + description: 'zus CLI (branch or commit SHA) which the tests will use' + default: '' custom_go_sdk_version: required: false default: "" @@ -168,6 +172,7 @@ runs: ./check-params.sh "${{inputs.zdns_image}}" "${{ env.SNAPSHOT_BRANCH_ZDNS_TAG }}" "ZDNS_TAG" ./check-params.sh "${{inputs.zbox_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZBOXCLI }}" "ZBOX_BRANCH" ./check-params.sh "${{inputs.zwallet_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZWALLETCLI }}" "ZWALLET_BRANCH" + ./check-params.sh "${{inputs.zus_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZUSCLI }}" "ZUSCLI_BRANCH" ./check-params.sh "${{inputs.zs3_minio}}" "${{ env.SNAPSHOT_BRANCH_MIBIOSERVER_TAG }}" "ZS3_MINIO" ./check-params.sh "${{inputs.zs3_logsearchapi}}" "${{ env.SNAPSHOT_BRANCH_LOGSEARCHAPI_TAG }}" "ZS3_LOGSEARCHAPI" ./check-params.sh "${{inputs.zs3_client}}" "${{ env.SNAPSHOT_BRANCH_CLIENTAPI_TAG }}" "ZS3_CLIENT" @@ -676,13 +681,21 @@ runs: fetch-depth: 1 path: ./zboxcli + - name: "Checkout zus-cli" + uses: actions/checkout@v3 + with: + ref: ${{ env.ZUSCLI_BRANCH }} + repository: 0chain/zus-cli + fetch-depth: 1 + path: ./zus-cli + - name: "Upgrade GoSDK" shell: 'script --return --quiet --command "bash {0}"' if: ${{ env.GOSDK_VERSION != '' && env.GOSDK_VERSION != 'NONE' }} run: | echo echo "==============================================================" - echo "UPGRADING GOSDK IN ZBOXCLI, ZWALLETCLI" + echo "UPGRADING GOSDK IN ZBOXCLI, ZWALLETCLI AND ZUSCLI" echo "==============================================================" echo @@ -704,6 +717,8 @@ runs: ../upgrade-gosdk.sh $GOSDK_HEAD zwalletcli cd ../zboxcli ../upgrade-gosdk.sh $GOSDK_HEAD zboxcli + cd ../zus-cli + ../upgrade-gosdk.sh $GOSDK_HEAD zus-cli sudo rm -rf upgrade-gosdk.sh @@ -713,7 +728,7 @@ runs: run: | echo echo "======================================================" - echo "BUILDING 0WALLET AND 0BOX CLI BINARIES:" + echo "BUILDING 0WALLET, 0BOX AND ZUS-CLI BINARIES:" echo "======================================================" echo # echo "removing go.work file if present" @@ -735,6 +750,13 @@ runs: mv zbox .. echo "CLI build SUCCESS!" + echo "Building zus-cli [${{ env.ZUSCLI_BRANCH }}]..." + cd ../zus-cli + go mod tidy + docker run --rm -v ./:/zus-cli -w /zus-cli golang:1.23 make install > build.log 2>&1 || { cat build.log && echo "::error title=zus-cli build failed::zus-cli build failed" && exit 1; } + mv zus-cli .. + echo "zus-cli build SUCCESS!" + - name: "Health Check" shell: 'script --return --quiet --command "bash {0}"' run: | diff --git a/run-system-tests/action.yml b/run-system-tests/action.yml index 23dbaecd..742562d0 100644 --- a/run-system-tests/action.yml +++ b/run-system-tests/action.yml @@ -19,6 +19,10 @@ inputs: required: false description: '0Wallet CLI (branch or commit SHA) which the tests will use' default: '' + zus_cli_branch: + required: false + description: 'zus CLI (branch or commit SHA) which the tests will use' + default: '' s3_migration_cli_branch: required: false description: 'S3 Migration CLI (branch or commit SHA) which the tests will use' @@ -133,6 +137,7 @@ runs: ./check-params.sh "${{inputs.zbox_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZBOXCLI }}" "ZBOX_BRANCH" ./check-params.sh "${{inputs.zwallet_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZWALLETCLI }}" "ZWALLET_BRANCH" + ./check-params.sh "${{inputs.zus_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_ZUSCLI_BRANCH }}" "ZUSCLI_BRANCH" ./check-params.sh "${{inputs.system_tests_branch}}" "${{ env.SNAPSHOT_BRANCH_SYSTEM_TEST }}" "SYSTEM_TESTS_BRANCH" ./check-params.sh "${{inputs.s3_migration_cli_branch}}" "${{ env.SNAPSHOT_BRANCH_S3-MIGRATION }}" "S3_MIGRATION_BRANCH" ./check-params.sh "${{inputs.custom_go_sdk_version}}" "${{ env.SNAPSHOT_BRANCH_GOSDK }}" "GOSDK_VERSION" @@ -224,6 +229,7 @@ runs: echo "0box network URL: [0box.${{ env.NETWORK_URL }}]" echo "0box CLI branch: [${{ env.ZBOX_BRANCH }}]" echo "0wallet CLI branch: [${{ env.ZWALLET_BRANCH }}]" + echo "zus-cli branch: [${{ env.ZUSCLI_BRANCH }}]" echo "s3 migration CLI branch: [${{ env.S3_MIGRATION_BRANCH }}]" echo "Ethereum node URL: [https://virtual.mainnet.rpc.tenderly.co/${{ inputs.TENDERLY_VIRTUAL_TESTNET_RPC_ID }}]" echo "Custom gosdk version: [${{ env.GOSDK_VERSION }}]" @@ -258,6 +264,14 @@ runs: fetch-depth: 1 path: ./zboxcli + - name: "Checkout zus-cli" + uses: actions/checkout@v3 + with: + ref: ${{ env.ZUSCLI_BRANCH }} + repository: 0chain/zus-cli + fetch-depth: 1 + path: ./zus-cli + - name: "Checkout S3 Migration CLI" uses: actions/checkout@v3 with: @@ -321,6 +335,8 @@ runs: ../upgrade-gosdk.sh $GOSDK_HEAD zwalletcli cd ../zboxcli ../upgrade-gosdk.sh $GOSDK_HEAD zboxcli + cd ../zus-cli + ../upgrade-gosdk.sh $GOSDK_HEAD zus-cli cd ../s3-migration ../upgrade-gosdk.sh $GOSDK_HEAD zs3cli cd ../tests/cli_tests @@ -336,7 +352,7 @@ runs: run: | echo echo "======================================================" - echo "BUILDING 0WALLET AND 0BOX CLI BINARIES:" + echo "BUILDING 0WALLET, 0BOX AND ZUS CLI BINARIES:" echo "======================================================" echo @@ -351,6 +367,11 @@ runs: cd ../zboxcli make install > build.log 2>&1 || { cat build.log && echo "::error title=zbox CLI build failed::zbox CLI build failed" && exit 1; } mv zbox ../tests/cli_tests + + echo "Building zus-cli [${{ env.ZUSCLI_BRANCH }}]..." + cd ../zus-cli + make install > build.log 2>&1 || { cat build.log && echo "::error title=zus-cli build failed::zus-cli build failed" && exit 1; } + mv zus-cli ../tests/cli_tests echo "Building s3 migration CLI [${{ env.S3_MIGRATION_BRANCH }}]..." cd ../s3-migration @@ -438,7 +459,13 @@ runs: mkdir -p ${BRANCH_DIR}/latest/flaky_cli mkdir -p ${BRANCH_DIR}/latest/tokenomics + cd tests/cli_tests + # create symlink + ln -s ./zus-cli ./zbox + ln -s ./zus-cli ./zwallet + echo "VERIFY SYMLINKS:" + ls -l ./zbox ./zwallet (./zwallet version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZWallet Version Info:/") || true (./zbox version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZBox Version Info:/") || true echo "TESTS_READY=true" >> $GITHUB_ENV @@ -581,6 +608,7 @@ runs: cp tests/cli_tests/zwallet . cp tests/cli_tests/zbox . + cp tests/cli_tests/zus-cli . ####### CREATING ALLOCATION THAT SHOULD RECEIVE CHALLENGES ####### truncate -s 1000000 upload_test_file From 181845675eecc85efc92f2019e8d9d8d6f7becdb Mon Sep 17 00:00:00 2001 From: storybehind Date: Wed, 23 Oct 2024 23:33:06 +0530 Subject: [PATCH 2/6] create symlink zbox only --- run-system-tests/action.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/run-system-tests/action.yml b/run-system-tests/action.yml index 742562d0..c1146a5b 100644 --- a/run-system-tests/action.yml +++ b/run-system-tests/action.yml @@ -314,7 +314,7 @@ runs: run: | echo echo "==============================================================" - echo "UPGRADING GOSDK IN ZBOXCLI, ZWALLETCLI, ZS3CLI & SYSTEM TESTS" + echo "UPGRADING GOSDK IN ZBOXCLI, ZWALLETCLI, ZUSCLI, ZS3CLI & SYSTEM TESTS" echo "==============================================================" echo @@ -463,9 +463,10 @@ runs: cd tests/cli_tests # create symlink ln -s ./zus-cli ./zbox - ln -s ./zus-cli ./zwallet + # ln -s ./zus-cli ./zwallet echo "VERIFY SYMLINKS:" - ls -l ./zbox ./zwallet + ls -l ./zbox + # ls -l ./zbox ./zwallet (./zwallet version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZWallet Version Info:/") || true (./zbox version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZBox Version Info:/") || true echo "TESTS_READY=true" >> $GITHUB_ENV From a389511d564b40b6fa8112531013bf3d213340da Mon Sep 17 00:00:00 2001 From: storybehind Date: Sat, 26 Oct 2024 20:57:26 +0530 Subject: [PATCH 3/6] fix symlink issue --- run-system-tests/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run-system-tests/action.yml b/run-system-tests/action.yml index c1146a5b..f9a3302e 100644 --- a/run-system-tests/action.yml +++ b/run-system-tests/action.yml @@ -462,10 +462,12 @@ runs: cd tests/cli_tests # create symlink + rm ./zbox ln -s ./zus-cli ./zbox # ln -s ./zus-cli ./zwallet echo "VERIFY SYMLINKS:" ls -l ./zbox + readlink ./zbox # ls -l ./zbox ./zwallet (./zwallet version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZWallet Version Info:/") || true (./zbox version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZBox Version Info:/") || true From f085cf06b2162e8587bf0b491bd42713d97f48f4 Mon Sep 17 00:00:00 2001 From: storybehind Date: Mon, 2 Dec 2024 19:11:01 +0530 Subject: [PATCH 4/6] add symlink to zwallet --- run-system-tests/action.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/run-system-tests/action.yml b/run-system-tests/action.yml index f9a3302e..b14d3e60 100644 --- a/run-system-tests/action.yml +++ b/run-system-tests/action.yml @@ -462,13 +462,14 @@ runs: cd tests/cli_tests # create symlink - rm ./zbox + echo "CREATING SYMLINKS:" + rm -f ./zbox ./zwallet ln -s ./zus-cli ./zbox - # ln -s ./zus-cli ./zwallet + ln -s ./zus-cli ./zwallet echo "VERIFY SYMLINKS:" - ls -l ./zbox + ls -l ./zbox ./zwallet readlink ./zbox - # ls -l ./zbox ./zwallet + readlink ./zwallet (./zwallet version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZWallet Version Info:/") || true (./zbox version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZBox Version Info:/") || true echo "TESTS_READY=true" >> $GITHUB_ENV From 59b1559c12766b7cde10d73b732a753c8db80073 Mon Sep 17 00:00:00 2001 From: storybehind Date: Thu, 12 Dec 2024 10:56:38 +0530 Subject: [PATCH 5/6] run zus-cli tests separately --- run-system-tests/action.yml | 63 ++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/run-system-tests/action.yml b/run-system-tests/action.yml index b14d3e60..a418376d 100644 --- a/run-system-tests/action.yml +++ b/run-system-tests/action.yml @@ -459,17 +459,7 @@ runs: mkdir -p ${BRANCH_DIR}/latest/flaky_cli mkdir -p ${BRANCH_DIR}/latest/tokenomics - cd tests/cli_tests - # create symlink - echo "CREATING SYMLINKS:" - rm -f ./zbox ./zwallet - ln -s ./zus-cli ./zbox - ln -s ./zus-cli ./zwallet - echo "VERIFY SYMLINKS:" - ls -l ./zbox ./zwallet - readlink ./zbox - readlink ./zwallet (./zwallet version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZWallet Version Info:/") || true (./zbox version --configDir ./config --config ./zbox_config.yaml --wallet ../ignore --silent | grep -A2 'Version info' | sed "s/Version info:/ZBox Version Info:/") || true echo "TESTS_READY=true" >> $GITHUB_ENV @@ -612,7 +602,6 @@ runs: cp tests/cli_tests/zwallet . cp tests/cli_tests/zbox . - cp tests/cli_tests/zus-cli . ####### CREATING ALLOCATION THAT SHOULD RECEIVE CHALLENGES ####### truncate -s 1000000 upload_test_file @@ -864,6 +853,58 @@ runs: exit $system_tests_exit_code + - name: "Run zus-cli system tests" + shell: 'script --return --quiet --command "bash {0}"' + if: ${{ always() && env.TESTS_READY && env.RUN_SUBSET_OF_TESTS == 'false' && env.RUN_CLI_SYSTEM_TESTS == 'true' }} + run: | + echo + echo "======================================================" + echo "RUNNING SYSTEM TESTS:" + echo "======================================================" + echo + + export HOME="/root" + + GOPATH=$(echo $(go env GOPATH)) + + # create symlink + echo "CREATING SYMLINKS:" + rm -f ./zbox ./zwallet + ln -s ./zus-cli ./zbox + ln -s ./zus-cli ./zwallet + echo "VERIFY SYMLINKS:" + ls -l ./zbox ./zwallet + readlink ./zbox + readlink ./zwallet + + # cd tests/cli_tests + system_tests_exit_code=0 + echo "Sequential tests are currently running.... It will take a few minutes for initial test output to appear..." + echo + ${GOPATH}/bin/gotestsum --jsonfile test-output.json --hide-summary=output --format testname ${{ env.SHOULD_RETRY_FAILURES }} --raw-command -- ../../TEST_RUNNER_COMMAND.sh || system_tests_exit_code=$? + cat test-output.json | ${GOPATH}/bin/go-test-report --groupSize 1 --output ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/cli/index.html --title "0Chain System test suite [${{ env.BRANCH_DIR }}/${GITHUB_SHA:0:8}] ran against [${{ env.NETWORK_URL }}] at [${{ env.TEST_TIME }}]" + + ${GOPATH}/bin/gotestsum --jsonfile test-output.json --hide-summary=output --format testname ${{ env.SHOULD_RETRY_FAILURES }} --raw-command -- ../../KILL_TEST_RUNNER_COMMAND.sh || system_tests_exit_code=$? + cat test-output.json | ${GOPATH}/bin/go-test-report --groupSize 1 --output ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/killtestscli/index.html --title "0Chain System test suite: Kill tests [${{ env.BRANCH_DIR }}/${GITHUB_SHA:0:8}] ran against [${{ env.NETWORK_URL }}] at [${{ env.TEST_TIME }}]" + + ${GOPATH}/bin/gotestsum --jsonfile test-output.json --hide-summary=output --format testname ${{ env.SHOULD_RETRY_FAILURES }} --raw-command -- ../../MONITORING_TEST_RUNNER_COMMAND.sh || system_tests_exit_code=$? + cat test-output.json | ${GOPATH}/bin/go-test-report --groupSize 1 --output ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/monitoringtestscli/index.html --title "0Chain System test suite: Monitoring tests [${{ env.BRANCH_DIR }}/${GITHUB_SHA:0:8}] ran against [${{ env.NETWORK_URL }}] at [${{ env.TEST_TIME }}]" + + cp -R ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/cli ../../${{ env.BRANCH_DIR }}/latest/ + cp -R ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/killtestscli ../../${{ env.BRANCH_DIR }}/latest/ + cp -R ../../${{ env.BRANCH_DIR }}/${GITHUB_SHA}/monitoringtestscli ../../${{ env.BRANCH_DIR }}/latest/ + echo "TESTS_RAN=true" >> $GITHUB_ENV + + if [[ $system_tests_exit_code == 0 ]]; + then + echo TESTS_PASSED=true >> $GITHUB_ENV + else + echo TESTS_PASSED=false >> $GITHUB_ENV + echo "::error title=System tests faled!::System tests failed. Ensure tests are running against the correct images/branches and rule out any possible code issues before attempting a re-run" + fi + + exit $system_tests_exit_code + - name: "Run subset of CLI System Tests" if: ${{ always() && env.TESTS_READY && env.RUN_SUBSET_OF_TESTS == 'true' }} shell: 'script --return --quiet --command "bash {0}"' From 1cb4c304d8b6c73cf378081f37b3063a716741c8 Mon Sep 17 00:00:00 2001 From: storybehind Date: Fri, 13 Dec 2024 12:46:09 +0530 Subject: [PATCH 6/6] pwd logs --- run-system-tests/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run-system-tests/action.yml b/run-system-tests/action.yml index c9635ea7..8063bd39 100644 --- a/run-system-tests/action.yml +++ b/run-system-tests/action.yml @@ -892,6 +892,7 @@ runs: GOPATH=$(echo $(go env GOPATH)) + echo "CLI_TESTS_DIR=$(pwd)/tests/cli_tests" >> $GITHUB_ENV cd tests/cli_tests system_tests_exit_code=0 echo "Sequential tests are currently running.... It will take a few minutes for initial test output to appear..." @@ -935,6 +936,8 @@ runs: GOPATH=$(echo $(go env GOPATH)) # create symlink + cd $CLI_TESTS_DIR + echo "Current Directory: $(pwd)" echo "CREATING SYMLINKS:" rm -f ./zbox ./zwallet ln -s ./zus-cli ./zbox @@ -944,7 +947,6 @@ runs: readlink ./zbox readlink ./zwallet - # cd tests/cli_tests system_tests_exit_code=0 echo "Sequential tests are currently running.... It will take a few minutes for initial test output to appear..." echo