Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing Index API Spec Tests, Part 1 #678

Merged
merged 23 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
106fd00
replication added
Tokesh Aug 3, 2024
e912e13
fixing lint and trying test verbose
Tokesh Aug 3, 2024
bd877a8
changing docker compose
Tokesh Aug 3, 2024
6fd6292
Merge branch 'main' into replication-namespace
Tokesh Aug 3, 2024
addcd76
adding tests for replication namespace
Tokesh Aug 3, 2024
638d60e
fixing lint, validate specs ci
Tokesh Aug 3, 2024
a6e0a87
fixing docker-compose and validate specs ci
Tokesh Aug 3, 2024
b012e7b
fixing validate specs ci
Tokesh Aug 3, 2024
236fea7
trying to fix validate specs
Tokesh Aug 3, 2024
864ee68
trying to fix validate specs v2
Tokesh Aug 3, 2024
30fca51
Merge branch 'replication-namespace'
Tokesh Aug 14, 2024
1d051cd
Merge branch 'main' of https://github.com/Tokesh/opensearch-api-speci…
Tokesh Aug 14, 2024
9620b94
Merge branch 'opensearch-project:main' into main
Tokesh Aug 22, 2024
f847731
Merge remote-tracking branch 'refs/remotes/origin/main'
Tokesh Sep 29, 2024
42056a6
adding not covered index api tests
Tokesh Nov 17, 2024
7c7328c
Merge branch 'main' into index-tests
Tokesh Nov 23, 2024
94915e9
deleting not necessary files
Tokesh Nov 23, 2024
cf167fd
fixing lint
Tokesh Nov 23, 2024
93a58c9
fixing paths, deleting not necessary code, adding validate query api …
Tokesh Nov 23, 2024
7e5570b
deleting empty file
Tokesh Nov 23, 2024
1514af5
fixing minor bug in scenario
Tokesh Nov 23, 2024
37b40b1
adding special folder for validation tests in indices
Tokesh Nov 24, 2024
d925d04
fixing path to test story schema
Tokesh Nov 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/namespaces/replication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,4 @@ components:
content:
application/json:
schema:
$ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
$ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
37 changes: 37 additions & 0 deletions tests/default/indices/mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,40 @@ chapters:
status: 200
payload:
acknowledged: true
- synopsis: Add new fields to index mapping.
path: /{index}/_mapping
method: POST
parameters:
index: movies
request:
payload:
properties:
genre:
type: text
rating:
type: float
response:
status: 200
payload:
acknowledged: true
- synopsis: Get specific field mappings for an index.
Tokesh marked this conversation as resolved.
Show resolved Hide resolved
path: /{index}/_mapping/field/{fields}
method: GET
parameters:
index: movies
fields: director,year
response:
status: 200
payload:
movies:
mappings:
year:
full_name: year
mapping:
year:
type: integer
director:
full_name: director
mapping:
director:
type: text
124 changes: 124 additions & 0 deletions tests/default/indices/msearch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test endpoints relevant to the lifecycle of an index, including multi-get and multi-search operations.
epilogues:
- path: /books
method: DELETE
status: [200, 404]
- path: /games
Tokesh marked this conversation as resolved.
Show resolved Hide resolved
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create an index named `books` with mappings and settings.
path: /{index}
method: PUT
parameters:
index: books
request:
payload:
mappings:
properties:
name:
type: keyword
age:
type: integer
settings:
number_of_shards: 5
number_of_replicas: 2
Tokesh marked this conversation as resolved.
Show resolved Hide resolved
response:
status: 200

- synopsis: Create an index named `games` with default settings.
path: /{index}
method: PUT
parameters:
index: games

- synopsis: Add documents to the `books` index.
path: /{index}/_doc/{id}
method: POST
parameters:
index: books
id: '1'
request:
payload:
name: Book 1
age: 10
response:
status: 201

- synopsis: Add more documents to the `books` index.
path: /{index}/_doc/{id}
method: POST
parameters:
index: books
id: '2'
request:
payload:
name: Book 2
age: 20
response:
status: 201

- synopsis: Add another document to the `books` index.
path: /{index}/_doc/{id}
method: POST
parameters:
index: books
id: '3'
request:
payload:
name: Book 3
age: 30
response:
status: 201
Tokesh marked this conversation as resolved.
Show resolved Hide resolved

- synopsis: Perform a `_mget` request to retrieve documents by IDs.
Tokesh marked this conversation as resolved.
Show resolved Hide resolved
path: /{index}/_mget
method: POST
parameters:
index: books
request:
payload:
ids: ['1', '2', '3']
response:
status: 200
payload:
docs:
- _index: books
_id: '1'
_source:
name: Book 1
age: 10
- _index: books
_id: '2'
_source:
name: Book 2
age: 20
- _index: books
_id: '3'
_source:
name: Book 3
age: 30

- synopsis: Perform a `_msearch` request to execute multiple search queries in a single call.
path: /{index}/_msearch
method: POST
parameters:
index: books
request:
content_type: application/x-ndjson
payload:
- {index: books}
- {query: {match: {name: Book 1}}}
- {index: books}
- {query: {match: {name: Book 2}}}
response:
status: 200
- synopsis: Delete the `books` and `games` indices.
path: /{index}
method: DELETE
parameters:
index: books,games
response:
status: 200
24 changes: 24 additions & 0 deletions tests/default/indices/refresh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,27 @@ chapters:
payload:
_shards:
failed: 0
- synopsis: Adding one more document.
Tokesh marked this conversation as resolved.
Show resolved Hide resolved
path: /{index}/_doc
method: POST
parameters:
index: movies
request:
payload:
title: Margin call
year: 2011
response:
status: 201
- synopsis: Refresh an index.
path: /{index}/_refresh
method: GET
parameters:
index: movies
ignore_unavailable: true
allow_no_indices: false
expand_wildcards: all
response:
status: 200
payload:
_shards:
failed: 0
Loading