diff --git a/upload/uploader_test.go b/upload/uploader_test.go index 75008373..1fe8915c 100644 --- a/upload/uploader_test.go +++ b/upload/uploader_test.go @@ -49,6 +49,7 @@ func Test_UploaderSingleUpload(t *testing.T) { go uploader.Start(ctx, nil) wg.Wait() cancel() + <-ctx.Done() if exp, got := string(uploadedData), "my upload data"; exp != got { t.Errorf("expected uploadedData to be %s, got %s", exp, got) @@ -92,6 +93,7 @@ func Test_UploaderDoubleUpload(t *testing.T) { go uploader.Start(ctx, nil) wg.Wait() cancel() + <-ctx.Done() if exp, got := string(uploadedData), "my upload data"; exp != got { t.Errorf("expected uploadedData to be %s, got %s", exp, got) @@ -141,6 +143,7 @@ func Test_UploaderFailThenOK(t *testing.T) { go uploader.Start(ctx, nil) wg.Wait() cancel() + <-ctx.Done() if exp, got := string(uploadedData), "my upload data"; exp != got { t.Errorf("expected uploadedData to be %s, got %s", exp, got) @@ -188,6 +191,7 @@ func Test_UploaderOKThenFail(t *testing.T) { go uploader.Start(ctx, nil) wg.Wait() cancel() + <-ctx.Done() if exp, got := string(uploadedData), "my upload data"; exp != got { t.Errorf("expected uploadedData to be %s, got %s", exp, got) @@ -210,6 +214,7 @@ func Test_UploaderContextCancellation(t *testing.T) { go uploader.Start(ctx, nil) <-ctx.Done() cancel() + <-ctx.Done() if exp, got := int32(0), atomic.LoadInt32(&uploadCount); exp != got { t.Errorf("expected uploadCount to be %d, got %d", exp, got)