Skip to content

Commit

Permalink
Allowing _cat/allocation to return more than 0 shards in test (#84539) (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
masseyke committed Mar 24, 2022
1 parent 83d3eb9 commit 70d719e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
- match:
$body: |
/^
( 0 \s+
( \d \s+ #usually 0, unless some system index has been recreated before this runs
\d+(\.\d+)?[kmgt]?b \s+
\d+(\.\d+)?[kmgt]?b \s+
(\d+(\.\d+)?[kmgt]b \s+)? #no value from client nodes
Expand Down Expand Up @@ -216,7 +216,7 @@
- match:
$body: |
/^
( 0 \s+
( \d \s+ #usually 0, unless some system index has been recreated before this runs
0 \s+
\d+ \s+
(\d+ \s+) #always should return value since we filter out non data nodes by default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
number_of_shards: "1"
number_of_replicas: "0"
- do:
cat.indices: {}
cat.indices:
index: index1

- match:
$body: |
Expand All @@ -37,6 +38,7 @@
- do:
cat.indices:
index: index1
v: false
h: i,cd,cds,creation.date,creation.date.string
- match:
Expand Down Expand Up @@ -262,6 +264,7 @@

- do:
cat.indices:
index: b*,foo
h: [status, index]
s: [status, index]

Expand All @@ -274,6 +277,7 @@
- do:
cat.indices:
index: b*,foo
h: [status, index]
s: [status, "index:desc"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
index:
hidden: true
- do:
cat.indices: {}
cat.indices:
index: i*
- match:
$body: |
/^$/
- do:
cat.indices:
index: i*
expand_wildcards: ["all"]
- match:
$body: |
Expand Down Expand Up @@ -58,7 +60,7 @@
- do:
cat.indices:
index: ".*"
index: ".i*"
- match:
$body: |
/^(green \s+
Expand Down Expand Up @@ -103,6 +105,7 @@
- do:
cat.indices:
index: "i*"
expand_wildcards: ["open", "hidden"]
- match:
$body: |
Expand Down Expand Up @@ -155,14 +158,16 @@
alias1:
is_hidden: true
- do:
cat.indices: {}
cat.indices:
index: i*

- match:
$body: |
/^$/
- do:
cat.indices:
index: i*
expand_wildcards: ["all"]
- match:
$body: |
Expand Down Expand Up @@ -224,7 +229,8 @@
index: ".*"
- match:
$body: |
/^(green \s+
/^(.* # Accounts for system indices that get automatically generated
green \s+
open \s+
index1 \s+
([a-zA-Z0-9=/_+]|[\\\-]){22} \s+
Expand All @@ -234,5 +240,6 @@
0 \s+
(\d+|\d+[.]\d+)(kb|b) \s+
(\d+|\d+[.]\d+)(kb|b) \s*
.* # Accounts for system indices that get automatically generated
)
$/
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"Test cat shards output":

- do:
cat.shards: {}
cat.shards:
index: i*

- match:
$body: |
Expand All @@ -103,7 +104,8 @@
number_of_shards: "5"
number_of_replicas: "1"
- do:
cat.shards: {}
cat.shards:
index: i*

- match:
$body: |
Expand All @@ -118,7 +120,8 @@
number_of_replicas: "0"

- do:
cat.shards: {}
cat.shards:
index: i*
- match:
$body: |
/^(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}$/
Expand Down

0 comments on commit 70d719e

Please sign in to comment.