Skip to content

Commit

Permalink
Update PerformanceVerificationTest to not rely on wall clock
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Kurait <[email protected]>
  • Loading branch information
AndreKurait committed Aug 22, 2024
1 parent a8661a6 commit 143ce1a
Showing 1 changed file with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,29 @@ protected Document getDocument(IndexReader reader, int docId, boolean isLive) {
});
reindexThread.start();

// Wait for some time to allow buffering to occur
Thread.sleep(2000);

// Check the number of ingested documents
int ingestedDocs = ingestedDocuments.get();
int sentDocs = sentDocuments.get();
// Wait until ingested and sent document counts stabilize
int previousIngestedDocs = 0;
int previousSentDocs = 0;
int ingestedDocs = 0;
int sentDocs = 0;
boolean stabilized = false;

while (!stabilized) {
Thread.sleep(250);
ingestedDocs = ingestedDocuments.get();
sentDocs = sentDocuments.get();

if (ingestedDocs == previousIngestedDocs && sentDocs == previousSentDocs) {
stabilized = true;
} else {
previousIngestedDocs = ingestedDocs;
previousSentDocs = sentDocs;
}
}

// Release the pause and wait for the reindex to complete
pauseLatch.countDown();
reindexThread.join(5000);
reindexThread.join(30000); // fail if not complete in 30 seconds

// Assert that we had buffered expected number of documents
int bufferedDocs = ingestedDocs - sentDocs;
Expand Down

0 comments on commit 143ce1a

Please sign in to comment.