Set chunkSize when creating a new GCS backend (#6655)

Adds a small step to TestBackend to prevent regression.
This commit is contained in:
Scott Stevenson
2019-05-03 16:08:29 -04:00
committed by Brian Kassouf
parent 0c9b011709
commit caa2a0698f
2 changed files with 15 additions and 3 deletions

View File

@@ -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,

View File

@@ -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)
}