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

test(instrumentation-mongodb): Include all versions in coverage #2681

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

onurtemizkan
Copy link
Contributor

Which problem is this PR solving?

  • Test coverage of the MongoDB instrumentation is currently 49.74% - Link

This is because tests for MongoDB versions v3 and v4 are not included in the coverage report.

Short description of the changes

  • Runs v3 and v4 tests in the test command to make sure they are included in the coverage report

@github-actions github-actions bot added pkg:instrumentation-mongodb pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found. labels Jan 27, 2025
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.41%. Comparing base (fcca38a) to head (88a3527).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2681      +/-   ##
==========================================
+ Coverage   90.95%   92.41%   +1.46%     
==========================================
  Files         172      172              
  Lines        8137     8137              
  Branches     1649     1649              
==========================================
+ Hits         7401     7520     +119     
+ Misses        736      617     -119     

see 2 files with indirect coverage changes

Copy link
Contributor

This package does not have an assigned component owner and is considered unmaintained. As such this package is in feature-freeze and this PR will be closed with 14 days unless a new owner or a sponsor (a member of @open-telemetry/javascript-approvers) for the feature is found. It is the responsibility of the author to find a sponsor for this feature.
Are you familiar with this package? Consider becoming a component owner.

"test": "npm run test-v3 && npm run test-v4 && npm run test-v5-v6 && nyc merge .nyc_output ./coverage/coverage-final.json",
"test-v3": "tav mongodb 3.7.4 npm run test-v3-run",
"test-v4": "tav mongodb 4.17.0 npm run test-v4-run",
"test-v5-v6": "tav mongodb 6.8.0 npm run test-v5-v6-run",
Copy link
Contributor

Choose a reason for hiding this comment

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

do you think is necessary to pin here the version? pacakge.json file already has the version fixed and if we want to update to a newer version we need to do it in both places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just double checked, for the pinned version, it's not needed. 👍

@david-luna
Copy link
Contributor

david-luna commented Jan 29, 2025

I have my doubts about this PR. IMHO the wider the support range is the more tests with different versions we would need to do in order to aim for high coverage. We may end up doing a subset of test-all-versions 🤔

I'll bring up this into today's SIG

@onurtemizkan
Copy link
Contributor Author

Thanks for the review @david-luna!

The alternative I thought was generating coverage on test-all-versions and merging reports in the end. But that seems a bit wider scale update if that's going to be applied to every package (there are just a few packages excluding specific versions as far as I can see).

@david-luna
Copy link
Contributor

david-luna commented Jan 29, 2025

Thanks for the review @david-luna!

The alternative I thought was generating coverage on test-all-versions and merging reports in the end. But that seems a bit wider scale update if that's going to be applied to every package (there are just a few packages excluding specific versions as far as I can see).

@onurtemizkan we discussed this approach for coverage in the SIG. We accept the tradeoff of running 3 different tests to get the coverage report. Also

  • locally you can get a different version of the package under test if npm run test fails in one of the steps.
  • we will keep an eye on the CI to be sure is not impacting it significantly

Thanks for your contribution :) I'm going to approve, make sure your branch is up to date in order to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:instrumentation-mongodb pkg-status:unmaintained:autoclose-scheduled pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants