Skip to content

Commit 6396718

Browse files
authored
Test-only tech-debt cleanup: Make TestCtx use stdlib testing.Context() instead of a DIY version (#7669)
1 parent 45b3bbf commit 6396718

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

base/logging_context.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ func NewTaskID(contextID string, taskName string) string {
176176

177177
// TestCtx creates a context for the given test which is also cancelled once the test has completed.
178178
func TestCtx(t testing.TB) context.Context {
179-
ctx, cancelCtx := context.WithCancel(context.Background())
180-
t.Cleanup(cancelCtx)
181-
return LogContextWith(ctx, &LogContext{TestName: t.Name()})
179+
return LogContextWith(t.Context(), &LogContext{TestName: t.Name()})
182180
}
183181

184182
// BucketCtx extends the parent context with a bucket name.

0 commit comments

Comments
 (0)