-
Notifications
You must be signed in to change notification settings - Fork 137
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 throws exception when calling stop_service() and says interaction has already been used #933
Comments
Just as a heads up, I've restarted my WSL distro and it's working again, but still, I don't understand why the issue started happening in the first place and I'm afraid it could happen when I deploy these tests to our pipelines. |
I wonder whether this is an issue with the local files perhaps? That is, Pact Python is reading the existing pacts, and trying to add to them when generating the consumer test. This might explain why it worked initially, then stopped, then worked again (especially if the files are stored in a temporary directory). |
To be honest, I'm not sure. If you mean the local json file Pact generates, I was deleting it before running the test. I also forgot to mention that the |
Yeah, that is what I was referring to. When you use It is not completely clear to me why it thinks it has a different response, as they all response with a 200 and no defined body. As a result, I'm wondering whether the lack of body definition is causing an issue within the underlying CLI. Maybe give that a go? While I investigate this a bit, have you considered using the |
Have you read the Contributing Guidelines on issues?
Prerequisites
pact-python
.Description
Hello,
I've been suddenly getting the message below after trying to re-run a test that had previously passed.
An interaction with same description ("a request for creating flow 1") and provider state ("Flow 1 is created") but a different response status and response body has already been used. Please use a different description or provider state, or remove any random data in the interaction.
Also, when the Pact file is generated, it contains all the previous validated flows accumulated.
Based on previous issues raised in this repo, I saw that this issue could be happening because Pact's mock service isn't properly being stopped after the test finishes running. So I looked in the debug console and found this exception in the stack:
This is my pact config:
And this is my test:
Then I had a look at the log file to see if there were any more detailed information about this exception, but found nothing. I'll attach the file to this issue. I don't see the service running in any port in VSCode's ports tab, so at this point I'm not even sure if the service is starting properly.
pact-mock-service.log
Reproducible demo
No response
Steps to reproduce
Expected behavior
Pact should properly close the mock service after calling stop_service().
Actual behavior
Pact throws RuntimeException when trying to stop the mock service and accumulates pacts in the generated pact file.
Your environment
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble
Self-service
The text was updated successfully, but these errors were encountered: