Skip to content

Commit

Permalink
roachtest: add Tasker error handling comment
Browse files Browse the repository at this point in the history
Added a comment to inform test implementors, using the task API, that returning
an error from a Tasker goroutine will fail a test.

Informs: cockroachdb#118214

Epic: None
Release note: None
  • Loading branch information
herkolategan committed Nov 22, 2024
1 parent 716be3f commit fd90592
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/cmd/roachtest/roachtestutil/task/tasker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit fd90592

Please sign in to comment.