Skip to content

Commit c9afe00

Browse files
committed
discovery: add comprehensive for async timestamp range queue
In this commit, we add thorough unit tests for the new asynchronous timestamp range queue functionality. The tests verify several critical properties and invariants of the system. The basic functionality tests ensure that messages can be queued and are eventually processed by calling ApplyGossipFilter. We verify that the queue properly rejects new messages when full, returning false as designed to prevent blocking. Concurrent access is tested extensively to ensure the queue remains thread-safe under heavy load. Multiple goroutines attempt to queue messages simultaneously, and we verify that the system handles this gracefully without data races or corruption. The test suite includes property-based tests using the rapid framework to verify key invariants: the queue never exceeds its capacity, all successfully queued messages are eventually processed if the syncer remains active, and messages maintain FIFO ordering throughout the pipeline. Error handling tests ensure that failures in ApplyGossipFilter don't block the queue processor. When errors occur, the system logs them and continues processing remaining messages, maintaining overall system availability. Finally, shutdown tests verify that the queue processor exits cleanly when the syncer stops, preventing goroutine leaks and ensuring proper resource cleanup.
1 parent 644d9d9 commit c9afe00

File tree

1 file changed

+532
-0
lines changed

1 file changed

+532
-0
lines changed

0 commit comments

Comments
 (0)