Skip to content

Commit 70d719e

Browse files
authored
Allowing _cat/allocation to return more than 0 shards in test (#84539) (#85342)
We delete all indices in a cluster before running ClientYamlTestSuiteIT. However some system indices can regenerate. The cat.allocation, cat.indices, and cat.shards tests were failing because they assume that no indices not created by the tests exist. They can now all handle system indices being created during the test. Closes #83719 Closes #84765 Closes #84972 Closes #82151 Closes #82660
1 parent 83d3eb9 commit 70d719e

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.allocation/10_basic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
- match:
8383
$body: |
8484
/^
85-
( 0 \s+
85+
( \d \s+ #usually 0, unless some system index has been recreated before this runs
8686
\d+(\.\d+)?[kmgt]?b \s+
8787
\d+(\.\d+)?[kmgt]?b \s+
8888
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
@@ -216,7 +216,7 @@
216216
- match:
217217
$body: |
218218
/^
219-
( 0 \s+
219+
( \d \s+ #usually 0, unless some system index has been recreated before this runs
220220
0 \s+
221221
\d+ \s+
222222
(\d+ \s+) #always should return value since we filter out non data nodes by default

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.indices/10_basic.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
number_of_shards: "1"
1919
number_of_replicas: "0"
2020
- do:
21-
cat.indices: {}
21+
cat.indices:
22+
index: index1
2223

2324
- match:
2425
$body: |
@@ -37,6 +38,7 @@
3738
3839
- do:
3940
cat.indices:
41+
index: index1
4042
v: false
4143
h: i,cd,cds,creation.date,creation.date.string
4244
- match:
@@ -262,6 +264,7 @@
262264

263265
- do:
264266
cat.indices:
267+
index: b*,foo
265268
h: [status, index]
266269
s: [status, index]
267270

@@ -274,6 +277,7 @@
274277
275278
- do:
276279
cat.indices:
280+
index: b*,foo
277281
h: [status, index]
278282
s: [status, "index:desc"]
279283

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.indices/20_hidden.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
index:
1414
hidden: true
1515
- do:
16-
cat.indices: {}
16+
cat.indices:
17+
index: i*
1718
- match:
1819
$body: |
1920
/^$/
2021
2122
- do:
2223
cat.indices:
24+
index: i*
2325
expand_wildcards: ["all"]
2426
- match:
2527
$body: |
@@ -58,7 +60,7 @@
5860
5961
- do:
6062
cat.indices:
61-
index: ".*"
63+
index: ".i*"
6264
- match:
6365
$body: |
6466
/^(green \s+
@@ -103,6 +105,7 @@
103105
104106
- do:
105107
cat.indices:
108+
index: "i*"
106109
expand_wildcards: ["open", "hidden"]
107110
- match:
108111
$body: |
@@ -155,14 +158,16 @@
155158
alias1:
156159
is_hidden: true
157160
- do:
158-
cat.indices: {}
161+
cat.indices:
162+
index: i*
159163

160164
- match:
161165
$body: |
162166
/^$/
163167
164168
- do:
165169
cat.indices:
170+
index: i*
166171
expand_wildcards: ["all"]
167172
- match:
168173
$body: |
@@ -224,7 +229,8 @@
224229
index: ".*"
225230
- match:
226231
$body: |
227-
/^(green \s+
232+
/^(.* # Accounts for system indices that get automatically generated
233+
green \s+
228234
open \s+
229235
index1 \s+
230236
([a-zA-Z0-9=/_+]|[\\\-]){22} \s+
@@ -234,5 +240,6 @@
234240
0 \s+
235241
(\d+|\d+[.]\d+)(kb|b) \s+
236242
(\d+|\d+[.]\d+)(kb|b) \s*
243+
.* # Accounts for system indices that get automatically generated
237244
)
238245
$/

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.shards/10_basic.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090
"Test cat shards output":
9191

9292
- do:
93-
cat.shards: {}
93+
cat.shards:
94+
index: i*
9495

9596
- match:
9697
$body: |
@@ -103,7 +104,8 @@
103104
number_of_shards: "5"
104105
number_of_replicas: "1"
105106
- do:
106-
cat.shards: {}
107+
cat.shards:
108+
index: i*
107109

108110
- match:
109111
$body: |
@@ -118,7 +120,8 @@
118120
number_of_replicas: "0"
119121

120122
- do:
121-
cat.shards: {}
123+
cat.shards:
124+
index: i*
122125
- match:
123126
$body: |
124127
/^(index(1|2) \s+ \d \s+ (p|r) \s+ ((STARTED|INITIALIZING|RELOCATING) \s+ (\d \s+ (\d+|\d+[.]\d+)(kb|b) \s+)? \d{1,3}.\d{1,3}.\d{1,3}.\d{1,3} \s+ .+|UNASSIGNED \s+) \n?){15}$/

0 commit comments

Comments
 (0)