Skip to content

Commit

Permalink
Set chunkSize when creating a new GCS backend (#6655)
Browse files Browse the repository at this point in the history
Adds a small step to TestBackend to prevent regression.
  • Loading branch information
Scott Stevenson authored and briankassouf committed May 3, 2019
1 parent 0c9b011 commit caa2a06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions physical/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 12 additions & 0 deletions physical/gcs/gcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"math/rand"
"os"
"strconv"
"testing"
"time"

Expand Down Expand Up @@ -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)
}

0 comments on commit caa2a06

Please sign in to comment.