mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Set chunkSize when creating a new GCS backend (#6655)
Adds a small step to TestBackend to prevent regression.
This commit is contained in:
committed by
Brian Kassouf
parent
0c9b011709
commit
caa2a0698f
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user