Hey all, I am writing an integration test for a service that contacts another service using graphql with apollo client.
What is the best approach for mocking the service? Is a regular http mock server a reasonable approach?
I’ll mention that the test is dockerized. Thanks!
m
mbonnin
01/29/2023, 8:49 AM
MockServer is what we do for apollo-kotlin codebase. It's working great 👍. There's even an
apollo-mockserver
artifact if you need native/js support
mbonnin
01/29/2023, 8:50 AM
If not OkHttp MockWebServer has more features
r
Ron Aharoni
01/29/2023, 10:44 AM
I am also trying to use MockServer. My mock container name is managementmock, so I configure ApolloClient’s server url to be http://managementmock:1080. However, I get a connection refused error, and it seems that for some reason the ip is added to the url.
I attached an image, do you have a clue why that might happen?
m
mbonnin
01/29/2023, 10:47 AM
1080
is the port. IIRC it's assigned automatically, you don't have control over it. You should retrieve the url from the mock server: