Ensure the new test task is scheduled beyond millisecond delay to avoid incorrect test failure.
This commit is contained in:
parent
a2228b9292
commit
3fba5b31e6
1 changed files with 4 additions and 0 deletions
|
|
@ -816,6 +816,10 @@ public class ShardConsumerTest {
|
||||||
assertThat(consumer.taskRunningTime(), nullValue());
|
assertThat(consumer.taskRunningTime(), nullValue());
|
||||||
cache.requestBarrier.reset();
|
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();
|
cache.publish();
|
||||||
|
|
||||||
awaitAndResetBarrier(taskArriveBarrier);
|
awaitAndResetBarrier(taskArriveBarrier);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue