Skip to content

Commit

Permalink
tests: use temp file for capturing e2e goal-partkey-commands output (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
cce authored Aug 30, 2024
1 parent 10e8b39 commit 81edd96
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,16 @@ 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 SC2034,SC2046,SC2053,SC2207,SC2145 -S warning"
fail_on_error: true
path: |
test/scripts/e2e_subs
18 changes: 12 additions & 6 deletions test/scripts/e2e_subs/goal-partkey-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 81edd96

Please sign in to comment.