Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload debug logs #308

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/actions/tests/run-e2e-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,49 @@ runs:
eval "$pytest_cmd"
fi

- name: Handle Debug Logs
if: always()
shell: bash
run: |
# Determine test phase based on keyword
if [[ "${{ inputs.keyword }}" == "test_get_status or test_get_params" ]]; then
TEST_PHASE="smoke"
elif [[ "${{ inputs.tests }}" == "postmerge" ]]; then
if [[ "${{ inputs.mc_epoch }}" == "3" ]]; then
TEST_PHASE="postmerge-final"
else
TEST_PHASE="postmerge-epoch${{ inputs.mc_epoch }}"
fi
else
TEST_PHASE="premerge"
fi
Comment on lines +113 to +123
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't scale well when we add/change test suites. Debug logs are used when something fails, so let's just use the same name for every artifact and overwrite


echo "TEST_PHASE=${TEST_PHASE}" >> $GITHUB_ENV

if [[ "${{ inputs.local-environment }}" == "true" ]]; then
echo "Copy debug log from docker container"
mkdir -p E2E-tests
docker cp tests:/e2e-tests/debug.log E2E-tests/debug_${TEST_PHASE}.log || docker cp tests:/E2E-tests/debug.log E2E-tests/debug_${TEST_PHASE}.log
cd E2E-tests
else
cd e2e-tests
fi

# Process the log file
awk '{print strftime("[%Y-%m-%d %H:%M:%S]"), $0}' debug_${TEST_PHASE}.log > debug_with_timestamps.log
nl -ba -s ' ' -w 8 debug_with_timestamps.log > debug_with_timestamps_and_line_numbers.log
mv debug_with_timestamps_and_line_numbers.log debug_${TEST_PHASE}.log

- name: Archive Debug Log
if: always()
uses: actions/upload-artifact@v4
with:
name: debug_log_${{ env.TEST_PHASE }}
retention-days: 15
overwrite: true
path: E2E-tests/debug_${{ env.TEST_PHASE }}.log
if-no-files-found: error

- name: Copy test results
if: ${{ inputs.local-environment == 'true' }}
shell: bash
Expand Down
Loading