Skip to content

Commit

Permalink
Added snapshot tests. (#728)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Dec 12, 2024
1 parent e955278 commit 18f135d
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 4 deletions.
27 changes: 27 additions & 0 deletions tests/snapshot/snapshot/cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test cleaning up a snapshot repository.
prologues:
- path: /_snapshot/my-fs-repository
method: POST
request:
payload:
type: fs
settings:
location: /tmp/opensearch/repo
epilogues:
- path: /_snapshot/my-fs-repository
method: DELETE
status: [200, 404]
chapters:
- synopsis: Verify snapshot repository.
path: /_snapshot/{repository}/_cleanup
method: POST
parameters:
repository: my-fs-repository
response:
status: 200
payload:
results:
deleted_bytes: 0
deleted_blobs: 0
40 changes: 40 additions & 0 deletions tests/snapshot/snapshot/clone.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test cloning a snapshot.
prologues:
- path: /_snapshot/my-fs-repository
method: POST
request:
payload:
type: fs
settings:
location: /tmp/opensearch/repo
- path: /_snapshot/my-fs-repository/my-test-snapshot
method: PUT
parameters:
wait_for_completion: true
request:
payload:
indices: '*'
partial: true
epilogues:
- path: /_snapshot/my-fs-repository/my-test-snapshot
method: DELETE
status: [200, 404]
- path: /_snapshot/my-fs-repository/my-cloned-snapshot
method: DELETE
status: [200, 404]
- path: /_snapshot/my-fs-repository
method: DELETE
status: [200, 404]
chapters:
- synopsis: Clone a snapshot.
path: /_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}
method: PUT
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
target_snapshot: my-cloned-snapshot
request:
payload:
indices: '*'
31 changes: 27 additions & 4 deletions tests/snapshot/snapshot/snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,29 @@ epilogues:
status: [200, 404]
parameters:
repository: my-fs-repository
prologues:
- path: /_snapshot/{repository}
method: PUT
chapters:
- synopsis: Create and update a snapshot repository.
path: /_snapshot/{repository}
method:
- POST
- PUT
parameters:
repository: my-fs-repository
request:
payload:
type: fs
settings:
location: /tmp/opensearch/repo
chapters:
- synopsis: Get all snapshot repositories.
path: /_snapshot
method: GET
response:
status: 200
payload:
my-fs-repository:
type: fs
settings:
location: /tmp/opensearch/repo
- synopsis: Get information about a repository.
path: /_snapshot/{repository}
method: GET
Expand Down Expand Up @@ -77,3 +89,14 @@ chapters:
payload:
snapshots:
- snapshot: my-test-snapshot
- synopsis: Delete a snapshot.
path: /_snapshot/{repository}/{snapshot}
method: DELETE
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
- synopsis: Delete a snapshot repository.
path: /_snapshot/{repository}
method: DELETE
parameters:
repository: my-fs-repository
25 changes: 25 additions & 0 deletions tests/snapshot/snapshot/verify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test verifying a snapshot repository.
prologues:
- path: /_snapshot/my-fs-repository
method: POST
request:
payload:
type: fs
settings:
location: /tmp/opensearch/repo
epilogues:
- path: /_snapshot/my-fs-repository
method: DELETE
status: [200, 404]
chapters:
- synopsis: Verify snapshot repository.
path: /_snapshot/{repository}/_verify
method: POST
parameters:
repository: my-fs-repository
response:
status: 200
payload:
nodes: {}

0 comments on commit 18f135d

Please sign in to comment.