Skip to content

Commit

Permalink
add a testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
pkwarren committed Sep 12, 2023
1 parent a5a296e commit 76af8ef
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"errors"
"fmt"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -107,3 +108,17 @@ func TestErrorIs(t *testing.T) {
assert.False(t, errors.Is(connectErr, NewError(CodeUnavailable, err)))
assert.True(t, errors.Is(connectErr, connectErr))
}

func TestErrorNoRace(t *testing.T) {
t.Parallel()
err := NewError(CodeUnauthenticated, errors.New("unauthenticated"))
var wg sync.WaitGroup
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
_ = err.Meta()
}()
}
wg.Wait()
}

0 comments on commit 76af8ef

Please sign in to comment.