Skip to content

Add unit tests for custom error types#289

Open
GautamBytes wants to merge 1 commit intoopenkruise:masterfrom
GautamBytes:add-ut-for-error-types
Open

Add unit tests for custom error types#289
GautamBytes wants to merge 1 commit intoopenkruise:masterfrom
GautamBytes:add-ut-for-error-types

Conversation

@GautamBytes
Copy link
Copy Markdown
Contributor

This pull request introduces unit tests for the custom error types RetryError and BadRequestError defined in pkg/util/errors/types.go.

Purpose:

The tests are added to validate the behavior of our custom error handling, ensuring that:

  • The Error() methods produce the correct string output.
  • The Is... and As... helper functions correctly identify and unwrap custom errors, even when they are wrapped by other errors using fmt.Errorf with %w.

@kruise-bot kruise-bot requested review from FillZpp and zmberg July 13, 2025 18:37
@kruise-bot
Copy link
Copy Markdown

[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 furykerry for approval by writing /assign @furykerry in a comment. For more information see:The Kubernetes Code Review Process.

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

Details 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

@GautamBytes
Copy link
Copy Markdown
Contributor Author

@hantmac please review it whenever feasible!

Signed-off-by: GautamBytes <manchandanigautam@gmail.com>
@GautamBytes GautamBytes force-pushed the add-ut-for-error-types branch from b3baa3c to 1d9cbc8 Compare August 13, 2025 18:07
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.65%. Comparing base (00aae12) to head (1d9cbc8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #289      +/-   ##
==========================================
+ Coverage   47.52%   47.65%   +0.12%     
==========================================
  Files          63       64       +1     
  Lines        9799     9823      +24     
==========================================
+ Hits         4657     4681      +24     
  Misses       4585     4585              
  Partials      557      557              
Flag Coverage Δ
unittests 47.65% <ø> (+0.12%) ⬆️

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GautamBytes
Copy link
Copy Markdown
Contributor Author

#288 (comment)
same here !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants