From 68f9455557192f190f0f26c78ef1ce281ec430ca Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:27:24 -0400 Subject: [PATCH 1/8] use temp file for capturing goal output --- test/scripts/e2e_subs/goal-partkey-commands.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/scripts/e2e_subs/goal-partkey-commands.sh b/test/scripts/e2e_subs/goal-partkey-commands.sh index b333a0e8aa..7d7154ec7b 100755 --- a/test/scripts/e2e_subs/goal-partkey-commands.sh +++ b/test/scripts/e2e_subs/goal-partkey-commands.sh @@ -83,16 +83,22 @@ verify_registered_state () { SEARCH_INVOKE_CONTEXT=$(echo "$3" | xargs) # look for participation ID anywhere in the partkeyinfo output - PARTKEY_OUTPUT=$(${gcmd} account partkeyinfo) - if ! echo "$PARTKEY_OUTPUT" | grep -q -F "$SEARCH_KEY"; then - fail_test "Key $SEARCH_KEY was not installed properly for cmd '$SEARCH_INVOKE_CONTEXT':\n$PARTKEY_OUTPUT" + info_temp_file=$(mktemp) + ${gcmd} account partkeyinfo > "${info_temp_file}" + if ! grep -q -F "$SEARCH_KEY" "${info_temp_file}"; then + echo "info_temp_file contents:" + cat "${info_temp_file}" + fail_test "Key $SEARCH_KEY was not installed properly for cmd '$SEARCH_INVOKE_CONTEXT'" fi # looking for yes/no, and the 8 character head of participation id in this line: # yes LFMT...RHJQ 4UPT6AQC... 4 0 3000 - LISTKEY_OUTPUT=$(${gcmd} account listpartkeys) - if ! echo "$LISTKEY_OUTPUT" | grep -q "$SEARCH_STATE.*$(echo "$SEARCH_KEY" | cut -c1-8)"; then - fail_test "Unexpected key $SEARCH_KEY state (looked for $SEARCH_STATE ) for cmd '$SEARCH_INVOKE_CONTEXT':\n$LISTKEY_OUTPUT" + list_temp_file=$(mktemp) + ${gcmd} account listpartkeys > "${list_temp_file}" + if ! grep -q "$SEARCH_STATE.*$(echo "$SEARCH_KEY" | cut -c1-8)" "${list_temp_file}"; then + echo "list_temp_file contents:" + cat "${list_temp_file}" + fail_test "Unexpected key $SEARCH_KEY state (looked for $SEARCH_STATE ) for cmd '$SEARCH_INVOKE_CONTEXT'" fi } From ac6a10462f7f260d69e29374cbff61234f9c2e85 Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:41:07 -0400 Subject: [PATCH 2/8] run shellcheck in e2e_subs --- scripts/travis/codegen_verification.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/travis/codegen_verification.sh b/scripts/travis/codegen_verification.sh index 53ad607a49..7da7b5c913 100755 --- a/scripts/travis/codegen_verification.sh +++ b/scripts/travis/codegen_verification.sh @@ -72,5 +72,10 @@ else echo All tidy fi +echo "Run shellcheck in e2e_subs" +pushd test/scripts/e2e_subs +shellcheck -e SC2154,SC2034,SC2046,SC2053,SC2207,SC2145 -S warning *.sh +popd + # test binary compatibility "${SCRIPTPATH}/../../test/platform/test_linux_amd64_compatibility.sh" From 64e8fefac47848f7a74066889d6cf1fc4eec07ba Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:56:53 -0400 Subject: [PATCH 3/8] set source path for shellcheck --- scripts/travis/codegen_verification.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/travis/codegen_verification.sh b/scripts/travis/codegen_verification.sh index 7da7b5c913..1876f47191 100755 --- a/scripts/travis/codegen_verification.sh +++ b/scripts/travis/codegen_verification.sh @@ -74,7 +74,7 @@ fi echo "Run shellcheck in e2e_subs" pushd test/scripts/e2e_subs -shellcheck -e SC2154,SC2034,SC2046,SC2053,SC2207,SC2145 -S warning *.sh +shellcheck -e SC2154,SC2034,SC2046,SC2053,SC2207,SC2145 -P . -S warning *.sh popd # test binary compatibility From c948bc9fdeee1a22d71a0948aae743f0d85f997e Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:08:29 -0400 Subject: [PATCH 4/8] remove shellcheck --- scripts/travis/codegen_verification.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/travis/codegen_verification.sh b/scripts/travis/codegen_verification.sh index 1876f47191..53ad607a49 100755 --- a/scripts/travis/codegen_verification.sh +++ b/scripts/travis/codegen_verification.sh @@ -72,10 +72,5 @@ else echo All tidy fi -echo "Run shellcheck in e2e_subs" -pushd test/scripts/e2e_subs -shellcheck -e SC2154,SC2034,SC2046,SC2053,SC2207,SC2145 -P . -S warning *.sh -popd - # test binary compatibility "${SCRIPTPATH}/../../test/platform/test_linux_amd64_compatibility.sh" From 892532559acc923f9b928c03089b0eb6b789eeb4 Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Fri, 30 Aug 2024 08:36:06 -0400 Subject: [PATCH 5/8] add reviewdog-shellcheck --- .github/workflows/reviewdog.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index b02d99e7cc..b2008b5610 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -102,3 +102,15 @@ jobs: run: | curl -X POST --data-urlencode "payload={\"text\": \"Reviewdog failed. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}" $SLACK_WEBHOOK if: ${{ failure() && (contains(github.ref_name, 'rel/nightly') || contains(github.ref_name, 'rel/beta') || contains(github.ref_name, 'rel/stable') || contains(github.ref_name, 'master')) }} + reviewdog-shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: shellcheck + uses: reviewdog/action-shellcheck@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: "github-pr-check" + shellcheck_flags: "-e SC2154,SC2034,SC2046,SC2053,SC2207,SC2145 -S warning" + path: | + test/scripts/e2e_subs From 227be8c4566d742e96c6f8900f1583b9b8bae659 Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Fri, 30 Aug 2024 08:40:07 -0400 Subject: [PATCH 6/8] introduce bug fixed in #6095 to see if shellcheck would have caught it earlier --- .github/workflows/reviewdog.yml | 2 +- test/scripts/e2e_subs/goal-partkey-commands.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index b2008b5610..76d69d269a 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -111,6 +111,6 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} reporter: "github-pr-check" - shellcheck_flags: "-e SC2154,SC2034,SC2046,SC2053,SC2207,SC2145 -S warning" + shellcheck_flags: "-e SC2034,SC2046,SC2053,SC2207,SC2145 -S warning" path: | test/scripts/e2e_subs diff --git a/test/scripts/e2e_subs/goal-partkey-commands.sh b/test/scripts/e2e_subs/goal-partkey-commands.sh index 7d7154ec7b..c58f692266 100755 --- a/test/scripts/e2e_subs/goal-partkey-commands.sh +++ b/test/scripts/e2e_subs/goal-partkey-commands.sh @@ -8,7 +8,6 @@ date "+$0 start %Y%m%d_%H%M%S" WALLET=$1 -gcmd="goal -w ${WALLET}" INITIAL_ACCOUNT=$(${gcmd} account list|awk '{ print $3 }') # Registered Account ParticipationID Last Used First round Last round From ca10f4be87efe01df5366982472653b83985e99f Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Fri, 30 Aug 2024 08:49:06 -0400 Subject: [PATCH 7/8] fail reviewdog-shellcheck on error --- .github/workflows/reviewdog.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 76d69d269a..7c0f2d26ae 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -112,5 +112,6 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} reporter: "github-pr-check" shellcheck_flags: "-e SC2034,SC2046,SC2053,SC2207,SC2145 -S warning" + fail_on_error: true path: | test/scripts/e2e_subs From ac00c9d704622f2c09a186bddce800c2d0b97fbc Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Fri, 30 Aug 2024 08:51:38 -0400 Subject: [PATCH 8/8] add back gcmd to fix bug after shellcheck detected it --- test/scripts/e2e_subs/goal-partkey-commands.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/scripts/e2e_subs/goal-partkey-commands.sh b/test/scripts/e2e_subs/goal-partkey-commands.sh index c58f692266..7d7154ec7b 100755 --- a/test/scripts/e2e_subs/goal-partkey-commands.sh +++ b/test/scripts/e2e_subs/goal-partkey-commands.sh @@ -8,6 +8,7 @@ date "+$0 start %Y%m%d_%H%M%S" WALLET=$1 +gcmd="goal -w ${WALLET}" INITIAL_ACCOUNT=$(${gcmd} account list|awk '{ print $3 }') # Registered Account ParticipationID Last Used First round Last round