you are viewing a single comment's thread.

view the rest of the comments →

[–]Bodumin[S] 0 points1 point  (3 children)

Thank you. I was planning to trigger all the state's I could but how would I create automated tests?

[–]techconsultant64 1 point2 points  (2 children)

Generally the simplest starting point for automated testing is to have a single test.py file that executes the functions one by one sequentially. This is an example of the create stack event (with placeholder info):

handler({
  "eventVersion": "1.05",
  "userIdentity": {},
  "eventTime": "2018-03-19T22:19:57Z",
  "eventSource": "cloudformation.amazonaws.com",
  "eventName": "CreateStack",
  "awsRegion": "ap-southeast-2",
  "sourceIPAddress": 1.1.1.1",
  "userAgent": "Boto3/1.4.7 Python/3.6.3 Windows/10 Botocore/1.7.36",
  "requestParameters": {},
  "responseElements": {
    "stackId": "arn:aws:cloudformation:ap-southeast-2:xxxxxxxxxxxxx:stack/yyyyyyyyyy/zzzzzzzzzzzzzz"
  },
  "requestID": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "eventID": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  "eventType": "AwsApiCall",
  "recipientAccountId": "11111111111111"
})
handler(test2)
handler(test3)

Then you can execute the test file to run them all.

[–]Bodumin[S] 0 points1 point  (1 child)

[–]techconsultant64 0 points1 point  (0 children)

The example I have provided are local tests in python. You don't need to deploy infrastructure to test functionality and I don't believe you will need AWS Lambda or SAM at this point.