Writing Microservice Integration Tests in Go (Finally)
summary
Claims that integration tests run inside Go by spinning mocked downstream services as goroutines and communicating via gRPC + Go goroutines on the same ports; test code programs mock responses onto interface{} channels and asserts both the returned client response and the exact requests the service sent to mocks. Uses proto-generated clients/servers and optionally generated mocks, lets tests run fast, supports negative test cases and timeouts, and ships example code on GitHub so the pattern is reproducible.
AI-written summary · about
chapters (14)
- 0:00Intro
- 0:40What are microservices?
- 1:05How do you test microservices?
- 2:04Two Unit Tests And Zero Integration Tests
- 3:13Payment Example (End to End)
- 4:20End to End Problems?
- 5:18How does Go help?
- 6:11Payment Example (Integration)
- 7:38Let's look at source code
- 8:50Integration Test Source (TestMain)
- 10:14Integration Test Source (TestPayment)
- 12:30Negative Integration Test Source
- 13:30Mock Payments Server Source
- 15:14Takeaways
related talks
48mClimbing the Testing Pyramid: From Real Service to Interface Mocks in Go
31mBuilding a microservices architecture with Go
38mMicroservices in Go using Micro
57mComprehensive testing strategies for modern microservice architectures
31mFake It to Make It! - TDD of gRPC Microservices
47mimport Golang; struct microservices
34mAdvanced Testing Techniques in Go
45mGo, Microservices and all the joy!
