MCPcopy
hub / github.com/zeromicro/go-zero / TestBatchErrorConcurrentAdd

Function TestBatchErrorConcurrentAdd

core/errorx/batcherror_test.go:51–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestBatchErrorConcurrentAdd(t *testing.T) {
52 const count = 10000
53 var batch BatchError
54 var wg sync.WaitGroup
55
56 wg.Add(count)
57 for i := 0; i < count; i++ {
58 go func() {
59 defer wg.Done()
60 batch.Add(errors.New(err1))
61 }()
62 }
63 wg.Wait()
64
65 assert.NotNil(t, batch.Err())
66 assert.Equal(t, count, len(batch.errs))
67 assert.True(t, batch.NotNil())
68}
69
70func TestBatchError_Unwrap(t *testing.T) {
71 t.Run("nil", func(t *testing.T) {

Callers

nothing calls this directly

Calls 8

AddMethod · 0.95
NotNilMethod · 0.95
ErrMethod · 0.95
TrueMethod · 0.80
AddMethod · 0.65
DoneMethod · 0.65
WaitMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…