Skip to content

Commit fd0b769

Browse files
authored
Add JUnit Test Reports to build outputs. (#15271)
It's difficult today to parse all the logs from tests. Engineers waste time scrolling through the log outputs and looking for the relevant stack trace. This PR adds an action to generate a JUnit report so devs can understand test results at a glance. This generates 3 reports for each of the main build jobs when the build completes. We leave the frontend build out since this is aggregated by cypress. See https://github.com/airbytehq/airbyte/pull/15271/checks?check_run_id=7683783016 for an example of how this works. Use the https://github.com/dorny/test-reporter action and configure this to look at the Jacoco test report output for top level and second level builds. Note that most of the parameters into the action don't work. Comment out the trap commands to output logs. Though this can be useful for debugging, there is little practical use in the day-to-day, and results in extremely noisy logs.
1 parent 7d95d5f commit fd0b769

File tree

4 files changed

+37
-7
lines changed

4 files changed

+37
-7
lines changed

.github/workflows/gradle.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,15 @@ jobs:
234234
- name: Ensure no file change
235235
run: git --no-pager diff && test -z "$(git --no-pager diff)"
236236

237+
- name: Generate Test Report
238+
uses: dorny/test-reporter@v1
239+
if: always()
240+
with:
241+
name: Connectors Base Test Report
242+
# Specify top-level and second-level modules. Note there cannot be a space between the comma.
243+
path: '/actions-runner/_work/airbyte/airbyte/*/build/test-results/*/*.xml,/actions-runner/_work/airbyte/airbyte/*/*/build/test-results/*/*.xml'
244+
reporter: java-junit
245+
237246
# In case of self-hosted EC2 errors, remove this block.
238247
stop-connectors-base-build-runner:
239248
name: "Connectors Base: Stop Build EC2 Runner"
@@ -471,7 +480,8 @@ jobs:
471480
SUB_BUILD=PLATFORM ./gradlew build javadoc --scan
472481
473482
- name: Integration test
474-
run: SUB_BUILD=PLATFORM ./gradlew newIntegrationTest
483+
run: |
484+
SUB_BUILD=PLATFORM ./gradlew newIntegrationTest
475485
476486
- name: Slow integration test
477487
if: contains(github.ref, 'bump-version') || contains(github.ref, 'master')
@@ -485,16 +495,25 @@ jobs:
485495
if: success() && github.ref == 'refs/heads/master'
486496
run: ./tools/site/link_checker.sh check_docs
487497

488-
# This is only required on the usual github runner. The usual runner does not contain enough disk space for our use.
489-
# - name: Get Docker Space
490-
# run: docker run --rm busybox df -h
498+
# This is only required on the usual github runner. The usual runner does not contain enough disk space for our use.
499+
# - name: Get Docker Space
500+
# run: docker run --rm busybox df -h
491501

492502
- name: Run End-to-End Acceptance Tests
493503
run: ./tools/bin/acceptance_test.sh
494504

495505
- name: Automatic Migration Acceptance Test
496506
run: SUB_BUILD=PLATFORM ./gradlew :airbyte-tests:automaticMigrationAcceptanceTest --scan -i
497507

508+
- name: Generate Test Report
509+
uses: dorny/test-reporter@v1
510+
if: always() # run this step even if previous step failed
511+
with:
512+
name: Platform Test Report with Docker E2E Test
513+
# Specify top-level and second-level modules. Note there cannot be a space between the comma.
514+
path: '/actions-runner/_work/airbyte/airbyte/*/build/test-results/*/*.xml,/actions-runner/_work/airbyte/airbyte/*/*/build/test-results/*/*.xml'
515+
reporter: java-junit
516+
498517
# In case of self-hosted EC2 errors, remove this block.
499518
stop-platform-build-runner:
500519
name: "Platform: Stop Build EC2 Runner"
@@ -626,6 +645,14 @@ jobs:
626645
run: |
627646
CI=true IS_MINIKUBE=true ./tools/bin/acceptance_test_kube.sh
628647
648+
- name: Generate Test Report
649+
uses: dorny/test-reporter@v1
650+
if: always() # run this step even if previous step failed
651+
with:
652+
name: Platform Kubernetes E2E Test Report
653+
path: '/actions-runner/_work/airbyte/airbyte/*/build/test-results/*/*.xml'
654+
reporter: java-junit
655+
629656
- uses: actions/upload-artifact@v2
630657
if: failure()
631658
with:

airbyte-test-utils/src/main/java/io/airbyte/test/airbyte_test_container/AirbyteTestContainer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ public void startBlocking() throws IOException, InterruptedException {
7070
@SuppressWarnings({"unchecked", "rawtypes"})
7171
public void startAsync() throws IOException, InterruptedException {
7272
final File cleanedDockerComposeFile = prepareDockerComposeFile(dockerComposeFile);
73-
dockerComposeContainer = new DockerComposeContainer(cleanedDockerComposeFile).withEnv(env);
73+
dockerComposeContainer = new DockerComposeContainer(cleanedDockerComposeFile)
74+
.withEnv(env);
75+
7476
// Only expose logs related to db migrations.
7577
serviceLogConsumer(dockerComposeContainer, "init");
7678
serviceLogConsumer(dockerComposeContainer, "bootloader");

tools/bin/acceptance_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ VERSION=dev TRACKING_STRATEGY=logging USE_STREAM_CAPABLE_STATE=true docker-compo
1414
# Sometimes source/dest containers using airbyte volumes survive shutdown, which need to be killed in order to shut down properly.
1515
shutdown_cmd="docker-compose down -v || docker kill \$(docker ps -a -f volume=airbyte_workspace -f volume=airbyte_data -f volume=airbyte_db -q) && docker-compose down -v"
1616
# Uncomment for debugging. Warning, this is verbose.
17-
#trap "echo 'docker-compose logs:' && docker-compose logs -t --tail 1000 && $shutdown_cmd" EXIT
17+
# trap "echo 'docker-compose logs:' && docker-compose logs -t --tail 1000 && $shutdown_cmd" EXIT
1818

1919
echo "Waiting for services to begin"
2020
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8000/api/v1/health)" != "200" ]]; do echo "Waiting for docker deployment.."; sleep 5; done

tools/bin/e2e_test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ mkdir -p /tmp/airbyte_local
1616

1717
# Detach so we can run subsequent commands
1818
VERSION=dev TRACKING_STRATEGY=logging docker-compose up -d
19-
trap 'echo "docker-compose logs:" && docker-compose logs -t --tail 1000 && docker-compose down && docker stop airbyte_ci_pg' EXIT
19+
# Uncomment for debugging. Warning, this is verbose.
20+
# trap 'echo "docker-compose logs:" && docker-compose logs -t --tail 1000 && docker-compose down && docker stop airbyte_ci_pg' EXIT
2021

2122
docker run --rm -d -p 5433:5432 -e POSTGRES_PASSWORD=secret_password -e POSTGRES_DB=airbyte_ci --name airbyte_ci_pg postgres
2223
echo "Waiting for health API to be available..."

0 commit comments

Comments
 (0)