We all know that a proper testing framework accelerates a team’s productivity and efficiency. And, testing serverless is no different; a proper testing framework to ensure accuracy and reliability is vital as if the serverless architecture fails, the business can suffer any number of consequences that impact reputation, customer satisfaction, revenue and more. In addition, remediating issues can be resource-intensive. As a result, today we’ll share the steps we took to integrate Jenkins with a serverless testing framework to improve visibility and ease administration of Ansible Playbooks at Flux7. Following these steps, you, too, can grow visibility and decrease administrative overhead while lowering remediation costs.
This journey began for us at Flux7 when we started using Ansible Playbooks to deploy infrastructure and knew we needed a testing framework to test every role on Ansible. Promoting a test-driven culture, Flux7 uses Molecule to test Ansible Roles. To further improve, automate and streamline its test processes, we created an automated serverless framework with integration of Ansible role repositories which contain Molecule test-cases.
How To Create a Serverless Testing Framework
A serverless architecture is a combination of Backend as a Service (BaaS) and Function as a Service (FaaS). Hence, it is more likely to be called Platform as a Service (PaaS) as it includes an integration of separate, distributed services that must be tested both independently, and together. As a result, creating a testing framework that allows for easy repeatability in testing is important. To do so, we took a templatized testing approach with:
A Lambda function that is used for customer deployments and custom configurations.
A CI/CD pipeline that auto-deploys serverless architecture; it allows changes or additions to be made to architecture and propagates a company-wide framework for writing serverless code.
The testing framework allows DevOps engineers to test, check lint, verify code and converge. It not only reduces maintenance costs and testing efforts, but also provides a high return on investment (ROI) for DevOps teams looking to optimize their Agile processes.
Before we jump further into the details of the framework, let’s take a quick look at its architecture.