diff --git a/physical/gcs/gcs.go b/physical/gcs/gcs.go index c9a68ebc1aaf..24f1deadb7d5 100644 --- a/physical/gcs/gcs.go +++ b/physical/gcs/gcs.go @@ -158,9 +158,9 @@ func NewBackend(c map[string]string, logger log.Logger) (physical.Backend, error } return &Backend{ - bucket: bucket, - haEnabled: haEnabled, - + bucket: bucket, + haEnabled: haEnabled, + chunkSize: chunkSize, client: client, permitPool: physical.NewPermitPool(maxParallel), logger: logger, diff --git a/physical/gcs/gcs_test.go b/physical/gcs/gcs_test.go index 79dfebef830c..58ee9a02283a 100644 --- a/physical/gcs/gcs_test.go +++ b/physical/gcs/gcs_test.go @@ -5,6 +5,7 @@ import ( "fmt" "math/rand" "os" + "strconv" "testing" "time" @@ -57,6 +58,17 @@ func TestBackend(t *testing.T) { t.Fatal(err) } + // Verify chunkSize is set correctly on the Backend + be := backend.(*Backend) + expectedChunkSize, err := strconv.Atoi(defaultChunkSize) + if err != nil { + t.Fatalf("failed to convert defaultChunkSize to int: %s", err) + } + expectedChunkSize = expectedChunkSize * 1024 + if be.chunkSize != expectedChunkSize { + t.Fatalf("expected chunkSize to be %d. got=%d", expectedChunkSize, be.chunkSize) + } + physical.ExerciseBackend(t, backend) physical.ExerciseBackend_ListPrefix(t, backend) }