Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set chunkSize when creating a new GCS backend #6655

Merged
merged 1 commit into from
May 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}