Skip to content

fix: flaky integration tests (gRPC, BullMQ) and two client tests that checked nothing - #10

Merged
koresar merged 4 commits into
masterfrom
fix/flaky-grpc-test
Nov 25, 2026
Merged

koresar merged 4 commits into
masterfrom
fix/flaky-grpc-test

Conversation

@hmvs

@hmvs hmvs commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

CI on master fails on most commits because of intermittent test failures. Each has its own commit.

  • gRPC "should behave with @grpc/grpc-js" failed with 14 UNAVAILABLE. Both gRPC tests used port 50051, and grpc-js shares one subchannel per address. A client left over from the first test put that subchannel in backoff. The second test now uses port 50052.
  • BullMQ "should behave with 'bullmq' module" timed out after 1s. The job could complete before QueueEvents read the stream, and removeOnComplete: true had deleted the job, so waitUntilFinished() had nothing to read. The test now waits for QueueEvents and keeps completed jobs.
  • BullMQ "should behave with AllserverClient" hung for 60s. Same lost event, but in the library: the first call of a new BullmqClientTransport could complete before its QueueEvents connection was ready. call() now waits for queueEvents.waitUntilReady() before it adds the job. This is the only change outside tests.
  • Two tests in AllserverClient.test.js used a Mocha-style done callback. In node:test the first argument is the test context, so done() threw TypeError: done is not a function. The tests passed before their assertions ran, and the error sometimes failed the whole file (seen on macOS, Node 20). They are now async tests.

Before: about 1 in 6 local runs of the integration file failed. After: 0 failures in 410 runs on Node 22, 24 and 26 (BullMQ 6.7.10).

Vadym Kurachevskyi added 4 commits November 25, 2026 12:43
The first gRPC test does not close its clients, and grpc-js keeps one
subchannel per address for all clients. After the first server stopped, a
client of the first test tried to connect again and put the subchannel in
backoff. The client of the second test used the same subchannel and failed
with "14 UNAVAILABLE: No connection established".
The job could complete before QueueEvents started to read the events
stream. The event was then lost, and waitUntilFinished() could not read the
result from the job because removeOnComplete had deleted it. The test now
waits for QueueEvents and keeps completed jobs, as BullmqClientTransport does.
The first call of a new BullmqClientTransport could complete on the server
before the client's QueueEvents connection was ready. The "completed" event
was then lost and the call failed after the full timeout.
The tests used a Mocha-style `done` callback. In node:test the first argument
is the test context, so `done()` threw "TypeError: done is not a function".
The tests passed before their assertions ran, and the error sometimes failed
the whole file. They are now async tests.
@hmvs hmvs changed the title fix: three flaky integration tests (gRPC, BullMQ) fix: flaky integration tests (gRPC, BullMQ) and two client tests that checked nothing Nov 25, 2026
@hmvs
hmvs marked this pull request as ready for review November 25, 2026 02:11
@koresar
koresar merged commit 7b668ea into master Nov 25, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants