-
Notifications
You must be signed in to change notification settings - Fork 410
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
feat: Added support for Mongo v5+ #2085
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2085 +/- ##
==========================================
+ Coverage 97.18% 97.21% +0.03%
==========================================
Files 248 251 +3
Lines 41936 42388 +452
==========================================
+ Hits 40754 41206 +452
Misses 1182 1182
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
// hosts is an array but we will always pull the first for consistency | ||
if (conf?.s?.options?.hosts?.length) { | ||
;[{ host, port }] = conf.s.options.hosts | ||
} |
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'm pretty sure it being an array is for sharding. Using only the first entry, are we creating any issues for the user?
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.
it's the pattern we have above and replicating logic for consistency
common.test('options', async function optionsTest(t, collection, verify) { | ||
const data = await collection.options() | ||
|
||
// Depending on the version of the mongo server this will change. |
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 you expand on this comment? Is it saying that >=5 is the first branch?
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.
none of these tests changed. they were just refactored to be async. Judging by the test sometimes data is returned or not
Description
Our mongodb versioned tests were all callback based. In 5.0 they removed callbacks. Last year we pinned versioned tests(#1490). This is a follow up to separate the older callback based tests(legacy <4), and newer promise based tests(4+). By doing so we can now test on all released versions of mongodb. As you can see from PR there was very little to fix instrumentation in 5+. Parsing the database name and host from certain commands was needed as well as applying
promise: true
to some missing collection methods.How to Test
npm run versioned:internal mongodb
Related Issues
Closes #1491