%% date:: [[2023-04-25]] parent:: %% # [[Testing microservices]] Testing [[Microservices]] poses some unique challenges compared to testing a [[Monolith]]. ## Tips in testing microservices ### Make [[Observability]] a priority One of the [[Disadvantages of microservices]] is that they are more difficult to monitor. Combat this by including an observability plan from the beginning. [^techstrong] - [[Schrödinger's Pokémon - TestCon Europe]] and [[Schrödinger's Pokémon - Observability for chaotic load testing]] ### Implement a [[Circuit breaker pattern]] A circuit breaker acts like a proxy between microservices, preventing [[Retry storm]]s and other [[Cascading Failures]]. [[Dimming|Brownout Theory]] can be applied to intelligently regulate traffic with the goal of improving overall system [[Performance]]. ### Use canary testing Keep the [[Chaos engineering terminology#Blast radius|blast radius]] by introducing changes to a small percentage of the services first. [^techstrong] ### [[Infrastructure as code]] Define your environment using manifest files, so that deployment is codified and thus repeatable. ## Sample microservices apps for testing - [Sock Shop](https://github.com/microservices-demo/microservices-demo) - polyglot architecture - limitation: there are minor bugs, particularly in the checkout process - you can only check out with items in your cart lower than a value. - [TeaStore](https://github.com/DescartesResearch/TeaStore) - Docker and Kubernetes - particularly good for [benchmarking](https://github.com/DescartesResearch/TeaStore/wiki/Testing-and-Benchmarking) and resource management - tested with LIMBO and JMeter, and the methodology for these tests is available - [TrainTicket](https://github.com/FudanSELab/train-ticket) - Docker and Kubernetes - Can be used in conjunction with, for example, [[Jaeger]] for tracing. [^techstrong]: Fee, N. (2020). _Staying together by breaking apart: How DevOps can thrive in a world of social distancing and serverless._ TechStrong Con 2020. Retrieved from https://digitalanarchist.com/videos/techstrong-con-virtual-summit/nocnica-fee-stay-together-by-breaking-apart-how-devops-can-thrive-in-a-world-of-social-distancing-serverless