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

Refactor /pkg/webhook/v1beta1/pod/inject_webhook_test.go according to Developer Guide. #2388

Closed
Electronic-Waste opened this issue Jul 16, 2024 · 2 comments · Fixed by #2401

Comments

@Electronic-Waste
Copy link
Member

What you would like to be added?

Refactor /pkg/webhook/v1beta1/pod/inject_webhook_test.go to obey rules defined in the Developer Guide.

Why is this needed?

Currently, testcases in /pkg/webhook/v1beta1/pod/inject_webhook_test.go are defined in slices and use reflect.Equal for comparison. It's not recommended according to the Developer Guide. We should:

  1. Use cmp.Diff instead of reflect.Equal, to provide useful comparisons.

  2. Define test cases as maps instead of slices to avoid dependencies on the running order. Map key should be equal to the test case name.

Love this feature?

Give it a 👍 We prioritize the features with most 👍

@andreyvelich
Copy link
Member

Thank you for creating this @Electronic-Waste!

Do you want to work on this testing improvement ?

@Electronic-Waste
Copy link
Member Author

@andreyvelich Yes, I will work on this testing improvement when I have the bandwidth.

/assign

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

Successfully merging a pull request may close this issue.

2 participants