@@ -24,6 +24,13 @@ func TestAWSConfigFromURL(t *testing.T) {
24
24
"dummy" ,
25
25
"http://s3.default.svc.cluster.local:4569" ,
26
26
},
27
+ {
28
+ "s3://@us-east-1/test-bucket" ,
29
+ "" ,
30
+ "" ,
31
+ "us-east-1" ,
32
+ "" ,
33
+ },
27
34
{
28
35
"dynamodb://user:[email protected] :8000/cortex" ,
29
36
"user" ,
@@ -54,10 +61,10 @@ func TestAWSConfigFromURL(t *testing.T) {
54
61
cfg , err := ConfigFromURL (parsedURL )
55
62
require .NoError (t , err )
56
63
57
- if cfg .Credentials == nil {
58
- assert .Equal (t , "" , tc .expectedKey )
59
- assert .Equal (t , "" , tc .expectedSecret )
64
+ if tc .expectedKey == "" && tc .expectedSecret == "" {
65
+ assert .Nil (t , cfg .Credentials )
60
66
} else {
67
+ require .NotNil (t , cfg .Credentials )
61
68
val , err := cfg .Credentials .Get ()
62
69
require .NoError (t , err )
63
70
assert .Equal (t , tc .expectedKey , val .AccessKeyID )
@@ -70,6 +77,8 @@ func TestAWSConfigFromURL(t *testing.T) {
70
77
if tc .expectedEp != "" {
71
78
require .NotNil (t , cfg .Endpoint )
72
79
assert .Equal (t , tc .expectedEp , * cfg .Endpoint )
80
+ } else {
81
+ assert .Nil (t , cfg .Endpoint )
73
82
}
74
83
})
75
84
}
0 commit comments