1
0
Fork 0
Philip O'Toole 8 months ago
parent 7334aafb97
commit 6e294e2a3b

@ -134,6 +134,11 @@ func Test_UploaderFailThenOK(t *testing.T) {
wg.Add(2)
sc := &mockStorageClient{
uploadFn: func(ctx context.Context, reader io.Reader, id string) error {
if uploadCount == 2 {
// uploadFn can be called a third time before the cancel kicks in.
// This would push waitGroup into negative numbers and panic.
return nil
}
defer wg.Done()
if uploadCount == 0 {
uploadCount++
@ -175,6 +180,11 @@ func Test_UploaderOKThenFail(t *testing.T) {
wg.Add(2)
sc := &mockStorageClient{
uploadFn: func(ctx context.Context, reader io.Reader, id string) error {
if uploadCount == 2 {
// uploadFn can be called a third time before the cancel kicks in.
// This would push waitGroup into negative numbers and panic.
return nil
}
defer wg.Done()
if uploadCount == 1 {

Loading…
Cancel
Save