Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into security-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DarshitChanpura committed Jul 23, 2024
2 parents a25b14f + 34ff292 commit dce0965
Show file tree
Hide file tree
Showing 38 changed files with 465 additions and 283 deletions.
1 change: 1 addition & 0 deletions .cspell
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ aarch
actiongroup
actiongroups
aggregatable
argjson
asciifolding
authc
authinfo
Expand Down
3 changes: 2 additions & 1 deletion .github/opensearch-cluster/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ services:
environment:
- 'OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD:-myStrongPassword123!}'
- discovery.type=single-node
- path.repo=/tmp/opensearch/repo
- path.repo=/tmp/opensearch/repo
- plugins.index_state_management.job_interval=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Spec Test Coverage Analysis
{{with .test_coverage}}

| Total | Tested |
|-------------------|----------------------------------------------------------|
| {{.paths_count}} | {{.evaluated_paths_count}} ({{.evaluated_paths_pct}} %) |

{{end}}
3 changes: 2 additions & 1 deletion .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
workflow_run:
workflows:
- Analyze PR Changes
- Test Spec
types:
- completed

Expand Down Expand Up @@ -71,4 +72,4 @@ jobs:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ env.PR_NUMBER }}
body: ${{ steps.render.outputs.result }}
edit-mode: replace
edit-mode: replace
59 changes: 58 additions & 1 deletion .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,61 @@ jobs:
run: docker-compose up -d

- name: Run Tests
run: npm run test:spec -- --opensearch-insecure
run: |
npm run test:spec -- --opensearch-insecure --coverage coverage/test-spec-coverage-${{ matrix.entry.version }}.json
- name: Upload Test Coverage Results
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.entry.version }}
path: coverage/test-spec-coverage-${{ matrix.entry.version }}.json

merge-coverage:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: test-opensearch-spec
steps:
- uses: actions/checkout@v3

- name: Download Spec Coverage Data
uses: actions/download-artifact@v4
with:
path: coverage

- name: Combine Test Coverage Data
shell: bash -eo pipefail {0}
run: |
jq -sc '
map(to_entries) |
flatten |
group_by(.key) |
map({key: .[0].key, value: map(.value) | max}) |
from_entries |
.' $(find ./coverage -name "test-spec-coverage-*.json") > ./coverage/coverage.json
cat ./coverage/coverage.json
- name: Construct Comment Data Payload
shell: bash -eo pipefail {0}
run: |
jq \
--arg pr_number ${PR_NUMBER} \
--slurpfile test_coverage ./coverage/coverage.json \
--null-input '
{
"pr_number": ($pr_number),
"comment_identifier": "# Test Coverage Analysis",
"template_name": "pr-test-coverage-analysis",
"template_data": {
"test_coverage": ($test_coverage[0])
}
}
' | tee pr-comment.json
env:
PR_NUMBER: ${{ github.event.pull_request.number }}

- name: Upload PR Comment Payload
uses: actions/upload-artifact@v4
with:
name: pr-comment
path: pr-comment.json
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `is_hidden` to `/{index}/_alias/{name}` and `/{index}/_aliases/{name}` ([#429](https://github.com/opensearch-project/opensearch-api-specification/pull/429))
- Added `ignore_unmapped` to `GeoDistanceQuery` ([#427](https://github.com/opensearch-project/opensearch-api-specification/pull/427))
- Added missing variants of `indices.put_alias` ([#434](https://github.com/opensearch-project/opensearch-api-specification/pull/434))
- Added `plugins` to NodeInfoSettings ([#442](https://github.com/opensearch-project/opensearch-api-specification/pull/442))
- Added test coverage ([#443](https://github.com/opensearch-project/opensearch-api-specification/pull/443))
- Added tests for security APIs ([#439](https://github.com/opensearch-project/opensearch-api-specification/pull/439))

### Changed
Expand All @@ -61,6 +63,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Replaced the deprecated fs.rmdirSync with fs.rmSync ([#359](https://github.com/opensearch-project/opensearch-api-specification/pull/359))
- Tester tool now provides better context for non-2XX responses when --verbose is used ([#359](https://github.com/opensearch-project/opensearch-api-specification/pull/359))
- Lock testing for next release of OpenSearch to a specific SHA ([#431](https://github.com/opensearch-project/opensearch-api-specification/pull/431))
- Replace nullable with null type ([#436](https://github.com/opensearch-project/opensearch-api-specification/pull/436))

### Deprecated

Expand Down
Loading

0 comments on commit dce0965

Please sign in to comment.