Skip to content

Commit

Permalink
test update
Browse files Browse the repository at this point in the history
  • Loading branch information
taylanisikdemir committed Apr 12, 2024
1 parent 019ac56 commit 2cc4d24
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions common/codec/version0_thriftrw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,26 @@ func (s *thriftRWEncoderSuite) TestEncode() {

func (s *thriftRWEncoderSuite) TestEncodeConcurrent() {
var wg sync.WaitGroup
var mu sync.Mutex
var finalErr error
count := 200
errs := make([]error, count)
wg.Add(count)
for i := 0; i < count; i++ {
go func() {
go func(idx int) {
defer wg.Done()
binary, err := s.encoder.Encode(thriftObject)
if err != nil {
mu.Lock()
finalErr = multierr.Append(finalErr, err)
mu.Unlock()
errs[idx] = err
return
}

if diff := cmp.Diff(thriftEncodedBinary, binary); diff != "" {
mu.Lock()
finalErr = multierr.Append(finalErr, fmt.Errorf("Mismatch (-want +got):\n%s", diff))
mu.Unlock()
errs[idx] = fmt.Errorf("Mismatch (-want +got):\n%s", diff)
return
}
}()
}(i)
}
wg.Wait()
s.NoError(finalErr)
s.NoError(multierr.Combine(errs...))
}

func (s *thriftRWEncoderSuite) TestDecode() {
Expand Down

0 comments on commit 2cc4d24

Please sign in to comment.