Skip to content

Commit 609f8c6

Browse files
committed
improving yaml rest test
1 parent 4b509c1 commit 609f8c6

File tree

1 file changed

+79
-10
lines changed

1 file changed

+79
-10
lines changed

modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/240_data_stream_settings.yml

Lines changed: 79 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ setup:
2121
indices.create_data_stream:
2222
name: my-data-stream-1
2323

24-
- do:
25-
indices.rollover:
26-
alias: "my-data-stream-1"
27-
2824
- do:
2925
cluster.health:
3026
index: "my-data-stream-1"
@@ -52,14 +48,25 @@ setup:
5248
body:
5349
index:
5450
number_of_shards: 2
51+
lifecycle.name: my-new-policy
5552
- match: { data_streams.0.name: my-data-stream-1 }
5653
- match: { data_streams.0.applied_to_data_stream: true }
5754
- match: { data_streams.0.index_settings_results.applied_to_data_stream_only: [index.number_of_shards]}
58-
- match: { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: [] }
55+
- match: { data_streams.0.index_settings_results.applied_to_data_stream_and_backing_indices: [index.lifecycle.name] }
5956
- match: { data_streams.0.settings.index.number_of_shards: "2" }
57+
- match: { data_streams.0.settings.index.lifecycle.name: "my-new-policy" }
6058
- match: { data_streams.0.effective_settings.index.number_of_shards: "2" }
6159
- match: { data_streams.0.effective_settings.index.number_of_replicas: "0" }
62-
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-policy" }
60+
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" }
61+
62+
- do:
63+
indices.rollover:
64+
alias: "my-data-stream-1"
65+
66+
- do:
67+
cluster.health:
68+
index: "my-data-stream-1"
69+
wait_for_status: green
6370

6471
- do:
6572
indices.get_data_stream_settings:
@@ -68,17 +75,32 @@ setup:
6875
- match: { data_streams.0.settings.index.number_of_shards: "2" }
6976
- match: { data_streams.0.effective_settings.index.number_of_shards: "2" }
7077
- match: { data_streams.0.effective_settings.index.number_of_replicas: "0" }
71-
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-policy" }
78+
- match: { data_streams.0.effective_settings.index.lifecycle.name: "my-new-policy" }
7279

7380
- do:
7481
indices.get_data_stream:
7582
name: my-data-stream-1
7683
- match: { data_streams.0.name: my-data-stream-1 }
7784
- match: { data_streams.0.settings.index.number_of_shards: "2" }
85+
- match: { data_streams.0.settings.index.lifecycle.name: "my-new-policy" }
7886
- match: { data_streams.0.effective_settings: null }
7987

88+
- do:
89+
indices.get_data_stream:
90+
name: my-data-stream-1
91+
- set: { data_streams.0.indices.0.index_name: idx0name }
92+
- set: { data_streams.0.indices.1.index_name: idx1name }
93+
94+
- do:
95+
indices.get_settings:
96+
index: my-data-stream-1
97+
- match: { .$idx0name.settings.index.number_of_shards: "1" }
98+
- match: { .$idx0name.settings.index.lifecycle.name: "my-new-policy" }
99+
- match: { .$idx1name.settings.index.number_of_shards: "2" }
100+
- match: { .$idx1name.settings.index.lifecycle.name: "my-new-policy" }
101+
80102
---
81-
"Test invalid settings":
103+
"Test multiple data streams":
82104
- do:
83105
allowed_warnings:
84106
- "index template [my-template] has index patterns [data-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template] will take precedence during new index creation"
@@ -97,8 +119,55 @@ setup:
97119
name: my-data-stream-1
98120

99121
- do:
100-
indices.rollover:
101-
alias: "my-data-stream-1"
122+
indices.create_data_stream:
123+
name: my-data-stream-2
124+
125+
- do:
126+
indices.create_data_stream:
127+
name: my-data-stream-3
128+
129+
- do:
130+
cluster.health:
131+
index: "my-data-stream-1,my-data-stream-2,my-data-stream-3"
132+
wait_for_status: green
133+
134+
- do:
135+
indices.get_data_stream_settings:
136+
name: "*"
137+
- length: { data_streams: 3 }
138+
139+
- do:
140+
indices.get_data_stream_settings:
141+
name: "my-data-stream-1,my-data-stream-2"
142+
- length: { data_streams: 2 }
143+
144+
- do:
145+
indices.put_data_stream_settings:
146+
name: my-data-stream-1,my-data-stream-2
147+
body:
148+
index:
149+
number_of_shards: 2
150+
lifecycle.name: my-new-policy
151+
- length: { data_streams: 2 }
152+
153+
---
154+
"Test invalid settings":
155+
- do:
156+
allowed_warnings:
157+
- "index template [my-template] has index patterns [data-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template] will take precedence during new index creation"
158+
indices.put_index_template:
159+
name: my-template
160+
body:
161+
index_patterns: [ my-data-stream-* ]
162+
data_stream: { }
163+
template:
164+
settings:
165+
number_of_replicas: 0
166+
lifecycle.name: my-policy
167+
168+
- do:
169+
indices.create_data_stream:
170+
name: my-data-stream-1
102171

103172
- do:
104173
cluster.health:

0 commit comments

Comments
 (0)