Q42 — AWS DVA-C02 Ch.2
Question 42 of 100 | ← Chapter 2
A developer is creating an AWS Lambda function. The Lambda function will process messages from an Amazon Simple Queue Service (Amazon SQS) queue. The developer wants to integrate unit testing into the CI/CD workflow.
- A. Create an AWS CloudFormation template to create the SQS queue and deploy the Lambda function. Create the stack from the template during the CI/CD process. Invoke the deployed function and verify output.
- B. Create an SQS event for testing. Use a test that consumes messages from the SQS queue during the function's CI/CD process.
- C. Create an SQS queue for testing. Use this SQS queue in the application's unit tests. Run unit tests during the CI/CD process. ✓
- D. Use the aws lambda invoke command with a test event during the CI/CD process.
Correct Answer: C. Create an SQS queue for testing. Use this SQS queue in the application's unit tests. Run unit tests during the CI/CD process.
Explanation
Unit tests should be isolated. See: https://aws.amazon.com/blogs/devops/unit-testing-aws-lambda-with-python-and-mock-aws-services/