This document discusses testing microservices and strategies for testing services in a microservices architecture. It covers service virtualization to stub or simulate collaborating services. Contract and consumer-driven testing patterns are explained as well as canary releases, blue-green deployments, and dark launches for releasing to production. Testing strategies like fault injection and monitoring in production environments are also mentioned.
20. @alexsotob20
@Mock EmailService email;
Mockito.when(email.receiveBodyMessagesWithSubject("My Subject”))
.thenReturn("This is My Message")
// Test calls
Mockito.verify(email, Mockito.times(1))
.receiveBodyMessagesWithSubject(Matchers.anyString());
@ClassRule
public static HoverflyRule hoverflyRule =
HoverflyRule.inSimulationMode(SimulationSource.dsl(
service("api.flight.com")
.get("/api/bookings/1")
.willReturn(success("{"bookingId":"1"}", "application/json"))
));
// Test calls
hoverfly.verify(
service(matches("*.flight.*"))
.get("/api/bookings")
.anyQueryParams());
Record Method Expectation
Verify Method Called
Record Service Expectation
Verify Service Called
48. @alexsotob48
As we move to services
architectures, we push the
complexity to the space
between our services
CHRISTIAN POSTA
49. @alexsotob49
Istio Control Plane
Pod
Container
JVM
Service A
Envoy Side-car
Pod
Container
JVM
Service B
Envoy Side-car
Pod
Container
JVM
Service C
Envoy Side-car
HTTP1.1, HTTP2,
gRPC, TCP w/TLS
HTTP1.1, HTTP2,
gRPC, TCP w/TLS
HTTP1.1, HTTP2,
gRPC, TCP w/TLS
Istio Pilot Istio Mixer Istio Auth
istioctl, API, config Quota, Telemetry
Rate Limiting, ACL
CA, SPIFFE
Istio Data Plane
58. @alexsotob58
Testing Evolution to microservices world
Manual
Tests
After Code
Automatic
Test
Test First TDD and
BDD
Service
Virtualization
and CDC
Testing in
Production