Deploy With Certainty

  • View
    217

  • Download
    0

Embed Size (px)

Transcript

  • Deploy microservices with Certainty

    Alex Soto@alexsotob

  • @alexsotob2

    Alex Soto

    Red Hat Engineer www.lordofthejars.com @alexsotob

    Who Am I?

  • @alexsotob3

    Questions

  • @alexsotob4

    Any resemblance to reality is pure coincidence

  • @alexsotob5

    Villains Database Application

  • @alexsotob5

    Villains Database Application

  • @alexsotob5

    Villains Database Application

    Villains

  • @alexsotob5

    Villains Database Application

    Villains Crimes

  • @alexsotob5

    Villains Database Application

    Villains CrimesGive Me Information of Gru

  • @alexsotob5

    Villains Database Application

    Villains CrimesGive Me Crimes of GruGive Me Information of Gru

  • @alexsotob5

    Villains Database Application

    Villains CrimesGive Me Crimes of GruGive Me Information of Gru

  • @alexsotob5

    Villains Database Application

    Villains CrimesGive Me Crimes of GruGive Me Information of Gru

  • @alexsotob6

    Villains Database Application

  • @alexsotob6

    Villains Database Application

  • @alexsotob6

    Villains Database Application

    Consumer

  • @alexsotob6

    Villains Database Application

    Consumer Producer

  • @alexsotob6

    Villains Database Application

    Consumer Producer

  • @alexsotob6

    Villains Database Application

    Consumer ProducerGET /villains/Gru

  • @alexsotob6

    Villains Database Application

    Consumer ProducerGET /crimes/GruGET /villains/Gru

  • @alexsotob6

    Villains Database Application

    Consumer ProducerGET /crimes/Gru

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

    GET /villains/Gru

  • @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" }]

  • @alexsotob7

    Destroying Production Deployment

  • @alexsotob8

  • @alexsotob9

    Unit Tests and Mock

  • @alexsotob

    Advantages Disadvantages

    Unit Tests (and Mocks)

    10

  • @alexsotob

    Advantages Disadvantages

    Unit Tests (and Mocks)

    10

    CheapNo setup of environment

  • @alexsotob

    Advantages Disadvantages

    Unit Tests (and Mocks)

    10

    CheapNo setup of environment

    FastMocks

  • @alexsotob

    Advantages Disadvantages

    Unit Tests (and Mocks)

    10

    CheapNo setup of environment

    FastMocks

    ReliableAll local, no flaky

  • @alexsotob

    Advantages Disadvantages

    Unit Tests (and Mocks)

    10

    CheapNo setup of environment

    FastMocks

    ReliableAll local, no flaky

    TargetedYou know where it failed

  • @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

  • @alexsotob11

    Integration Tests

  • @alexsotob

    Advantages Disadvantages

    Integration Tests

    12

  • @alexsotob

    Advantages Disadvantages

    Integration Tests

    12

    TrustworthyThey are real

  • @alexsotob

    Advantages Disadvantages

    Integration Tests

    12

    TrustworthyThey are real

    SlowBoot service and dependencies

  • @alexsotob

    Advantages Disadvantages

    Integration Tests

    12

    TrustworthyThey are real

    Not ReliableMay fail for any external reason

    SlowBoot service and dependencies

  • @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

  • @alexsotob13

    Manual Tests

  • @alexsotob14

    Contract Tests

  • @alexsotob15

    Ownership of the Contracts

  • @alexsotob

    OwnershipDifferent Approaches

    16

  • @alexsotob

    > Provider Contractsprovider centric, consumers adapts all or nothing

    OwnershipDifferent Approaches

    16

  • @alexsotob

    > Provider Contractsprovider centric, consumers adapts all or nothing

    > Consumer Contractsindividual consumers needs

    OwnershipDifferent Approaches

    16

  • @alexsotob

    > Provider Contractsprovider centric, consumers adapts all or nothing

    > Consumer Contractsindividual consumers needs

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

    OwnershipDifferent Approaches

    16

  • @alexsotob17

    Consumer Side

    Consumer Test

  • @alexsotob17

    Consumer Side

    Stub Server

    Consumer Test

    Expectations

  • @alexsotob17

    Consumer Side

    Stub Server

    Consumer Test

    Expectations

  • @alexsotob17

    Consumer Side

    Stub Server

    Consumer Test

    Expectations

    GET /crimes/Gru

  • @alexsotob17

    Consumer Side

    Stub Server

    Consumer Test

    Expectations

    GET /crimes/Gru

    [{"name":...]}

  • @alexsotob17

    Consumer Side

    Stub Server

    Consumer Test

    Expectations

    GET /crimes/Gru

    [{"name":...]}

  • @alexsotob17

    Consumer Side

    Stub Server

    Consumer Test

    Expectations

    GET /crimes/Gru

    [{"name":...]}

    Sharing

  • Provider Side

    Sharing

    Provider

  • Provider Side

    Sharing

    Test

    Provider

  • Provider Side

    Sharing

    Test

    Provider

  • Provider Side

    Sharing

    Test

    Provider

    GET /crimes/Gru

    [{"name":...]}

  • Provider Side

    Sharing

    Test

    Provider

    GET /crimes/Gru

    [{"name":...]}

  • Provider Side

    Sharing

    Test

    Provider

    GET /crimes/Gru

    [{"name":...]}

  • @alexsotob19

    Contract Tests Testing FrameworksConsumer Driven Contracts

  • @alexsotob20

  • @alexsotob20

    > Pact FoundationPact specification v3

  • @alexsotob20

    > Pact FoundationPact specification v3

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

  • @alexsotob20

    > Pact FoundationPact specification v3

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

    > Pact BrokerSharing contracts, API documentation, Overview of services

  • @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

  • @alexsotob21

    Building With Certainty

  • @alexsotob22

    Deploy with Certainty

  • @alexsotob

    Deploying ConsumerSteps on CI (Commit Stage)

    23

  • @alexsotob

    > Execute BuildPublish contracts as artefact version

    Deploying ConsumerSteps on CI (Commit Stage)

    23

  • @alexsotob

    > Execute BuildPublish contracts as artefact version

    > Run Head Provider Contract TestsCheck contract compatibility against version contract

    Deploying ConsumerSteps on CI (Commit Stage)

    23

  • @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

  • @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

  • @alexsotob

    Deploying ProviderSteps on CI (Commit Stage)

    24

  • @alexsotob

    > Execute BuildRun as usual

    Deploying ProviderSteps on CI (Commit Stage)

    24

  • @alexsotob

    > Execute BuildRun as usual

    > Run Provider Contract TestsCheck contract compatibility against latest contract

    Deploying ProviderSteps on CI (Commit Stage)

    24

  • @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

  • @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