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

[gk-test] Refactor run code into Runner #1445

Merged
merged 1 commit into from
Jul 20, 2021

Conversation

willbeason
Copy link
Member

Now that much of the test running logic is defined, it is more apparent
how to organize it.

Code specific to running tests, but which does not change with the
nature of the tests being run or how the results are printed, should
live in its own place. It may be decorated in the future with objects
(like Printers) which are specified by the user.

This PR has zero changes to logic - it only moves logic around.

Signed-off-by: Will Beason willbeason@google.com

@willbeason willbeason added the authorship-tooling Tools for authors of Gatekeeper Constraints, Templates, Mutators label Jul 15, 2021
@willbeason willbeason added this to the gk-test cli alpha milestone Jul 15, 2021
@willbeason willbeason self-assigned this Jul 15, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2021

Codecov Report

Merging #1445 (4c02d44) into master (152e102) will increase coverage by 0.40%.
The diff coverage is 90.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1445      +/-   ##
==========================================
+ Coverage   50.35%   50.75%   +0.40%     
==========================================
  Files          77       78       +1     
  Lines        5108     5111       +3     
==========================================
+ Hits         2572     2594      +22     
+ Misses       2185     2170      -15     
+ Partials      351      347       -4     
Flag Coverage Δ
unittests 50.75% <90.90%> (+0.40%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/gktest/opa.go 50.00% <ø> (ø)
pkg/gktest/read_constraints.go 88.88% <88.88%> (ø)
pkg/gktest/runner.go 93.33% <93.33%> (ø)
pkg/readiness/object_tracker.go 82.60% <0.00%> (+1.63%) ⬆️
...onstrainttemplate/constrainttemplate_controller.go 57.28% <0.00%> (+4.20%) ⬆️
pkg/gktest/filter.go 66.66% <0.00%> (+33.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 152e102...4c02d44. Read the comment docs.

@willbeason willbeason force-pushed the refactor branch 2 times, most recently from 1fcbd99 to ff33863 Compare July 15, 2021 16:07
@willbeason willbeason mentioned this pull request Jul 15, 2021
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.

LGTM

@sozercan @shomron LGTY?

@willbeason willbeason changed the title Refactor run code into Runner [gk-test] Refactor run code into Runner Jul 16, 2021
Now that much of the test running logic is defined, it is more apparent
how to organize it.

Code specific to running tests, but which does not change with the
nature of the tests being run or how the results are printed, should
live in its own place. It may be decorated in the future with objects
(like Printers) which are specified by the user.

This PR has zero changes to logic - it only moves logic around.

Signed-off-by: Will Beason <willbeason@google.com>
Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

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

LGTM

@willbeason willbeason merged commit 55a042e into open-policy-agent:master Jul 20, 2021
@willbeason willbeason deleted the refactor branch July 20, 2021 14:41
julianKatz pushed a commit to julianKatz/gatekeeper that referenced this pull request Jul 27, 2021
Now that much of the test running logic is defined, it is more apparent
how to organize it.

Code specific to running tests, but which does not change with the
nature of the tests being run or how the results are printed, should
live in its own place. It may be decorated in the future with objects
(like Printers) which are specified by the user.

This PR has zero changes to logic - it only moves logic around.

Signed-off-by: Will Beason <willbeason@google.com>
Signed-off-by: juliankatz <juliankatz@google.com>
julianKatz added a commit to julianKatz/gatekeeper that referenced this pull request Aug 2, 2021
I recently ran `make vendor` on gatekeeper master and noticed that a
number of files from frameworks/constraint were being deleted.  Why?

It runs out that a recent PR (open-policy-agent#1445) removed a dependency on
frameworks/constraint/pkg/apis and `make vendor` was pruning the unused
code from the vendor/ directory.

As the API types declared in frameworks/constraint are part of the API
used in g8r, I thought it appropriate to add them to the scheme.  This
fixes the problem with make vendor.

Signed-off-by: juliankatz <juliankatz@google.com>
julianKatz added a commit to julianKatz/gatekeeper that referenced this pull request Aug 2, 2021
I recently ran `make vendor` on gatekeeper master and noticed that a
number of files from frameworks/constraint were being deleted.  Why?

It runs out that a recent PR (open-policy-agent#1445) removed a dependency on
frameworks/constraint/pkg/apis and `make vendor` was pruning the unused
code from the vendor/ directory.

Further, while we might expect the AddToScheme calls to be used when we
setup the scheme in main.go, it turns out that we were making
essentially duplicate versions of the AddToScheme files in g8r.  I've
replaced these with a single file that calls all the AddToScheme
functions in frameworks/constraint.

Signed-off-by: juliankatz <juliankatz@google.com>
maxsmythe pushed a commit that referenced this pull request Aug 3, 2021
* Add frameworks apis to scheme

I recently ran `make vendor` on gatekeeper master and noticed that a
number of files from frameworks/constraint were being deleted.  Why?

It runs out that a recent PR (#1445) removed a dependency on
frameworks/constraint/pkg/apis and `make vendor` was pruning the unused
code from the vendor/ directory.

As the API types declared in frameworks/constraint are part of the API
used in g8r, I thought it appropriate to add them to the scheme.  This
fixes the problem with make vendor.

Signed-off-by: juliankatz <juliankatz@google.com>

* Add frameworks apis to scheme

I recently ran `make vendor` on gatekeeper master and noticed that a
number of files from frameworks/constraint were being deleted.  Why?

It runs out that a recent PR (#1445) removed a dependency on
frameworks/constraint/pkg/apis and `make vendor` was pruning the unused
code from the vendor/ directory.

Further, while we might expect the AddToScheme calls to be used when we
setup the scheme in main.go, it turns out that we were making
essentially duplicate versions of the AddToScheme files in g8r.  I've
replaced these with a single file that calls all the AddToScheme
functions in frameworks/constraint.

Signed-off-by: juliankatz <juliankatz@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authorship-tooling Tools for authors of Gatekeeper Constraints, Templates, Mutators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants