Skip to content

Commit

Permalink
Merge pull request #668 from josvijay/shard-consumer-test-fix
Browse files Browse the repository at this point in the history
Ensure the new test task is scheduled beyond millisecond delay to avo…
  • Loading branch information
ychunxue authored Dec 20, 2019
2 parents 51ab53c + 3fba5b3 commit 8a01abb
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ public void testLongRunningTasks() throws Exception {
assertThat(consumer.taskRunningTime(), nullValue());
cache.requestBarrier.reset();

// Sleep for 10 millis before processing next task. If we don't; then the following
// assertion on time fails. This happens if cache.publish() is executed in the
// same millisecond as that of previousTaskStartTime, resulting in the unit test failure.
Thread.sleep(10);
cache.publish();

awaitAndResetBarrier(taskArriveBarrier);
Expand Down

0 comments on commit 8a01abb

Please sign in to comment.