Netflix/dyno-queues

Unit test issue: com.netflix.dyno.queues.redis.v2.RedisDynoQueueTest > testTimeoutUpdate FAILED

openaphid opened this issue · 1 comments

One test in testTimeoutUpdate is flawed as its result is not determinated.

        boolean updated = rdq.setUnackTimeout(id, 500);
        assertTrue(updated);
        popped = rdq.pop(1, 1, TimeUnit.SECONDS);  // <-- RedisPipelineQueue.processUnacks() might be scheduled while waiting in pop operation
        assertNotNull(popped);
        assertEquals(0, popped.size());

RedisPipelineQueue.processUnacks() is triggered periodically via a scheduled thread pool. If it happens to run while waiting for pop to finish, pop may return some results and the test fails.

The full console output is as follows:

[INFO ] 2020-08-22 14:28:16,790 RedisPipelineQueue - com.netflix.dyno.queues.redis.v2.RedisPipelineQueue is ready to serve {test_queue.x}, shard=x
[DEBUG] 2020-08-22 14:28:18,801 RedisPipelineQueue - Adding 1 messages back to the queue for test_queue
[DEBUG] 2020-08-22 14:28:18,810 RedisPipelineQueue - Adding 1 messages back to the queue for test_queue
[DEBUG] 2020-08-22 14:28:18,825 RedisPipelineQueue - Adding 1 messages back to the queue for test_queue
[DEBUG] 2020-08-22 14:28:18,846 RedisPipelineQueue - Adding 2 messages back to the queue for test_queue
[DEBUG] 2020-08-22 14:28:18,890 RedisPipelineQueue - Adding 1 messages back to the queue for test_queue
[DEBUG] 2020-08-22 14:28:18,898 RedisPipelineQueue - Adding 1 messages back to the queue for test_queue
[DEBUG] 2020-08-22 14:28:18,913 RedisPipelineQueue - Adding 2 messages back to the queue for test_queue
[DEBUG] 2020-08-22 14:28:18,947 RedisPipelineQueue - Adding 1 messages back to the queue for test_queue
[DEBUG] 2020-08-22 14:28:19,237 RedisPipelineQueue - Cannot get the message payload some fake id
Message [id=0, payload=Hello World-0, timeout=0, priority=10]
Message [id=1, payload=Hello World-1, timeout=0, priority=9]
Message [id=2, payload=Hello World-2, timeout=0, priority=8]
Message [id=3, payload=Hello World-3, timeout=0, priority=7]
Message [id=4, payload=Hello World-4, timeout=0, priority=6]
Message [id=5, payload=Hello World-5, timeout=0, priority=5]
Message [id=6, payload=Hello World-6, timeout=0, priority=4]
Message [id=7, payload=Hello World-7, timeout=0, priority=3]
Message [id=8, payload=Hello World-8, timeout=0, priority=2]
Message [id=9, payload=Hello World-9, timeout=0, priority=1]
[DEBUG] 2020-08-22 14:28:23,895 RedisPipelineQueue - Adding 1 messages back to the queue for test_queue

expected:<0> but was:<1>
Expected :0
Actual   :1
<Click to see difference>

java.lang.AssertionError: expected:<0> but was:<1>
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.failNotEquals(Assert.java:743)
        at com.netflix.dyno.queues.redis.v2.RedisDynoQueueTest.testTimeoutUpdate(RedisDynoQueueTest.java:119)

This seems like a flaky test and is expected to fail sometimes if the underlying dynomite layer fails to pop for any reason (no quorum achieved, etc.)

Please see the updated README for the project status.