From 09250b5d30a7694bf0eb87c70ba08975e508e36f Mon Sep 17 00:00:00 2001 From: James Ryans Date: Wed, 8 May 2024 21:27:32 +0700 Subject: [PATCH 1/3] dump storage docker logs if test failed Signed-off-by: James Ryans --- .github/workflows/ci-cassandra.yml | 5 +++++ .github/workflows/ci-elasticsearch.yml | 5 +++++ .github/workflows/ci-opensearch.yml | 5 +++++ scripts/cassandra-integration-test.sh | 3 +-- scripts/es-integration-test.sh | 4 ++-- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-cassandra.yml b/.github/workflows/ci-cassandra.yml index 0c2304bccf9..15cbfdb5a62 100644 --- a/.github/workflows/ci-cassandra.yml +++ b/.github/workflows/ci-cassandra.yml @@ -44,8 +44,13 @@ jobs: go-version: 1.22.x - name: Run cassandra integration tests + id: test-execution run: bash scripts/cassandra-integration-test.sh ${{ matrix.version.image }} ${{ matrix.version.schema }} ${{ matrix.jaeger-version }} + - name: Output Cassandra logs + run: docker logs ${{ steps.test-execution.outputs.cid }} + if: ${{ failure() }} + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.github/workflows/ci-elasticsearch.yml b/.github/workflows/ci-elasticsearch.yml index 92781ce6a54..6c2175c8971 100644 --- a/.github/workflows/ci-elasticsearch.yml +++ b/.github/workflows/ci-elasticsearch.yml @@ -58,8 +58,13 @@ jobs: - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 - name: Run elasticsearch integration tests + id: test-execution run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.image }} + - name: Output Elasticsearch logs + run: docker logs ${{ steps.test-execution.outputs.cid }} + if: ${{ failure() }} + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/.github/workflows/ci-opensearch.yml b/.github/workflows/ci-opensearch.yml index ada7ba1a015..6556a36360c 100644 --- a/.github/workflows/ci-opensearch.yml +++ b/.github/workflows/ci-opensearch.yml @@ -52,8 +52,13 @@ jobs: - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 - name: Run opensearch integration tests + id: test-execution run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.image }} + - name: Output Opensearch logs + run: docker logs ${{ steps.test-execution.outputs.cid }} + if: ${{ failure() }} + - name: Upload coverage to codecov uses: ./.github/actions/upload-codecov with: diff --git a/scripts/cassandra-integration-test.sh b/scripts/cassandra-integration-test.sh index 294122b3fb4..06527c3a772 100755 --- a/scripts/cassandra-integration-test.sh +++ b/scripts/cassandra-integration-test.sh @@ -18,14 +18,13 @@ setup_cassandra() { local tag=$1 local image=cassandra local params=( - --rm --detach --publish 9042:9042 --publish 9160:9160 ) local cid cid=$(docker run "${params[@]}" "${image}:${tag}") - echo "${cid}" + echo "${cid}" >> "$GITHUB_OUTPUT" } teardown_cassandra() { diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index fc036cf7da5..1eebb065647 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -42,7 +42,7 @@ setup_es() { local cid cid=$(docker run "${params[@]}" "${image}:${tag}") - echo "${cid}" + echo "${cid}" >> "$GITHUB_OUTPUT" } setup_opensearch() { @@ -57,7 +57,7 @@ setup_opensearch() { ) local cid cid=$(docker run "${params[@]}" "${image}:${tag}") - echo "${cid}" + echo "${cid}" >> "$GITHUB_OUTPUT" } wait_for_storage() { From 5858824e4f300c53704bbc742521b46c8849562e Mon Sep 17 00:00:00 2001 From: James Ryans Date: Wed, 8 May 2024 21:54:57 +0700 Subject: [PATCH 2/3] fix wrong echo text to GITHUB_OUTPUT Signed-off-by: James Ryans --- scripts/cassandra-integration-test.sh | 2 +- scripts/es-integration-test.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/cassandra-integration-test.sh b/scripts/cassandra-integration-test.sh index 06527c3a772..2025c915f76 100755 --- a/scripts/cassandra-integration-test.sh +++ b/scripts/cassandra-integration-test.sh @@ -24,7 +24,7 @@ setup_cassandra() { ) local cid cid=$(docker run "${params[@]}" "${image}:${tag}") - echo "${cid}" >> "$GITHUB_OUTPUT" + echo "cid=${cid}" >> "$GITHUB_OUTPUT" } teardown_cassandra() { diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index 1eebb065647..0bd220e2b43 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -42,7 +42,7 @@ setup_es() { local cid cid=$(docker run "${params[@]}" "${image}:${tag}") - echo "${cid}" >> "$GITHUB_OUTPUT" + echo "cid=${cid}" >> "$GITHUB_OUTPUT" } setup_opensearch() { @@ -57,7 +57,7 @@ setup_opensearch() { ) local cid cid=$(docker run "${params[@]}" "${image}:${tag}") - echo "${cid}" >> "$GITHUB_OUTPUT" + echo "cid=${cid}" >> "$GITHUB_OUTPUT" } wait_for_storage() { From a2918f529480eb4f4884cd91a68141c964701393 Mon Sep 17 00:00:00 2001 From: James Ryans Date: Wed, 8 May 2024 22:38:33 +0700 Subject: [PATCH 3/3] return cid to the func called Signed-off-by: James Ryans --- scripts/cassandra-integration-test.sh | 1 + scripts/es-integration-test.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/scripts/cassandra-integration-test.sh b/scripts/cassandra-integration-test.sh index 2025c915f76..e73c628b59d 100755 --- a/scripts/cassandra-integration-test.sh +++ b/scripts/cassandra-integration-test.sh @@ -25,6 +25,7 @@ setup_cassandra() { local cid cid=$(docker run "${params[@]}" "${image}:${tag}") echo "cid=${cid}" >> "$GITHUB_OUTPUT" + echo "${cid}" } teardown_cassandra() { diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index 0bd220e2b43..f4f11d4be6a 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -43,6 +43,7 @@ setup_es() { local cid cid=$(docker run "${params[@]}" "${image}:${tag}") echo "cid=${cid}" >> "$GITHUB_OUTPUT" + echo "${cid}" } setup_opensearch() { @@ -58,6 +59,7 @@ setup_opensearch() { local cid cid=$(docker run "${params[@]}" "${image}:${tag}") echo "cid=${cid}" >> "$GITHUB_OUTPUT" + echo "${cid}" } wait_for_storage() {