-
Notifications
You must be signed in to change notification settings - Fork 1.8k
test(NODE-5295): assert bypass mongocryptd connection fails with ECONNREFUSED #3673
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
Conversation
9b860d8 to
0123b5a
Compare
test/integration/client-side-encryption/client_side_encryption.prose.test.js
Outdated
Show resolved
Hide resolved
test/integration/client-side-encryption/client_side_encryption.prose.test.js
Outdated
Show resolved
Hide resolved
baileympearson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make the PR description a bit better? reduce error message match strictness is pretty vague and won't be much help in our commit history
e5b3b10 to
3a91450
Compare
| .to.have.property('name', 'MongoServerSelectionError'); | ||
|
|
||
| expect(insertError).to.match(/connect ECONNREFUSED 127.0.0.1:27021/); | ||
| expect(insertError, 'Error must contain ECONNREFUSED').to.satisfy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than hard-coding logic for different Node versions, why not inspect the error and search for ECONNREFUSED?
| expect(insertError, 'Error must contain ECONNREFUSED').to.satisfy( | |
| expect(inspec(insertError), 'Error must contain ECONNREFUSED').to.match(/.*ECONNREFUSED.*/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would want to know if there was yet another shape that the error took, the information went missing from the message in node 20, we will return it to the message in some way in: https://jira.mongodb.org/browse/NODE-5296, added todos and updated the ticket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From our public docs about our errors:
It is our recommendation to use instanceof checks on errors and to avoid relying on parsing error.message and error.name strings in your code. We guarantee instanceof checks will pass according to semver guidelines, but errors may be sub-classed or their messages may change at any time, even patch releases, as we see fit to increase the helpfulness of the errors.
We don't guarantee error messages. The error information is still present, the error is just structured differently. I don't think preserving the exact error info is important and so checking that the error itself is the correct error type is sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I was not thinking about public API / semver, just usefulness, as in an error with no message is not helpful so I don't want the test to not know about changes to the message if that's the regex we're looking for, in all cases, once we fix the node20 situation
92d95bb to
ab3605f
Compare
Description
What is changing?
Fixes an error match assertion on node 20
Is there new documentation needed for these changes?
What is the motivation for this change?
Double check the following
npm run check:lintscripttype(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript