Skip to content

Commit

Permalink
Merge branch 'main' into vale
Browse files Browse the repository at this point in the history
Signed-off-by: Theo N. Truong <[email protected]>
  • Loading branch information
nhtruong authored Oct 24, 2024
2 parents ce71bb6 + 110474f commit 93c1b65
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
tests: plugins/query_insights
- version: 2.18.0
hub: opensearchstaging
ref: '@sha256:4445e195c53992038891519dc3be0d273cdaad1b047943d68921168ed243e7e9'
ref: '@sha256:57a1cd1142d68c203e2e4aa0666d9a691e1e409a5d14aa4a8f5044036f05cf06'
- version: 3.0.0
hub: opensearchstaging
ref: '@sha256:727643acdfebed77bfdb26362dbcff536b7ea02a0cc4ae2da2521729171333de'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added API spec for query insights plugin ([#625](https://github.com/opensearch-project/opensearch-api-specification/pull/625))
- Added API spec for `adjust_pure_negative` for bool queries ([#641](https://github.com/opensearch-project/opensearch-api-specification/pull/641))
- Added a spec style checker [#620](https://github.com/opensearch-project/opensearch-api-specification/pull/620).
- Added `remote_store` to node `Stats` ([#643](https://github.com/opensearch-project/opensearch-api-specification/pull/643))

### Changed

Expand Down
131 changes: 108 additions & 23 deletions TESTING_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
<!-- TOC -->
* [Spec Testing Guide](#spec-testing-guide)
* [Running Spec Tests](#running-spec-tests)
* [Running Spec Tests Locally](#running-spec-tests-locally)
* [Prerequisites](#prerequisites-)
* [OpenSearch Cluster](#opensearch-cluster-)
* [Run Tests](#run-tests)
* [Running Spec Tests with Amazon OpenSearch](#running-spec-tests-with-amazon-opensearch)
* [Common Errors](#common-errors)
* [401 Unauthorized](#401-unauthorized)
* [FORBIDDEN/10/cluster create-index blocked (api)](#forbidden10cluster-create-index-blocked-api)
* [FAILED Cat with a json response (from security-analytics).](#failed--cat-with-a-json-response-from-security-analytics)
* [Writing Spec Tests](#writing-spec-tests)
* [Simple Test Story](#simple-test-story)
* [Using Output from Previous Chapters](#using-output-from-previous-chapters)
* [Managing Versions](#managing-versions)
* [Managing Distributions](#managing-distributions)
* [Waiting for Tasks](#waiting-for-tasks)
* [Warnings](#warnings)
* [multiple-paths-detected](#multiple-paths-detected)
* [Suppressing Warnings](#suppressing-warnings)
* [Collecting Test Coverage](#collecting-test-coverage)
* [Coverage Summary](#coverage-summary)
* [Coverage Report](#coverage-report)
- [Spec Testing Guide](#spec-testing-guide)
- [Running Spec Tests](#running-spec-tests)
- [Running Spec Tests Locally](#running-spec-tests-locally)
- [Prerequisites](#prerequisites)
- [OpenSearch Cluster](#opensearch-cluster)
- [Run Tests](#run-tests)
- [Running Spec Tests with Amazon OpenSearch](#running-spec-tests-with-amazon-opensearch)
- [Common Errors](#common-errors)
- [401 Unauthorized](#401-unauthorized)
- [FORBIDDEN/10/cluster create-index blocked (api)](#forbidden10cluster-create-index-blocked-api)
- [FAILED Cat with a json response (from security-analytics).](#failed--cat-with-a-json-response-from-security-analytics)
- [Writing Spec Tests](#writing-spec-tests)
- [Simple Test Story](#simple-test-story)
- [Using Output from Previous Chapters](#using-output-from-previous-chapters)
- [Managing Versions](#managing-versions)
- [Managing Distributions](#managing-distributions)
- [Waiting for Tasks](#waiting-for-tasks)
- [Warnings](#warnings)
- [multiple-paths-detected](#multiple-paths-detected)
- [Suppressing Warnings](#suppressing-warnings)
- [Collecting Test Coverage](#collecting-test-coverage)
- [Coverage Summary](#coverage-summary)
- [Coverage Report](#coverage-report)
- [Integration Testing](#integration-testing)
- [Stable Releases](#stable-releases)
- [Custom Setup](#custom-setup)
- [Future Releases](#future-releases)
<!-- TOC -->

# Spec Testing Guide
Expand Down Expand Up @@ -375,4 +379,85 @@ The test tool can display detailed and hierarchal test coverage with `--coverage
GET /_alias/{name}
POST /_alias/{name}
HEAD /_alias/{name}
```
## Integration Testing
This project runs integration tests against multiple versions of OpenSearch in the [test-spec.yml](.github/workflows/test-spec.yml) workflow.
### Stable Releases
The simplest entry in the test matrix executes tests in [tests/default](tests/default) against a released version of OpenSearch.
For example, the following entries run tests gainst OpenSearch 1.3.17 and 2.17.0.
```yaml
entry:
- version: 1.3.17
- version: 2.17.0
```
### Custom Setup
Some tests require a custom docker image. For example, testing the notifications plugin requires a custom webhook. This can be done by creating a custom `docker-compose.yml`, such as the one in [tests/plugins/notifications](tests/plugins/notifications/docker-compose.yml).
```yaml
webhook:
image: python:latest
volumes:
- ./server.py:/server.py
ports:
- '8080:8080'
entrypoint: python server.py
```
The following example in the test matrix will use the custom `docker-compose.yml` and execute all tests in [tests/plugins/notifications](tests/plugins/notifications).
```yaml
entry:
- version: 2.17.0
tests: plugins/notifications
```
### Future Releases
Snapshot builds of OpenSearch are available on Docker Hub under [opensearchstaging/opensearch/tags](https://hub.docker.com/r/opensearchstaging/opensearch/tags).
The following example in the test matrix will use [a snapshot build of OpenSearch 2.18](https://hub.docker.com/layers/opensearchstaging/opensearch/2.18.0/images/sha256-504a9c42bc1b13cb47b39a29db8a9d300d01b8851fb95dbb9db6770f478e45b5?context=explore) to execute the default test suite in [tests/default](tests/default/).
```yaml
- version: 2.18.0
hub: opensearchstaging
ref: '@sha256:4445e195c53992038891519dc3be0d273cdaad1b047943d68921168ed243e7e9'
```
It's important to note that snapshot builds may not contain all plugins, and may contain previous versions of a plugin if the current code failed to build. It's therefore possible that updating a SHA to test new functionality available in a more recent build causes failures with existing tests. As of today the only workaround is to try the next build that will hopefully have more/all the plugins. For a discussion about this problem see [opensearch-build#5130](https://github.com/opensearch-project/opensearch-build/issues/5130).
Use the following command to retrieve the manifest of a given build to make it easier to identify a SHA that includes all the plugins.
```bash
$ docker run -it --entrypoint bash opensearchstaging/opensearch:2.18.0@sha256:4445e195c53992038891519dc3be0d273cdaad1b047943d68921168ed243e7e9 -c "cat /usr/share/opensearch/manifest.yml"
```
```yaml
---
schema-version: '1.1'
build:
name: OpenSearch
version: 2.18.0
platform: linux
architecture: x64
distribution: tar
location: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.18.0/10320/linux/x64/tar/dist/opensearch/opensearch-2.18.0-linux-x64.tar.gz
id: '10320'
components:
- name: OpenSearch
repository: https://github.com/opensearch-project/OpenSearch.git
ref: 2.x
commit_id: b67f76541b78e58844b54305eb21232e78167744
location: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.18.0/10320/linux/x64/tar/builds/opensearch/dist/opensearch-min-2.18.0-linux-x64.tar.gz
- name: common-utils
repository: https://github.com/opensearch-project/common-utils.git
ref: 2.x
commit_id: 63ee9746ce04a8eace0ba6320e93bf5833f6a4a6
...
```
6 changes: 5 additions & 1 deletion spec/namespaces/knn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,11 @@ components:
required: true
responses:
knn.delete_model@200: {}
knn.get_model@200: {}
knn.get_model@200:
content:
application/json:
schema:
type: object
knn.search_models@200: {}
knn.stats@200: {}
knn.train_model@200:
Expand Down
8 changes: 8 additions & 0 deletions spec/schemas/nodes._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,20 @@ components:
$ref: '#/components/schemas/ShardSearchPipelineStats'
segment_replication_backpressure:
$ref: '#/components/schemas/ShardSegmentReplicationBackpressureStats'
remote_store:
$ref: '#/components/schemas/RemoteStoreStats'
repositories:
$ref: '#/components/schemas/ShardRepositoriesStats'
admission_control:
$ref: '#/components/schemas/ShardAdmissionControlStats'
caches:
$ref: '#/components/schemas/ShardCachesStats'
RemoteStoreStats:
type: object
properties:
last_successful_fetch_of_pinned_timestamps:
description: Timestamp for the last successful fetch of pinned timestamps.
$ref: '_common.yaml#/components/schemas/StringifiedEpochTimeUnitSeconds'
ShardClusterManagerThrottlingStats:
type: object
properties:
Expand Down
19 changes: 18 additions & 1 deletion tests/default/knn/train_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ prologues:
- {index: {_index: movies, _id: '9'}}
- {recommendation_vector: [9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5], duration: 8.9}
status: [200]
- method: POST
path: /_refresh
status: [200]
epilogues:
- path: /movies
method: DELETE
Expand Down Expand Up @@ -70,4 +73,18 @@ chapters:
response:
status: 200
output:
test_model_id: payload.model_id
test_model_id: payload.model_id
- synopsis: Wait for the model to get trained.
warnings:
multiple-paths-detected: false
method: GET
path: /_plugins/_knn/models/{model_id}
parameters:
model_id: ${train_model.test_model_id}
retry:
count: 3
response:
status: 200
payload:
model_id: ${train_model.test_model_id}
state: created

0 comments on commit 93c1b65

Please sign in to comment.