In this video, Ms. Natalie White, Enterprise Solutions Architect at AWS talks about testable infrastructure and how integration testing functions on AWS.
It is a known fact that reliable integration testing plays a major role in ensuring the product functions efficiently. Once the integration tests pass, developers will gain the confidence to promote their code changes from the testing to production environments.
In this video, the speaker also covers the integration testing best practices with AWS CodePipeline, COdeBuild, and Step functions. At 1.41, the speaker briefs that at AWS, integration testing is used to verify the interaction between the layers of the applications and dependencies on other services. Integration testing can definitely be a part of the CICD (Continuous integration and continuous deployment).
At 3:02, the speaker summarizes the purpose of having integration tests for the applications built. Integration tests help in exposing problems in the interaction between components, expose downstream failures, expose security gaps in deployed systems, and help in testing deployed units as a group.
It is highly recommended that developers create low-level lifecycle versions of the lambda functions where they can deploy the code packages. The developers can then invoke the lambdas through sample events which can be triggered through the CICD pipeline.
At 6:24, Ms.Natalie talks about how integration testing is different on AWS. Deploying infrastructure on-premises can lead to having stale/inconsistent environments, and allows having only simplified testing. With AWS, deploying infrastructure as code resolves stale environment issues, and having production-like integration testing becomes easy with AWS.
The speaker reiterates the definitions of AWS CodePipeline and AWS CodeCommit as they are vital to have the integration testing. AWS CodePipeline provides easy and highly configurable methods for releasing the pipelines in an automated fashion. This provides a great ability to the end-users to build, test as well as deploy their applications in a reliable way. AWS CodeCommit plays a role in eliminating the need to support and scale the infrastructure in order to support critical code
‘Three Patterns’ to implement integration testing on AWS
At 12:01, Ms.Natalie discusses the three patterns that will be helpful in implementing the integration tests. The first pattern to be discussed was ‘Standalone Lambda functions’. This is the simplest pattern where lambdas can be invoked from the code pipeline.
There are two major drawbacks to this pattern. The major drawback is that the lambdas are provisioned outside the pipeline and the other drawback is you can exceed the code-pipeline custom action limit. At 13:07, the speakers begin to talk on the next pattern, ‘Lambdas deployed with AWS Cloud formation’.
With this pattern, there is no need to wait for the lambdas to be invoked, instead, cloud formation can be used to deploy as a part of the pipeline. Lambdas will be in the code repository along with the code that makes the infrastructure changes. The major advantage of this approach is that tests are always up to date and the tests are close to code. The disadvantage of following this approach is that there is a limit on the workflows and that the pattern is quite brittle. The speaker also illustrates the same with a demo.
At 22:07, Ms. Natalie explains the third pattern which is ‘AWS Step functions’. AWS Step function pattern is an iterative development derived from the ‘Lambdas deployed with AWS cloud formation’ pattern. AWS Step functions play a major role in orchestrating different AWS services to complete tasks.
With the step function, you can create multiple steps in a process where the output of the one-step will become the input for the other step. This is commonly followed as the step functions offer automatic retry handling ability, triggering, and tracking for each of the workflow steps. In addition, we can ensure that the steps are executed in the correct order. With the ‘AWS Step functions’ pattern, the lambdas are deployed along with a step function state machine.
The step function state machine will define how the lambdas are going to run and define a more conditional workflow that can be used to create and run dynamic tests. The advantages of using this approach include having consolidated results, dynamic workflows, and the tests will always remain up to date. Speaker illustrates the same with a demo.
In this video, the speaker covers important topics like AWS CodeBuild, AWS CodeCommit, and how integration testing can be implemented using different patterns. In addition, Ms. Natalie highlights the advantages and disadvantages of each of the patterns and briefly explains how each pattern is iteratively built on one over the other.