From 249a376889a8414e0007cd38fa2ac89a54051bf3 Mon Sep 17 00:00:00 2001 From: Ben Brooks Date: Thu, 7 Aug 2025 19:31:00 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"Test-only=20tech-debt=20cleanup:=20Ma?= =?UTF-8?q?ke=20`TestCtx`=20use=20stdlib=20`testing.Conte=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6396718d1539745519a1041a2a4b25c3196140a5. --- base/logging_context.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/logging_context.go b/base/logging_context.go index 03da897e3e..3231b299f5 100644 --- a/base/logging_context.go +++ b/base/logging_context.go @@ -176,7 +176,9 @@ func NewTaskID(contextID string, taskName string) string { // TestCtx creates a context for the given test which is also cancelled once the test has completed. func TestCtx(t testing.TB) context.Context { - return LogContextWith(t.Context(), &LogContext{TestName: t.Name()}) + ctx, cancelCtx := context.WithCancel(context.Background()) + t.Cleanup(cancelCtx) + return LogContextWith(ctx, &LogContext{TestName: t.Name()}) } // BucketCtx extends the parent context with a bucket name.