Pact JSON file not being created when running into a Docker Container
See original GitHub issueHello everyone,
I’m currently trying to integrate my Pact Tests with a CI/CD pipeline. I have a .NET Core application that runs its tests and builds within a Docker container.
I am able to run my tests on the machine I use to develop with no issues. Sadly, when the tests run within the container, the Pact file is not generated. On the other hand, it generates the pact log file and it does not contain any errors.
Generated log file:
I, [2020-03-09T05:25:23.064685 #517] INFO -- : Cleared interactions for example "" I, [2020-03-09T05:25:23.271031 #517] INFO -- : Registered expected interaction GET /api/People?query=... D, [2020-03-09T05:25:23.271482 #517] DEBUG -- : { ... } I, [2020-03-09T05:25:24.821328 #517] INFO -- : Cleared interactions for example "" I, [2020-03-09T05:25:24.829914 #517] INFO -- : Registered expected interaction GET /api/People?query=... D, [2020-03-09T05:25:24.830098 #517] DEBUG -- : { ... } I, [2020-03-09T05:25:25.063320 #517] INFO -- : Cleared interactions for example ""
Note that it is missing the message “Writing pact for *** to ***.json”
Here is the line that run the tests within the dockerfile
dotnet test -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:CoverletOutput=/testresults/coverage/"$i".xml "./tests/$prj"
Thanks in advance for your help
Cheers
David
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
Hello guys!
Thanks for all the help. It ended up being a mix of a few issues on my side (misconfigured application together with odd failure handling on the pipeline)
However, now it has been fixed and it is all running as expected.
Thanks for all your time and sorry for the mess.
You could try hacking it by sending a POST to the mock service
http://localhost:<port>/pact
at the end of your test to force it to write the file. It wouldn’t fix the underlying problem, but it might help identify something.