When working with Spring Boot to build micro-services its very easy to write extensive and very readable integration tests and mock remote service requests with MockRestServiceServer
.
Is there a way to use similar approach to perform additional integration test on ZuulProxy
? What I would like to achieve is being able to mock remote servers that ZuulProxy
would forward to and validate that all of my ZuulFitler
s behaved as expected. However, ZuulProxy
is using RestClient
from Netflix (deprecated it would seem?) which naturally does not use RestTemplate
which could be re-configured by MockRestServiceServer
and I currently can't find a good way of mocking responses from remote services for proxied requests.
I have a micro-service that is responsible for handling API Session Key creation and then will act similar to an API Gateway. Forwarding is done with Zuul Proxy to underlying exposed services, and Zuul Filters will detect if Session key is valid or not. An integration test would therefore create a valid session and then forward to a fake endpoint, e.g 'integration/test'.
Specifying that 'integration/test' is a new endpoint is possible by setting a configuration property on @WebIntegrationTest
, I can successfully mock all services that are being handled via RestTemplate
but not Zuul forwarding.
What's the best way to do achieve mocking of a forward target service?