@@ -138,13 +138,13 @@ func TestAccLambdaInvokeAction_logTypes(t *testing.T) {
138138 CheckDestroy : acctest .CheckDestroyNoop ,
139139 Steps : []resource.TestStep {
140140 {
141- Config : testAccInvokeActionConfig_logType (rName , testData , inputJSON , string ( awstypes . LogTypeNone ) ),
141+ Config : testAccInvokeActionConfig_logType (rName , testData , inputJSON , "None" ),
142142 Check : resource .ComposeTestCheckFunc (
143143 testAccCheckInvokeActionLogType (ctx , rName , inputJSON , awstypes .LogTypeNone ),
144144 ),
145145 },
146146 {
147- Config : testAccInvokeActionConfig_logType (rName , testData , inputJSON , string ( awstypes . LogTypeTail ) ),
147+ Config : testAccInvokeActionConfig_logType (rName , testData , inputJSON , "Tail" ),
148148 Check : resource .ComposeTestCheckFunc (
149149 testAccCheckInvokeActionLogType (ctx , rName , inputJSON , awstypes .LogTypeTail ),
150150 ),
@@ -182,34 +182,6 @@ func TestAccLambdaInvokeAction_clientContext(t *testing.T) {
182182 })
183183}
184184
185- func TestAccLambdaInvokeAction_logTypeTail (t * testing.T ) {
186- ctx := acctest .Context (t )
187- rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
188- testData := "log_output_test"
189- inputJSON := `{"key1":"value1","key2":"value2"}`
190-
191- resource .ParallelTest (t , resource.TestCase {
192- PreCheck : func () {
193- acctest .PreCheck (ctx , t )
194- acctest .PreCheckPartitionHasService (t , names .LambdaEndpointID )
195- },
196- ErrorCheck : acctest .ErrorCheck (t , names .LambdaServiceID ),
197- ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
198- TerraformVersionChecks : []tfversion.TerraformVersionCheck {
199- tfversion .SkipBelow (tfversion .Version1_14_0 ),
200- },
201- CheckDestroy : acctest .CheckDestroyNoop ,
202- Steps : []resource.TestStep {
203- {
204- Config : testAccInvokeActionConfig_logType (rName , testData , inputJSON , string (awstypes .LogTypeTail )),
205- Check : resource .ComposeTestCheckFunc (
206- testAccCheckInvokeActionLogOutput (ctx , rName , inputJSON ),
207- ),
208- },
209- },
210- })
211- }
212-
213185func TestAccLambdaInvokeAction_complexPayload (t * testing.T ) {
214186 ctx := acctest .Context (t )
215187 rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
@@ -376,46 +348,6 @@ func testAccCheckInvokeActionLogType(ctx context.Context, functionName, inputJSO
376348 }
377349}
378350
379- // testAccCheckInvokeActionLogOutput verifies that log output is captured and can be decoded
380- func testAccCheckInvokeActionLogOutput (ctx context.Context , functionName , inputJSON string ) resource.TestCheckFunc {
381- return func (s * terraform.State ) error {
382- conn := acctest .Provider .Meta ().(* conns.AWSClient ).LambdaClient (ctx )
383-
384- input := & lambda.InvokeInput {
385- FunctionName : & functionName ,
386- InvocationType : awstypes .InvocationTypeRequestResponse ,
387- Payload : []byte (inputJSON ),
388- LogType : awstypes .LogTypeTail ,
389- }
390-
391- output , err := conn .Invoke (ctx , input )
392- if err != nil {
393- return fmt .Errorf ("Failed to invoke Lambda function %s with log type Tail: %w" , functionName , err )
394- }
395-
396- if output .FunctionError != nil {
397- return fmt .Errorf ("Lambda function %s returned an error: %s" , functionName , string (output .Payload ))
398- }
399-
400- // Verify log result is present
401- if output .LogResult == nil {
402- return fmt .Errorf ("Expected log result when log type is Tail, but got none" )
403- }
404-
405- logData , err := base64 .StdEncoding .DecodeString (* output .LogResult )
406- if err != nil {
407- return fmt .Errorf ("Failed to decode log result: %w" , err )
408- }
409-
410- logStr := string (logData )
411- if len (logStr ) == 0 {
412- return fmt .Errorf ("Decoded log result is empty" )
413- }
414-
415- return nil
416- }
417- }
418-
419351// testAccCheckInvokeActionClientContext verifies client context is passed correctly
420352func testAccCheckInvokeActionClientContext (ctx context.Context , functionName , inputJSON , clientContext string ) resource.TestCheckFunc {
421353 return func (s * terraform.State ) error {
0 commit comments