Skip to content

Commit ccb108c

Browse files
committed
fix: race in tests
1 parent cd0fa1d commit ccb108c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

exitplan_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,16 @@ func TestOnExitTimeout(t *testing.T) {
196196
func TestCallbackName(t *testing.T) {
197197
t.Parallel()
198198

199+
mu := sync.Mutex{}
199200
names := make([]string, 0)
200201

201202
l := exitplan.New(
202203
exitplan.WithExitError(func(err error) {
203204
var exErr *exitplan.CallbackErr
204205
if errors.As(err, &exErr) {
206+
mu.Lock()
205207
names = append(names, exErr.Name)
208+
mu.Unlock()
206209
}
207210
}),
208211
)

0 commit comments

Comments
 (0)