From 834069ccca512d915dbfba8a4c564c2e01121476 Mon Sep 17 00:00:00 2001 From: ladamesny Date: Mon, 9 Dec 2024 15:09:01 -0500 Subject: [PATCH 1/4] upload debug logs --- .github/actions/tests/run-e2e-tests/action.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/actions/tests/run-e2e-tests/action.yml b/.github/actions/tests/run-e2e-tests/action.yml index 66eb53d8a..38efb923e 100644 --- a/.github/actions/tests/run-e2e-tests/action.yml +++ b/.github/actions/tests/run-e2e-tests/action.yml @@ -105,6 +105,23 @@ runs: eval "$pytest_cmd" fi + - name: Add Line Numbers and Timestamps to debug.log + if: always() + run: | + cd e2e-tests + awk '{print strftime("[%Y-%m-%d %H:%M:%S]"), $0}' debug.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.log + + - name: Archive Debug Log + if: always() + uses: actions/upload-artifact@v4 + with: + name: debug_log + retention-days: 15 + overwrite: true + path: e2e-tests/debug.log + - name: Copy test results if: ${{ inputs.local-environment == 'true' }} shell: bash From 7369a04fdfc060e30df4a031eebcef197f6bdacc Mon Sep 17 00:00:00 2001 From: ladamesny Date: Mon, 9 Dec 2024 15:31:35 -0500 Subject: [PATCH 2/4] chore: handle debug.log for local and non local envs --- .github/actions/tests/run-e2e-tests/action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/tests/run-e2e-tests/action.yml b/.github/actions/tests/run-e2e-tests/action.yml index 38efb923e..bd5d6f6f5 100644 --- a/.github/actions/tests/run-e2e-tests/action.yml +++ b/.github/actions/tests/run-e2e-tests/action.yml @@ -107,7 +107,12 @@ runs: - name: Add Line Numbers and Timestamps to debug.log if: always() + shell: bash run: | + if [[ "${{ inputs.local-environment }}" == "true" ]]; then + echo "Copy debug log from docker container" + docker cp tests:/e2e-tests/debug.log e2e-tests/debug.log + fi cd e2e-tests awk '{print strftime("[%Y-%m-%d %H:%M:%S]"), $0}' debug.log > debug_with_timestamps.log nl -ba -s ' ' -w 8 debug_with_timestamps.log > debug_with_timestamps_and_line_numbers.log @@ -117,7 +122,7 @@ runs: if: always() uses: actions/upload-artifact@v4 with: - name: debug_log + name: debug_log_${{ steps.run-tests.outcome }} retention-days: 15 overwrite: true path: e2e-tests/debug.log From 523e700f356c97d457d31a85a2a0640b521bc444 Mon Sep 17 00:00:00 2001 From: ladamesny Date: Mon, 9 Dec 2024 15:45:16 -0500 Subject: [PATCH 3/4] chore: fix path to debug file --- .github/actions/tests/run-e2e-tests/action.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/actions/tests/run-e2e-tests/action.yml b/.github/actions/tests/run-e2e-tests/action.yml index bd5d6f6f5..a1b46d2fa 100644 --- a/.github/actions/tests/run-e2e-tests/action.yml +++ b/.github/actions/tests/run-e2e-tests/action.yml @@ -105,15 +105,22 @@ runs: eval "$pytest_cmd" fi - - name: Add Line Numbers and Timestamps to debug.log + - name: Handle Debug Logs if: always() shell: bash run: | if [[ "${{ inputs.local-environment }}" == "true" ]]; then echo "Copy debug log from docker container" - docker cp tests:/e2e-tests/debug.log e2e-tests/debug.log + # Create directory if it doesn't exist + mkdir -p E2E-tests + # Copy from the container's E2E-tests path + docker cp tests:/e2e-tests/debug.log E2E-tests/debug.log || docker cp tests:/E2E-tests/debug.log E2E-tests/debug.log + cd E2E-tests + else + cd e2e-tests fi - cd e2e-tests + + # Process the log file awk '{print strftime("[%Y-%m-%d %H:%M:%S]"), $0}' debug.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.log @@ -125,7 +132,8 @@ runs: name: debug_log_${{ steps.run-tests.outcome }} retention-days: 15 overwrite: true - path: e2e-tests/debug.log + path: E2E-tests/debug.log + if-no-files-found: error - name: Copy test results if: ${{ inputs.local-environment == 'true' }} From 9698563d8f079febbdf68a12eead70f4e9289205 Mon Sep 17 00:00:00 2001 From: ladamesny Date: Mon, 9 Dec 2024 16:01:25 -0500 Subject: [PATCH 4/4] chore: make debug log file names unique --- .../actions/tests/run-e2e-tests/action.yml | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/actions/tests/run-e2e-tests/action.yml b/.github/actions/tests/run-e2e-tests/action.yml index a1b46d2fa..80d518797 100644 --- a/.github/actions/tests/run-e2e-tests/action.yml +++ b/.github/actions/tests/run-e2e-tests/action.yml @@ -109,30 +109,43 @@ runs: 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 + + echo "TEST_PHASE=${TEST_PHASE}" >> $GITHUB_ENV + if [[ "${{ inputs.local-environment }}" == "true" ]]; then echo "Copy debug log from docker container" - # Create directory if it doesn't exist mkdir -p E2E-tests - # Copy from the container's E2E-tests path - docker cp tests:/e2e-tests/debug.log E2E-tests/debug.log || docker cp tests:/E2E-tests/debug.log E2E-tests/debug.log + 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.log > debug_with_timestamps.log + 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.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_${{ steps.run-tests.outcome }} + name: debug_log_${{ env.TEST_PHASE }} retention-days: 15 overwrite: true - path: E2E-tests/debug.log + path: E2E-tests/debug_${{ env.TEST_PHASE }}.log if-no-files-found: error - name: Copy test results