From 00fdcd841cc85f1f807ba2cb0c6336931c34c366 Mon Sep 17 00:00:00 2001 From: Harshith Mente <109957201+joeyyy09@users.noreply.github.com> Date: Wed, 21 Aug 2024 23:41:14 +0530 Subject: [PATCH] [fix] Print Kafka logs on test failure (#5873) ## Description of the changes - Add Kafka service logging before shutdown in Kafka integration test script ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: joeyyy09 --- .github/workflows/ci-e2e-kafka.yml | 4 ---- scripts/kafka-integration-test.sh | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-e2e-kafka.yml b/.github/workflows/ci-e2e-kafka.yml index 0b1dfa79250..f043b9778fd 100644 --- a/.github/workflows/ci-e2e-kafka.yml +++ b/.github/workflows/ci-e2e-kafka.yml @@ -38,10 +38,6 @@ jobs: id: test-execution run: bash scripts/kafka-integration-test.sh -j ${{ matrix.jaeger-version }} - - name: Output Kafka logs on failure - run: docker compose -f ${{ steps.test-execution.outputs.docker_compose_file }} logs - if: ${{ failure() }} - - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/scripts/kafka-integration-test.sh b/scripts/kafka-integration-test.sh index b46e809ff45..eecaaf2092d 100755 --- a/scripts/kafka-integration-test.sh +++ b/scripts/kafka-integration-test.sh @@ -10,6 +10,7 @@ echo "docker_compose_file=${compose_file}" >> "${GITHUB_OUTPUT:-/dev/null}" jaeger_version="" manage_kafka="true" +success="false" print_help() { echo "Usage: $0 [-K] -j " @@ -43,7 +44,16 @@ setup_kafka() { docker compose -f "${compose_file}" up -d kafka } +dump_logs() { + echo "::group::Kafka logs" + docker compose -f "${compose_file}" logs + echo "::endgroup::" +} + teardown_kafka() { + if [[ "$success" == "false" ]]; then + dump_logs + fi echo "Stopping Kafka..." docker compose -f "${compose_file}" down } @@ -98,6 +108,8 @@ main() { wait_for_kafka run_integration_test + + success="true" } main "$@"