Skip to content

Commit 5d7f691

Browse files
committed
Adds migrate tests
1 parent 49925ae commit 5d7f691

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

tests/migration/20_reindex.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
requires:
3+
stack: true
4+
serverless: false
5+
---
6+
teardown:
7+
- do:
8+
indices.delete_data_stream:
9+
name: test-reindex-datastream
10+
---
11+
"Test migrate_reindex, get_migrate_reindex_status, cancel_migrate_reindex":
12+
- do:
13+
indices.put_index_template:
14+
name: test-reindex-template
15+
body:
16+
index_patterns: [test-reindex-datastream*]
17+
template:
18+
mappings:
19+
properties:
20+
'@timestamp':
21+
type: date
22+
'foo':
23+
type: keyword
24+
data_stream: {}
25+
26+
- do:
27+
indices.create_data_stream:
28+
name: test-reindex-datastream
29+
- is_true: acknowledged
30+
31+
- do:
32+
indices.migrate_reindex:
33+
body: |
34+
{
35+
"mode": "upgrade",
36+
"source": {
37+
"index": "test-reindex-datastream"
38+
}
39+
}
40+
- is_true: acknowledged
41+
42+
- do:
43+
indices.get_migrate_reindex_status:
44+
index: "test-reindex-datastream"
45+
- match: { complete: true }
46+
47+
48+
- do:
49+
indices.cancel_migrate_reindex:
50+
index: "test-reindex-datastream"
51+
- match: { acknowledged: true }
52+
53+
- do:
54+
catch: /resource_not_found_exception/
55+
indices.cancel_migrate_reindex:
56+
index: "test-reindex-datastream"

tests/migration/30_create_from.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
requires:
3+
stack: true
4+
serverless: false
5+
---
6+
teardown:
7+
- do:
8+
indices.delete:
9+
index: test-source-index-1
10+
ignore: 404
11+
- do:
12+
indices.delete:
13+
index: test-dest-index-1
14+
ignore: 404
15+
---
16+
"Test migrate.create_from":
17+
- do:
18+
indices.create:
19+
index: test-source-index-1
20+
body:
21+
settings:
22+
index:
23+
number_of_shards: 3
24+
number_of_replicas: 5
25+
mappings:
26+
dynamic: strict
27+
properties:
28+
bar:
29+
type: text
30+
- do:
31+
indices.create_from:
32+
source: "test-source-index-1"
33+
dest: "test-dest-index-1"
34+
body: {}
35+
- do:
36+
indices.get_settings:
37+
index: test-dest-index-1
38+
- match: { test-dest-index-1.settings.index.number_of_shards: "3" }
39+
- match: { test-dest-index-1.settings.index.number_of_replicas: "5" }
40+
- do:
41+
indices.get_mapping:
42+
index: test-dest-index-1
43+
- match: {test-dest-index-1.mappings.properties.bar.type: text}

0 commit comments

Comments
 (0)