Testing in the 21st Century
As Unicorns
Alex Soto

Red Hat Engineer

@alexsotob
@alexsotob2
Alex Soto
Red Hat Engineer
www.lordofthejars.com
@alexsotob
Who Am I?
@alexsotob3
https://www.manning.com/books/testing-java-microservices
@alexsotob4
Questions
S O F T WA R E I S
E AT I N G T H E W O R L D
“With great power, there must also come—

great responsibility.”



—SPIDERMAN (STAN LEE)
@alexsotob7
@alexsotob8
@alexsotob9
Testing
@alexsotob10
Microservices Core Principles
MyService
Monitoring
Tracing
Discovery
API
Invocation
Resilience
Pipeline
Authentication
Logging Elasticity
@alexsotob11
Microservices architecture
@alexsotob12
Old Testing Model
@alexsotob13
@alexsotob14
Step Up Rule
@alexsotob
Evolution
15
Martin Fowler
Cindy Sridharan
@alexsotob16
Service Virtualization
@alexsotob17
@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
@alexsotob18
Contract Tests
@alexsotob19
We are on Production
@alexsotob20
Shit! We break Production Environment
@alexsotob21
Production is not sacrosanct anymore
@alexsotob22
Blue-Green Deployments
Blue/Green Deployment
CI/CD PRODUCTION ROUTER USERS
BUILD
SCM
Blue/Green Deployment
CI/CD PRODUCTION ROUTER USERS
BUILDSCM
Blue/Green Deployment
CI/CD PRODUCTION ROUTER USERS
SCM
Blue/Green Deployment
CD/CD PRODUCTION ROUTER USERS
SCM
@alexsotob27
Canary Release
Canary Deployment
CI/CD PRODUCTION ROUTER USERS
SCM
Canary Deployment
CI/CD PRODUCTION ROUTER USERS
SCM
Canary Deployment
CI/CD PRODUCTION ROUTER USERS
SCM
Canary Deployment
CI/CD PRODUCTION ROUTER USERS
SCM
Canary Deployment
CI/CD PRODUCTION ROUTER USERS
SCM
Canary Deployment
CI/CD PRODUCTION ROUTER USERS
SCM
Canary Deployment
CI/CD PRODUCTION ROUTER USERS
SCM
@alexsotob @AndyGeeDe35
Dark Launches
Dark Launches
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
INTERNAL USERS
Shadowing Traffic
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
@alexsotob38
@alexsotob39
@alexsotob40
As we move to services
architectures, we push the
complexity to the space
between our services
CHRISTIAN POSTA
@alexsotob41
▪ Greek word for “sail”
▪ Fleet configuration
▪ Routing and Load-Balancing control
▪ Observability
▪ Chaos Testing
▪ Security Options
Istio
@alexsotob42
DEMO
http://bit.ly/istio-tutorial
@alexsotob43
Diferencia
@alexsotob44
Simple Comparison
@alexsotob45
Noise Detection Comparison
@alexsotob46
Let’s Wind Down
@alexsotob47
Tests are a Team
@alexsotob48
Secure Your Steps
@alexsotob49
Stubbing collaborating services
Service A
Service
Virtualization
X
Service B v1
Service B v2
Host:”serviceb-shadow”
Service C Service D…Z
@alexsotob50
Synthetic transactions
Service A
Service B v1
Service B v2
Host:”serviceb-shadow”
synthetic:true
rollback
@alexsotob51
Virtualizing test-cluster’s database
Service A
Service B v1
Service B v2
Host:”serviceb-shadow”
Prod DB
Virtual DB
read
Throwaway
write
@alexsotob52
Materializing test-cluster’s database
Service A
Service B v1
Service B v2
Host:”serviceb-shadow”
Prod DB
Test DB
CDC
kafka streams
consume CDC
“And the fears that once controlled
me can't get to me at all.”



—ELSA
@alexsotob
asotobue@redhat.com
https://developers.redhat.com/

Testing XXIst Century