Skip to content

🌱 (cleanup): Refactor metrics endpoint tests by extracting shared helpers #1719

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

Merged

Conversation

camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Feb 5, 2025

Refactored the metrics endpoint tests by introducing reusable helper functions. This reduces duplication and improves maintainability across both tests.

Motivated by: #1712

@camilamacedo86 camilamacedo86 requested a review from a team as a code owner February 5, 2025 23:44
@camilamacedo86 camilamacedo86 changed the title (cleanup): (cleanup): Refactor metrics endpoint tests by extracting shared helpers 🌱 (cleanup): Refactor metrics endpoint tests by extracting shared helpers Feb 5, 2025
Copy link

netlify bot commented Feb 5, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 42ab2ea
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/67a52235897dfd0008014982
😎 Deploy Preview https://deploy-preview-1719--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@camilamacedo86 camilamacedo86 force-pushed the cleanup-metrics-tests branch 7 times, most recently from 89697b8 to 6a2c1d8 Compare February 6, 2025 13:14
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.87%. Comparing base (099a6cf) to head (42ab2ea).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1719      +/-   ##
==========================================
+ Coverage   67.58%   67.87%   +0.29%     
==========================================
  Files          59       59              
  Lines        4982     4993      +11     
==========================================
+ Hits         3367     3389      +22     
+ Misses       1371     1362       -9     
+ Partials      244      242       -2     
Flag Coverage Δ
e2e 53.00% <ø> (-0.09%) ⬇️
unit 55.09% <ø> (+0.31%) ⬆️

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 41 to 45
config.createMetricsClusterRoleBinding()
token := config.getServiceAccountToken()
config.createCurlMetricsPod()
config.validate(token)
defer config.cleanup()
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a config.run() that encapsulates these calls since they look the same in both tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done !!!
Good call.

…hared helpers

Refactored the metrics endpoint tests by introducing reusable helper functions.
This reduces duplication and improves maintainability across both tests.
Copy link
Member

@LalatenduMohanty LalatenduMohanty left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 6, 2025
@LalatenduMohanty
Copy link
Member

@joelanford Not adding to the merge queue incase you want to take another look.

@camilamacedo86 camilamacedo86 added this pull request to the merge queue Feb 6, 2025
@camilamacedo86 camilamacedo86 removed this pull request from the merge queue due to a manual request Feb 6, 2025
@camilamacedo86
Copy link
Contributor Author

Hi @LalatenduMohanty @joelanford

I am moving forward.
The nit suggestion done by @joelanford is addressed, and we can always come back and follow up with further adjustments if you need to.

@camilamacedo86 camilamacedo86 added this pull request to the merge queue Feb 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 7, 2025
@camilamacedo86 camilamacedo86 added this pull request to the merge queue Feb 7, 2025
Merged via the queue into operator-framework:main with commit ae41bfc Feb 7, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants