Skip to content

Commit

Permalink
Add test for source-only snapshot with synthetic source (elastic#113233)
Browse files Browse the repository at this point in the history
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 elastic#112735
  • Loading branch information
dnhatn authored Sep 20, 2024
1 parent 77bf974 commit b977a33
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,53 @@ setup:
- match: {hits.total: 1 }
- length: {hits.hits: 1 }
- match: {hits.hits.0._id: "1" }

---
"Failed to snapshot indices with synthetic source":
- skip:
features: ["allowed_warnings"]

- do:
indices.create:
index: test_synthetic
body:
mappings:
_source:
mode: synthetic
settings:
number_of_shards: 1
number_of_replicas: 0

- do:
snapshot.create:
repository: test_repo_restore_1
snapshot: test_snapshot_2
wait_for_completion: true
body: |
{ "indices": "test_synthetic" }
- match: { snapshot.snapshot: test_snapshot_2 }
- match: { snapshot.state : PARTIAL }
- match: { snapshot.shards.successful: 0 }
- match: { snapshot.shards.failed : 1 }
- match: { snapshot.failures.0.index: "test_synthetic" }
- 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]" }
- is_true: snapshot.version
- gt: { snapshot.version_id: 0}

- do:
snapshot.create:
repository: test_repo_restore_1
snapshot: test_snapshot_3
wait_for_completion: true
body: |
{ "indices": "test_*" }
- match: { snapshot.snapshot: test_snapshot_3 }
- match: { snapshot.state : PARTIAL }
- match: { snapshot.shards.successful: 1 }
- match: { snapshot.shards.failed : 1 }
- match: { snapshot.failures.0.index: "test_synthetic" }
- 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]" }
- is_true: snapshot.version
- gt: { snapshot.version_id: 0}

0 comments on commit b977a33

Please sign in to comment.