Skip to content

Commit 81edd96

Browse files
authored
tests: use temp file for capturing e2e goal-partkey-commands output (algorand#6115)
1 parent 10e8b39 commit 81edd96

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

.github/workflows/reviewdog.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,16 @@ jobs:
102102
run: |
103103
curl -X POST --data-urlencode "payload={\"text\": \"Reviewdog failed. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}" $SLACK_WEBHOOK
104104
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')) }}
105+
reviewdog-shellcheck:
106+
runs-on: ubuntu-latest
107+
steps:
108+
- uses: actions/checkout@v4
109+
- name: shellcheck
110+
uses: reviewdog/action-shellcheck@v1
111+
with:
112+
github_token: ${{ secrets.GITHUB_TOKEN }}
113+
reporter: "github-pr-check"
114+
shellcheck_flags: "-e SC2034,SC2046,SC2053,SC2207,SC2145 -S warning"
115+
fail_on_error: true
116+
path: |
117+
test/scripts/e2e_subs

test/scripts/e2e_subs/goal-partkey-commands.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,22 @@ verify_registered_state () {
8383
SEARCH_INVOKE_CONTEXT=$(echo "$3" | xargs)
8484

8585
# look for participation ID anywhere in the partkeyinfo output
86-
PARTKEY_OUTPUT=$(${gcmd} account partkeyinfo)
87-
if ! echo "$PARTKEY_OUTPUT" | grep -q -F "$SEARCH_KEY"; then
88-
fail_test "Key $SEARCH_KEY was not installed properly for cmd '$SEARCH_INVOKE_CONTEXT':\n$PARTKEY_OUTPUT"
86+
info_temp_file=$(mktemp)
87+
${gcmd} account partkeyinfo > "${info_temp_file}"
88+
if ! grep -q -F "$SEARCH_KEY" "${info_temp_file}"; then
89+
echo "info_temp_file contents:"
90+
cat "${info_temp_file}"
91+
fail_test "Key $SEARCH_KEY was not installed properly for cmd '$SEARCH_INVOKE_CONTEXT'"
8992
fi
9093

9194
# looking for yes/no, and the 8 character head of participation id in this line:
9295
# yes LFMT...RHJQ 4UPT6AQC... 4 0 3000
93-
LISTKEY_OUTPUT=$(${gcmd} account listpartkeys)
94-
if ! echo "$LISTKEY_OUTPUT" | grep -q "$SEARCH_STATE.*$(echo "$SEARCH_KEY" | cut -c1-8)"; then
95-
fail_test "Unexpected key $SEARCH_KEY state (looked for $SEARCH_STATE ) for cmd '$SEARCH_INVOKE_CONTEXT':\n$LISTKEY_OUTPUT"
96+
list_temp_file=$(mktemp)
97+
${gcmd} account listpartkeys > "${list_temp_file}"
98+
if ! grep -q "$SEARCH_STATE.*$(echo "$SEARCH_KEY" | cut -c1-8)" "${list_temp_file}"; then
99+
echo "list_temp_file contents:"
100+
cat "${list_temp_file}"
101+
fail_test "Unexpected key $SEARCH_KEY state (looked for $SEARCH_STATE ) for cmd '$SEARCH_INVOKE_CONTEXT'"
96102
fi
97103
}
98104

0 commit comments

Comments
 (0)