Test Automation in a Kubernetes-Spinnaker CD Pipeline

Continuous delivery of software updates to your users requires an automated process that consistently supports building, testing, and releasing high-quality updates of software products. A pipeline should automatically recognize any code changes and then move those changes along the pipeline that will create artifacts as necessary, automatically perform unit and functional testing, and perform a production-grade release build. Ideally, you’d integrate a testing framework such as Functionize that automatically updates tests to accommodate the code changes, self-heal when anomalies are discovered, and eliminates test duplication.  

With Spinnaker and the Kubernetes Engine, your team can build and configure a robust continuous delivery flow that helps to ensure your software ships as quickly as it is built and validated. In this article, we’ll discuss how well Functionize—as an AI autonomous testing platform—integrates with a Google CD pipeline. Functionize has been partnering with Google on their Spinnaker project, and Google teams now realize that the Functionize testing automation platform is an excellent complement to the Kubernetes / Spinnaker framework.

Google became a major innovator in CI/CD by converting several of its development tools to open source. This includes Kubernetes—the Google container orchestration platform—as well as Cloud Container Builder, Cloud Source Repositories—and Spinnaker the high-performance deployment platform.

Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It groups the constituent containers of an application into logical units for easy discovery and management. Kubernetes has been working for over 15 years running production workloads at Google.

Spinnaker is an open source, multi-cloud continuous delivery platform for releasing software changes with high velocity and confidence. Originally built at Netflix, Spinnaker has been proven in production by hundreds of teams across millions of deployments. It combines a powerful, flexible pipeline management system with integrations to the major cloud providers.

Testing automation is essential for continuous delivery

Too often, automated testing is an overlooked component within the discussion of continuous delivery. DevOps engineers focus primarily on integration and deployment and pays little or no attention to testing and quality assurance. Perhaps this is because DevOps engineers continue to assume that manual testing is still adequate. You can’t fault them too much for that. While manual testing is in many cases sufficient in a conventional, non-CD environment, it must be largely replaced with automated and autonomous testing in a continuous delivery pipeline.

With Kubernetes and Spinnaker, you can configure your existing DevOps setups to automatically build, automatically test, and automatically deploy your app. The figure below depicts a typical Google CD pipeline.

Test automation in a kubernetes-spinnaker cd pipeline

What is missing from this picture is automated testing. If you ask seasoned DevOps staff what is essential for a CI/CD pipeline, they are not likely to mention automated testing tools—even though automated testing is very crucial to achieve complete CI/CD success.

The bottom line is that you can’t do CI or CD without testing automation. If the goal is to automate by configuring the delivery pipeline to be seamless and continuous, then testing must also be automated as much as possible.

Here are some of the reasons that testing automation is critical to CI/CD success:

  • Faster testing — Automation enables long periods of parallel testing that quickly traverses all application functionality.
  • Much higher consistency — An effective CI/CD pipeline minimizes variation, unpredictability, and anomalies. Test automation helps to achieve consistency by mitigating human error during test execution.
  • Agility — In an optimized CI/CD pipeline, frameworks and tools are configurable to accommodate changes in requirements or technology. And, when you implement robust testing automation, most of that configuration is automatic.
  • Use available effort more efficiently — Although testing is often an afterthought when implementing CI/CD, it should be a major focus—if only because of the time savings. Your testers can spend more time on tests that are not automatable, and also be working to optimize the testing automation tools.
  • Easily handle many small changes — Some types of manual testing are periodically necessary—such as usability testing. Major releases also typically require more manual testing of some features. But it can be much better in a CD pipeline, because the intent is that most code updates are frequent and small. Automated testing minimizes the tedium by constantly examining and testing each of these small changes—without human intervention.

Full Development Testing and Deployment Architecture

The entire development process can be highly automated in a Google CD pipeline—all the way from code-complete through (mostly automated) testing to end-user deployment. After a proper setup, a Kubernetes-Spinnaker CI/CD pipeline is configurable such that the moment that a developer commits a code change, a process will initiate that moves the change through the automated testing and delivery pipeline. This includes artifact creation, versioning, repository distribution, unit testing, functional testing, and physical production rollout.

This framework also supports limited releases to alpha or beta testing groups. If a canary release of this kind encounters an error, the pipeline administrator can perform a complete rollback of all deployed software changes—with a single mouse click.

Together, Kubernetes and Spinnaker support the creation of a continuous delivery workflow which is continuous along its entire length, and which integrates many activities in a high-performance production line. Delivery of high-quality software to customers heavily depends on validation and verification—of new code and established code.

Now let’s see how easy it is to integrate Functionize with Spinnaker.

Connecting Functionize with Spinnaker

Compared to conventional testing framework implementation, setting up Functionize to run with Spinnaker is really quite easy.

Test automation in a kubernetes-spinnaker cd pipeline

These are major steps for employing Helm to integrate the Kubernetes Engine with Spinnaker:

  1. Launch Google Cloud Shell to create the Kubernetes Engine.
  2. Create a Git repository and upload to Google Cloud Source Repository.
  3. Use Helm to deploy Spinnaker to Kubernetes Engine.
  4. Build a Docker image for your application.
  5. Build triggers that will refresh Docker images on any application change.
  6. Set up a Spinnaker pipeline to deploy your app to Kubernetes.
  7. Test the trigger with a code change to production.

Next, you would install Jenkins and enable the API. Nginx is a great web server for using Aptly to manage Debian repositories. You can easily connect these to Spinnaker for continuous delivery. Functionize supports several ways to run deployments through apps, such as webhooks and its API. We also have a command-line interface for orchestrating silent environments such as Linux. We can also set up a Jenkins Bash script for orchestrations by means of a loop check. Since supports Jenkins, Functionize can import a job into the pipeline and run everything seamlessly.

A faster pipeline: Testing without scripting

Imagine an intuitive and intelligent testing framework that can anticipate code changes and self-heal test cases to increase reusability and improve delivery speed. Functionize is bringing such tools—tools with highly autonomous features—to the market today. With its unique, patented Adaptive Event AnalysisTM engine, Functionize autonomously identifies test case similarities, then optimizes and adapts to create new replacement test cases when appropriate. With powerful next-generation machine learning technology, Functionize smoothly and seamlessly weaves functional testing, performance testing, and load testing into the Google CI/CD platforms for continuous delivery of your software.