@@ -107,8 +107,9 @@ func TestMinioCredentials(t *testing.T) {
107107		cfg  :=  setting.MinioStorageConfig {
108108			AccessKeyID :     ExpectedAccessKey ,
109109			SecretAccessKey : ExpectedSecretAccessKey ,
110+ 			IamEndpoint :     FakeEndpoint ,
110111		}
111- 		creds  :=  buildMinioCredentials (cfg ,  FakeEndpoint )
112+ 		creds  :=  buildMinioCredentials (cfg )
112113		v , err  :=  creds .Get ()
113114
114115		assert .NoError (t , err )
@@ -117,13 +118,15 @@ func TestMinioCredentials(t *testing.T) {
117118	})
118119
119120	t .Run ("Chain" , func (t  * testing.T ) {
120- 		cfg  :=  setting.MinioStorageConfig {}
121+ 		cfg  :=  setting.MinioStorageConfig {
122+ 			IamEndpoint : FakeEndpoint ,
123+ 		}
121124
122125		t .Run ("EnvMinio" , func (t  * testing.T ) {
123126			t .Setenv ("MINIO_ACCESS_KEY" , ExpectedAccessKey + "Minio" )
124127			t .Setenv ("MINIO_SECRET_KEY" , ExpectedSecretAccessKey + "Minio" )
125128
126- 			creds  :=  buildMinioCredentials (cfg ,  FakeEndpoint )
129+ 			creds  :=  buildMinioCredentials (cfg )
127130			v , err  :=  creds .Get ()
128131
129132			assert .NoError (t , err )
@@ -135,7 +138,7 @@ func TestMinioCredentials(t *testing.T) {
135138			t .Setenv ("AWS_ACCESS_KEY" , ExpectedAccessKey + "AWS" )
136139			t .Setenv ("AWS_SECRET_KEY" , ExpectedSecretAccessKey + "AWS" )
137140
138- 			creds  :=  buildMinioCredentials (cfg ,  FakeEndpoint )
141+ 			creds  :=  buildMinioCredentials (cfg )
139142			v , err  :=  creds .Get ()
140143
141144			assert .NoError (t , err )
@@ -144,11 +147,11 @@ func TestMinioCredentials(t *testing.T) {
144147		})
145148
146149		t .Run ("FileMinio" , func (t  * testing.T ) {
147- 			t .Setenv ("MINIO_SHARED_CREDENTIALS_FILE" , "testdata/minio.json" )
148150			// prevent loading any actual credentials files from the user 
151+ 			t .Setenv ("MINIO_SHARED_CREDENTIALS_FILE" , "testdata/minio.json" )
149152			t .Setenv ("AWS_SHARED_CREDENTIALS_FILE" , "testdata/fake" )
150153
151- 			creds  :=  buildMinioCredentials (cfg ,  FakeEndpoint )
154+ 			creds  :=  buildMinioCredentials (cfg )
152155			v , err  :=  creds .Get ()
153156
154157			assert .NoError (t , err )
@@ -161,7 +164,7 @@ func TestMinioCredentials(t *testing.T) {
161164			t .Setenv ("MINIO_SHARED_CREDENTIALS_FILE" , "testdata/fake.json" )
162165			t .Setenv ("AWS_SHARED_CREDENTIALS_FILE" , "testdata/aws_credentials" )
163166
164- 			creds  :=  buildMinioCredentials (cfg ,  FakeEndpoint )
167+ 			creds  :=  buildMinioCredentials (cfg )
165168			v , err  :=  creds .Get ()
166169
167170			assert .NoError (t , err )
@@ -187,7 +190,9 @@ func TestMinioCredentials(t *testing.T) {
187190			defer  server .Close ()
188191
189192			// Use the provided EC2 Instance Metadata server 
190- 			creds  :=  buildMinioCredentials (cfg , server .URL )
193+ 			creds  :=  buildMinioCredentials (setting.MinioStorageConfig {
194+ 				IamEndpoint : server .URL ,
195+ 			})
191196			v , err  :=  creds .Get ()
192197
193198			assert .NoError (t , err )
0 commit comments