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: fixing some misleading unit test case names #4934

Merged
merged 3 commits into from
Dec 17, 2024

Conversation

keithfz
Copy link
Contributor

@keithfz keithfz commented Dec 16, 2024

What type of PR is this?

Fix

What this PR does / why we need it:
Some of the test cases in api/v1alpha1/validation/envoyproxy_validate_test.go were misleading.

I initially noticed a couple test cases were named "invalid" but they were actually valid scenarios, and were being checked as such with the expected: true field in the test table. This was for e.g. should be invalid when service patch type is empty

Upon this, also realized there two tests were not testing what they were supposed to be. E.g. should be invalid when pdb type not set should be valid, and was only invalid because the test did have the patch type set and did not the patch object, causing the invalid result. The correct thing to test for would be a valid case where type is not set, but patch is.

Also added more specific test names for the deployment cases, since we test patches for all deployment,daemonset,service,hpa,pdb in the validation tests, as well as fixed a misleading comment/log message in kubernetes_helpers.go that was related to similar codepaths.

Which issue(s) this PR fixes:

Fixes #4933

Release Notes: No

Signed-off-by: keithfz <kzeto4@gmail.com>
Signed-off-by: keithfz <kzeto4@gmail.com>
Signed-off-by: keithfz <kzeto4@gmail.com>
@keithfz keithfz requested a review from a team as a code owner December 16, 2024 05:36
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 66.28%. Comparing base (469de2f) to head (47d1087).

Files with missing lines Patch % Lines
api/v1alpha1/kubernetes_helpers.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4934      +/-   ##
==========================================
+ Coverage   66.27%   66.28%   +0.01%     
==========================================
  Files         209      209              
  Lines       32035    32035              
==========================================
+ Hits        21231    21235       +4     
+ Misses       9541     9539       -2     
+ Partials     1263     1261       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@zhaohuabing zhaohuabing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

Copy link
Contributor

@shawnh2 shawnh2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for checking

@shawnh2 shawnh2 merged commit 4cba2e2 into envoyproxy:main Dec 17, 2024
22 of 25 checks passed
Dean-Coakley pushed a commit to Dean-Coakley/envoy-gateway that referenced this pull request Dec 20, 2024
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.

Some misleading test names in api/v1alpha1/validation/envoyproxy_validate_test.go
3 participants