aws / aws/aws-cdk

(aws-lambda-destinations): integ.destinations.ts test fails

Open
#24,215 2 comments 1 reaction 0 assignees View on GitHub
@aws-cdk/assertions @aws-cdk/aws-lambda-destinations bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the bug

When running integ.destinations.ts test, the test fails.

Command:
`yarn integ-runner --force --profiles profile-name --parallel-regions eu-west-1`

Output:
```
Running test ~/aws-cdk/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js in profile-name/eu-west-1
ASSERT integ.destinations-Destinations/DefaultTest (profile-name/eu-west-1) 50.772s
AssertionResultsAwsApiCallSQSreceiveMessage
!! Expected type object but received undefined
undefined
```

### Expected Behavior

The test should succeed in `main`branch

### Current Behavior

The test fails

### Reproduction Steps

Run the command
`cd packages/@aws-cdk/aws-lambda-destinations && yarn build && yarn integ-runner --force --profiles profile-name --parallel-regions eu-west-1`

### Possible Solution

The issue comes from the fact only leaves are returned in api call response object.

In CloudWatch logs (log group /aws/lambda/DestinationsDefaultTestDe-SingletonFunction[uniqueId] ), we can find the returned result that is checked against expected one:

```
Returning result
{
"apiCallResponse.Messages.0.MessageId": "a19f06c3-46f2-4693-a21d-8b812f09e8a6",
"apiCallResponse.Messages.0.ReceiptHandle": "AQEBp4r0zHHcejpDa8EsZx4PcQs7awb1G0Qh37BQjejE53qRRi6N54Hs/nLfLCB1HCbQ783NjbMxL4AugPosBe/qLImLintI7Uk2Bvb+i+e3IUCIaA94Y5BW7xNBhPPsIHmEimvRtPYCsVMsyCR+2w1bZN/Sv2EmNXuvm+uSTfdhZJuNHfWTf1reCK4qkUBRsyUBtYw38INnLTNI6EvZD9/id31vUAI5YSbgJLRU0NC1N1fGTkKnPi91vmNr1nkxHg5/C1931rJKxBVIrRqRVPx3QLyh2EwNWcBPiAUoiUsW7Q4DSUM6uAjRMMt40i+DrqdXZT3H4lxDvMOmmrm+1Shnih5y5GIWHU3XpzL8inC04UaPbMGL89IHQUzRI5m/PuPHuX+GwCbGuX7HOgtVmblygqA4yXmFWqAaL3tpQhlOMmsvey/ubRhVknPknkz46ypG",
"apiCallResponse.Messages.0.MD5OfBody": "e6afcec597817dee710d53d59f0a590f",
"apiCallResponse.Messages.0.Body.version": 1,
"apiCallResponse.Messages.0.Body.timestamp": "2023-02-17T15:39:54.683Z",
"apiCallResponse.Messages.0.Body.requestContext.requestId": "2d60e6ee-0c1a-4272-af27-0f5f777d2444",
"apiCallResponse.Messages.0.Body.requestContext.functionArn": "arn:aws:lambda:eu-west-1:[AccountId]:function:aws-cdk-lambda-destinations-SnsSqsC4810B27-Udxyat9yy4aG:$LATEST",
"apiCallResponse.Messages.0.Body.requestContext.condition": "Success",
"apiCallResponse.Messages.0.Body.requestContext.approximateInvokeCount": 1,
"apiCallResponse.Messages.0.Body.requestPayload.status": "OK",
"apiCallResponse.Messages.0.Body.responseContext.statusCode": 200,
"apiCallResponse.Messages.0.Body.responseContext.executedVersion": "$LATEST",
"apiCallResponse.Messages.0.Body.responsePayload": "success"
}
```

Therefore `Messages.0.Body` path do not exist and `undefined` is returned instead of an object.

Possible solutions:
- change the test to check each path individually
- improve assertions to be able to get non-leaf paths.

### Additional Information/Context

_No response_

### CDK CLI Version

2.61.1 (build d319d9c)

### Framework Version

_No response_

### Node.js Version

16.18.1

### OS

Both Mac OS 12.3 and Ubuntu 22.04

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Run the reported command from packages/@aws-cdk/aws-lambda-destinations and inspect test/integ.destinations.js together with the assertion handling for the apiCallResponse.Messages.0.Body path. Determine whether the test or the assertion behavior should change, then verify that the integration test succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.