-
Notifications
You must be signed in to change notification settings - Fork 529
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Is there any way we can write a test for this? |
Please add this PR to the changelog line where thanos was updated. Line 24 in 96905d9
|
@colega I was thinking the same. Will look into it after testing the fix. Update: Added a couple of tests. |
ce219fa
to
2dfbde3
Compare
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
1fd597a
to
3537726
Compare
* 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) { |
There was a problem hiding this comment.
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:
- Create
newBucketClient()
(non exported) taking thefactory
. Test this. - Keep
NewBucketClient()
(exported) with nofactory
. It just callsnewBucketClient()
passing thefactory
too.
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
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]