Closed nishalparbhu closed 3 years ago
That's a little strange. Is it always failing for this test and it's not obvious why or it is intermittently failing (and not obvious why!)? I'm suspecting some space or encoding issue when passing to the ruby bit.
I've run this test in isolation with Pytest. I have a whole suite of tests (around 50 PACT tests) which all pass but I created this test yesterday and every time (5-10 times) I've run it, it fails. In all occasions the pact-mock-service.log
appears to be the same from what I've seen.
This "missing request x"/"unexpected request x" happens when the request is fired off before the expectation is put into the mock service.
If you hit me up on Slack I'll try and help you solve it next week.
This "missing request x"/"unexpected request x" happens when the request is fired off before the expectation is put into the mock service.
- send request x to mock service (register the "unexpected request")
- set up expectation
- end test
- verify requests (calculate that the expected request from step 2 was never received).
I understand what you're saying, I'm just unaware how I would need to change the code so that the expectation is set up before the request is fired off (I have a similar structure for most of my tests and I've not had this issue on the others). How do I restructure the test?
If you hit me up on Slack I'll try and help you solve it next week.
This would be great. Apologies I'm still a bit new to Slack, how do I add/message you on Slack?
Hi @nishalparbhu, I am facing exact same issue, I was wondering if your issue was resolved. If it was, do you mind posting your solution? Thanks
Hi there, apologies I have not yet, I think if you join the slack channel they will help but for my particular case I just had to exclude those tests for the time being (it only occurred for a small set of tests for me at this point) but I think if you request to join the slack channel and post on there, they will help you 👍
Hi there, apologies I have not yet, I think if you join the slack channel they will help but for my particular case I just had to exclude those tests for the time being (it only occurred for a small set of tests for me at this point) but I think if you request to join the slack channel and post on there, they will help you 👍
Hi @nishalparbhu, thanks for the reply. While my issue was resolved. I made the test case as async
and things started working fine. 👍 !
Apologies I accidently pressed enter before filling in the first time 😭
So I've been using Python PACT for a while and normally everything works fine. Recently however I've been getting this issue where sometimes I try and run a test and I can't decipher what is going wrong based on the
pact-mock-service.log
or the stack traceFor this I've been using
pact-python==1.2.6
This is my code I've used to create the test in Python:
REQUEST_OBJECT
above is based on a class I've created to just send python requests (using requests package)This is the stack trace output:
This is the
pact-mock-service.log
output which is what is confusing me because it seems I am making the right request but it still fails:I'm happy to add further to this thread with anything else that is needed 😄