Skip to content

[confmap/provider/s3provider] Remove duplicate check for scheme #38664

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

Merged
merged 1 commit into from
Apr 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions confmap/provider/s3provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ func newWithSettings(_ confmap.ProviderSettings) confmap.Provider {
}

func (fmp *provider) Retrieve(ctx context.Context, uri string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) {
if !strings.HasPrefix(uri, schemeName+":") {
return nil, fmt.Errorf("%q uri is not supported by %q provider", uri, schemeName)
}

// initialize the s3 client in the first call of Retrieve
if fmp.client == nil {
cfg, err := config.LoadDefaultConfig(context.Background())
Expand Down
8 changes: 1 addition & 7 deletions confmap/provider/s3provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func TestURIs(t *testing.T) {
{"No bucket", "s3://s3.region.amazonaws.com/key", "", "", "", false},
{"No region", "s3://some-bucket.s3..amazonaws.com/key", "", "", "", false},
{"Test malformed uri", "s3://some-bucket.s3.us-west-2.amazonaws.com/key%", "", "", "", false},
{"Unsupported scheme", "https://google.com", "", "", "", false},
{"Valid bucket", "s3://bucket.name-here.s3.us-west-2.amazonaws.com/key", "bucket.name-here", "us-west-2", "key", true},
}

Expand All @@ -94,13 +95,6 @@ func TestURIs(t *testing.T) {
}
}

func TestUnsupportedScheme(t *testing.T) {
fp := newTestProvider("./testdata/otel-config.yaml")
_, err := fp.Retrieve(context.Background(), "https://google.com", nil)
assert.Error(t, err)
assert.NoError(t, fp.Shutdown(context.Background()))
}

func TestNonExistent(t *testing.T) {
fp := newTestProvider("./testdata/non-existent.yaml")
_, err := fp.Retrieve(context.Background(), "s3://non-exist-bucket.s3.region.amazonaws.com/key", nil)
Expand Down
Loading