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

Added tests for pkg/util/hash #5344

Conversation

anujagrawal699
Copy link
Contributor

Description:
This PR introduces unit tests for the hash package to ensure its functionality and maintainability. Currently, the package lacks unit tests, making it difficult to catch potential regressions and verify its behavior. By adding these tests, we aim to improve the reliability and code coverage of this critical component. The code coverage of the package is 100%.

Implemented Test:
TestDeepHashObject(): Verifies that the DeepHashObject function produces consistent hashes for various input types.

What type of PR is this?
/kind failing-test
/kind feature

Test Coverage:
The hash package lacked unit tests and thus implementing this tests increased it's test coverage from 0% to 100%. This can be verified in the file directory i.e. pkg/util/hash using command
go test -coverprofile=coverage.out

What this PR does / why we need it:
The tests introduced in this PR will:
Ensure the basic functionality of the hash package
Improve test coverage of the hash package
Serve as documentation for expected behavior
Help catch potential issues in future changes

Which issue(s) this PR fixes:
Fixes part of #5235

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Anuj Agrawal <[email protected]>
@karmada-bot karmada-bot added the kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. label Aug 9, 2024
@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 9, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign whitewindmills for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 9, 2024
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.53%. Comparing base (37488bd) to head (3f576e8).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5344      +/-   ##
==========================================
- Coverage   28.53%   28.53%   -0.01%     
==========================================
  Files         632      632              
  Lines       43856    43856              
==========================================
- Hits        12515    12514       -1     
- Misses      30443    30444       +1     
  Partials      898      898              
Flag Coverage Δ
unittests 28.53% <ø> (-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.

@XiShanYongYe-Chang
Copy link
Member

Hi @anujagrawal699, the target file has been overwritten by the test, ref: https://app.codecov.io/gh/karmada-io/karmada/tree/master/pkg%2Futil%2Fhash

@anujagrawal699
Copy link
Contributor Author

Hi @anujagrawal699, the target file has been overwritten by the test, ref: https://app.codecov.io/gh/karmada-io/karmada/tree/master/pkg%2Futil%2Fhash

Thanks @XiShanYongYe-Chang . I'm not able to find indication of any direct overwriting of the hash.go file. Could you help me troubleshoot?

@XiShanYongYe-Chang
Copy link
Member

Maybe the function is called where the test already covers the target logic.

@anujagrawal699
Copy link
Contributor Author

So, i think the pr is not necessary for it. Should i close it?

@XiShanYongYe-Chang
Copy link
Member

Yes, let's close it @anujagrawal699 thanks~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants