Skip to content

Commit 9d9ccc6

Browse files
nielsbaumanmridula-s109
authored andcommitted
Fix index stats field data YAML test (elastic#129816)
Occasional shard allocation issues were causing the YAML tests to fail because the shard that had the document in it would be unavailable. Fixes elastic#96711
1 parent 1042e14 commit 9d9ccc6

File tree

1 file changed

+11
-6
lines changed
  • rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.stats

1 file changed

+11
-6
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.stats/13_fields.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ setup:
99
# Limit the number of shards so that shards are unlikely
1010
# to be relocated or being initialized between the test
1111
# set up and the test execution
12-
index.number_of_shards: 2
12+
# The tests in `IndexStatsIT` provide sufficient coverage for multi-shard scenarios.
13+
index.number_of_shards: 1
14+
index.number_of_replicas: 0
1315
mappings:
1416
properties:
1517
bar:
@@ -25,11 +27,6 @@ setup:
2527
completion:
2628
type: completion
2729

28-
- do:
29-
cluster.health:
30-
index: test1
31-
wait_for_no_relocating_shards: true
32-
3330
- do:
3431
index:
3532
index: test1
@@ -73,6 +70,14 @@ setup:
7370
body:
7471
sort: [ "bar", "baz" ]
7572

73+
# Wait for the shards to be allocated to avoid missing results in the stats request
74+
# See https://github.com/elastic/elasticsearch/issues/96711#issuecomment-2996311920 for more context
75+
- do:
76+
cluster.health:
77+
index: test1
78+
wait_for_status: green
79+
wait_for_no_relocating_shards: true
80+
7681
---
7782
"Fields - blank":
7883
- do:

0 commit comments

Comments
 (0)