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 and clean up e2e framework utils, this patch handles test/e2e/framework/psp_util.go file #77534
Conversation
/hold |
Can you create OWNERS files for the psp dir please? |
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
but you need add the generated files and OWNERs files.
Overall lgtm, can you rebase please? |
Hi @WanLinghao any updates on this? |
@alejandrox1 Sorry for the delay, I have checked this, it is not ready to merge. We must take care of |
Sorry for the delay as well, there is actually been some debate about how to handle To get in the same page, framework.ExpectNoErrorWithOffset(1, err, explain...)
gomega.ExpectWithOffset(1, err).NotTo(gomega.HaveOccurred(), explain...)} The first argument to For example, if you have a test, and you perform certain actions in your test through helper functions and an assertion in one of these helper function fails the line numbers provided by Gomega will point you to the line in the helper function that failed instead of showing you the line in your test that failed.
With that in mind, in order to refactor code from the framework into its own package within the framework (i.e., e2e/framework/psp), we need to replace calls to if err != nil {
e2elog.Logf("Unexpected error occurred: %v", err)
}
gomega.ExpectWithOffset(1+offset, err).NotTo(gomega.HaveOccurred(), explain...) Which replaces the call to |
@alejandrox1 Hi, this patch is ready to review |
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
/approve
/hold
Do we want an owners file for framework/psp?
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fejta, timothysc, WanLinghao 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 |
…e/framework/psp_util.go file
/test pull-kubernetes-e2e-gce-device-plugin-gpu |
@fejta Hi, I updated the patch to fix a golint error. |
if err != nil { | ||
e2elog.Logf("Unexpected error occurred: %v", err) | ||
} | ||
gomega.ExpectWithOffset(2, err).NotTo(gomega.HaveOccurred(), explain...) |
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 ExpectNoError
from the framework calls gomega.ExpectWithOffset(1, err)
not gomega.ExpectWithOffset(2, err)
, correct? If so, we should change this.
This patch changes the current behavior. Which is not wrong but we should add it in a separate PR and only focus on refactoring for this on. This way we can revert if something starts failing in CI.
/lgtm cancel
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.
@alejandrox1 Do you mean we should change gomega.ExpectWithOffset(2, err).NotTo(gomega.HaveOccurred(), explain...)
to gomega.ExpectWithOffset(1, err).NotTo(gomega.HaveOccurred(), explain...)
? But I believe the original definition should be gomega.ExpectWithOffset(2, err).NotTo(gomega.HaveOccurred(), explain...)
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.
Sorry, you are completely right!
Given https://github.com/kubernetes/kubernetes/blob/master/test/e2e/framework/util.go#L1321
a framework.NoExpectError
is equivalent to gomega.ExpectWithOffset(2, err).NotTo(gomega.HaveOccurred(), explain...)
.
/lgtm
/hold cancel
I believe the consensus thus far has to keep all e2e framework subpkgs under the same ownership. |
/retest Review the full test history for this PR. Silence the bot with an |
/kind cleanup
What this PR does / why we need it:
Refactor and clean up e2e framework utils, this patch handles test/e2e/framework/perf_util.go file
ref:#76206