From 01c019766290802080d9f8356e9df7eae228db77 Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Tue, 2 May 2023 15:33:50 -0400 Subject: [PATCH] chore(storage): fix progress call in gRPC Writer Fixes #7798 --- storage/grpc_client.go | 12 +++++++----- storage/integration_test.go | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/grpc_client.go b/storage/grpc_client.go index dd44d7d073b1..88ea7e561de3 100644 --- a/storage/grpc_client.go +++ b/storage/grpc_client.go @@ -1060,11 +1060,13 @@ func (c *grpcStorageClient) OpenWriter(params *openWriterParams, opts ...storage pr.CloseWithError(err) return } - // At this point, the current buffer has been uploaded. Capture the - // committed offset here in case the upload was not finalized and - // another chunk is to be uploaded. - offset = off - progress(offset) + // At this point, the current buffer has been uploaded. For resumable + // uploads, capture the committed offset here in case the upload was not + // finalized and another chunk is to be uploaded. + if gw.upid != "" { + offset = off + progress(offset) + } // When we are done reading data and the chunk has been finalized, // we are done. diff --git a/storage/integration_test.go b/storage/integration_test.go index 76b318fded26..b87ccd72a1cc 100644 --- a/storage/integration_test.go +++ b/storage/integration_test.go @@ -2251,7 +2251,7 @@ func TestIntegration_WriterContentType(t *testing.T) { } func TestIntegration_WriterChunksize(t *testing.T) { - ctx := skipJSONReads(skipGRPC("https://github.com/googleapis/google-cloud-go/issues/7839"), "no reads in test") + ctx := skipJSONReads(context.Background(), "no reads in test") multiTransportTest(ctx, t, func(t *testing.T, ctx context.Context, bucket, _ string, client *Client) { obj := client.Bucket(bucket).Object("writer-chunksize-test" + uidSpaceObjects.New()) objSize := 1<<10<<10 + 1 // 1 Mib + 1 byte