From c33177e42809b45d4307cec819b6357b366fe0b5 Mon Sep 17 00:00:00 2001 From: Alan Woodward Date: Mon, 24 Jun 2019 10:03:43 +0100 Subject: [PATCH] LUCENE-8766: Further checks against race in test --- .../src/test/org/apache/lucene/monitor/TestCachePurging.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); } });