Skip to content

Commit

Permalink
Fixing IT, accounting for updates as well
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Bafna <[email protected]>
  • Loading branch information
gbbafna committed Aug 1, 2023
1 parent 52e3655 commit b7ab7ca
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public void testFailoverWhileIndexing() throws Exception {
shard_count = scaledRandomIntBetween(1, 5);
createIndex(indexName);
ensureGreen(indexName);
int docCount = scaledRandomIntBetween(20, 100);
final int indexDocAfterFailover = scaledRandomIntBetween(20, 100);
int docCount = scaledRandomIntBetween(20, 50);
final int indexDocAfterFailover = scaledRandomIntBetween(20, 50);
AtomicInteger numAutoGenDocs = new AtomicInteger();
CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean finished = new AtomicBoolean(false);
Expand All @@ -145,7 +145,8 @@ public void testFailoverWhileIndexing() throws Exception {
.prepareIndex(indexName)
.setSource("field", numAutoGenDocs.get())
.get();
if (indexResponse.status() == RestStatus.CREATED) {

if (indexResponse.status() == RestStatus.CREATED || indexResponse.status() == RestStatus.ACCEPTED) {
numAutoGenDocs.incrementAndGet();
if (numAutoGenDocs.get() == docCount / 2) {
if (random().nextInt(3) == 0) {
Expand Down Expand Up @@ -178,6 +179,9 @@ public void testFailoverWhileIndexing() throws Exception {
ensureYellowAndNoInitializingShards(indexName);
indexingThread.join();
refresh(indexName);
assertHitCount(client(internalCluster().getClusterManagerName()).prepareSearch(indexName).setSize(0).get(), numAutoGenDocs.get());
assertHitCount(
client(internalCluster().getClusterManagerName()).prepareSearch(indexName).setSize(0).setTrackTotalHits(true).get(),
numAutoGenDocs.get()
);
}
}

0 comments on commit b7ab7ca

Please sign in to comment.