-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pact-mock-server/Webrick server returns ECONNRESET #34
Comments
Investigation. Here are 3 Use cases described:
I set a standalone pact server running with the following command:
I have 2 clients with different endpoints and consumer names:
USE CASE #1 ( different consumer but same provider ) After starting server and running the tests I get the following result:
Until here everything is great: But when I want to query mock service with requests that were supposed to exist on server, as we generated pact files,
Does pact-mock-server supposed to work this way? I thought it is forming in-memory collection of interaction, so I can query each set up interaction. USE CASE #2 ( same consumer and provider ) Both files have After running pact-mock-server again and running the test we get the following output:
Queries to localhost:1234 result in the same as in use case # 1. USE CASE # 3 (files merged into 1 files) I've copied the expectation from Tommy.js in the end of Mary.js. Thus no dublication of setting up the Pact.mockservice occurs.
Running this code also generated the same results. Console output:
Now the request to alligators/Tommy returns expected response and alligators/Mary fails. I assume this is due to the ordering, as Tommy expectation was set after the Mary. |
Ok, before I spend half an hour going through all those logs, let me address "I have 2 clients with different endpoints and consumer names:". You can't use the same mock service for both of these, you need two separate mock service instances, each running on a different port. Can you make a repository with the code required to replicate the bug? |
@bethesque I've created the sample project. https://github.com/ichyr/pact-js-example All relevant set up information is in README.
|
@ichyr Just for reference, in the coming weeks the pact-consumer-dsl will automatically run a mock service transparently to you for this use case. Additionally, we have just added the capability to reset a session between tests that could simplify your code to date. |
Hi @ichyr, I'm currently on maternity leave with 3 month old twins, so I don't have time to look into this at the moment. @sergei-matheson is maintaining the library while I'm on mat leave. |
Oh... just realised this is from last year... ignore previous comment. It seems I never followed up - I apologise. I was 8 months pregnant with twins at the time and trying to hand over a project, so it must have gotten lost in the interminable list of things that had to be done that month. |
Hi!
I have 2 unit test written in js using ( pact-consumer-js-dsl ) that create interactions like in the README for that library e.g. alligators/Mary, alligators/Pete They are separated in two different files. In each file I set up the same logic:
When I trigger them the pact json files are generated. But after they are generated the pact-mock-server writes in logs that:
ERROR Errno:ECONNRESET: An existing connection was forcibly closed by the remote host. @ io-Fillbuf - fd:5
I don't know if this is the correct way of behavior so want to know if those errors that I get are
`
After this error occurs, the server ( started on localhost:1234 ) as response to request localhost:1234/alligators/Mary (specified in the js code above) will response with:
Is this a BUG in pact-mock-server and how this can by solved?
P.S. These are errors of WebRick server, so in the internet people say that switching to thin server resolves this.
The text was updated successfully, but these errors were encountered: