Skip to content

Commit ba2cf69

Browse files
committed
Update hardcodes to use standard constants
1 parent 0a268ab commit ba2cf69

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

internal/service/lambda/invoke_action_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"context"
88
"encoding/base64"
99
"fmt"
10+
"net/http"
1011
"testing"
1112

1213
"github.com/aws/aws-sdk-go-v2/service/lambda"
@@ -207,7 +208,7 @@ func testAccCheckInvokeAction(ctx context.Context, functionName, inputJSON, expe
207208

208209
output, err := conn.Invoke(ctx, input)
209210
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)
211212
}
212213

213214
if output.FunctionError != nil {
@@ -233,7 +234,7 @@ func testAccCheckInvokeActionWithQualifier(ctx context.Context, functionName, in
233234
FunctionName: &functionName,
234235
})
235236
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)
237238
}
238239

239240
// Invoke with the specific version
@@ -246,7 +247,7 @@ func testAccCheckInvokeActionWithQualifier(ctx context.Context, functionName, in
246247

247248
output, err := conn.Invoke(ctx, input)
248249
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)
250251
}
251252

252253
if output.FunctionError != nil {
@@ -280,14 +281,14 @@ func testAccCheckInvokeActionInvocationType(ctx context.Context, functionName, i
280281

281282
// For async invocations, we just verify the request was accepted
282283
if invocationType == awstypes.InvocationTypeEvent {
283-
if output.StatusCode != 202 {
284+
if output.StatusCode != http.StatusAccepted {
284285
return fmt.Errorf("Expected status code 202 for async invocation, got %d", output.StatusCode)
285286
}
286287
}
287288

288289
// For dry run, we verify the function would execute successfully
289290
if invocationType == awstypes.InvocationTypeDryRun {
290-
if output.StatusCode != 204 {
291+
if output.StatusCode != http.StatusNoContent {
291292
return fmt.Errorf("Expected status code 204 for dry run, got %d", output.StatusCode)
292293
}
293294
}

0 commit comments

Comments
 (0)