-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add helper wrapping envtest #2995
Conversation
1450fc9
to
c200d4e
Compare
err := testEnv.Get(ctx, key, machine) | ||
Expect(apierrors.IsNotFound(err)).To(BeTrue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling out that this is the only substantive change, I am not sure why remediated machines were not being deleted before in this test but now they error with NotFound
. Maybe the sync interval was different and so reconciliation didn't happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting, the new check looks better though
Not sure what to do about the apidiff failure
Doesn't look like any of the providers use this test code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benmoss
I like the idea of having util for envtest, but I find a little bit confusing the fact that TestEnvironment is also a Manager and a Client.
test/helpers/envtest.go
Outdated
return err | ||
} | ||
|
||
func (t *TestEnvironment) initManager() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should return the manager and the client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I inlined this since we don't really need it as a separate method at all
return err | ||
} | ||
|
||
func (t *TestEnvironment) StartManager() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to merge this into init manager?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to register reconcilers before you start the manager, so we can't start it when we initialize it
I just did this as a convenience, to reduce the verbosity of using it. We could not embed those structs though, the main win here is to avoid our tests having 5 pieces of state, instead we just wrap up everything in the environment object. |
/test pull-cluster-api-e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/milestone v0.3.6
/assign @ncdc @fabriziopandini
for final LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: benmoss, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
What this PR does / why we need it:
Trying to make envtest it a simpler API, less copypasta. I think we should be able to keep it up to date with the full set of our CRDs.
I only updated the
controllers
package tests, but others can be updated as needed.Split out from #2975