From fd90592f295b59f06b688a014392045ee679c327 Mon Sep 17 00:00:00 2001 From: Herko Lategan Date: Fri, 22 Nov 2024 15:28:54 +0000 Subject: [PATCH] roachtest: add Tasker error handling comment Added a comment to inform test implementors, using the task API, that returning an error from a Tasker goroutine will fail a test. Informs: #118214 Epic: None Release note: None --- pkg/cmd/roachtest/roachtestutil/task/tasker.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/roachtest/roachtestutil/task/tasker.go b/pkg/cmd/roachtest/roachtestutil/task/tasker.go index e5cf6c67311e..bf0b8eb9222b 100644 --- a/pkg/cmd/roachtest/roachtestutil/task/tasker.go +++ b/pkg/cmd/roachtest/roachtestutil/task/tasker.go @@ -16,9 +16,12 @@ type Func func(context.Context, *logger.Logger) error // Tasker is an interface for executing tasks (goroutines). It is intended for // use in tests, enabling the test framework to manage panics and errors. type Tasker interface { - // Go runs the given function in a goroutine. + // Go runs the given function in a goroutine. If an error is returned, it will + // fail the test. Panics are recovered and treated as errors. Go(fn Func, opts ...Option) // GoWithCancel runs the given function in a goroutine and returns a - // CancelFunc that can be used to cancel the function. + // CancelFunc that can be used to cancel the function. If an error is + // returned, it will fail the test. Panics are recovered and treated as + // errors. GoWithCancel(fn Func, opts ...Option) context.CancelFunc }