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

fix GetBannedUser #436

Closed

Conversation

rsoaresd
Copy link
Contributor

@rsoaresd rsoaresd commented Dec 3, 2024

Description

We should return an error when no BannedUser is found

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.23%. Comparing base (a6a8525) to head (3998c7b).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #436   +/-   ##
=======================================
  Coverage   78.23%   78.23%           
=======================================
  Files          49       49           
  Lines        2444     2444           
=======================================
  Hits         1912     1912           
  Misses        478      478           
  Partials       54       54           
Files with missing lines Coverage Δ
pkg/banneduser/banneduser.go 100.00% <100.00%> (ø)

Copy link

sonarqubecloud bot commented Dec 3, 2024

@rsoaresd
Copy link
Contributor Author

rsoaresd commented Dec 3, 2024

I forgot that we need to not return an error here in cases where we just want to see if already exists: https://github.com/kubesaw/ksctl/blob/a89cb52c172831ed523b575be62b6b4ea7a4a5aa/pkg/cmd/ban.go#L75

@rsoaresd rsoaresd closed this Dec 3, 2024
@mfrancisc
Copy link
Contributor

Maybe you can return a specific type of error in this case, like:

return errors.NewNotFound(schema.GroupResource{}, key.Name)

and update the ksctl function to ignore this error.

@rajivnathan
Copy link
Contributor

+1 to @mfrancisc suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants