Skip to content

Commit

Permalink
Fix: merging coverage includes plugin tests. (#662)
Browse files Browse the repository at this point in the history
* Fix: merging coverage includes plugin tests.

Signed-off-by: dblock <[email protected]>

* Display missing test paths.

Signed-off-by: dblock <[email protected]>

---------

Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Nov 11, 2024
1 parent a3b1804 commit 0d5f712
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,16 @@ jobs:
working-directory: tests/${{ matrix.entry.tests || 'default' }}
run: docker compose up -d

- name: Generate Test Files Hash
id: tests
run: echo "hash=${{ matrix.entry.version }}-${{ hashFiles(format('tests/{0}', matrix.entry.tests || 'default')) }}" >> $GITHUB_OUTPUT

- name: Run Tests
run: |
npm run test:spec -- \
--opensearch-insecure \
--opensearch-version=${{ matrix.entry.version }} \
--coverage coverage/test-spec-coverage-${{ matrix.entry.version }}-${{ matrix.entry.tests || 'default' }}.json \
--coverage coverage/test-spec-coverage-${{ steps.tests.outputs.hash }}.json \
--tests=tests/${{ matrix.entry.tests || 'default' }}
- name: Get Container Logs
Expand All @@ -96,8 +100,8 @@ jobs:
- name: Upload Test Coverage Results
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.entry.version }}-${{ hashFiles(format('tests/{0}', matrix.entry.tests || 'default')) }}
path: coverage/test-spec-coverage-${{ matrix.entry.version }}-${{ matrix.entry.tests || 'default' }}.json
name: coverage-${{ matrix.entry.version }}-${{ steps.tests.outputs.hash }}
path: coverage/test-spec-coverage-${{ steps.tests.outputs.hash }}.json

merge-coverage:
runs-on: ubuntu-latest
Expand All @@ -111,6 +115,17 @@ jobs:
with:
path: coverage

- name: Display Missing Test Paths
run: |
jq -sc '
(map(.operations) | add | unique) as $all |
(map(.evaluated_operations) | add | unique) as $evaluated |
$all-$evaluated |
sort_by(.path) |
.[] |
"\(.method) \(.path)"
' $(find ./ -name "test-spec-coverage-*.json")
- name: Combine Test Coverage Data
shell: bash -eo pipefail {0}
run: |
Expand Down

0 comments on commit 0d5f712

Please sign in to comment.