Slide 1

Slide 1 text

Oleg Nenashev, WireMock Inc. 1 WireMock8s Mocking your APIs in Kubernetes June 29, 2023 - Basel

Slide 2

Slide 2 text

> whoami @oleg_nenashev oleg-nenashev 2

Slide 3

Slide 3 text

WireMock Inc.? ● Early stage startup ● WireMock creator is a co-founder of the Inc. ● WireMock Cloud - SaaS for end-to-end API mocking ● Soon: K8s Edition for managed / on-premises ● // We are hiring ;-) wiremock.io

Slide 4

Slide 4 text

Disclaimer ● This is a talk about is NOT about “VERSUS” or “OR” ● There’s comparison ● Your mileage may vary

Slide 5

Slide 5 text

Outline ● APIs in Cloud Native ● Microcks and WireMock ● Comparison ● HOWTO: WireMock in Cloud Native app CI/CD These slides

Slide 6

Slide 6 text

Software ATE the world Source:developer.mercedes-benz.co m/products/vehicle_status/details

Slide 7

Slide 7 text

The new ecosystem is about APIs GROWTH IN WEB APIS SINCE 2005 Over 90% of developers use APIs. Skyrocket growth of APIs JANUARY 2006 JANUARY 2008 JANUARY 2010 JANUARY 2012 JANUARY 2014 JANUARY 2016 JANUARY 2018 MONTH The growth over time of the Programmable Web API API directory to more than 22,000 entries 22000 20000 18000 16000 14000 12000 10000 8000 6000 4000 2000 0 TOTAL API COUNT Programmable Web * Gartner Hype Cycle for APIs, 2022

Slide 8

Slide 8 text

APIs? Not just REST! ● Any interface! ● Async interfaces too ● Binary interfaces too 8

Slide 9

Slide 9 text

Open Standards ● Standard specifications for APIs ● Developer tools for the specification ● Ways to share specifications between teams at early stages ● Tools for serving APIs based on specifications www.openapis.org www.asyncapi.com

Slide 10

Slide 10 text

Are there API Mocking tools? 10

Slide 11

Slide 11 text

11 Of course! https://twitter.com/dastbe/statu s/1303858170155081728

Slide 12

Slide 12 text

API Mocking Landscape 12 en.wikipedia.org/wiki/Comparison_of_API_simulation_tools Kubernetes Native Not so Proprietary Open Source

Slide 13

Slide 13 text

13 https://microcks.io

Slide 14

Slide 14 text

Microcks summary ● “Open source Kubernetes Native tool for API Mocking and Testing” ● Kubernetes native ● Runs in Docker and OpenShift too 14 https://microcks.io

Slide 15

Slide 15 text

Congrats, Microcks!

Slide 16

Slide 16 text

Microcks in CI/CD ● You provision test APIs in CI/CD on-demand ● Plugins and environment wrappers ● Contract testing for deployed APIs 16 https://microcks.io

Slide 17

Slide 17 text

https://wiremock.org

Slide 18

Slide 18 text

Website: wiremock.org

Slide 19

Slide 19 text

~4M MONTHLY DOWNLOADS OF THE JAVA LIBRARY Downloads Over the Last 12 Months For com..github.tomakehurst WireMock 5K STARS IN GITHUB AND GROWING 4.0K 3.0K 2.0K 1.0K 2012 2014 2016 Date 2018 2020 2022 Star history Align timeline Start – history.com Tomakehurst/wiremock 5.0K 3,036 Used by 3,036 Open Source Projects >46M Pulls of WireMock Docker Image 181 Contributors >5M Downloads a month 1.3k Forks

Slide 20

Slide 20 text

Key features https://github.com/wiremock

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

Not just a Java tool github.com/wiremock/ecosystem

Slide 23

Slide 23 text

WireMock8s ● wiremock/wiremock ● wiremock/wiremock-docker ● wiremock/helm-charts ● wiremock/grpc-wiremock ● wiremock/wiremock-testcontainers-go Full demo will be here: github.com/oleg-nenashev/wiremock8s 23

Slide 24

Slide 24 text

gRPC Adapter for WireMock 24

Slide 25

Slide 25 text

github.com/wiremock/wiremock-testcontainers-java

Slide 26

Slide 26 text

Example - JUnit 5

Slide 27

Slide 27 text

Example - Golang https://github.com/oleg-nenashev/ wiremock-testcontainers-go/

Slide 28

Slide 28 text

WireMock as a Proxy Tests Real API Provider OR

Slide 29

Slide 29 text

WireMock Proxy? Why? ● Record & Playback for Request sequences ● Reverse engineering of legacy undocumented APIs ● Emulating complex cases ○ Overriding particular responses ○ Emulating response sequences / Stateful behavior ○ Failure Injection

Slide 30

Slide 30 text

Two tools. What's the difference? 30

Slide 31

Slide 31 text

Reminder

Slide 32

Slide 32 text

