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

Increase the code coverage for the controllers package files to 70% #662

Open
2 tasks
jvanz opened this issue Feb 29, 2024 · 2 comments
Open
2 tasks

Increase the code coverage for the controllers package files to 70% #662

jvanz opened this issue Feb 29, 2024 · 2 comments

Comments

@jvanz
Copy link
Member

jvanz commented Feb 29, 2024

We have a goal to reach 70% of code coverage in the kubewarden controller repository. For that, we can improve the coverage of the controllers package. Considering the current metric of the package, it's virtually reached the 70%, the current coverage is 69.67%.

However, when we take a look on the individual files is possible to see that some of them need some improvement. The only two files under the 70% threshold is policyserver_controller.go (58.43%) and policystatus_utils.go (59.52%).

In the case of the policyserver_controller.go, most of the lines missing the coverage is the lines where errors are returned and requeue the reconciliation loop. I believe we can cover this line by doing some mocking and unit tests.

For the policystatus_utils.go file besides the lines returning when some error happen. There are some call to apimeta to set status conditions which are not being tested. I believe we can try to use some mock and unit tests to tests this lines as well.

Acceptance criteria

  • Improve the policyserver_controller.go code coverage to reach close to 70% coverage
  • Improve the policystatus_util.go test to cover the missing SetStatusCondition calls and reach close to 70% coverage
@jvanz
Copy link
Member Author

jvanz commented Mar 1, 2024

This is a spin off of #648

@flavio
Copy link
Member

flavio commented Mar 1, 2024

I think we should tackle #660 before we go and improve the code coverage of the PolicyServer reconciliation loop. That's because there's quite some code we can delete once we address the linked issue

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

No branches or pull requests

2 participants