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

Conversation

usererror
Copy link
Contributor

@usererror usererror commented Apr 30, 2019

This PR sets the chunkSize on the GCS Backend in New and adds a small regression test to TestBackend.

Rationale

I was taking a look at the GCS physical backend code and noticed that chunkSize was being parsed and checked but never set on the actual backend in New. Looking through the commit history, it appears that chunkSize was originally a package level variable but was later changed to a parameter within the Backend but it was never wired up inside of New.

Tests

To verify I wasn't crazy, I ran the new test before changing the New func:

$ go test ./physical/gcs
2019-04-30T02:54:15.062-0400 [DEBUG] configuring backend
2019-04-30T02:54:15.062-0400 [DEBUG] configuration: bucket=vault-gcs-testacc-352928274214603302 chunk_size=8388608 ha_enabled=true max_parallel=0
2019-04-30T02:54:15.062-0400 [DEBUG] creating client
2019-04-30T02:54:15.062-0400 [DEBUG] configuring backend
2019-04-30T02:54:15.062-0400 [DEBUG] configuration: bucket=vault-gcs-testacc-352928274214603302 chunk_size=8388608 ha_enabled=true max_parallel=0
2019-04-30T02:54:15.062-0400 [DEBUG] creating client
2019-04-30T02:54:49.938-0400 [DEBUG] configuring backend
2019-04-30T02:54:49.938-0400 [DEBUG] configuration: bucket=vault-gcs-testacc-7058591571723470507 chunk_size=8388608 ha_enabled=false max_parallel=0
2019-04-30T02:54:49.938-0400 [DEBUG] creating client
--- FAIL: TestBackend (1.82s)
    gcs_test.go:68: expected chunkSize to be 8388608. got=0
FAIL
FAIL	github.com/usererror/vault/physical/gcs	36.771s

After setting the chunkSize in New the tests are all green:

$ go test ./physical/gcs
ok  	github.com/usererror/vault/physical/gcs	69.402s

Adds a small step to TestBackend to prevent regression.
@jefferai jefferai added this to the 1.1.3 milestone May 3, 2019
@briankassouf briankassouf merged commit caa2a06 into hashicorp:master May 3, 2019
briankassouf pushed a commit that referenced this pull request Jun 4, 2019
Adds a small step to TestBackend to prevent regression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants