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: Remove client.Reset usage #1762

Merged
merged 3 commits into from Dec 18, 2021

Conversation

willbeason
Copy link
Member

@willbeason willbeason commented Dec 15, 2021

Right now client.Reset complicates the ability to shard template compilation and running as it means it's very easy to accidentally forget to completely reset state. We're going to be making a lot of changes relatively quickly to local.Driver and client.Client, so we may miss things. We could try to maintain this behavior, but it'll be a lot of trouble (both to implement + test).

Further, it means that we can't initialize modules as part of Client/Driver initialization since these are immediately deleted per the call to client.Reset after Client is instantiated.

This PR removes calls to client.Reset. A PR in frameworks will remove this function from Client's interface.

We originally added client.Reset to prepare for the possibility of a remote driver in frameworks. For now we don't have plans to complete that, so it seems safe to remove usage here. There are tests which made usage of this functionality - I've modified them so each case instantiates a new Client. This should have no effect on benchmarks as this setup does not happen within the call to b.Run().

This does not change the preexisting issue of broken benchmarks.

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

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

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

codecov-commenter commented Dec 17, 2021

Codecov Report

Merging #1762 (7fcb486) into master (7ce20d9) will decrease coverage by 0.09%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1762      +/-   ##
==========================================
- Coverage   52.35%   52.26%   -0.10%     
==========================================
  Files          98       98              
  Lines        8781     8781              
==========================================
- Hits         4597     4589       -8     
- Misses       3824     3830       +6     
- Partials      360      362       +2     
Flag Coverage Δ
unittests 52.26% <ø> (-0.10%) ⬇️

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

Impacted Files Coverage Δ
...onstrainttemplate/constrainttemplate_controller.go 59.85% <0.00%> (-2.89%) ⬇️
pkg/readiness/ready_tracker.go 69.83% <0.00%> (-0.51%) ⬇️
pkg/readiness/object_tracker.go 83.98% <0.00%> (+1.06%) ⬆️
pkg/readiness/list.go 91.17% <0.00%> (+11.76%) ⬆️

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 609da15...7fcb486. Read the comment docs.

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 48eab16 into open-policy-agent:master Dec 18, 2021
@willbeason willbeason deleted the no-reset branch December 18, 2021 14:40
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.

None yet

5 participants