-
Notifications
You must be signed in to change notification settings - Fork 546
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
e2e test utilities update #2799
Conversation
f5a8d7d
to
de529f0
Compare
} | ||
|
||
func (m *DeterminedE2EClient) Update(context context.Context, obj k8scontrollerclient.Object, options ...k8scontrollerclient.UpdateOption) error { | ||
m.keepTrying(func() 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.
should we check for conflict failures and get the latest resource version before trying again?
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.
Yes, I think so, otherwise this will be pretty brittle.
We could use the SSA client, or maybe an merge update strategy would work?
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
/retest-required Please review the full test history for this PR and help us cut down flakes. |
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.
Very nice. I had some nits, nothing blocking. I saw @njhale lgtm'd so it's fine to go in as-is.
I respun CI, I think there may be another flake.
|
||
"github.com/onsi/ginkgo/v2" | ||
k8serror "k8s.io/apimachinery/pkg/api/errors" | ||
extensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" |
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.
nit: we use apiextensionsv1
for this import elsewhere in the codebase
|
||
Logf("deleting %s/%s", namespace, obj.GetName()) | ||
if err := k8scontrollerclient.IgnoreNotFound(m.Delete(context.Background(), obj)); err != nil { | ||
Logf("error deleting object %s/%s: %s", namespace, obj.GetName(), obj) |
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.
nit: should the last argument here be the error instead of the obj?
if err := m.Client.Delete(context.Background(), &crd); err != nil { | ||
return err |
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.
CRDs may take some time to delete, especially on openshift, if there are CRs associated with that CRD as well. Would it make sense to block after Deletion and wait for a apierrors.NotFound(m.Client.Get(crd))
?
} | ||
|
||
func (m *DeterminedE2EClient) Update(context context.Context, obj k8scontrollerclient.Object, options ...k8scontrollerclient.UpdateOption) error { | ||
m.keepTrying(func() 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.
Yes, I think so, otherwise this will be pretty brittle.
We could use the SSA client, or maybe an merge update strategy would work?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: exdx, njhale, perdasilva 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 |
c407449
to
0760106
Compare
0760106
to
57c5357
Compare
/lgtm |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
Should we squash the commits before merging? |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
5 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
Holding so the bot doesn't go crazy retesting. /hold |
57c5357
to
20b3c6d
Compare
* Update unpack job security Signed-off-by: perdasilva <perdasilva@redhat.com> * Refactor catsrc pod creation to use security package Signed-off-by: perdasilva <perdasilva@redhat.com>
…method to create from file Signed-off-by: perdasilva <perdasilva@redhat.com>
…llection Signed-off-by: perdasilva <perdasilva@redhat.com>
Signed-off-by: perdasilva <perdasilva@redhat.com>
Signed-off-by: perdasilva <perdasilva@redhat.com>
Signed-off-by: perdasilva <perdasilva@redhat.com>
20b3c6d
to
527290f
Compare
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
// ApplyPodSpecSecurity applies the standard security profile to a pod spec | ||
func ApplyPodSpecSecurity(spec *corev1.PodSpec) { | ||
var containerSecurityContext = &corev1.SecurityContext{ | ||
Privileged: pointer.Bool(privileged), |
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 pointer.T()
pattern is nice
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.
all @timflannagan
util.Logf("expecting catalog source last connection state '%s' to be '%s'", actual.Status.GRPCConnectionState.LastObservedState, s.Expected) | ||
return s.EqualMatcher.Match(actual.Status.GRPCConnectionState.LastObservedState) | ||
default: | ||
return false, fmt.Errorf("actual %v is not a subscription", actual) |
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.
return false, fmt.Errorf("actual %v is not a subscription", actual) | |
return false, fmt.Errorf("actual %v is not a catalogsource", actual) |
*matchers.EqualMatcher | ||
} | ||
|
||
func (s *CatalogSourceGrpcConnectionLastConnectionStateMatcher) FailureMessage(actual interface{}) (message string) { |
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.
Could we use client.Object
instead of the interface{}
type as an argument? Since we know we are dealing with a kube object.
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 is the Matcher interface =S would be nice tho!
/hold cancel |
Description of the change:
This PR makes the following changes:
DeterminedE2EClient
which wraps calls around an Eventually loopE2ETestHelper
. A dedicated class for OLM resource assertions with some initial assertions for Subscriptions and CatalogSourceMotivation for the change:
BugFix: removes resource catching from update call in e2e client. This should not be done since it may be updating a resource that is not managed by the client.
Architectural changes:
None
Testing remarks:
Manually tested against e2e tests
Reviewer Checklist
/doc
[FLAKE]
are truly flaky and have an issue