Skip to content

Commit

Permalink
fix flaky of snapshot.restore/10_basic.yml yaml it (elastic#83053)
Browse files Browse the repository at this point in the history
This test performs snapshot and verifies it has exactly 1 successful
shard. This could fail when additional indices might be added (such as
system .task index).
  • Loading branch information
idegtiarenko authored Jan 26, 2022
1 parent d88d480 commit c775642
Showing 1 changed file with 51 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ setup:
wait_for_status: green

---
"Create a snapshot and then restore it":
"Create a snapshot with single index and then restore it":

- skip:
features: ["allowed_warnings"]

- do:
snapshot.create:
repository: test_repo_restore_1
snapshot: test_snapshot
snapshot: test_snapshot_1
wait_for_completion: true
body:
indices: "test_index"

- match: { snapshot.snapshot: test_snapshot }
- match: { snapshot.snapshot: test_snapshot_1 }
- match: { snapshot.state : SUCCESS }
- match: { snapshot.shards.successful: 1 }
- match: { snapshot.shards.failed : 0 }
Expand All @@ -49,7 +51,7 @@ setup:
- do:
snapshot.restore:
repository: test_repo_restore_1
snapshot: test_snapshot
snapshot: test_snapshot_1
wait_for_completion: true

- do:
Expand All @@ -62,3 +64,48 @@ setup:
- gt: { test_index.shards.0.index.size.recovered_in_bytes: 0}
- match: { test_index.shards.0.index.files.reused: 0}
- match: { test_index.shards.0.index.size.reused_in_bytes: 0}

---
"Create a snapshot and then restore single index from it":

- skip:
features: ["allowed_warnings"]

- do:
snapshot.create:
repository: test_repo_restore_1
snapshot: test_snapshot_2
wait_for_completion: true

- match: { snapshot.snapshot: test_snapshot_2 }
- match: { snapshot.state : SUCCESS }
# snapshot can contain system indices and have shards.successful >=1
- gt: { snapshot.shards.successful: 0 }
- match: { snapshot.shards.failed : 0 }
- is_true: snapshot.version
- gt: { snapshot.version_id: 0}

- do:
indices.close:
index : test_index
allowed_warnings:
- "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour"

- do:
snapshot.restore:
repository: test_repo_restore_1
snapshot: test_snapshot_2
wait_for_completion: true
body:
indices: "test_index"

- do:
indices.recovery:
index: test_index

- match: { test_index.shards.0.type: SNAPSHOT }
- match: { test_index.shards.0.stage: DONE }
- match: { test_index.shards.0.index.files.recovered: 1}
- gt: { test_index.shards.0.index.size.recovered_in_bytes: 0}
- match: { test_index.shards.0.index.files.reused: 0}
- match: { test_index.shards.0.index.size.reused_in_bytes: 0}

0 comments on commit c775642

Please sign in to comment.