Merge pull request #668 from josvijay/shard-consumer-test-fix

Ensure the new test task is scheduled beyond millisecond delay to avo…
This commit is contained in:
ychunxue 2019-12-20 09:58:53 -08:00 committed by GitHub
commit 8a01abbf43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -816,6 +816,10 @@ public class ShardConsumerTest {
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);