Transcript
Page 1: Deploy With Certainty

Deploy microservices with Certainty

Alex Soto@alexsotob

Page 2: Deploy With Certainty

@alexsotob2

Alex Soto

Red Hat Engineer www.lordofthejars.com @alexsotob

Who Am I?

Page 3: Deploy With Certainty

@alexsotob3

Questions

Page 4: Deploy With Certainty

@alexsotob4

Any resemblance to reality is pure coincidence

Page 5: Deploy With Certainty

@alexsotob5

Villains Database Application

Page 6: Deploy With Certainty

@alexsotob5

Villains Database Application

Page 7: Deploy With Certainty

@alexsotob5

Villains Database Application

Villains

Page 8: Deploy With Certainty

@alexsotob5

Villains Database Application

Villains Crimes

Page 9: Deploy With Certainty

@alexsotob5

Villains Database Application

Villains CrimesGive Me Information of Gru

Page 10: Deploy With Certainty

@alexsotob5

Villains Database Application

Villains CrimesGive Me Crimes of GruGive Me Information of Gru

Page 11: Deploy With Certainty

@alexsotob5

Villains Database Application

Villains CrimesGive Me Crimes of GruGive Me Information of Gru

Page 12: Deploy With Certainty

@alexsotob5

Villains Database Application

Villains CrimesGive Me Crimes of GruGive Me Information of Gru

Page 13: Deploy With Certainty

@alexsotob6

Villains Database Application

Page 14: Deploy With Certainty

@alexsotob6

Villains Database Application

Page 15: Deploy With Certainty

@alexsotob6

Villains Database Application

Consumer

Page 16: Deploy With Certainty

@alexsotob6

Villains Database Application

Consumer Producer

Page 17: Deploy With Certainty

@alexsotob6

Villains Database Application

Consumer Producer

Page 18: Deploy With Certainty

@alexsotob6

Villains Database Application

Consumer ProducerGET /villains/Gru

Page 19: Deploy With Certainty

@alexsotob6

Villains Database Application

Consumer ProducerGET /crimes/GruGET /villains/Gru

Page 20: Deploy With Certainty

@alexsotob6

Villains Database Application

Consumer ProducerGET /crimes/Gru

[{ "name": "Moon", "villain": "Gru", "wiki": "/wiki/Moon"}]

GET /villains/Gru

Page 21: Deploy With Certainty

@alexsotob6

Villains Database Application

Consumer ProducerGET /crimes/Gru

[{ "name": "Moon", "villain": "Gru", "wiki": "/wiki/Moon"}]

GET /villains/Gru

"name": “Gru”,"areaOfInfluence": "World""crimes": [{ "name": "Moon", "wiki": "/wiki/Moon" }]

Page 22: Deploy With Certainty

@alexsotob7

Destroying Production Deployment

Page 23: Deploy With Certainty

@alexsotob8

Page 24: Deploy With Certainty

@alexsotob9

Unit Tests and Mock

Page 25: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Unit Tests (and Mocks)

10

Page 26: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Unit Tests (and Mocks)

10

CheapNo setup of environment

Page 27: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Unit Tests (and Mocks)

10

CheapNo setup of environment

FastMocks

Page 28: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Unit Tests (and Mocks)

10

CheapNo setup of environment

FastMocks

ReliableAll local, no flaky

Page 29: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Unit Tests (and Mocks)

10

CheapNo setup of environment

FastMocks

ReliableAll local, no flaky

TargetedYou know where it failed

Page 30: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Unit Tests (and Mocks)

10

CheapNo setup of environment

FastMocks

ReliableAll local, no flaky

Not TrustworthyHow you understand the system

TargetedYou know where it failed

Page 31: Deploy With Certainty

@alexsotob11

Integration Tests

Page 32: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Integration Tests

12

Page 33: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Integration Tests

12

TrustworthyThey are real

Page 34: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Integration Tests

12

TrustworthyThey are real

SlowBoot service and dependencies

Page 35: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Integration Tests

12

TrustworthyThey are real

Not ReliableMay fail for any external reason

SlowBoot service and dependencies

Page 36: Deploy With Certainty

@alexsotob

Advantages Disadvantages

Integration Tests

12

TrustworthyThey are real

Not ReliableMay fail for any external reason

SlowBoot service and dependencies

Become e2eYou easily end up with e2e tests

Page 37: Deploy With Certainty

@alexsotob13

Manual Tests

Page 38: Deploy With Certainty

@alexsotob14

Contract Tests

Page 39: Deploy With Certainty

@alexsotob15

Ownership of the Contracts

Page 40: Deploy With Certainty

@alexsotob

OwnershipDifferent Approaches

16

Page 41: Deploy With Certainty

@alexsotob

> Provider Contractsprovider centric, consumers adapts all or nothing

OwnershipDifferent Approaches

16

Page 42: Deploy With Certainty

@alexsotob

> Provider Contractsprovider centric, consumers adapts all or nothing

> Consumer Contractsindividual consumer’s needs

OwnershipDifferent Approaches

16

Page 43: Deploy With Certainty

@alexsotob

> Provider Contractsprovider centric, consumers adapts all or nothing

> Consumer Contractsindividual consumer’s needs

> Consumer-driven Contractsrepresentation of a provider's obligations to all its consumers

OwnershipDifferent Approaches

16

Page 44: Deploy With Certainty

@alexsotob17

Consumer Side

Consumer Test

Page 45: Deploy With Certainty

@alexsotob17

Consumer Side

Stub Server

Consumer Test

Expectations

Page 46: Deploy With Certainty

@alexsotob17

Consumer Side

Stub Server

Consumer Test

