Skip to content

Commit 100804e

Browse files
committed
test: Improve 'republish in consume block' test reliability
- Add ack() for the final message (deliveryTag 10000) before canceling consumer to ensure proper cleanup - Increase test timeout from default 5s to 60s to accommodate processing 10,000 messages with concurrent publishes This test was timing out due to: 1. Missing ack on final message before cancel 2. Insufficient timeout for high-volume message processing The test validates that the buffer pool can handle concurrent publishes within a consume callback without race conditions.
1 parent eb78699 commit 100804e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

test/test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,13 +823,14 @@ test("can republish in consume block without race condition", async () => {
823823
if (msg.deliveryTag < 10000) {
824824
await Promise.all([q.publish(msg.body), q.publish(msg.body), msg.ack()])
825825
} else if (msg.deliveryTag === 10000) {
826+
await msg.ack()
826827
await consumer.cancel()
827828
}
828829
})
829830
await expect(consumer.wait()).resolves.toBeUndefined()
830831
await expect(conn.close()).resolves.toBeUndefined()
831832
console.log(conn.bufferPool.length)
832-
})
833+
}, 60_000)
833834

834835
test("raises when channelMax is reached", async () => {
835836
const amqp = getNewClient()

0 commit comments

Comments
 (0)