From c77564214a77cbaf3616992743248b1db54b2909 Mon Sep 17 00:00:00 2001 From: Ievgen Degtiarenko Date: Wed, 26 Jan 2022 10:58:09 +0100 Subject: [PATCH] fix flaky of snapshot.restore/10_basic.yml yaml it (#83053) 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). --- .../test/snapshot.restore/10_basic.yml | 55 +++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/snapshot.restore/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/snapshot.restore/10_basic.yml index cba3613d9a0fc..1ea5b542625e8 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/snapshot.restore/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/snapshot.restore/10_basic.yml @@ -22,7 +22,7 @@ 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"] @@ -30,10 +30,12 @@ setup: - 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 } @@ -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: @@ -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}