7
7
"context"
8
8
"encoding/base64"
9
9
"fmt"
10
+ "net/http"
10
11
"testing"
11
12
12
13
"github.com/aws/aws-sdk-go-v2/service/lambda"
@@ -207,7 +208,7 @@ func testAccCheckInvokeAction(ctx context.Context, functionName, inputJSON, expe
207
208
208
209
output , err := conn .Invoke (ctx , input )
209
210
if err != nil {
210
- return fmt .Errorf ("Failed to invoke Lambda function %s: %s " , functionName , err )
211
+ return fmt .Errorf ("Failed to invoke Lambda function %s: %w " , functionName , err )
211
212
}
212
213
213
214
if output .FunctionError != nil {
@@ -233,7 +234,7 @@ func testAccCheckInvokeActionWithQualifier(ctx context.Context, functionName, in
233
234
FunctionName : & functionName ,
234
235
})
235
236
if err != nil {
236
- return fmt .Errorf ("Failed to get Lambda function %s: %s " , functionName , err )
237
+ return fmt .Errorf ("Failed to get Lambda function %s: %w " , functionName , err )
237
238
}
238
239
239
240
// Invoke with the specific version
@@ -246,7 +247,7 @@ func testAccCheckInvokeActionWithQualifier(ctx context.Context, functionName, in
246
247
247
248
output , err := conn .Invoke (ctx , input )
248
249
if err != nil {
249
- return fmt .Errorf ("Failed to invoke Lambda function %s with qualifier: %s " , functionName , err )
250
+ return fmt .Errorf ("Failed to invoke Lambda function %s with qualifier: %w " , functionName , err )
250
251
}
251
252
252
253
if output .FunctionError != nil {
@@ -280,14 +281,14 @@ func testAccCheckInvokeActionInvocationType(ctx context.Context, functionName, i
280
281
281
282
// For async invocations, we just verify the request was accepted
282
283
if invocationType == awstypes .InvocationTypeEvent {
283
- if output .StatusCode != 202 {
284
+ if output .StatusCode != http . StatusAccepted {
284
285
return fmt .Errorf ("Expected status code 202 for async invocation, got %d" , output .StatusCode )
285
286
}
286
287
}
287
288
288
289
// For dry run, we verify the function would execute successfully
289
290
if invocationType == awstypes .InvocationTypeDryRun {
290
- if output .StatusCode != 204 {
291
+ if output .StatusCode != http . StatusNoContent {
291
292
return fmt .Errorf ("Expected status code 204 for dry run, got %d" , output .StatusCode )
292
293
}
293
294
}
0 commit comments