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

feat: support expansion in gator verify #3650

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

David-Jaeyoon-Lee
Copy link
Contributor

What this PR does / why we need it:
It allows for expansion in gator verify.

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #3432

Special notes for your reviewer:

@David-Jaeyoon-Lee David-Jaeyoon-Lee requested a review from a team as a code owner October 16, 2024 21:17
@David-Jaeyoon-Lee David-Jaeyoon-Lee marked this pull request as draft October 16, 2024 21:17
@codecov-commenter
Copy link

codecov-commenter commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 54.68750% with 29 lines in your changes missing coverage. Please review.

Project coverage is 47.75%. Comparing base (3350319) to head (716b53c).
Report is 168 commits behind head on master.

Files with missing lines Patch % Lines
pkg/gator/verify/runner.go 64.81% 13 Missing and 6 partials ⚠️
pkg/gator/reader/read_constraints.go 0.00% 10 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (3350319) and HEAD (716b53c). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (3350319) HEAD (716b53c)
unittests 2 1
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3650      +/-   ##
==========================================
- Coverage   54.49%   47.75%   -6.75%     
==========================================
  Files         134      221      +87     
  Lines       12329    18756    +6427     
==========================================
+ Hits         6719     8956    +2237     
- Misses       5116     8949    +3833     
- Partials      494      851     +357     
Flag Coverage Δ
unittests 47.75% <54.68%> (-6.75%) ⬇️

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.

pkg/gator/errors.go Outdated Show resolved Hide resolved
pkg/gator/verify/runner.go Outdated Show resolved Hide resolved
@JaydipGabani
Copy link
Contributor

Are we going to add expannsionTemplate to suite?

@David-Jaeyoon-Lee David-Jaeyoon-Lee marked this pull request as ready for review October 24, 2024 22:55
@maxsmythe maxsmythe requested a review from a team October 25, 2024 23:52
Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

couple small nits

@@ -9,6 +9,9 @@ var (
// ErrNotAConstraint indicates the user-indicated file does not contain a
// Constraint.
ErrNotAConstraint = errors.New("not a Constraint")
// ErrNotAnExpansion indicates the user-indicated file does not contain a
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: "an ExpansionTemplate"

}

gvk := u.GroupVersionKind()
if gvk.Group != "expansion.gatekeeper.sh" {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should test both group and kind here (we don't do that for constraints because constraints have an unknown set of kinds that all live under the same group)

@@ -327,7 +364,32 @@ func (r *Runner) runReview(ctx context.Context, newClient func() (gator.Client,
Object: *toReview,
Source: mutationtypes.SourceTypeOriginal,
}
return c.Review(ctx, au, reviews.EnforcementPoint(util.GatorEnforcementPoint))

review, err := c.Review(ctx, au, reviews.EnforcementPoint(util.GatorEnforcementPoint))
Copy link
Contributor

Choose a reason for hiding this comment

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

As a general rule in golang you should return ASAP on error.

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.

source:generated within constraint.yaml causes gator verify to fail
4 participants