Skip to content

Commit

Permalink
Merge branch 'main' into term-vectors
Browse files Browse the repository at this point in the history
Signed-off-by: Niyazbek Torekeldi <[email protected]>
  • Loading branch information
Tokesh authored Dec 17, 2024
2 parents 7525a18 + eb948fb commit f3080c7
Show file tree
Hide file tree
Showing 29 changed files with 645 additions and 34 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ jobs:
tests: plugins/workload-management
- version: 2.18.0
tests: plugins/analysis
- version: 2.18.0
tests: plugins/security
cert: tests/plugins/security/.kirk.pem
key: tests/plugins/security/.kirk-key.pem
- version: 2.19.0
hub: opensearchstaging
ref: '@sha256:4da23e0137b2b67206d23b36fcf0914cc39b3bf19310c782f536e4934b86f6cc'
Expand Down Expand Up @@ -97,6 +101,8 @@ jobs:
--opensearch-version=${{ matrix.entry.version }} \
--coverage coverage/test-spec-coverage-${{ steps.tests.outputs.hash }}.json \
--opensearch-url=${{ matrix.entry.url || 'https://localhost:9200'}} \
--opensearch-cert=${{ matrix.entry.cert }} \
--opensearch-key=${{ matrix.entry.key }} \
--tests=tests/${{ matrix.entry.tests || 'default' }}
- name: Get Container Logs
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added response schema for `PUT` and `DELETE /_plugins/_transform/{id}` ([#722](https://github.com/opensearch-project/opensearch-api-specification/pull/716))
- Added response schema for `GET /_plugins/_knn/warmup/{index}` ([#717](https://github.com/opensearch-project/opensearch-api-specification/pull/717))
- Added support for multiple test verbs ([#724](https://github.com/opensearch-project/opensearch-api-specification/pull/724))
- Added support for using a certificate and key in tests ([#731](https://github.com/opensearch-project/opensearch-api-specification/pull/731))
- Added `_type` to `termvector` and `mtermvector` ([#734](https://github.com/opensearch-project/opensearch-api-specification/pull/734))

### Removed
Expand Down Expand Up @@ -71,6 +72,9 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed response schema for `/_render/template` and `/_render/template/{id}` ([#724](https://github.com/opensearch-project/opensearch-api-specification/pull/724))
- Fixed data stream schema numeric property types ([#725](https://github.com/opensearch-project/opensearch-api-specification/pull/725))
- Fixed snapshot status numeric property types ([#729](https://github.com/opensearch-project/opensearch-api-specification/pull/729))
- Fixed request schema for `PATCH /_plugins/_security/api/nodesdn` ([#731](https://github.com/opensearch-project/opensearch-api-specification/pull/731))
- Fixed response schema for `GET /_plugins/_security/api/nodesdn/{cluster_name}` ([#731](https://github.com/opensearch-project/opensearch-api-specification/pull/731))
- Fixed request body for `/_search/scroll/{scroll_id}` ([#732](https://github.com/opensearch-project/opensearch-api-specification/pull/732))

### Changed
- Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683))
Expand Down
2 changes: 2 additions & 0 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ The dump-cluster-spec tool connects to an OpenSearch cluster which has the [open
- `--opensearch-insecure`: Disable SSL/TLS certificate verification, defaults to performing verification.
- `--opensearch-username <username>`: The username to authenticate with the cluster, defaults to `admin`, only used when `--opensearch-password` is set.
- `--opensearch-password <password>`: The password to authenticate with the cluster, also settable via the `OPENSEARCH_PASSWORD` environment variable.
- `--opensearch-cert <file>`: The OpenSSL certificate file, also settable via the `OPENSEARCH_CERT` environment variable.
- `--opensearch-key <file>`: The OpenSSL certificate private key, also settable via the `OPENSEARCH_KEY` environment variable.
- `--output <path>`: The path to write the dumped spec to, defaults to `<repository-root>/build/opensearch-openapi-CLUSTER.yaml`.

**Example**
Expand Down
14 changes: 14 additions & 0 deletions TESTING_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [Prerequisites](#prerequisites)
- [OpenSearch Cluster](#opensearch-cluster)
- [Run Tests](#run-tests)
- [Running Spec Tests that Require an Admin Certificate](#running-spec-tests-that-require-an-admin-certificate)
- [Running Spec Tests with Amazon OpenSearch](#running-spec-tests-with-amazon-opensearch)
- [Common Errors](#common-errors)
- [401 Unauthorized](#401-unauthorized)
Expand Down Expand Up @@ -76,6 +77,19 @@ Want to help with some missing tests? Choose from the remaining paths in the tes
npm run test:spec -- --opensearch-insecure --coverage-report
```
### Running Spec Tests that Require an Admin Certificate
Some tests may require an admin certificate for authorization. The certificate can be provided wth `--opensearch-cert` and the key with `opensearch-key`.
For example, run tests in [plugins/security](tests/plugins/security) as follows:
```bash
npm run test:spec--insecure -- \
--tests tests/plugins/security/api/nodesdn.yaml \
--opensearch-key tests/plugins/security/kirk-key.pem \
--opensearch-cert tests/plugins/security/kirk.pem \
--verbose
```
### Running Spec Tests with Amazon OpenSearch
Use an Amazon OpenSearch service instance.
Expand Down
3 changes: 0 additions & 3 deletions spec/namespaces/_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2523,9 +2523,6 @@ components:
$ref: '../schemas/_common.yaml#/components/schemas/Duration'
scroll_id:
$ref: '../schemas/_common.yaml#/components/schemas/ScrollId'
required:
- scroll_id
description: The scroll ID if not passed by URL or query parameter.
search:
content:
application/json:
Expand Down
11 changes: 9 additions & 2 deletions spec/namespaces/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,8 @@ paths:
responses:
'200':
$ref: '#/components/responses/security.update_distinguished_name@200'
'201':
$ref: '#/components/responses/security.update_distinguished_name@201'
'400':
$ref: '#/components/responses/security.update_distinguished_name@400'
'403':
Expand Down Expand Up @@ -1449,7 +1451,7 @@ components:
content:
application/json:
schema:
$ref: '../schemas/security._common.yaml#/components/schemas/PatchOperation'
$ref: '../schemas/security._common.yaml#/components/schemas/PatchOperations'
security.patch_distinguished_names:
content:
application/json:
Expand Down Expand Up @@ -1843,7 +1845,7 @@ components:
content:
application/json:
schema:
$ref: '../schemas/security._common.yaml#/components/schemas/DistinguishedNames'
$ref: '../schemas/security._common.yaml#/components/schemas/DistinguishedNamesMap'
security.get_distinguished_name@400:
content:
application/json:
Expand Down Expand Up @@ -2183,6 +2185,11 @@ components:
application/json:
schema:
$ref: '../schemas/security._common.yaml#/components/schemas/Ok'
security.update_distinguished_name@201:
content:
application/json:
schema:
$ref: '../schemas/security._common.yaml#/components/schemas/Ok'
security.update_distinguished_name@400:
content:
application/json:
Expand Down
5 changes: 5 additions & 0 deletions spec/schemas/security._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,11 @@ components:
type: string
description: Message returned as part of CREATED response.

PatchOperations:
type: array
items:
$ref: '#/components/schemas/PatchOperation'

PatchOperation:
type: object
properties:
Expand Down
33 changes: 33 additions & 0 deletions tests/default/_core/point_in_time/all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test point-in-time.
version: '>= 2.4'
epilogues:
- path: /_search/point_in_time/_all
method: DELETE
- path: /movies
method: DELETE
status: [200, 404]
prologues:
- path: /_bulk
method: POST
parameters:
refresh: true
request:
content_type: application/x-ndjson
payload:
- {create: {_index: movies}}
- {title: The Cruise, year: 1998}
- {create: {_index: movies}}
- {title: Drive, year: 1960}
- path: /movies/_search/point_in_time
method: POST
parameters:
keep_alive: 1m
chapters:
- synopsis: Get all point in time.
path: /_search/point_in_time/_all
method: GET
- synopsis: Delete all point in time.
path: /_search/point_in_time/_all
method: DELETE
19 changes: 19 additions & 0 deletions tests/default/_core/search.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test search.
chapters:
- synopsis: Search across all indexes (GET).
path: /_search
method: GET
request:
payload:
query:
match_all: {}
- synopsis: Search across all indexes (POST).
path: /_search
method: POST
request:
payload:
query:
match_all: {}

33 changes: 33 additions & 0 deletions tests/default/_core/search/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test the creation of a search pipeline.
version: '>= 2.9'
epilogues:
- path: /_search/pipeline/empty-pipeline
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create search pipeline.
path: /_search/pipeline/{id}
method: PUT
parameters:
id: empty-pipeline
request:
payload: {}
response:
status: 200
payload:
acknowledged: true
- synopsis: Query all pipelines.
path: /_search/pipeline
method: GET
- synopsis: Query created pipeline.
path: /_search/pipeline/{id}
method: GET
parameters:
id: empty-pipeline
- synopsis: Delete created pipeline.
path: /_search/pipeline/{id}
method: DELETE
parameters:
id: empty-pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ prologues:
name: Drive
status: [201]
epilogues:
- path: /_search/pipeline/names_pipeline
- path: /_search/pipeline/rename-field
method: DELETE
status: [200, 404]
- path: /movies
Expand All @@ -24,7 +24,7 @@ chapters:
path: /_search/pipeline/{id}
method: PUT
parameters:
id: names_pipeline
id: rename-field
request:
payload:
response_processors:
Expand All @@ -35,21 +35,14 @@ chapters:
status: 200
payload:
acknowledged: true
- synopsis: Query created pipeline.
path: /_search/pipeline/{id}
method: GET
parameters:
id: names_pipeline
response:
status: 200
- synopsis: Search.
warnings:
multiple-paths-detected: false
path: /{index}/_search
method: GET
parameters:
index: movies
search_pipeline: names_pipeline
search_pipeline: rename-field
response:
status: 200
payload:
Expand Down
37 changes: 37 additions & 0 deletions tests/default/_core/search/point_in_time.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test point-in-time.
version: '>= 2.4'
epilogues:
- path: /_search/point_in_time/_all
method: DELETE
- path: /movies
method: DELETE
status: [200, 404]
prologues:
- path: /_bulk
method: POST
parameters:
refresh: true
request:
content_type: application/x-ndjson
payload:
- {create: {_index: movies}}
- {title: The Cruise, year: 1998}
- {create: {_index: movies}}
- {title: Drive, year: 1960}
- path: /movies/_search/point_in_time
id: pit
method: POST
parameters:
keep_alive: 1m
output:
id: payload.pit_id
chapters:
- synopsis: Delete all pits.
path: /_search/point_in_time
request:
payload:
pit_id:
- ${pit.id}
method: DELETE
Loading

0 comments on commit f3080c7

Please sign in to comment.