Skip to content

Commit 99e9096

Browse files
author
Kenichi Omichi
committed
Remove unused FailfWithOffset()
The function has been unused from outside of e2e framework at all since 30b3472 which added the function. This removes it for code cleanup.
1 parent 3536a48 commit 99e9096

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

test/e2e/framework/log.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,11 @@ func Logf(format string, args ...interface{}) {
4242
log("INFO", format, args...)
4343
}
4444

45-
// Failf logs the fail info, including a stack trace.
45+
// Failf logs the fail info, including a stack trace starts at 2 levels above its caller
46+
// (for example, for call chain f -> g -> Failf("foo", ...) error would be logged for "f").
4647
func Failf(format string, args ...interface{}) {
47-
FailfWithOffset(1, format, args...)
48-
}
49-
50-
// FailfWithOffset calls "Fail" and logs the error with a stack trace that starts at "offset" levels above its caller
51-
// (for example, for call chain f -> g -> FailfWithOffset(1, ...) error would be logged for "f").
52-
func FailfWithOffset(offset int, format string, args ...interface{}) {
5348
msg := fmt.Sprintf(format, args...)
54-
skip := offset + 1
49+
skip := 2
5550
log("FAIL", "%s\n\nFull Stack Trace\n%s", msg, PrunedStack(skip))
5651
e2eginkgowrapper.Fail(nowStamp()+": "+msg, skip)
5752
}

test/e2e/framework/log_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ func TestFailureOutput(t *testing.T) {
110110
},
111111
testResult{
112112
name: "[Top Level] log fails",
113-
output: "INFO: before\nFAIL: I'm failing.\n\nFull Stack Trace\nk8s.io/kubernetes/test/e2e/framework_test.glob..func1.2.1(...)\n\tlog_test.go:56\nk8s.io/kubernetes/test/e2e/framework_test.glob..func1.2()\n\tlog_test.go:57\nk8s.io/kubernetes/test/e2e/framework_test.runTests()\n\tlog_test.go:47" + commonOutput,
113+
output: "INFO: before\nFAIL: I'm failing.\n\nFull Stack Trace\nk8s.io/kubernetes/test/e2e/framework_test.glob..func1.2()\n\tlog_test.go:57\nk8s.io/kubernetes/test/e2e/framework_test.runTests()\n\tlog_test.go:47" + commonOutput,
114114
failure: "I'm failing.",
115-
stack: "k8s.io/kubernetes/test/e2e/framework_test.glob..func1.2.1(...)\n\tlog_test.go:56\nk8s.io/kubernetes/test/e2e/framework_test.glob..func1.2()\n\tlog_test.go:57\nk8s.io/kubernetes/test/e2e/framework_test.runTests()\n\tlog_test.go:47\n",
115+
stack: "k8s.io/kubernetes/test/e2e/framework_test.glob..func1.2()\n\tlog_test.go:57\nk8s.io/kubernetes/test/e2e/framework_test.runTests()\n\tlog_test.go:47\n",
116116
},
117117
}
118118
// Compare individual fields. Comparing the slices leads to unreadable error output when there is any mismatch.

0 commit comments

Comments
 (0)