Skip to content

Commit

Permalink
Added tests for POST /_remotestore/_restore. (#741)
Browse files Browse the repository at this point in the history
* Added tests for POST /_remotestore/_restore.

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

* Fixed book and movie years.

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

---------

Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Dec 18, 2024
1 parent 4c03b59 commit 7a32419
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
tests: routing
- version: 2.18.0
tests: snapshot
- version: 2.18.0
tests: remote_store
- version: 2.18.0
tests: dangling
url: http://localhost:9200
Expand Down
2 changes: 1 addition & 1 deletion tests/default/_core/mget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prologues:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book1}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 60}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {create: {_index: movies, _id: movie1}}
- {director: Bennett Miller, title: The Cruise, year: 1998}
- {create: {_index: movies, _id: movie2}}
Expand Down
2 changes: 1 addition & 1 deletion tests/default/_core/msearch/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prologues:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book1}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 60}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {create: {_index: movies, _id: movie1}}
- {director: Bennett Miller, title: The Cruise, year: 1998}
- {create: {_index: movies, _id: movie2}}
Expand Down
2 changes: 1 addition & 1 deletion tests/default/_core/reindex/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ prologues:
request:
payload:
title: Beauty and the Beast
year: 91
year: 1991
status: [201]
chapters:
- synopsis: Transform documents using a pipeline.
Expand Down
2 changes: 1 addition & 1 deletion tests/default/cat/pending_tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prologues:
request:
payload:
title: Beauty and the Beast
year: 91
year: 1991
status: [201]
- path: /_reindex
method: POST
Expand Down
2 changes: 1 addition & 1 deletion tests/default/cluster/pending_tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prologues:
request:
payload:
title: Beauty and the Beast
year: 91
year: 1991
status: [201]
- path: /_reindex
method: POST
Expand Down
4 changes: 2 additions & 2 deletions tests/default/indices/delete_by_query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ prologues:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book_1392214}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 60}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {create: {_index: books, _id: book_1392215}}
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 91}
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991}
chapters:
- synopsis: Delete documents in the index (full query term, script).
path: /{index}/_delete_by_query
Expand Down
4 changes: 2 additions & 2 deletions tests/default/indices/delete_by_query/rethrottle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ prologues:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book_1392214}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 60}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {create: {_index: books, _id: book_1392215}}
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 91}
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991}
- path: /books/_delete_by_query
id: task
method: POST
Expand Down
2 changes: 1 addition & 1 deletion tests/default/indices/msearch/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ prologues:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book1}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 60}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {create: {_index: books, _id: book2}}
- {director: Bennett Miller, title: The Cruise, year: 1998}
- {create: {_index: books, _id: book3}}
Expand Down
2 changes: 1 addition & 1 deletion tests/default/transforms/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ prologues:
request:
payload:
title: Beauty and the Beast
year: 91
year: 1991
status: [201]
epilogues:
- path: /movies
Expand Down
2 changes: 1 addition & 1 deletion tests/default/transforms/transform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ prologues:
request:
payload:
title: Beauty and the Beast
year: 91
year: 1991
status: [201]
epilogues:
- path: /_plugins/_transform/movies-to-films
Expand Down
2 changes: 1 addition & 1 deletion tests/default/transforms/transform/explain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ prologues:
request:
payload:
title: Beauty and the Beast
year: 91
year: 1991
status: [201]
- path: /_plugins/_transform/movies-to-films
method: PUT
Expand Down
2 changes: 1 addition & 1 deletion tests/default/transforms/transform/start.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ prologues:
request:
payload:
title: Beauty and the Beast
year: 91
year: 1991
status: [201]
- path: /_plugins/_transform/movies-to-films
method: PUT
Expand Down
2 changes: 1 addition & 1 deletion tests/default/transforms/transform/stop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ prologues:
request:
payload:
title: Beauty and the Beast
year: 91
year: 1991
status: [201]
- path: /_plugins/_transform/movies-to-films
method: PUT
Expand Down
23 changes: 23 additions & 0 deletions tests/remote_store/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3'

services:
opensearch-cluster:
image: ${OPENSEARCH_DOCKER_HUB_PROJECT:-opensearchproject}/opensearch:${OPENSEARCH_VERSION:-latest}${OPENSEARCH_DOCKER_REF}
ports:
- 9200:9200
- 9600:9600
environment:
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD:-myStrongPassword123!}
- OPENSEARCH_JAVA_OPTS=${OPENSEARCH_JAVA_OPTS}
- cluster.remote_store.state.enabled=true
- discovery.type=single-node
- node.attr.remote_store.repository.fs-segment-store.settings.location=/tmp/opensearch/repo/segment
- node.attr.remote_store.repository.fs-segment-store.type=fs
- node.attr.remote_store.repository.fs-state-store.settings.location=/tmp/opensearch/repo/state
- node.attr.remote_store.repository.fs-state-store.type=fs
- node.attr.remote_store.repository.fs-translog-store.settings.location=/tmp/opensearch/repo/translog
- node.attr.remote_store.repository.fs-translog-store.type=fs
- node.attr.remote_store.segment.repository=fs-segment-store
- node.attr.remote_store.state.repository=fs-state-store
- node.attr.remote_store.translog.repository=fs-translog-store
- path.repo=/tmp/opensearch/repo
26 changes: 26 additions & 0 deletions tests/remote_store/remote_store/restore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test restore from a remote store.
prologues:
- path: /_bulk
method: POST
parameters:
refresh: true
request:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book1}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {create: {_index: movies, _id: movie1}}
- {director: Bennett Miller, title: The Cruise, year: 1998}
- {create: {_index: movies, _id: movie2}}
- {director: Nicolas Winding Refn, title: Drive, year: 1960}
chapters:
- synopsis: Restore from remote store.
path: /_remotestore/_restore
method: POST
request:
payload:
indices:
- movies

0 comments on commit 7a32419

Please sign in to comment.