[TEST] Added await for yellow status,

because the shard the get request for 'test' index, 'type1' type and id 1 is getting executed on may not be in a started state
and also added more logging.
This commit is contained in:
Martijn van Groningen 2014-05-19 11:20:25 +02:00
parent 420f2db4cd
commit 39018c5d0b
1 changed files with 8 additions and 1 deletions

View File

@ -529,7 +529,14 @@ public class LocalGatewayIndexStateTests extends ElasticsearchIntegrationTest {
logger.info("--> index a different doc");
client().prepareIndex("test", "type1", "2").setSource("field1", "value2").setRefresh(true).execute().actionGet();
assertThat(client().prepareGet("test", "type1", "1").execute().actionGet().isExists(), equalTo(false));
logger.info("--> verify that doc 2 does exist");
assertThat(client().prepareGet("test", "type1", "2").execute().actionGet().isExists(), equalTo(true));
// Need an ensure yellow here, since the index gets created (again) when we index doc2, so the shard that doc
// with id 1 is assigned to might not be in a started state. We don't need to do this when verifying if doc 2
// exists, because we index into the shard that doc gets assigned to.
ensureYellow("test");
logger.info("--> verify that doc 1 doesn't exist");
assertThat(client().prepareGet("test", "type1", "1").execute().actionGet().isExists(), equalTo(false));
}
}