Skip to content

Apache Lucene open-source search software

LUCENE-8766: Further checks against race in test

Alan Woodwardc33177e42809
diff --git a/lucene/monitor/src/test/org/apache/lucene/monitor/TestCachePurging.java b/lucene/monitor/src/test/org/apache/lucene/monitor/TestCachePurging.java
index 3e87071097a..e1409a8cf6e 100644
--- a/lucene/monitor/src/test/org/apache/lucene/monitor/TestCachePurging.java
+++ b/lucene/monitor/src/test/org/apache/lucene/monitor/TestCachePurging.java
@@ -149,7 +149,9 @@ public class TestCachePurging extends MonitorTestBase {
monitor.addQueryIndexUpdateListener(new MonitorUpdateListener() {
@Override
public void onPurge() {
- latch.countDown();
+ // It can sometimes take a couple of purge runs to get everything in sync
+ if (monitor.getQueryCacheStats().cachedQueries == 99)
+ latch.countDown();
}
});