Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: fix flaky test-cluster-dgram-2
There is no guarantee that a dgram packet will be received. The test is
currently written to only send exactly as many dgram packets as required
assuming they are all received. As a result, failures like this may
occur (from CI):

```
not ok 719 parallel/test-cluster-dgram-2
  ---
  duration_ms: 120.39
  severity: fail
  stack: |-
    timeout
```

This change has the workers send packets continuously until disconnect.

Ref: https://ci.nodejs.org/job/node-test-commit-arm/6044/nodes=armv7-ubuntu1404/console
  • Loading branch information
Trott committed Nov 24, 2016
commit 4620616cb949987b6acd77a4eedde6a88f6de729
9 changes: 8 additions & 1 deletion test/parallel/test-cluster-dgram-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ function worker() {
// send(), explicitly bind them to an ephemeral port.
socket.bind(0);

for (var i = 0; i < PACKETS_PER_WORKER; i++)
// There is no guarantee that a sent dgram packet will be received so keep
// sending until disconnect.
const interval = setInterval(() => {
socket.send(buf, 0, buf.length, common.PORT, '127.0.0.1');
}, 1);

cluster.worker.on('disconnect', () => {
clearInterval(interval);
});
}