Expectations

Page 47: Deploy With Certainty

@alexsotob17

Consumer Side

Stub Server

Consumer Test

Expectations

GET /crimes/Gru

Page 48: Deploy With Certainty

@alexsotob17

Consumer Side

Stub Server

Consumer Test

Expectations

GET /crimes/Gru

[{"name":...]}

Page 49: Deploy With Certainty

@alexsotob17

Consumer Side

Stub Server

Consumer Test

Expectations

GET /crimes/Gru

[{"name":...]}

Page 50: Deploy With Certainty

@alexsotob17

Consumer Side

Stub Server

Consumer Test

Expectations

GET /crimes/Gru

[{"name":...]}

Sharing

Page 51: Deploy With Certainty

Provider Side

Sharing

Provider

Page 52: Deploy With Certainty

Provider Side

Sharing

Test

Provider

Page 53: Deploy With Certainty

Provider Side

Sharing

Test

Provider

Page 54: Deploy With Certainty

Provider Side

Sharing

Test

Provider

GET /crimes/Gru

[{"name":...]}

Page 55: Deploy With Certainty

Provider Side

Sharing

Test

Provider

GET /crimes/Gru

[{"name":...]}

Page 56: Deploy With Certainty

Provider Side

Sharing

Test

Provider

GET /crimes/Gru

[{"name":...]}

Page 57: Deploy With Certainty

@alexsotob19

Contract Tests Testing FrameworksConsumer Driven Contracts

Page 58: Deploy With Certainty

@alexsotob20

Page 59: Deploy With Certainty

@alexsotob20

> Pact FoundationPact specification v3

Page 60: Deploy With Certainty

@alexsotob20

> Pact FoundationPact specification v3

> Integration with several languagesJVM, Ruby, Python, Go, .Net, Swift, JS

Page 61: Deploy With Certainty

@alexsotob20

> Pact FoundationPact specification v3

> Integration with several languagesJVM, Ruby, Python, Go, .Net, Swift, JS

> Pact BrokerSharing contracts, API documentation, Overview of services

Page 62: Deploy With Certainty

@alexsotob20

> Pact FoundationPact specification v3

> Integration with several languagesJVM, Ruby, Python, Go, .Net, Swift, JS

> Pact BrokerSharing contracts, API documentation, Overview of services

> Arquillian AlgeronArquillian ecosystem + Pact, Publishers/Retrievers, JBoss Forge

Page 63: Deploy With Certainty

@alexsotob21

Building With Certainty

Page 64: Deploy With Certainty

@alexsotob22

Deploy with Certainty

Page 65: Deploy With Certainty

@alexsotob

Deploying ConsumerSteps on CI (Commit Stage)

23

Page 66: Deploy With Certainty

@alexsotob

> Execute BuildPublish contracts as artefact version

Deploying ConsumerSteps on CI (Commit Stage)

23

Page 67: Deploy With Certainty

@alexsotob

> Execute BuildPublish contracts as artefact version

> Run Head Provider Contract TestsCheck contract compatibility against version contract

Deploying ConsumerSteps on CI (Commit Stage)

23

Page 68: Deploy With Certainty

@alexsotob

> Execute BuildPublish contracts as artefact version

> Run Head Provider Contract TestsCheck contract compatibility against version contract

> Run Prod Provider Contract TestsCheck contract compatibility against version contract

Deploying ConsumerSteps on CI (Commit Stage)

23

Page 69: Deploy With Certainty

@alexsotob

> Execute BuildPublish contracts as artefact version

> Run Head Provider Contract TestsCheck contract compatibility against version contract

> Run Prod Provider Contract TestsCheck contract compatibility against version contract

> Release ConsumerTag contract with environment name

Deploying ConsumerSteps on CI (Commit Stage)

23

Page 70: Deploy With Certainty

@alexsotob

Deploying ProviderSteps on CI (Commit Stage)

24

Page 71: Deploy With Certainty

@alexsotob

> Execute BuildRun as usual

Deploying ProviderSteps on CI (Commit Stage)

24

Page 72: Deploy With Certainty

@alexsotob

> Execute BuildRun as usual

> Run Provider Contract TestsCheck contract compatibility against latest contract

Deploying ProviderSteps on CI (Commit Stage)

24

Page 73: Deploy With Certainty

@alexsotob

> Execute BuildRun as usual

> Run Provider Contract TestsCheck contract compatibility against latest contract

> Run Prod Provider Contract TestsCheck contract compatibility against environment contract

Deploying ProviderSteps on CI (Commit Stage)

24

Page 74: Deploy With Certainty

@alexsotob

> Execute BuildRun as usual

> Run Provider Contract TestsCheck contract compatibility against latest contract

> Run Prod Provider Contract TestsCheck contract compatibility against environment contract

> Release Provider

Deploying ProviderSteps on CI (Commit Stage)

24

Page 75: Deploy With Certainty

@alexsotob25

Automate Everything Enjoy your Vacations

Page 76: Deploy With Certainty

@alexsotob26

Let’s Wind Down

Page 77: Deploy With Certainty

@alexsotob

Conclusions

27

Page 78: Deploy With Certainty

@alexsotob

Conclusions

27

> End To End TestsLate feedback Expensive change Difficult to orchestrate

Page 79: Deploy With Certainty

@alexsotob

Conclusions

27

> End To End TestsLate feedback Expensive change Difficult to orchestrate

> Consumer Driven ContractsFail fast Independent deployments Improve communication

Page 80: Deploy With Certainty

More Info

https://github.com/arquillian-testing-microservices/

https://www.manning.com/books/testing-java-microservices

@alexsotob


Top Related