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

storage: Fix default Azure bucket endpoint #3821

Merged
merged 1 commit into from
Dec 28, 2022

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Dec 28, 2022

What this PR does

In pkg/storage/bucket/azure, fix setting of default bucket endpoint. An empty string for this parameter used to be replaced by Thanos' default, but that's no longer the case in our current version of the dependency.

Also add tests, plus give azure.NewBucketClient a factory parameter, so the tests can fake objstore's bucket factory.

Which issue(s) this PR fixes or relates to

Checklist

  • Tests updated
  • [na] Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copy link
Contributor

@lamida lamida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@colega
Copy link
Contributor

colega commented Dec 28, 2022

Is there any way we can write a test for this?

@colega
Copy link
Contributor

colega commented Dec 28, 2022

Please add this PR to the changelog line where thanos was updated.

* [BUGFIX] Update `github.com/thanos-io/objstore` to address issue with Multipart PUT on s3-compatible Object Storage. #3802

@aknuds1
Copy link
Contributor Author

aknuds1 commented Dec 28, 2022

Is there any way we can write a test for this?

@colega I was thinking the same. Will look into it after testing the fix.

Update: Added a couple of tests.

@aknuds1 aknuds1 force-pushed the bugfix/azure-storage-default-endpoint branch 5 times, most recently from ce219fa to 2dfbde3 Compare December 28, 2022 12:15
@aknuds1 aknuds1 marked this pull request as ready for review December 28, 2022 12:16
@aknuds1 aknuds1 requested a review from a team as a code owner December 28, 2022 12:16
@aknuds1 aknuds1 requested a review from colega December 28, 2022 12:16
@aknuds1 aknuds1 added storage/azure bug Something isn't working labels Dec 28, 2022
@aknuds1 aknuds1 enabled auto-merge (squash) December 28, 2022 13:08
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 force-pushed the bugfix/azure-storage-default-endpoint branch from 1fd597a to 3537726 Compare December 28, 2022 13:09
@aknuds1 aknuds1 merged commit d5150b3 into main Dec 28, 2022
@aknuds1 aknuds1 deleted the bugfix/azure-storage-default-endpoint branch December 28, 2022 13:24
aknuds1 added a commit that referenced this pull request Dec 28, 2022
* storage: Fix default Azure bucket endpoint

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
"github.com/thanos-io/objstore"
"github.com/thanos-io/objstore/providers/azure"
yaml "gopkg.in/yaml.v3"
)

func NewBucketClient(cfg Config, name string, logger log.Logger) (objstore.Bucket, error) {
func NewBucketClient(cfg Config, name string, logger log.Logger, factory func(log.Logger, []byte, string) (*azure.Bucket, error)) (objstore.Bucket, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A post-merge comment. There's no need to take the factory in the exported function. What we do in other places is:

  1. Create newBucketClient() (non exported) taking the factory. Test this.
  2. Keep NewBucketClient() (exported) with no factory. It just calls newBucketClient() passing the factory too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working storage/azure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants