-
Notifications
You must be signed in to change notification settings - Fork 104
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
Mark E2E plumbing as test helpers #421
Conversation
Welcome @negz! |
Hi @negz. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Is this actually helping? |
I see that you comment exactly that in crossplane/crossplane#5722 (comment). So this PR is better than nothing clearly. |
/ok-to-test |
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 great @negz . Any side effects of calling t.Helper() successively on the same *testing.T value ?
Apologies for the late review on this folks. |
@vladimirvivien Not that I know of. I believe it's pretty normal to call it repeatedly (e.g. if you have several layers of test helper functions). |
/retest |
@vladimirvivien Calling the package abc
import (
"os"
"testing"
)
func TestMain(m *testing.M) {
os.Exit(m.Run())
}
func assertSomething(t *testing.T, a int) {
t.Helper()
t.Error("something failed")
}
func TestSomething(t *testing.T) {
data := []int{
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
}
for tc := range data {
assertSomething(t, tc)
}
} |
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
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 |
/lgtm |
/retest |
This is failing consistently it seems, is there a regression ? /retest |
@vladimirvivien seems like a flaky test. Let me take a look. |
/approve |
@negz can you please rebase and fix the conflicts? thanks |
This results in the environment.Test call point being used as the file and line number in test logs, failures, etc. Signed-off-by: Nic Cope <[email protected]>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpanato, harshanarayana, negz 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 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
In Crossplane we try to use reusable step functions in our E2E tests, so they end up looking like this:
Since step functions are passed
*testing.T
we'll often callt.Error
,t.Log
, etc from our step functions. These testing calls include the call point (i.e. filename and line number) in their output. Without usingt.Helper()
the call point will be the file where the step function is defined (e.g.features.go
) rather than the calling test.We want to mark our step functions as test helpers using
t.Helper
so that the calling test is included in the output. For this to work we need to mark all the intermediary plumbing functions and methods in e2e-framework as helpers too.Which issue(s) this PR fixes:
I didn't raise an issue tracking this.
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., Usage docs, etc.: