@@ -98,7 +98,7 @@ func TestSendFail_AwsSqs(t *testing.T) {
98
98
}
99
99
}
100
100
101
- func TestSetOptions_AwsSqs (t * testing.T ) {
101
+ func TestGetConfigOptions_AwsSqs (t * testing.T ) {
102
102
s := NewTypedAwsSqsService (AwsSqsOptions {
103
103
Region : "us-east-1" ,
104
104
AwsAccess : AwsAccess {
@@ -109,7 +109,7 @@ func TestSetOptions_AwsSqs(t *testing.T) {
109
109
})
110
110
111
111
options := & config.LoadOptions {}
112
- optionsF := SetOptions (s )
112
+ optionsF := GetConfigOptions (s )
113
113
114
114
for _ , f := range optionsF {
115
115
assert .NoError (t , f (options ))
@@ -120,13 +120,9 @@ func TestSetOptions_AwsSqs(t *testing.T) {
120
120
creds , _ := options .Credentials .Retrieve (context .TODO ())
121
121
assert .Equal (t , s .opts .AwsAccess .Key , creds .AccessKeyID )
122
122
assert .Equal (t , s .opts .AwsAccess .Secret , creds .SecretAccessKey )
123
- // Verify custom resolver is used
124
- //nolint:staticcheck // SA1019 Migration needed
125
- var resolverType aws.EndpointResolverWithOptionsFunc
126
- assert .IsType (t , resolverType , options .EndpointResolverWithOptions )
127
123
}
128
124
129
- func TestSetOptionsFromEnv_AwsSqs (t * testing.T ) {
125
+ func TestGetConfigOptionsFromEnv_AwsSqs (t * testing.T ) {
130
126
// Applying override via parameters instead of the ENV Variables
131
127
finalKey , finalSecret , finalRegion := "key" , "secret" , "us-east-1"
132
128
@@ -136,7 +132,7 @@ func TestSetOptionsFromEnv_AwsSqs(t *testing.T) {
136
132
137
133
s := NewTypedAwsSqsService (AwsSqsOptions {})
138
134
139
- options := SetOptions (s )
135
+ options := GetConfigOptions (s )
140
136
cfg , err := config .LoadDefaultConfig (context .TODO (), options ... )
141
137
assert .NoError (t , err )
142
138
@@ -147,7 +143,7 @@ func TestSetOptionsFromEnv_AwsSqs(t *testing.T) {
147
143
assert .Equal (t , finalRegion , cfg .Region )
148
144
}
149
145
150
- func TestSetOptionsOverrideCredentials_AwsSqs (t * testing.T ) {
146
+ func TestGetConfigOptionsOverrideCredentials_AwsSqs (t * testing.T ) {
151
147
os .Setenv ("AWS_ACCESS_KEY_ID" , "env_key" )
152
148
os .Setenv ("AWS_SECRET_ACCESS_KEY" , "env_secret" )
153
149
os .Setenv ("AWS_DEFAULT_REGION" , "us-east-2" )
@@ -163,7 +159,7 @@ func TestSetOptionsOverrideCredentials_AwsSqs(t *testing.T) {
163
159
},
164
160
})
165
161
166
- options := SetOptions (s )
162
+ options := GetConfigOptions (s )
167
163
cfg , err := config .LoadDefaultConfig (context .TODO (), options ... )
168
164
assert .NoError (t , err )
169
165
@@ -174,7 +170,7 @@ func TestSetOptionsOverrideCredentials_AwsSqs(t *testing.T) {
174
170
assert .Equal (t , finalRegion , cfg .Region )
175
171
}
176
172
177
- func TestSetOptionsCustomEndpointUrl_AwsSqs (t * testing.T ) {
173
+ func TestGetConfigOptionsCustomEndpointUrl_AwsSqs (t * testing.T ) {
178
174
// Will be overridden
179
175
os .Setenv ("AWS_DEFAULT_REGION" , "us-east-2" )
180
176
@@ -189,7 +185,7 @@ func TestSetOptionsCustomEndpointUrl_AwsSqs(t *testing.T) {
189
185
EndpointUrl : finalEndpoint ,
190
186
})
191
187
192
- options := SetOptions (s )
188
+ options := GetConfigOptions (s )
193
189
cfg , err := config .LoadDefaultConfig (context .TODO (), options ... )
194
190
assert .NoError (t , err )
195
191
@@ -199,27 +195,10 @@ func TestSetOptionsCustomEndpointUrl_AwsSqs(t *testing.T) {
199
195
assert .Equal (t , finalSecret , creds .SecretAccessKey )
200
196
assert .Equal (t , finalRegion , cfg .Region )
201
197
}
202
- func TestSetOptionsCustomResolverFunc (t * testing.T ) {
203
198
204
- finalKey , finalSecret , finalRegion , finalEndpoint := "key" , "secret" , "us-east-1" , "localhost"
205
-
206
- s := NewTypedAwsSqsService (AwsSqsOptions {
207
- Region : finalRegion ,
208
- AwsAccess : AwsAccess {
209
- Key : finalKey ,
210
- Secret : finalSecret ,
211
- },
212
- EndpointUrl : finalEndpoint ,
213
- })
214
-
215
- customResolver := s .getCustomResolver (finalRegion )
216
- endpoint , err := customResolver (sqs .ServiceID , finalRegion )
217
- assert .NoError (t , err )
218
- assert .Equal (t , finalEndpoint , endpoint .URL )
219
-
220
- }
221
-
222
- func TestSetOptionsCustomResolverFuncReturnErr (t * testing.T ) {
199
+ func TestGetClientOptionsCustomEndpointUrl_AwsSqs (t * testing.T ) {
200
+ // Will be overridden
201
+ os .Setenv ("AWS_DEFAULT_REGION" , "us-east-2" )
223
202
224
203
finalKey , finalSecret , finalRegion , finalEndpoint := "key" , "secret" , "us-east-1" , "localhost"
225
204
@@ -232,16 +211,13 @@ func TestSetOptionsCustomResolverFuncReturnErr(t *testing.T) {
232
211
EndpointUrl : finalEndpoint ,
233
212
})
234
213
235
- customResolver := s .getCustomResolver (finalRegion )
236
- _ , err := customResolver ("NotSQS" , finalRegion )
237
- assert .Error (t , err )
238
- //assert that err is of type aws.EndpointNotFoundError
239
- assert .IsType (t , & aws.EndpointNotFoundError {}, err )
240
-
214
+ options := GetClientOptions (s )
215
+ assert .Equal (t , 2 , len (options ))
241
216
}
242
217
243
218
// Helpers
244
- var SetOptions = (* awsSqsService ).setOptions
219
+ var GetConfigOptions = (* awsSqsService ).getConfigOptions
220
+ var GetClientOptions = (* awsSqsService ).getClientOptions
245
221
var SendMessageInput = (* awsSqsService ).sendMessageInput
246
222
247
223
var NewTypedAwsSqsService = func (opts AwsSqsOptions ) * awsSqsService {
0 commit comments