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

feat: Added support for Mongo v5+ #2085

Merged
merged 1 commit into from
Mar 20, 2024
Merged

feat: Added support for Mongo v5+ #2085

merged 1 commit into from
Mar 20, 2024

Conversation

bizob2828
Copy link
Member

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

Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.21%. Comparing base (0747ca4) to head (8c4cdf5).
Report is 6 commits behind head on main.

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              
Flag Coverage Δ
integration-tests-16.x 78.25% <ø> (+<0.01%) ⬆️
integration-tests-18.x 78.23% <ø> (+0.01%) ⬆️
integration-tests-20.x 78.24% <ø> (+<0.01%) ⬆️
unit-tests-16.x 90.59% <ø> (+0.10%) ⬆️
unit-tests-18.x 90.57% <ø> (+0.10%) ⬆️
unit-tests-20.x 90.57% <ø> (+0.10%) ⬆️
versioned-tests-16.x 74.50% <100.00%> (-0.02%) ⬇️
versioned-tests-18.x 75.61% <100.00%> (-0.02%) ⬇️
versioned-tests-20.x 75.62% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +282 to +285
// 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
}
Copy link
Contributor

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?

Copy link
Member Author

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.
Copy link
Contributor

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?

Copy link
Member Author

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

@bizob2828 bizob2828 merged commit 00f6feb into main Mar 20, 2024
48 checks passed
@bizob2828 bizob2828 deleted the mongo-5-plus-tests branch March 20, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add support for instrumenting mongodb@5
2 participants