Skip to content

Commit

Permalink
fix test to call t.Fatal in main test goroutine
Browse files Browse the repository at this point in the history
Signed-off-by: Adolfo García Veytia (Puerco) <adolfo.garcia@uservers.net>
  • Loading branch information
derekperkins authored and puerco committed Jul 23, 2024
1 parent 5168f2d commit a59174a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions throttler/throttler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,19 @@ func TestBatchedThrottler(t *testing.T) {
th := NewBatchedThrottler(test.MaxWorkers, len(test.ToBeBatched), test.BatchSize)
for i := 0; i < th.TotalJobs(); i++ {
go func(tbbSlice []string, expectedSlice []string) {
var err error
if !reflect.DeepEqual(tbbSlice, expectedSlice) {
t.Fatalf("wanted: %#v | got: %#v", expectedSlice, tbbSlice)
err = fmt.Errorf("wanted: %#v | got: %#v", expectedSlice, tbbSlice)
}
th.Done(nil)
th.Done(err)
}(test.ToBeBatched[th.BatchStartIndex():th.BatchEndIndex()], test.ExpectedBatchedSlices[i])
if errCount := th.Throttle(); errCount > 0 {
break
}
}

if th.Err() != nil {
fmt.Println("err:", th.Err())
t.Fatal(th.Err())
}
}
}

0 comments on commit a59174a

Please sign in to comment.