mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
e2e framework: fix incorrect backtrace in Failf
Commit 99e9096034
was only supposed to remove the
FailfWithOffset function, but it also changed the behavior by skipping one
additional stack frame. That makes no sense and is inconsistent with Fail, which
also logs the direct caller.
This commit is contained in:
parent
6e31c6531f
commit
2a7f9723ec
@ -41,11 +41,11 @@ func Logf(format string, args ...interface{}) {
|
||||
log("INFO", format, args...)
|
||||
}
|
||||
|
||||
// Failf logs the fail info, including a stack trace starts at 2 levels above its caller
|
||||
// (for example, for call chain f -> g -> Failf("foo", ...) error would be logged for "f").
|
||||
// Failf logs the fail info, including a stack trace starts with its direct caller
|
||||
// (for example, for call chain f -> g -> Failf("foo", ...) error would be logged for "g").
|
||||
func Failf(format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
skip := 2
|
||||
skip := 1
|
||||
log("FAIL", "%s\n\nFull Stack Trace\n%s", msg, PrunedStack(skip))
|
||||
fail(nowStamp()+": "+msg, skip)
|
||||
panic("unreachable")
|
||||
|
@ -154,10 +154,14 @@ k8s.io/kubernetes/test/e2e/framework_test.glob..func1.5()
|
||||
FAIL: I'm failing.
|
||||
|
||||
Full Stack Trace
|
||||
k8s.io/kubernetes/test/e2e/framework_test.glob..func1.3.1(...)
|
||||
log_test.go:56
|
||||
k8s.io/kubernetes/test/e2e/framework_test.glob..func1.3()
|
||||
log_test.go:57` + commonOutput,
|
||||
Failure: "I'm failing.",
|
||||
Stack: `k8s.io/kubernetes/test/e2e/framework_test.glob..func1.3()
|
||||
Stack: `k8s.io/kubernetes/test/e2e/framework_test.glob..func1.3.1(...)
|
||||
log_test.go:56
|
||||
k8s.io/kubernetes/test/e2e/framework_test.glob..func1.3()
|
||||
log_test.go:57`,
|
||||
},
|
||||
output.TestResult{
|
||||
|
Loading…
Reference in New Issue
Block a user