Skip to content

Commit

Permalink
changes to test
Browse files Browse the repository at this point in the history
Signed-off-by: Poojita Raj <[email protected]>
  • Loading branch information
Poojita-Raj committed Nov 7, 2022
1 parent eeeae29 commit 1d4a6b4
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,10 @@ public void testReplicationAfterPrimaryRefreshAndFlush() throws Exception {

public void testIndexReopenClose() throws Exception {
final String primary = internalCluster().startNode();
createIndex(INDEX_NAME);
ensureYellowAndNoInitializingShards(INDEX_NAME);
final String replica = internalCluster().startNode();
createIndex(INDEX_NAME);
ensureGreen(INDEX_NAME);

client().prepareIndex(INDEX_NAME).setId("1").setSource("foo", "bar").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get();
refresh(INDEX_NAME);

final int initialDocCount = scaledRandomIntBetween(100, 200);
try (
BackgroundIndexer indexer = new BackgroundIndexer(
Expand All @@ -263,11 +259,18 @@ public void testIndexReopenClose() throws Exception {
waitForReplicaUpdate();
}

assertHitCount(client(primary).prepareSearch(INDEX_NAME).setSize(0).setPreference("_only_local").get(), initialDocCount);
assertHitCount(client(replica).prepareSearch(INDEX_NAME).setSize(0).setPreference("_only_local").get(), initialDocCount);

logger.info("--> Closing the index ");
client().admin().indices().prepareClose(INDEX_NAME).get();

logger.info("--> Opening the index");
client().admin().indices().prepareOpen(INDEX_NAME).get();

ensureGreen(INDEX_NAME);
assertHitCount(client(primary).prepareSearch(INDEX_NAME).setSize(0).setPreference("_only_local").get(), initialDocCount);
assertHitCount(client(replica).prepareSearch(INDEX_NAME).setSize(0).setPreference("_only_local").get(), initialDocCount);
}

public void testMultipleShards() throws Exception {
Expand Down

0 comments on commit 1d4a6b4

Please sign in to comment.