Skip to content

Commit b977a33

Browse files
authored
Add test for source-only snapshot with synthetic source (#113233)
Source-only snapshots do not support indices that do not retain the original source, including indices with synthetic sources. This change adds a YAML test to verify this behavior. Closes #112735
1 parent 77bf974 commit b977a33

File tree

1 file changed

+50
-0
lines changed
  • x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/snapshot

1 file changed

+50
-0
lines changed

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/snapshot/10_basic.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,53 @@ setup:
9090
- match: {hits.total: 1 }
9191
- length: {hits.hits: 1 }
9292
- match: {hits.hits.0._id: "1" }
93+
94+
---
95+
"Failed to snapshot indices with synthetic source":
96+
- skip:
97+
features: ["allowed_warnings"]
98+
99+
- do:
100+
indices.create:
101+
index: test_synthetic
102+
body:
103+
mappings:
104+
_source:
105+
mode: synthetic
106+
settings:
107+
number_of_shards: 1
108+
number_of_replicas: 0
109+
110+
- do:
111+
snapshot.create:
112+
repository: test_repo_restore_1
113+
snapshot: test_snapshot_2
114+
wait_for_completion: true
115+
body: |
116+
{ "indices": "test_synthetic" }
117+
118+
- match: { snapshot.snapshot: test_snapshot_2 }
119+
- match: { snapshot.state : PARTIAL }
120+
- match: { snapshot.shards.successful: 0 }
121+
- match: { snapshot.shards.failed : 1 }
122+
- match: { snapshot.failures.0.index: "test_synthetic" }
123+
- match: { snapshot.failures.0.reason : "IllegalStateException[Can't snapshot _source only on an index that has incomplete source ie. has _source disabled or filters the source]" }
124+
- is_true: snapshot.version
125+
- gt: { snapshot.version_id: 0}
126+
127+
- do:
128+
snapshot.create:
129+
repository: test_repo_restore_1
130+
snapshot: test_snapshot_3
131+
wait_for_completion: true
132+
body: |
133+
{ "indices": "test_*" }
134+
135+
- match: { snapshot.snapshot: test_snapshot_3 }
136+
- match: { snapshot.state : PARTIAL }
137+
- match: { snapshot.shards.successful: 1 }
138+
- match: { snapshot.shards.failed : 1 }
139+
- match: { snapshot.failures.0.index: "test_synthetic" }
140+
- match: { snapshot.failures.0.reason: "IllegalStateException[Can't snapshot _source only on an index that has incomplete source ie. has _source disabled or filters the source]" }
141+
- is_true: snapshot.version
142+
- gt: { snapshot.version_id: 0}

0 commit comments

Comments
 (0)