Skip to content

Commit

Permalink
test: fix flaky test when run under load
Browse files Browse the repository at this point in the history
Running the test with the following:

    $ ./tools/test.py -J --repeat=100 test/addons/nsolid-statsdagent/nsolid-statsdagent.js

caused the test to fail in various ways. The fix takes into account that
when the test is slowed down under load it's possible for the
StatsDAgent instance to be ready before it can be checked in JS, and
that the data might have been placed into a single call to 'data'.

Fixes: #142
  • Loading branch information
trevnorris committed Jun 18, 2024
1 parent a184544 commit b6cfe61
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions test/addons/nsolid-statsdagent/nsolid-statsdagent.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,11 @@ const server = net.createServer(mustCall((socket) => {
expectedProcMetrics.length === 0) {
process.exit();
}
}, 2));
}, 1));
}));

server.listen(0, '127.0.0.1', mustCall(() => {
binding.setAddHooks(`tcp://127.0.0.1:${server.address().port}`);
assert.strictEqual(binding.getStatus(), 'initializing');
}));

assert.strictEqual(binding.getStatus(), null);

0 comments on commit b6cfe61

Please sign in to comment.