add explicit refresh post failure to test

log the hits post explicit refresh, and post explicit wait for green
This commit is contained in:
Shay Banon 2013-09-19 16:17:52 +02:00
parent 8ab77651ad
commit bb4f30c76c
1 changed files with 9 additions and 0 deletions

View File

@ -90,6 +90,15 @@ public class SearchWhileCreatingIndexTests extends AbstractSharedClusterTest {
assertHitCount(searchResponse, 1);
// now, let it go to primary or replica, though in a randomized re-creatable manner
searchResponse = client().prepareSearch("test").setPreference(randomAsciiOfLength(5)).setQuery(QueryBuilders.termQuery("field", "test")).execute().actionGet();
if (searchResponse.getHits().getTotalHits() != 1) {
refresh();
SearchResponse searchResponseAfterRefresh = client().prepareSearch("test").setPreference(randomAsciiOfLength(5)).setQuery(QueryBuilders.termQuery("field", "test")).execute().actionGet();
logger.info("hits count mismatch on any shard search failed, post explicit refresh hits are {}", searchResponseAfterRefresh.getHits().getTotalHits());
ensureGreen();
SearchResponse searchResponseAfterGreen = client().prepareSearch("test").setPreference(randomAsciiOfLength(5)).setQuery(QueryBuilders.termQuery("field", "test")).execute().actionGet();
logger.info("hits count mismatch on any shard search failed, post explicit wait for green hits are {}", searchResponseAfterGreen.getHits().getTotalHits());
assertHitCount(searchResponse, 1);
}
assertHitCount(searchResponse, 1);
status = client().admin().cluster().prepareHealth("test").get().getStatus();
cluster().ensureAtLeastNumNodes(numberOfReplicas + 1);