-
Notifications
You must be signed in to change notification settings - Fork 562
test(e2e): patch installplans w/ server-side apply #1617
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
test(e2e): patch installplans w/ server-side apply #1617
Conversation
/hold Looks like the patch is still running into issues with |
test/e2e/subscription_e2e_test.go
Outdated
|
||
// Set the InstallPlan's approval mode to Manual | ||
plan.Spec.Approval = v1alpha1.ApprovalManual | ||
plan.Spec.Approved = false | ||
plan, err = crc.OperatorsV1alpha1().InstallPlans(ref.Namespace).Update(context.TODO(), plan, metav1.UpdateOptions{}) | ||
require.NoError(GinkgoT(), err) | ||
setTypeMeta := func(p *v1alpha1.InstallPlan) *v1alpha1.InstallPlan { |
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.
if this is in an eventually, it should work?
This is really interesting. Does it make any sense to consider turning this logic into a library such that more of the e2e tests can start to use server-side apply? |
/hold cancel |
ea1cc4f
to
18b5531
Compare
@exdx The function is included with our e2e tests here, so it's already available to use in any of them. |
/test e2e-gcp |
return err | ||
} | ||
cp.GetObjectKind().SetGroupVersionKind(obj.GetObjectKind().GroupVersionKind()) | ||
cp.SetManagedFields(nil) |
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 this needed? shouldn't the ForceOwnership
make test
become the owner of any changed fields?
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.
this came out of some red/green/refactor-ing -- an error is returned without it.
Use server-side apply to patch InstallPlans under test in order to prevent update conflict flakes.
/retest |
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.
/lgtm
You've already addressed my sidechannel feedback, but I noticed a few nits on my last read.
|
||
// Apply returns a function that invokes a change func on an object and performs a server-side apply patch with the result and its status subresource. | ||
// The given resource must only specify its Name, Namespace, APIVersion, and Kind. | ||
// The given change function must be aunary, matching the signature: "func(<obj type>) 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.
// The given change function must be aunary, matching the signature: "func(<obj type>) error". | |
// The given change function must be unary, matching the signature: "func(<obj type>) error". |
} | ||
var err error | ||
if rt := changeType.Out(0); !rt.Implements(reflect.TypeOf((*error)(nil)).Elem()) { | ||
panic(fmt.Sprintf("unexpected return type in change function signature: expected %t, preset %s", err, rt)) |
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.
panic(fmt.Sprintf("unexpected return type in change function signature: expected %t, preset %s", err, rt)) | |
panic(fmt.Sprintf("unexpected return type in change function signature: expected %t, present %s", err, rt)) |
return err | ||
} | ||
|
||
reflect.ValueOf(obj).Elem().Set(cpv.Elem()) |
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.
Does the doc comment make it clear that the value addressed byobj
will be updated?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: benluddy, njhale 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 |
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
Use server-side apply to patch InstallPlans under test in order to prevent
update conflict flakes.