Skip to content

tests: Add unit tests to ping service#15439

Merged
guzalv merged 3 commits intomasterfrom
add-unit-tests-to-ping-svc
May 28, 2025
Merged

tests: Add unit tests to ping service#15439
guzalv merged 3 commits intomasterfrom
add-unit-tests-to-ping-svc

Conversation

@guzalv
Copy link
Contributor

@guzalv guzalv commented May 27, 2025

Description

While working with pull/15430 I noticed that the Ping service lacks unit tests. Even if it's a simple service, it can benefit from basic checks that verify that the contract is not broken.

This PR adds unit tests that check that the response is what's expected ("ok") and that the right level of access (anonymous in this case) is allowed.

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

CI, manual verification.

@openshift-ci
Copy link

openshift-ci bot commented May 27, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@guzalv
Copy link
Contributor Author

guzalv commented May 27, 2025

/test all

@rhacs-bot
Copy link
Contributor

rhacs-bot commented May 27, 2025

Images are ready for the commit at 2e9ba9b.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.8.x-813-g2e9ba9bd3c.

@codecov
Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.23%. Comparing base (e222e6e) to head (2e9ba9b).
Report is 20 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15439      +/-   ##
==========================================
- Coverage   49.24%   49.23%   -0.01%     
==========================================
  Files        2578     2581       +3     
  Lines      189155   189298     +143     
==========================================
+ Hits        93149    93206      +57     
- Misses      88674    88752      +78     
- Partials     7332     7340       +8     
Flag Coverage Δ
go-unit-tests 49.23% <ø> (-0.01%) ⬇️

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.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@guzalv guzalv marked this pull request as ready for review May 27, 2025 14:16
@guzalv guzalv requested review from rhybrillou and stehessel May 27, 2025 14:17
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @guzalv - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@rhybrillou rhybrillou left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for adding these tests.

Copy link
Collaborator

@stehessel stehessel left a comment

Choose a reason for hiding this comment

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

In general please include the context behind and a short summary of your changes in the PR description :).

Co-authored-by: Stephan Hesselmann <shesselm@redhat.com>
@guzalv
Copy link
Contributor Author

guzalv commented May 28, 2025

In general please include the context behind and a short summary of your changes in the PR description :).

I was doing that and I deliberately removed what I was writing because it didn't seem to provide any value (it seems to me that the PR title is explanatory enough), and according to the PR template no description is needed in those cases:

Feel free to remove this section if the title of your PR is sufficiently descriptive.

On the other hand you pointed this out so I should have kept a description in this case. I will add it, let me know what you think.

@guzalv guzalv requested a review from stehessel May 28, 2025 08:26
Copy link
Collaborator

@stehessel stehessel left a comment

Choose a reason for hiding this comment

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

I agree that in this case the description was not really needed and the change and intention were clear without it. Just to point this out as a general guideline for the future.

@guzalv
Copy link
Contributor Author

guzalv commented May 28, 2025

I agree that in this case the description was not really needed and the change and intention were clear without it. Just to point this out as a general guideline for the future.

Got it. Thanks!!

@guzalv guzalv enabled auto-merge (squash) May 28, 2025 08:57
@guzalv guzalv merged commit 9ad9dab into master May 28, 2025
89 checks passed
@guzalv guzalv deleted the add-unit-tests-to-ping-svc branch May 28, 2025 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants