mirror of https://github.com/apache/druid.git
Merge pull request #1611 from metamx/betterTimingTests2789
Better handling of slow stuff in NamespaceExtractionCacheManagerExecutorsTest
This commit is contained in:
commit
2d22bcc11b
|
@ -280,6 +280,7 @@ public class NamespaceExtractionCacheManagerExecutorsTest
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
final String cacheId = UUID.randomUUID().toString();
|
final String cacheId = UUID.randomUUID().toString();
|
||||||
|
final CountDownLatch latchBeforeMore = new CountDownLatch(1);
|
||||||
ListenableFuture<?> future =
|
ListenableFuture<?> future =
|
||||||
manager.schedule(
|
manager.schedule(
|
||||||
namespace, factory, new Runnable()
|
namespace, factory, new Runnable()
|
||||||
|
@ -301,17 +302,29 @@ public class NamespaceExtractionCacheManagerExecutorsTest
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
latchMore.countDown();
|
try {
|
||||||
|
if (latch.getCount() == 0) {
|
||||||
|
latchBeforeMore.await();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
|
log.debug("Interrupted");
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
latchMore.countDown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cacheId
|
cacheId
|
||||||
);
|
);
|
||||||
latch.await();
|
latch.await();
|
||||||
|
prior = runs.get();
|
||||||
|
latchBeforeMore.countDown();
|
||||||
Assert.assertFalse(future.isCancelled());
|
Assert.assertFalse(future.isCancelled());
|
||||||
Assert.assertFalse(future.isDone());
|
Assert.assertFalse(future.isDone());
|
||||||
Assert.assertTrue(fnCache.containsKey(ns));
|
Assert.assertTrue(fnCache.containsKey(ns));
|
||||||
prior = runs.get();
|
|
||||||
latchMore.await();
|
latchMore.await();
|
||||||
Assert.assertTrue(runs.get() > prior);
|
Assert.assertTrue(runs.get() > prior);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue