Skip to content

Commit f2687b4

Browse files
committed
Remove duplicate check for scheme
This was already being checked by the S3 URI regular expression Signed-off-by: Michael Shen <[email protected]>
1 parent 0781c78 commit f2687b4

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

confmap/provider/s3provider/provider.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ func newWithSettings(_ confmap.ProviderSettings) confmap.Provider {
5656
}
5757

5858
func (fmp *provider) Retrieve(ctx context.Context, uri string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) {
59-
if !strings.HasPrefix(uri, schemeName+":") {
60-
return nil, fmt.Errorf("%q uri is not supported by %q provider", uri, schemeName)
61-
}
62-
6359
// initialize the s3 client in the first call of Retrieve
6460
if fmp.client == nil {
6561
cfg, err := config.LoadDefaultConfig(context.Background())

confmap/provider/s3provider/provider_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func TestURIs(t *testing.T) {
7777
{"No bucket", "s3://s3.region.amazonaws.com/key", "", "", "", false},
7878
{"No region", "s3://some-bucket.s3..amazonaws.com/key", "", "", "", false},
7979
{"Test malformed uri", "s3://some-bucket.s3.us-west-2.amazonaws.com/key%", "", "", "", false},
80+
{"Unsupported scheme", "https://google.com", "", "", "", false},
8081
{"Valid bucket", "s3://bucket.name-here.s3.us-west-2.amazonaws.com/key", "bucket.name-here", "us-west-2", "key", true},
8182
}
8283

@@ -94,13 +95,6 @@ func TestURIs(t *testing.T) {
9495
}
9596
}
9697

97-
func TestUnsupportedScheme(t *testing.T) {
98-
fp := newTestProvider("./testdata/otel-config.yaml")
99-
_, err := fp.Retrieve(context.Background(), "https://google.com", nil)
100-
assert.Error(t, err)
101-
assert.NoError(t, fp.Shutdown(context.Background()))
102-
}
103-
10498
func TestNonExistent(t *testing.T) {
10599
fp := newTestProvider("./testdata/non-existent.yaml")
106100
_, err := fp.Retrieve(context.Background(), "s3://non-exist-bucket.s3.region.amazonaws.com/key", nil)

0 commit comments

Comments
 (0)