Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gatling

355 Aufrufe

Veröffentlicht am

SpringOne 2020
Wei Li: Solutions Engineer, Liberty Mutual Insurance;
Tongyu Wang: Architect, Liberty Mutual Insurance

Veröffentlicht in: Software
  • Als Erste(r) kommentieren

Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gatling

  1. 1. Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gatling Liberty Mutual Insurance - Tongyu Wang & Wei Li
  2. 2. Introduction 2 Tongyu Wang Architect, Liberty Mutual Insurance Wei Li Solutions Engineer, Liberty Mutual Insurance
  3. 3. Agenda 3  Traditional Testing Approach  What’s AVT  AVT Architecture and Implementation  Demo  Lessons Learned
  4. 4. How We Test Traditionally 4 Build Unit Test Deploy CI/CD Pipeline SCM Dev/Test/Stage/Perf MyApp Data Service A Service C Service B App AppOther Apps Dedicated Testing Suite (LoadRunner) Problems: ▪ Environment stability ▪ Dependency availability ▪ Limited testing window ▪ Unreliable results Client Dedicated env with shared dependencies Performance TestingFunctional Testing Dependencies
  5. 5. Automated Virtualized Testing (AVT) Approach 5 Introducing AVT AVT is an approach that leverages Containers As A Service (CaaS) infrastructure to auto-provision ephemeral runtime environments with external dependencies virtualized with mocks, so your application can run and be tested in a scalable and repeatable fashion. Benefits ▪ Reliable results and trending over time - because we focus on app-under-test rather than its dependencies and the environment ▪ Cost saving - we no longer need to maintain dedicated permanent test environments that only see sporadic usage ▪ Automated and repeatable - Increase testing automation in CI/CD pipeline Guiding Principles Reusable Components Integrated Framework • Test only what you control • Avoid testing in shared environments • Treat infrastructure as code • Docker images • Docker compose files • Kubernetes manifest files • Shell scripts • Monitoring/Visualization tools • Project structure convention • CI/CD pipeline integration • CaaS provider integration
  6. 6. AVT Conceptual Architecture 6 Build Unit Test Functional Test CI/CD Pipeline SCM Non-Prod/Prod MyApp Data Perf Test Deploy Functional Testing Env MyApp Data Mock Svc A Mock Svc A Mock Svc A Test Driver & Scripts Perf Testing Env MyApp Data Mock Svc A Mock Svc A Mock Svc A Test Driver & Scripts CaaS Infrastructure Auto-Provision Mock Svc A Mock Svc A Service A Artifact Repo Result Aggregation & Visualization
  7. 7. AVT Implementation @ Liberty Mutual 7 Build Unit Test Functional Test CI/CD Pipeline Non-Prod/Prod MyApp Data Perf Test Deploy Functional Testing Env Mock Svc A Mock Svc A Perf Testing Env Mock Svc A Mock Svc A Auto-Provision Mock Svc A Mock Svc A Service A App Artifacts Mock Config Test Scripts App Artifacts Mock Config Test Scripts
  8. 8. Demo - Sample Application and Tooling 8 Sample Application • A Spring Boot application • Expose Restful endpoints • Read data from a MySQL database • Call other web services Tooling • Java 11 and Maven 3.2.5 • InfluxDB 1.7 • Grafana 7.0.5 • Docker Desktop Community 2.3.0.3 • Kubernetes 1.16.5 • Kompose 1.21.0
  9. 9. Demo - Steps 9 Clone git repo (skipped) Use kompose to convert docker-compose to Kubernetes manifest files Build Spring Boot executable jar (skipped) run-app-gatling-k8s.sh kubectl apply -f k8s-app-gatling/
  10. 10. Demo - AVT Process Flow 10
  11. 11. Demo - AVT Process Flow (Continued) 11
  12. 12. Lessons Learned 12  Having well-defined service contracts is important.  The adoption of the framework can be incremental depending on each app’s unique situation to balance upfront costs vs. benefits over time.  Being able to launch test environments either from desktop or via CI/CD pipeline is very powerful, especially during test development and troubleshooting environment configurations.  Organizations adopting AVT should focus more on its core guiding principles, keep the implementation flexible and adjust to your organization’s existing infrastructure and practice.
  13. 13. Appendix 13
  14. 14. Docker Compose 14
  15. 15. Docker Compose (continued) 15
  16. 16. Sample Gatling Test Script 16
  17. 17. Kubernetes Manifests Converted from docker compose file by kompose 17
  18. 18. Kubernetes Manifest Example (app-deployment.yaml) 18
  19. 19. Kubernetes Manifest Example (app-deployment.yaml, continued) 19
  20. 20. Kubernetes Manifest Example (app-service.yaml) 20
  21. 21. Grafana Real Time Monitoring 21
  22. 22. Sample Gatling Test Report 22

×