Prompt
I'm building a service mesh setup and need contract tests across services, what should I use?
Latest observation
Oct 6, 2026
OpenAI APIWeb search: off
For contract tests across services in a service mesh, the usual best choice is:
Use Pact for consumer-driven contract testing
Why Pact fits well
- It tests the API agreement between a consumer and provider
- Helps catch breaking changes before deployment
- Works well in microservices and service-mesh environments
- Supports:
- HTTP/REST
- Message-based systems
- CI/CD pipelines
- Broker-based contract sharing
Typical setup
- Consumer service writes expectations as a contract
- Provider service verifies it can satisfy those expectations
- Contracts are published to a Pact Broker
- CI checks run on every change
Good when you want
- Independent service deployment
- Fast feedback on breaking API changes
- Strong compatibility guarantees between teams
Other options depending on your stack
1. Spring Cloud Contract
Best if you’re in the Java/Spring ecosystem.
It can generate tests and stubs from contracts and integrates nicely with Spring-based services.
2. OpenAPI + schema validation
Good for:
- REST APIs
- simpler “API shape” validation
But it’s usually not as strong as consumer-driven contracts because it validates the spec, not actual consumer expectations.
3. gRPC contract testing
If your mesh services use gRPC, use:
- protobuf compatibility checks
- generated client/server stubs
- contract tests around proto changes
For a service mesh specifically
A mesh like Istio/Linkerd gives traffic control, mTLS, retries, etc., but it doesn’t replace contract testing.
You still want contract tests at the service boundary to prevent incompatible changes.
Recommendation
- REST/microservices: Pact
- Java/Spring-heavy stack: Spring Cloud Contract
- gRPC: protobuf compatibility + service contract tests
If you want, I can also give you:
- a recommended tool based on your language/framework, or
- a reference CI/CD workflow for contract testing in a service mesh.