Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make metrics.test.js less flaky #1715

Merged
merged 2 commits into from
Nov 7, 2018
Merged

Conversation

michaelnisi
Copy link
Contributor

Seeing values between 49 and 56, relaxing the test to resolve #1691 seems reasonable.

Copy link
Contributor

@misterdjules misterdjules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this 👍

@@ -203,11 +203,11 @@ describe('request metrics plugin', function() {
// However the timeout value is 200,
// it's calculated by the client,
// but setTimeout is happening on the server, tolerate 10ms
assert.isAtLeast(metrics.preLatency, 50);
assert.closeTo(metrics.preLatency, 50, 10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking a bit further into this issue, it seems it could be due to nodejs/node#10154. If so, it means that the value of metrics.preLatency should always be at least 49ms in this test.

Thus I would suggest changing this to:

assert.isAtLeast(metrics.preLatency, 49);

And adding a comment why we use the value 49 instead of 50 (and adding a link to that GH issue in that comment).

Moreover, it seems that this specific Node.js core issue has been fixed in Node.js 11.x (but it hasn't been back ported to previous versions), so it would be interesting to check whether we're indeed not seeing this behavior for those tests when running with node 11.x.

@michaelnisi
Copy link
Contributor Author

Well done, looks like your first intuition was correct, locally with Node.js v11.1.0 the tests pass unmodified. I’ve adjusted the test and added a comment.

@misterdjules misterdjules merged commit 11d6458 into restify:master Nov 7, 2018
@misterdjules misterdjules changed the title Relax test make metrics.test.js less flaky Nov 7, 2018
@misterdjules misterdjules mentioned this pull request Dec 7, 2018
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

metrics.test.js seems to be flaky
2 participants