Skip to content

Commit

Permalink
[fix] Print Kafka logs on test failure (#5873)
Browse files Browse the repository at this point in the history
## 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 <[email protected]>
  • Loading branch information
joeyyy09 authored Aug 21, 2024
1 parent 133b07a commit 00fdcd8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci-e2e-kafka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions scripts/kafka-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <jaeger_version>"
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -98,6 +108,8 @@ main() {
wait_for_kafka

run_integration_test

success="true"
}

main "$@"

0 comments on commit 00fdcd8

Please sign in to comment.