From 95c4846e58cb2e9b7f908c1ea66092cae745cdcc Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 13 Nov 2015 12:16:22 -0500 Subject: [PATCH] Fix race condition in cat shards test This commit fixes a test bug in the cat shards REST test. In particular, there was a race condition in the test that would cause the test to sometimes fail. The race condition is that some of the shards would go to state STARTED after the sync flush was issued. These shards would (correctly) show up in the output as having state started but without a sync_id. However, the expected output was written to only look for shards that have state STARTED and a sync_id, or shards that are still INITIALIZING or are UNASSIGNED and (of course) do not have a sync_id. The best approach here is to just simplify the test. --- .../resources/rest-api-spec/test/cat.shards/10_basic.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.shards/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.shards/10_basic.yaml index 47552e74d17..5a139234523 100755 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.shards/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.shards/10_basic.yaml @@ -91,12 +91,11 @@ body: settings: number_of_shards: 5 - number_of_replicas: 1 + number_of_replicas: 0 - do: cluster.health: - wait_for_status: yellow - wait_for_relocating_shards: 0 + wait_for_status: green - do: indices.flush_synced: index: sync_id_test @@ -109,7 +108,7 @@ h: index,state,sync_id - match: $body: | - /^(sync_id_test\s+(STARTED\s+[A-Za-z0-9_\-]{20}|(INITIALIZING|UNASSIGNED)\s+)\s+\n){10}$/ + /^(sync_id_test\s+STARTED\s+[A-Za-z0-9_\-]{20}\s+\n){5}$/ - do: indices.delete: