Skip to content

Commit

Permalink
Fix flaky ordered lucene collector kill test
Browse files Browse the repository at this point in the history
Existing test was flaky as it relied on a thread being dead after
a certain amount of time, but the time will vary on each system.
The test will now just ensure that the consumer gets the correct
error propagate when killing the ordered lucene iterator implementation.
  • Loading branch information
seut authored and mergify[bot] committed Feb 17, 2020
1 parent a5b04dc commit a641562
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ public void testOrderedLuceneBatchIteratorWithMultipleCollectorsTripsCircuitBrea
}

@Test
@Ignore("Currently flaky, needs fixing")
public void test_lucene_ordered_collector_thread_dies_on_kill() throws Exception {
public void test_ensure_lucene_ordered_collector_propagates_kill() throws Exception {
LuceneOrderedDocCollector luceneOrderedDocCollector = createOrderedCollector(searcher1, 1);
AtomicReference<Thread> collectThread = new AtomicReference<>();
CountDownLatch latch = new CountDownLatch(1);
Expand All @@ -209,10 +208,8 @@ public void test_lucene_ordered_collector_thread_dies_on_kill() throws Exception

rowBatchIterator.kill(new InterruptedException("killed"));

// The collect thread must stop "almost" immediately, 10ms should be enough to wait.
// Without any kill logic implementation at the lucene collector, it will continue and may not complete in 10ms.
assertBusy(() -> assertThat(collectThread.get().isAlive(), is(false)),
10, TimeUnit.MILLISECONDS);
expectedException.expect(InterruptedException.class);
consumer.getResult();
}

private void consumeIteratorAndVerifyResultIsException(BatchIterator<Row> rowBatchIterator, Exception exception)
Expand Down

0 comments on commit a641562

Please sign in to comment.