From 7a3241996964e6429810660e7cb78cf32e1d7829 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Wed, 18 Dec 2024 11:39:55 -0500 Subject: [PATCH] Added tests for POST /_remotestore/_restore. (#741) * Added tests for POST /_remotestore/_restore. Signed-off-by: dblock * Fixed book and movie years. Signed-off-by: dblock --------- Signed-off-by: dblock --- .github/workflows/test-spec.yml | 2 ++ tests/default/_core/mget.yaml | 2 +- tests/default/_core/msearch/index.yaml | 2 +- tests/default/_core/reindex/pipeline.yaml | 2 +- tests/default/cat/pending_tasks.yaml | 2 +- tests/default/cluster/pending_tasks.yaml | 2 +- tests/default/indices/delete_by_query.yaml | 4 +-- .../indices/delete_by_query/rethrottle.yaml | 4 +-- tests/default/indices/msearch/index.yaml | 2 +- tests/default/transforms/preview.yaml | 2 +- tests/default/transforms/transform.yaml | 2 +- .../default/transforms/transform/explain.yaml | 2 +- tests/default/transforms/transform/start.yaml | 2 +- tests/default/transforms/transform/stop.yaml | 2 +- tests/remote_store/docker-compose.yml | 23 ++++++++++++++++ tests/remote_store/remote_store/restore.yaml | 26 +++++++++++++++++++ 16 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 tests/remote_store/docker-compose.yml create mode 100644 tests/remote_store/remote_store/restore.yaml diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index d3b495ca1..d166b375f 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -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 diff --git a/tests/default/_core/mget.yaml b/tests/default/_core/mget.yaml index 0d409ecf6..ee00dd57e 100644 --- a/tests/default/_core/mget.yaml +++ b/tests/default/_core/mget.yaml @@ -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}} diff --git a/tests/default/_core/msearch/index.yaml b/tests/default/_core/msearch/index.yaml index 7cb893404..1a3a3df74 100644 --- a/tests/default/_core/msearch/index.yaml +++ b/tests/default/_core/msearch/index.yaml @@ -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}} diff --git a/tests/default/_core/reindex/pipeline.yaml b/tests/default/_core/reindex/pipeline.yaml index 30a2fd6ac..a91ecc8a8 100644 --- a/tests/default/_core/reindex/pipeline.yaml +++ b/tests/default/_core/reindex/pipeline.yaml @@ -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. diff --git a/tests/default/cat/pending_tasks.yaml b/tests/default/cat/pending_tasks.yaml index 4a59f67ec..675386147 100644 --- a/tests/default/cat/pending_tasks.yaml +++ b/tests/default/cat/pending_tasks.yaml @@ -17,7 +17,7 @@ prologues: request: payload: title: Beauty and the Beast - year: 91 + year: 1991 status: [201] - path: /_reindex method: POST diff --git a/tests/default/cluster/pending_tasks.yaml b/tests/default/cluster/pending_tasks.yaml index f595fce7c..4a0e0781f 100644 --- a/tests/default/cluster/pending_tasks.yaml +++ b/tests/default/cluster/pending_tasks.yaml @@ -17,7 +17,7 @@ prologues: request: payload: title: Beauty and the Beast - year: 91 + year: 1991 status: [201] - path: /_reindex method: POST diff --git a/tests/default/indices/delete_by_query.yaml b/tests/default/indices/delete_by_query.yaml index b6c9c0a90..4c518fd03 100644 --- a/tests/default/indices/delete_by_query.yaml +++ b/tests/default/indices/delete_by_query.yaml @@ -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 diff --git a/tests/default/indices/delete_by_query/rethrottle.yaml b/tests/default/indices/delete_by_query/rethrottle.yaml index 3169ab20b..1e1293ab0 100644 --- a/tests/default/indices/delete_by_query/rethrottle.yaml +++ b/tests/default/indices/delete_by_query/rethrottle.yaml @@ -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 diff --git a/tests/default/indices/msearch/index.yaml b/tests/default/indices/msearch/index.yaml index 53fbb7122..ac8560563 100644 --- a/tests/default/indices/msearch/index.yaml +++ b/tests/default/indices/msearch/index.yaml @@ -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}} diff --git a/tests/default/transforms/preview.yaml b/tests/default/transforms/preview.yaml index f26becd9f..1624e78d3 100644 --- a/tests/default/transforms/preview.yaml +++ b/tests/default/transforms/preview.yaml @@ -10,7 +10,7 @@ prologues: request: payload: title: Beauty and the Beast - year: 91 + year: 1991 status: [201] epilogues: - path: /movies diff --git a/tests/default/transforms/transform.yaml b/tests/default/transforms/transform.yaml index eaae0a839..fb53e422e 100644 --- a/tests/default/transforms/transform.yaml +++ b/tests/default/transforms/transform.yaml @@ -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 diff --git a/tests/default/transforms/transform/explain.yaml b/tests/default/transforms/transform/explain.yaml index 7adc70c4a..028b6d5b8 100644 --- a/tests/default/transforms/transform/explain.yaml +++ b/tests/default/transforms/transform/explain.yaml @@ -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 diff --git a/tests/default/transforms/transform/start.yaml b/tests/default/transforms/transform/start.yaml index 55d681bcf..dba5678e4 100644 --- a/tests/default/transforms/transform/start.yaml +++ b/tests/default/transforms/transform/start.yaml @@ -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 diff --git a/tests/default/transforms/transform/stop.yaml b/tests/default/transforms/transform/stop.yaml index 7f3f9276e..7671b35f7 100644 --- a/tests/default/transforms/transform/stop.yaml +++ b/tests/default/transforms/transform/stop.yaml @@ -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 diff --git a/tests/remote_store/docker-compose.yml b/tests/remote_store/docker-compose.yml new file mode 100644 index 000000000..89c151c73 --- /dev/null +++ b/tests/remote_store/docker-compose.yml @@ -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 diff --git a/tests/remote_store/remote_store/restore.yaml b/tests/remote_store/remote_store/restore.yaml new file mode 100644 index 000000000..a15d6bf58 --- /dev/null +++ b/tests/remote_store/remote_store/restore.yaml @@ -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 +