32 Deployment / Project WireMock Microcks “Baremetal” “External” projects * No JVM Yes No Docker / Container Runtimes Yes Yes K8s / Helm Yes Yes K8s Operator DIY Yes K8s / Cloud Native Scaling DIY Yes Testcontainers Yes DIY SaaS WireMock Cloud N/A Deployment * Rust implementation, .NET Core, Quarkus Native, GraalVM DIY - Do it yourself

Slide 33

Slide 33 text

Operations / Cloud Native Experience 33 Features / Project WireMock Microcks CLI Yes Yes Platform SDKs Yes Code-Generated Scale to Zero DIY Yes (operator) Horizontal scaling DIY Yes (operator) OpenTelemetry integration No Yes Configuration as Code Yes Yes

Slide 34

Slide 34 text

Features 34 Features / Project WireMock Microcks Request Matching* Yes Yes Response templating* Yes Yes Record & Playback Yes No (playback is on the roadmap) Stateful Behavior Yes No Async Behavior DIY (extension) Yes Fault Injection Yes DIY (hook) Chaos Engineering Yes (WireMock Cloud) DIY (hook) * WireMock is more powerful for HTTP(s), but less - for gRPC

Slide 35

Slide 35 text

Protocols 35 Features / Project WireMock Microcks HTTP / REST API * Yes Yes HTTPs / SSL Yes Yes gRPC Adapter Yes GraphQL Yes (extension) Yes Async API Adapter => AWS SNS/SQS, Kafka, RabbitMQ, NATS, PubSub, MQTT No Yes CloudEvents PoC Yes (blog) Websockets No Yes * WireMock is more powerful for HTTP(s), but less - for gRPC

Slide 36

Slide 36 text

Add more Chaos… Engineering! * Available in WireMock Cloud

Slide 37

Slide 37 text

Developer Experience 37 Features / Project WireMock Microcks Web UI WireMock UI*, WireMock.NET, WireMock Cloud Yes Editor / IDE integrations WireMocha for IDEA, VSCode plugins, OpenAPI Tooling Async API and OpenAPI tooling Reusable Templates Repo Yes Yes (Just Starting) REST API and OpenAPI Reverse Engineering WireMock Cloud No * Unofficial

Slide 38

Slide 38 text

There’s no silver bullet 38

Slide 39

Slide 39 text

Comparison - TL;DR ● Microcks is cloud native and K8s native ● Microcks supports more protocols OOTB ● Microcks implements Async API events ● WireMock can be used in a cloud native way ● WireMock is more powerful as Mocking tool ○ Better form matching ○ Record & Playback capabilities ○ Stateful behavior ● WireMock embeds in Unit/Integration tests 39

Slide 40

Slide 40 text

WireMock in K8s App CI/CD? 40

Slide 41

Slide 41 text

41 Testcontainers + WireMock (Docker engine is needed) My approach - Choosing Deployment I. Tests inside Java / JVM? II. Other stack? Use WireMock classic (WireMock Java) III. Single team / workspace? IV. Bigger setups? Use WireMock Standalone With Helm / Crossplane / etc.

Slide 42

Slide 42 text

42 Demo time!

Slide 43

Slide 43 text

Repeat after me? 43 ● WireMock Cloud - Free Tier available, use it ○ https://www.wiremock.io/product ● Demo repository: TODO

Slide 44

Slide 44 text

WireMock8s. What’s next? 44

Slide 45

Slide 45 text

Public Roadmap https://github.com/orgs/wiremock/projects/4

Slide 46

Slide 46 text

WireMock8s initiatives 46 ● Testcontainers Go module 1.0 ● Helm Chart 1.0 ● Better extensions support ● Better observability / sub-events ● Native gRPC and CloudEvents mocking ● (?) OpenFeature adoption

Slide 47

Slide 47 text

WireMock Cloud. K8s Edition 47 Coming Soon! Subscribe - https://share-eu1.hsforms.com/1YS KnSP93Tsig1JoO3lXSawfbdiq

Slide 48

Slide 48 text

Takeaways ● API Mocking/Abstraction are great ● There is no silver bullet ● There are tools for Kubernetes! ● If you need a cloud native tool OOTB - Microcks ● WireMock can be made cloud native too ● WireMock Cloud if you need SaaS

Slide 49

Slide 49 text

References WireMock ● Website: wiremock.org ● Docs: wiremock.org/docs ● WireMock on K8s: wiremock.org/docs/solutions/kubernetes/ ● WireMock Cloud: www.wiremock.io/product ● WireMock and Testcontainers Microcks ● Website: microcks.io ● Docs: microcks.io/documentation 49

Slide 50

Slide 50 text

It’s [always] a great time to contribute! wiremock.org/participate

Slide 51

Slide 51 text

THANK YOU Contacts: E-mail: [email protected] GitHub: oleg-nenashev Twitter: @oleg_nenashev QUESTIONS?