From d95fc550b6e4f0ba2b3154c65c9908e3340c110e Mon Sep 17 00:00:00 2001 From: Aitor Perez <1515757+Zerpet@users.noreply.github.com> Date: Tue, 25 Feb 2025 17:23:21 +0000 Subject: [PATCH] Fix log collection in Selenium workflows Prior to this commit, if a test failed, the script 'run-suites.sh' would exit with non-zero status, stopping the exection of the job; therefore, the steps to move the logs to the expected location won't be executed. This commit separates the tests from the log preparation. --- .github/workflows/test-management-ui-for-pr.yaml | 8 ++++++-- .github/workflows/test-management-ui.yaml | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-management-ui-for-pr.yaml b/.github/workflows/test-management-ui-for-pr.yaml index 260a163b55..06b7b209b3 100644 --- a/.github/workflows/test-management-ui-for-pr.yaml +++ b/.github/workflows/test-management-ui-for-pr.yaml @@ -61,12 +61,16 @@ jobs: IMAGE_TAG=$(find PACKAGES/rabbitmq-server-generic-unix-*.tar.xz | awk -F 'PACKAGES/rabbitmq-server-generic-unix-|.tar.xz' '{print $2}') RABBITMQ_DOCKER_IMAGE=pivotalrabbitmq/rabbitmq:$IMAGE_TAG \ ${SELENIUM_DIR}/run-suites.sh short-suite-management-ui + + - name: Prepare logs for upload + if: ${{ failure() && steps.tests.outcome == 'failed' }} + run: | mkdir -p /tmp/short-suite mv /tmp/selenium/* /tmp/short-suite - name: Upload Test Artifacts - if: always() - uses: actions/upload-artifact@v4.3.2 + if: ${{ failure() && steps.tests.outcome == 'failed' }} + uses: actions/upload-artifact@v4 with: name: test-artifacts-${{ matrix.browser }}-${{ matrix.erlang_version }} path: | diff --git a/.github/workflows/test-management-ui.yaml b/.github/workflows/test-management-ui.yaml index 602d9dae95..c54f2eaa1a 100644 --- a/.github/workflows/test-management-ui.yaml +++ b/.github/workflows/test-management-ui.yaml @@ -69,18 +69,22 @@ jobs: docker build -t mocha-test --target test . - name: Run full UI suite on a 3-node rabbitmq cluster + id: tests run: | IMAGE_TAG=$(find PACKAGES/rabbitmq-server-generic-unix-*.tar.xz | awk -F 'PACKAGES/rabbitmq-server-generic-unix-|.tar.xz' '{print $2}') RABBITMQ_DOCKER_IMAGE=pivotalrabbitmq/rabbitmq:$IMAGE_TAG \ ${SELENIUM_DIR}/run-suites.sh full-suite-management-ui + + - name: Prepare logs for upload + if: ${{ failure() && steps.tests.outcome == 'failed' }} + run: | mkdir -p /tmp/full-suite - mv /tmp/selenium/* /tmp/full-suite + mv -v /tmp/selenium/* /tmp/full-suite - name: Upload Test Artifacts - if: always() + if: ${{ failure() && steps.tests.outcome == 'failed' }} uses: actions/upload-artifact@v4.3.2 with: name: test-artifacts-${{ matrix.browser }}-${{ matrix.erlang_version }} path: | /tmp/full-suite - /tmp/short-suite