bethskurrie
2018-03-24 03:39
has joined #pact-python

bethskurrie
2018-04-05 04:09
/github subscribe pact-foundation/pact-python

matthew.balvanz
2018-04-05 04:12
has joined #pact-python

bethskurrie
2018-04-24 10:35
@matthew.balvanz could you have a look at this issue? https://stackoverflow.com/questions/49983126/pact-simple-example-ad-setup-issues

bethskurrie
2018-04-24 10:35
Not sure if you're following the pact tags on stackoverflow. Sorry if you've already seen it.

bethskurrie
2018-04-24 10:41
I actually had a poke around the code myself, and added an answer - I think it's just super out of date.

matthew.balvanz
2018-04-24 13:45
Sure, I've got a full schedule today, but I hope to take a look at it tomorrow.

bethskurrie
2018-05-02 05:00
/github unsubscribe pact-foundation/pact-python deployments public commits

slack1
2018-05-09 20:01
has joined #pact-python

gnewitt
2018-05-29 22:49
has joined #pact-python

gonzalogarcia243
2018-06-08 15:00
has joined #pact-python

ashish.dubey91
2018-06-13 06:12
has joined #pact-python

ashish.dubey91
2018-06-13 06:15
hey guys, pact-verifier returns exit code 0 even when the verification fails, is that by design? I'd want some way to detect failures. exit code would have been the most elegant

bethskurrie
2018-06-13 07:52
That doesn't sound right :thinking_face:

bethskurrie
2018-06-13 07:52
As in, it sounds like a bug.

bethskurrie
2018-06-13 07:53
Under the hood, its calling the ruby pact-provider-verifier. Have a look and see if to can see that code, and how it handles error codes.

ashish.dubey91
2018-06-13 08:50
oh wait, the python pact-verifier also uses ruby? that'd be interesting

ashish.dubey91
2018-06-13 08:50
sorry I didn't mention that I installed the python version

bethskurrie
2018-06-13 09:25
It's packaged as a standalone executable.

bethskurrie
2018-06-13 09:25
You don't have to have ruby installed

bethskurrie
2018-06-13 09:36
And yes, I assumed you were using the python on, given the channel topic.

ashish.dubey91
2018-06-13 09:38
thanks. maybe I'll dive into the code

ashish.dubey91
2018-06-13 09:39
could be my first contribution

matthew.balvanz
2018-06-13 19:11
A quick glance at the code makes me think I attempted to make that happen:


matthew.balvanz
2018-06-13 19:12
We may need to dig a bit more to find out why that `sys.exit(p.returncode)` isn't the same as the Ruby exit code.


ashish.dubey91
2018-06-14 13:57
but not in the latest release?

ashish.dubey91
2018-06-14 13:58
oh wait that's not master, `p.communicate` is what fixes it

ashish.dubey91
2018-06-14 13:59
otherwise, `p.returncode` is always `None` as the process spawned by Popen is still executing

ashish.dubey91
2018-06-14 13:59
you have to either `poll`, `wait` or `communicate` to wait for the actual exit code


matthew.balvanz
2018-06-14 16:39
Yep, that is clearly not right. We likely need to add back a poll or wait after we finish reading the logs to get things back in order.

ashish.dubey91
2018-06-14 17:20
I can create a PR :slightly_smiling_face:

richard.jones
2018-06-15 00:12
has joined #pact-python

matthew.balvanz
2018-07-21 03:44
@ashish.dubey91 I just released 0.17.0 which should now be exiting with a non-zero code when verification fails.

bethskurrie
2018-07-21 04:27
Like a shop bought one!

thirumal.net
2018-07-23 05:55
has joined #pact-python

thirumal.net
2018-07-26 16:17
~://pact-foundation.slack.com~

thirumal.net
2018-07-26 16:20
Hi, i am doing POC for pact-python implementation in our project and i am facing below questions. It seems we have to use localhost:1234 from consumer side at the time of mock generation ? Can we use real service in place of mocking service ? If I use localhost:1234 , pact was generated but if i use real service ,then error is coming up So my question is do we need to always use Mock service ((localhost:1234) when we creating pacts from consumer side 2nd issue : i am from QA Team and thinking that pacts should be written by DEV team not QA team . is my assumption correct ? if yes, how these pacts will help QA Team ? Thank you in Advance,

thirumal.net
2018-07-26 16:22
@bethskurrie - Can you please help me on my question , Thank you in advance

matthew.balvanz
2018-07-26 17:49
Pact uses the mock service to generate the contract JSON files, which are later verified against the real service. Being able to use the real service I think would just convert the test into an integration test? I see you get an error when using the real service, when you verify the generated pact against that service do you see the same error?

bethskurrie
2018-07-26 22:06
You must use the mock to create a pact. This is one of the fundamental principles of using Pact.

bethskurrie
2018-07-26 22:07
@thirumal.net yes, it is typically the developers who write both the consumer and provider pact tests.

bethskurrie
2018-07-26 22:08
They run as part of the same test suite as the unit and functional tests.

bethskurrie
2018-07-26 22:08
They should be able to run locally, without any reliance on a deployed environment.

bethskurrie
2018-07-26 22:09
You may find these useful https://docs.pact.io/faq

bethskurrie
2018-07-26 22:10
I would recommend reading the entire Getting Started section if you have not already.

thirumal.net
2018-07-27 18:28
@matthew.balvanz -Thank you for your reply. i am not getting any error if i use real service with pact verifier.

thirumal.net
2018-07-27 18:28
@bethskurrie - Thank you very much for your help on clarifying my questions.

thirumal.net
2018-07-27 18:29
@bethskurrie - i will go through entire document you have mentioned and let you know if i have any questions. Thank you again !

thirumal.net
2018-07-30 18:35
Hi, i am doing poc with real service and need your help. i am able to create mock and verify for small service but not real service . just i am taking real service and trying to mock the response through mock service so that i can demo it to dev team for implementation . here is my issue *how should i generate the mock for below situation where Provider service is responding with below Jason format *

thirumal.net
2018-07-30 18:43
@bethskurrie or @matthew.balvanz - can you please guide me how to generate mock for provider which gives Jason response . unable to mock the jason response consumer side . here is the code i have tried so far ' def test_callAPI (self): url = 'http://localhost:1234' expected = { 'class': 'HealthCheck', } pact.given ( 'sending a request to url' ).upon_receiving ( 'class name should match with HealthCheck' ).with_request ( 'get', '/' ).will_respond_with ( 200,body=expected) with pact: result = callAPI ( url ) self.assertEqual ( result,expected )'

thirumal.net
2018-07-30 18:46
* Jason fomat * ' { "class": [ "HealthCheck" ], "properties": { "timestamp": "2018-07-30T02:48:04+0000", "systemName": "minimal-rx , "buildInfo": { "buildDate": "2018-07-27T07:38:19+0000", "appVersion": " ", "revision": " ", "branch": "develop" }, "health": "OK", "checks": [ { "check": "DB connection via Instance of ", "status": "OK", "assertion": "available", "target": "I" }, { "check": "Connection to /userinfo", "status": "OK", "config_id": " .com", "secure_key": " .com", "assertion": "access", "config_type": "OAUTH", "target": userinfo" } ] }, "links": [ { "rel": [ "self" ], "href": "/ " } ] }'

thirumal.net
2018-07-30 18:47
* Jason fomat * ' { "class": [ "HealthCheck" ], "properties": { "timestamp": "2018-07-30T02:48:04+0000", "systemName": "minimal-rx", "buildInfo": { "buildDate": "2018-07-27T07:38:19+0000", "appVersion": "CS-MRA_develop.25", "revision": "291a6553f509edc68074d31cd7d5a077a98c5add", "branch": "develop" }, "health": "OK", "checks": [ { "check": "DB connection via Instance of class com.zaxxer.hikari.HikariDataSource", "status": "OK", "assertion": "available", "target": "Instance of class com.zaxxer.hikari.HikariDataSource" }, { "check": "Connection to /userinfo", "status": "OK", "config_id": " .com", "secure_key": " .com", "assertion": "access", "config_type": "OAUTH", "target": userinfo" } ] }, "links": [ { "rel": [ "self" ], "href": "/minimal-rx/v1/admin/healthcheck" } ] }'

bethskurrie
2018-07-30 22:15
Hi @thirumal.net can you tell us exactly what problem you're having?

bethskurrie
2018-07-30 22:16
On a side, note, I'll make some suggestions for your other fields

bethskurrie
2018-07-30 22:17
"Given" should describe the state of the data on the provider. For example, if you need any domain objects, it should describe those. eg. "a widget with id 1 exists"

bethskurrie
2018-07-30 22:17
"upon_receiving" should describe the request. eg "a request for a widget with id 1"

bethskurrie
2018-07-30 22:18
in your case, I would say ``` pact.given ( 'the health of the system is OK' ).upon_receiving ( 'a request for the health check' ) ```

bethskurrie
2018-07-30 22:19
@matthew.balvanz will have to tell you how to express the JSON, because I don't know how to do it in python.

bethskurrie
2018-07-30 22:20
Please tell him what documentation you have already looked at.

bethskurrie
2018-07-30 22:21
For example, the example on the pact-python README appears to have a JSON body https://github.com/pact-foundation/pact-python What is missing from that example that you need to know?

thirumal.net
2018-07-30 23:23
@bethskurrie -Thank you for your quick response and i have gone through the documentation you have mentioned and here is exact issue i am facing : service provider gives lot of jason data in the response but i want to test only some part of it . in order to do that i am trying to mock only portion of the provider response but unable to do it service provider will give below response { *"class": [ "HealthCheck" ],* "properties": { "timestamp": "2018-07-30T02:48:04+0000", "systemName": "minimal-rx , "buildInfo": { "buildDate": "2018-07-27T07:38:19+0000", "appVersion": " ", "revision": " ", "branch": "develop" }, "health": "OK", "checks": [ { "check": "DB connection via Instance of ", "status": "OK", "assertion": "available", "target": "I" }, { "check": "Connection to /userinfo", "status": "OK", "config_id": " .com", "secure_key": " .com", "assertion": "access", "config_type": "OAUTH", "target": userinfo" } ] }, "links": [ { "rel": [ "self" ], "href": "/ " } ] }' ''but i want to verify only class:HealthCheck . to do this one i am mocking as below before running mock service but service is failing error is happening at 'will_respond_with ( 200, body= EachLike({'class': ['HealthCheck'], }, minimum=1) )' 'Error : AssertionError: [{'class': ['HealthCheck']}] != <pact.matchers.EachLike object at 0x06D64E50>'

thirumal.net
2018-07-30 23:25
my test consumer code is : ' url = 'http://localhost:1234' pact.given ( 'the health of the system is OK' ).upon_receiving ( 'a request for the health check' ).with_request ( 'get', '/' ).will_respond_with ( 200, body= EachLike({'class': ['HealthCheck'], }, minimum=1) )'

thirumal.net
2018-07-31 02:36
@bethskurrie - even though i am getting Assertion Error from Consumer side, i am able to generate mock which looks like below ' "consumer": { "name": "consumer" }, "provider": { "name": "provider" }, "interactions": [ { "description": "a request for the health check", "providerState": "the health of the system is OK", "request": { "method": "get", "path": "/" }, "response": { "status": 200, "headers": { }, "body": { "class": "HealthCheck", "properties": { "timestamp": "2016-12-15T20:16:01", "systemName": "minimal-rx", "buildInfo": { "buildDate": "2016-12-15T20:16:01", "appVersion": " 11", "revision": "291a6553f509edc68074d31cd7d5a077a98c5add", "branch": "develop" }, "health": "OK", "checks": [ { "check": "DB connection via Instance of class com. ", "status": "OK", "assertion": "available", "target": "Instance of class com " }, { "check": "Connection to ", "status": "OK", "config_id": " com", "secure_key": " ", "assertion": "access", "config_type": "OAUTH", "target": " o" } ] }, "links": [ { "rel": [ "self" ], "href": "/minimal-rx/v1/admin/healthcheck" } ] }, "matchingRules": { "$.body.properties.timestamp": { "match": "regex", "regex": "\\d+-\\d+-\\d+T\\d+:\\d+:\\d+" }, "$.body.properties.buildInfo.buildDate": { "match": "regex", "regex": "\\d+-\\d+-\\d+T\\d+:\\d+:\\d+" } } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } }'

thirumal.net
2018-07-31 02:38
but when i try to to run this jason against real provider service , i am getting below error . i am suspecting this is because of timestamp(in mock creation getting error on dates) .Error from pact verifier is *'Failure/Error: expect(response_body).to match_term expected_response_body, diff_options Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8 '*

thirumal.net
2018-07-31 02:41
can you please help me what might be the issue ? consumer side, i am doing mocking date like below , 'expected = {'class': 'HealthCheck', 'properties': {'timestamp': Term('\d+-\d+-\d+T\d+:\d+:\d+', '2016-12-15T20:16:01'),'

thirumal.net
2018-07-31 02:52
insteading of checking complete response can i check only certain data ? just to make sure class': 'HealthCheck' is coming from provider service ?

bethskurrie
2018-07-31 03:40
The data that is checked is the data that you mock.

bethskurrie
2018-07-31 03:40
You can't mock data, and not check it.

bethskurrie
2018-07-31 03:41
If you want to do that, use another tool.

bethskurrie
2018-07-31 03:41
I often use pact as well as "normal" mocking tools to test my code.

bethskurrie
2018-07-31 03:42
Your response contains a non utf-8 character in it.

bethskurrie
2018-07-31 03:43
According to a quick google, it is the character â

bethskurrie
2018-07-31 03:46
If you look at the log files, you should see the response body in there.

shashidesai
2018-07-31 18:35
has joined #pact-python

thirumal.net
2018-07-31 22:40
@bethskurrie -Thank you for your reply but unable to find out the reason why error is still coming up . can you please tell me how to mock only certain data instead of total response body ? out of total response i want to mock only one item from the response like *"class": [ "HealthCheck" ],* instead of total response

thirumal.net
2018-08-01 06:03
just trying to mock only one item like below 'url = 'http://localhost:1234' expected = {'class': 'HealthCheck'} and verifying with pact verifier but unfortunately i am getting error for this one too

matt.fellows
2018-08-01 06:49
has joined #pact-python

bethskurrie
2018-08-01 08:50
@thirumal.net I think you need a developer to pair with you on this.

bethskurrie
2018-08-01 08:57
Here is a list of things I recommend you do

bethskurrie
2018-08-01 09:02
? If possible, create a repository in Github that recreates the issue you are having so that we can actually look at the code ? Find a developer to pair with you ? Look at the pact logs that get created when the verification runs and see what the response body is. Please let me know if you cannot find this file. ? Look at the application logs of your provider to work out why you are getting a 403 ? The fact that you're getting a 403 suggests that you have not set up the authorization headers correctly or that you have not set up the required user data correctly. Make sure you fully understand how provider states work. You can read about them here: https://docs.pact.io/getting_started/provider_states https://github.com/pact-foundation/pact-provider-verifier#api-with-provider-states

matt.fellows
2018-08-01 10:39
I think your issue is not related to only mocking a part of the response. Looking at your code, it should be only mocking this part of the response. If you could provide us with something to run, we?ll be able to help you further

thirumal.net
2018-08-02 03:38
@matt.fellows - Thank you , i have uploaded my code and details in below Github link , can you please kindly help me ? https://github.com/pact-foundation/pact-python/issues/90

thirumal.net
2018-08-02 03:39
@bethskurrie - Thank you, i have uploaded a code in below path :https://github.com/pact-foundation/pact-python/issues/90

thirumal.net
2018-08-02 03:40
sure, i will follow the documentation you have mentioned

thirumal.net
2018-08-02 08:02
@bethskurrie - here is the repository created for the code base https://github.com/thiruHp/PACT-PYTHON-Issue

richard.jones
2018-08-03 04:58
Hi folks. I?ve spent a few hours today integrating my Python pact verification code into the pact-python library using it as the consumer mock server and provider verifier (rather than spawning the external shell process). I have it working, I?m just cleaning up now. I hope to have code up on github next week.

sgarvey
2018-08-06 11:23
has joined #pact-python

richard.jones
2018-08-06 22:54
So: next steps, now that I have the concept working. Should I just push up my fork of pact-python to github with the changes in place, or would folks like to talk about them first? The verifier code also includes a full test suite, including the pact-specification test files (included as git submodules) so I?ll be merging that too.

richard.jones
2018-08-06 22:57
@matthew.balvanz (and maybe @matt.fellows) I think that?s a question for you folks? I am pretty sure you?re the main culprits in pact-python land :slightly_smiling_face:

richard.jones
2018-08-06 22:57
wth slack

richard.jones
2018-08-06 22:57
why u change that name

bethskurrie
2018-08-06 22:58
@richard.jones are you reimplementing the verifier in python?

richard.jones
2018-08-06 22:58
Already did so :slightly_smiling_face:

bethskurrie
2018-08-06 22:58
That's great for you, but we rely on the shared usage of the underlying ruby mock to push out new features quickly across all the implementations.

richard.jones
2018-08-06 22:58
I?m now merging it into the pact-python code to handle the mocking / step also

bethskurrie
2018-08-06 22:59
We don't particularly want to have a separate implementation to manage as part of the pact core library.

richard.jones
2018-08-06 22:59
OK, separate project then, gotcha

bethskurrie
2018-08-06 23:00
For example, there is a new "wip pacts" feature coming, and we'll be able to incorporate that into all the libraries simply by updating the ruby standalone version. There is more logic in pact than just the matching/mocking/verifying.

bethskurrie
2018-08-06 23:01
The Broker interactions are an important part of the story too.

bethskurrie
2018-08-06 23:03
In the future, we will be handling the "shared code" by using a FFI bindings to a Rust implementation.

richard.jones
2018-08-06 23:05
So if I understand correctly, you?re saying that the implementation I?ve created isn?t wanted by the pact community? I?ll just keep it closed source if that?s the case, no worries.

richard.jones
2018-08-06 23:05
I don?t mind. I would have created it anyway, it?s got value here.

bethskurrie
2018-08-06 23:06
I'm quite sure there is somebody who will want it.

richard.jones
2018-08-06 23:06
And it?s been a valuable exercise for me

bethskurrie
2018-08-06 23:06
There are some people for whom the benefits of a native python implementation will be more important than having up to date broker integration (which is mostly what goes into the standalone pact impl these days)

bethskurrie
2018-08-06 23:07
I assume you've implemented v2 matching?

richard.jones
2018-08-06 23:07
v1-v3, yes

bethskurrie
2018-08-06 23:07
oh 3 even. Nice.

richard.jones
2018-08-06 23:07
and the JVM oddities

bethskurrie
2018-08-06 23:07
Well, ruby doesn't have that, so somebody might like it.

richard.jones
2018-08-06 23:07
:smile:

bethskurrie
2018-08-06 23:07
Oh really...

bethskurrie
2018-08-06 23:07
what are the jvm oddities?

richard.jones
2018-08-06 23:08
some of them are captured in the JVM test cases. I?d have to go back thru my code to identify them.

richard.jones
2018-08-06 23:08
I do, however, currently skip all the XML test cases from the JVM implementation.

bethskurrie
2018-08-06 23:08
Yeah, good call

richard.jones
2018-08-06 23:09
picking my battles :slightly_smiling_face:

richard.jones
2018-08-06 23:10
Some of the JVM oddities I ran into I fed back to the pact-specification github project as needing to be addressed in the pact spec text, and I think those all got handled (IIRC, this was months ago)


richard.jones
2018-08-06 23:13
Actually, I just searched, and it looks like all those oddities have been addressed \o/

bethskurrie
2018-08-06 23:14
Go Ron.

richard.jones
2018-08-06 23:15
So yeah, I technically support all the published spec versions. And can generate version 2 and 3 pact files, though at the moment it?s hard-coded to version 3 because I?ve got a TODO to figure how to switch.

richard.jones
2018-08-06 23:16
Probably something like ?if Term is used, then use v3? but probably something more explicit like Consumer(?ConsumerName?, pact_spec_level=2) or something.

richard.jones
2018-08-06 23:16
*shrug*

bethskurrie
2018-08-06 23:17
Usually it's defined when you set up the Pact configuration in the consumer project.

bethskurrie
2018-08-06 23:17
The user specifically says which version.

bethskurrie
2018-08-06 23:17
It's important, because the provider has to support the same version.

bethskurrie
2018-08-06 23:17
So better to be explicit.

richard.jones
2018-08-06 23:17
Yeah, that?s what I was thinking

richard.jones
2018-08-07 06:29
Any suggestions for what I call my (pact-python-fork + pact-verifier + pact-pytest) project are welcome - as long as it doesn?t have the name ?reece? in it :smile:

bethskurrie
2018-08-07 10:23
Naming things is hard!

bethskurrie
2018-08-07 10:24
pure-python-pact?

bethskurrie
2018-08-07 10:24
Might be a bit hard to say :-P

matt.fellows
2018-08-07 10:45
I feel like there is a Monty _python_ angle there :laughing:

bethskurrie
2018-08-07 10:48
:neutral_face:

richard.jones
2018-08-10 00:05
\o/ got mocking of pact working thru direct mocking of urllib3, no mocking service/TCP airgap \o/

richard.jones
2018-08-10 00:05
significant boost to the user experience :smile:

bethskurrie
2018-08-10 00:12
I don't know what that means, but yay?!

richard.jones
2018-08-10 00:16
It means the consumer unit test requests never get as far as making a TCP connection, they?re mocked at a level above that. That means a) no separate thread/process to handle the TCP connection, and b) failure is immediate, not requiring TCP/HTTP connection to be handled fully (a server needs to return something back to the caller even in the case of a mock rejection because the TCP connection is open and must be completed correctly or you get a second, messier exception raised - mocking the TCP connection away avoids that).

richard.jones
2018-08-10 00:17
This was the ultimate goal of handling mocking in pact-python natively, this significant improvement for the people writing / running / debugging the tests using the pact mocks.

bethskurrie
2018-08-10 03:02
Oh, right, that makes sense.

simon.nizov
2018-08-12 09:06
has joined #pact-python

wilkin4
2018-08-12 21:32
has joined #pact-python

richard.jones
2018-08-12 23:20
project ?pactman? progress with merged unit test suite and rebasing: 22 failed, 515 passed, 96 skipped (the XML JVM testcases). I?ve also identified a range of additional tests I?ll be creating to cover off some of the pact spec v3 matching rules that aren?t currently covered by the JVM test cases. They?re being written in the same form as the JVM ones, so are shareable between implementations.

richard.jones
2018-08-13 00:00
536 passed, 129 skipped \o/ - time to publish :smile:

bethskurrie
2018-08-13 00:03
Please do a PR so we can merge the new test cases into the pact spec Richard.

richard.jones
2018-08-13 00:05
Will do!

richard.jones
2018-08-13 02:06
https://github.com/reecetech/pactman (with many TODOs left, including your request above, Beth)

bethskurrie
2018-08-13 22:07
Nice

simon.nizov
2018-08-16 08:06
Hi! I have 2 services that use JWT for authentication. To be able to verify the provider I use the `?custom-provider-header` option to set the correct header (Obviously I don?t want to keep the JWT token inside the pact). Everything works but the output turns out kind of ugly with the warning. Is there a way to suppress that warning or place it at the end/beginning of the output?

simon.nizov
2018-08-16 08:07
``` Verifying a pact between A and B Given at least blan bla a request to bla bla bla with GET /some-url/ returns a response which WARN: Adding header 'Authorization: JWT UIDHDJSfjbsdjfhBKSDFBKSDBfSHDbfhsDF.DSGJJFJKSDFBJSDGBGKSJDHGBSDKJGHBksjdhgsdfgjbdsjhgbsdkjghbKDGHSBKSDjgbsdg.GDKJSKDGJBSDGjbSDKGHBSDG' to replayed request. This header did not exist in the pact, and hence this test cannot confirm that the request will work in real life. has status code 200 has a matching body includes headers "Content-Type" which equals "application/json" 1 interaction, 0 failures ```

simon.nizov
2018-08-19 09:27
:cricket:

matt.fellows
2018-08-19 12:47
@simon.nizov unfortunately not. A similar question came up on the forums the other day, we should update the verification library to allow us to set the log level

simon.nizov
2018-08-19 12:57
Thanks @matt.fellows, I?ll see if I can try to help with that

ashish.dubey91
2018-08-20 20:43
I'm getting some warnings when I run pact-verification ``` WARN: Ignoring unsupported matching rules {"match"=>"type", "min"=>3} for path $['body']['objects'] WARN: Only the first item will be used to match the items in the array at $['body']['objects'] ```

ashish.dubey91
2018-08-20 20:43
can someone help me why they would be?

matt.fellows
2018-08-20 20:45
I think it's a bug, there's one currently open in pact js assuming you have the latest

ashish.dubey91
2018-08-20 20:46
bug in my consumer implementation? I'm using pact-jvm for that

matt.fellows
2018-08-20 20:47
I'm assuming you're seeing it during verification

ashish.dubey91
2018-08-20 20:47
my consumer uses pact-jvm to define the tests. on the provider end, I'm running python's pact-verifier

matt.fellows
2018-08-20 20:48
Yep, There's a known bug in the process that does the verification which is incorrectly warning you. Take a look at the issues in pact js for more details just to check

ashish.dubey91
2018-08-20 20:50
sorry, I see none related in the open issues here https://github.com/pact-foundation/pact-js/issues?q=is%3Aopen+is%3Aissue

ashish.dubey91
2018-08-21 04:58
cc @bethskurrie would love some help here

bethskurrie
2018-08-21 05:25
Its a valid warning @ashish.dubey91

bethskurrie
2018-08-21 05:25
Actually, the second one is, the first one isn't

bethskurrie
2018-08-21 05:26
Please raise an issue asking for the pact-ruby-standalone to be updated to the latest version. I've done some work to remove the invalid warnings.

ashish.dubey91
2018-08-21 05:35
@bethskurrie will it work if I try the ruby impl..just to verify?

bethskurrie
2018-08-21 05:36
Yes, that's a good way to test it.

bethskurrie
2018-08-21 05:36
you can use the CLI - you don't need ruby


ashish.dubey91
2018-08-21 05:47
I get the same warnings. actually more this time like this one ``` WARN: Ignoring unsupported matching rules {"regex"=>"28.4167509"} for path $['query']['lat']* ```

bethskurrie
2018-08-21 05:48
Sigh. Yeah, ok, someone raised the query one.

bethskurrie
2018-08-21 05:48
Sorry, I will fix them.

bethskurrie
2018-08-21 05:48
They have been surprisingly difficult to fix, unfortunately.

ashish.dubey91
2018-08-21 05:49
oops. I see this warning and I wonder if there is something wrong with my pact definition or a bug ``` WARN: Ignoring unsupported matching rules {"match"=>"integer"} for path $['body']['data']['product']['options'][*]['type'] ``` because of this my pact verification fails as it tries to do an exact match

bethskurrie
2018-08-21 05:50
that one is valid

bethskurrie
2018-08-21 05:50
you need to use v2 matching rules.

bethskurrie
2018-08-21 05:50
that's a v3 one

bethskurrie
2018-08-21 05:50
it should be "match": "type"

ashish.dubey91
2018-08-21 08:33
ah. I don't see any documentation of that in pact-jvm project. of v2 matching rules or explicitly setting those

bethskurrie
2018-08-21 09:52
You will be able to set the pact specification version somewhere.

ashish.dubey91
2018-08-21 13:10
interestingly I was able to change the version. the spec version is correct in the generated pact file but the rules still have {"match"=>"integer"}

ashish.dubey91
2018-08-21 19:31
could this be a bug with pact-jvm?

richard.jones
2018-08-21 22:12
@ashish.dubey91 I?d be curious to know whether you have any success using the pactman verifier, which is compatible with spec version 2 and 3. I haven?t made a release yet, but you can clone the repos from https://github.com/reecetech/pactman - note that the command-line arguments for the pactman verifier are a little different to the pact-python one (https://github.com/reecetech/pactman#verifying-pacts-against-a-service)

richard.jones
2018-08-21 22:14
We also need to verify pact-jvm pacts, which is why I needed to support spec version 3 :slightly_smiling_face:

richard.jones
2018-08-22 01:29
I have just pushed up an actual release of pactman - https://pypi.org/project/pactman/

ashish.dubey91
2018-08-22 03:37
that's great! I can try it

ashish.dubey91
2018-08-22 03:42
@richard.jones ``` Traceback (most recent call last): File "/home/ashish/venv/bin/pact-verifier", line 7, in <module> from pactman.verifier.command_line import main File "/home/ashish/venv/local/lib/python2.7/site-packages/pactman/__init__.py", line 2, in <module> from .mock.consumer import Consumer ImportError: No module named mock.consumer ```

ashish.dubey91
2018-08-22 04:06
there seems to be some packaging issue

ashish.dubey91
2018-08-22 04:11
@richard.jones if this helps ``` s/pactman$ pwd /home/ashish.dubey/venv/local/lib/python2.7/site-packages/pactman (staging) ashish.dubey@cicommon6:~/venv/local/lib/python2.7/site-packages/pactman$ ls __init__.py __init__.pyc __version__.py __version__.pyc (staging) ashish.dubey@cicommon6:~/venv/local/lib/python2.7/site-packages/pactman$ ```

ashish.dubey91
2018-08-22 04:11
installed in a virtualenv

ashish.dubey91
2018-08-22 04:12
I want to make this work so badly

richard.jones
2018-08-22 04:57
@ashish.dubey91 thanks! I actually hadn?t tried to use it packaged yet, sorry! If you run cloned from the repos it should be ok. I?ll look into the packaging issue ASAP!

richard.jones
2018-08-22 04:58
hah, yeah, that package is totally broken :disappointed:

ashish.dubey91
2018-08-22 04:58
I tried cloning the repo and putting the files into my packaged directory but that had issues as well

richard.jones
2018-08-22 05:00
Yep, just pushing up a fix now :slightly_smiling_face:

richard.jones
2018-08-22 05:01
1.0.5 is released which should have all the codez

ashish.dubey91
2018-08-22 05:02
should I try again?

richard.jones
2018-08-22 05:02
just verifying ?

richard.jones
2018-08-22 05:03
Yep, 1.0.5 looks good

ashish.dubey91
2018-08-22 05:03
is it up on pypi?

ashish.dubey91
2018-08-22 05:03
I can't find the upgrade


ashish.dubey91
2018-08-22 05:05
not sure if it's cached somewhere or something ... I'm getting 1.0.4 yet

richard.jones
2018-08-22 05:06
the github repos is also updated, so you could pull from that and run python setup.py install in there

richard.jones
2018-08-22 05:07
hurm. there?s an issue in the verifier, yay for fresh codez

richard.jones
2018-08-22 05:09
I renamed one of the command line args just before release and missed a change. Just fixing.

ashish.dubey91
2018-08-22 05:11
this means I'm just stuck :confused:

richard.jones
2018-08-22 05:11
yup, sorry. I?m working on getting it fixed and released. Verifying it works again before release tho :smile:

richard.jones
2018-08-22 05:12
ok, it?s definitely working again locally. pushing it up now.

richard.jones
2018-08-22 05:13
github repos is up to date, just packaging and pushing to pypi now? and done

ashish.dubey91
2018-08-22 05:51
``` (venv) (staging) ashish.dubey@cicommon6:~$ pact-verifier -h Traceback (most recent call last): File "/home/ashish.dubey/venv/bin/pact-verifier", line 7, in <module> from pactman.verifier.command_line import main File "/home/ashish.dubey/venv/local/lib/python2.7/site-packages/pactman/__init__.py", line 2, in <module> from .mock.consumer import Consumer File "/home/ashish.dubey/venv/local/lib/python2.7/site-packages/pactman/mock/consumer.py", line 4, in <module> from .pact import Pact File "/home/ashish.dubey/venv/local/lib/python2.7/site-packages/pactman/mock/pact.py", line 6, in <module> from pactman.mock.request import Request File "/home/ashish.dubey/venv/local/lib/python2.7/site-packages/pactman/mock/request.py", line 49 raise ValueError(f'Invalid Pact specification version={spec_version}') ^ SyntaxError: invalid syntax ```

ashish.dubey91
2018-08-22 05:51
@richard.jones ^

ashish.dubey91
2018-08-22 17:41
@bethskurrie if I simply replace "integer" with "type" in my pact json before verification, it works. somehow I can't generate a pact in that form by pact-jvm, something's up with that

richard.jones
2018-08-22 22:16
@ashish.dubey91 which version of Python did you install with? It?s only compatible with version 3+ and only been tested with 3.6

matt.fellows
2018-08-22 22:23
Looks like python 2.7

richard.jones
2018-08-22 22:26
I?ve pushed up 1.0.7 which clarifies the Python version requirement. Sorry about that!

richard.jones
2018-08-22 22:49
All these wonderful things you discover when you make a public release of software that?s been internal for ? cripes about 6 months now :smile:

bethskurrie
2018-08-22 22:53
welcome to oss support.

matt.fellows
2018-08-22 22:58
And these are the easy/good ones :slightly_smiling_face:

matt.fellows
2018-08-22 22:58
Wait for the ?I want to use your software but am experiencing a completely unrelated problem while doing so. I see you know how a computer works, please help?

richard.jones
2018-08-22 23:19
I?ve been around OSS for a while, I know how fun it is :smile:

richard.jones
2018-08-22 23:20
I kinda rushed the pactman release out tho because of the impending PyCon AU and potential to alleviate some of @ashish.dubey91?s issues

richard.jones
2018-08-22 23:20
Release Early, Release Often :smile:

richard.jones
2018-08-22 23:20
(try not to Release Broken)

matt.fellows
2018-08-22 23:25
ah cool, I did see PyCon is coming up. That?s awesome - nothing like conference-driven-development :slightly_smiling_face:

richard.jones
2018-08-22 23:30
My co-worker Syliva is presenting about Pact on Sunday

matt.fellows
2018-08-22 23:58
awesome!

matt.fellows
2018-08-22 23:58
If you have any social/tweets for us to share, let us know

ayodaiken
2018-08-24 19:11
has joined #pact-python


richard.jones
2018-08-31 00:50
I?ve released version 1.0.9 which just fixes the ?verbose? level console output for the pact-verifier (which I will be renaming in the next release to avoid conflict with the existing tooling of that name) https://pypi.org/project/pactman/

matt.fellows
2018-08-31 00:51
This was great, btw - well done! I?ll pop a link on our docs site to share

richard.jones
2018-09-03 00:41
pactman 1.1.0 released: renames the pact-verifier command to pactman-verifier (as mentioned above); also implements HEAD request verification (oops) and adds a -V/--version command line option.

simon.nizov
2018-09-03 07:57
Hey @richard.jones, I?m a little confused, what?s the difference between `pactman` and the ?official? `pact-python` library?

andyharkinsqa
2018-09-03 16:23
has joined #pact-python

richard.jones
2018-09-03 21:51
@simon.nizov the key difference is all functionality is implemented in Python, rather than shelling out or forking to the ruby implementation. This allows for a much nicer mocking user experience (it can mock urllib3 directly), is faster, less messy configuration (multiple providers -> multiple ruby processes spawned on different ports). It also supports a broader set of the pact specification (versions 1.1 through to 3). There?s a few other quality of life improvements, but those are the big ones.

richard.jones
2018-09-03 21:52
No, I don?t expect anyone is generating version pacts to spec version 1.1 :wink:

simon.nizov
2018-09-04 08:55
@richard.jones Ahh gotcha, thanks! I think you should mention these differences in the opening paragraph of the readme :slightly_smiling_face:

richard.jones
2018-09-04 21:57
@simon.nizov yeah :slightly_smiling_face:

joguespermana
2018-09-05 02:57
has joined #pact-python

bethskurrie
2018-09-09 21:38
There should be a place where you set the pact specification version @ashish.dubey91

privat.sebastian.muel
2018-10-21 09:59
has joined #pact-python

sylvia.yap
2018-10-31 05:27
has joined #pact-python

hima.sanagavarapu
2018-11-07 19:34
has joined #pact-python

hima.sanagavarapu
2018-11-09 16:19
@hima.sanagavarapu has left the channel

kurst03
2018-11-18 00:52
has joined #pact-python

jornhansen
2018-11-24 08:15
has joined #pact-python

zach.the.hammer
2018-11-28 22:26
has joined #pact-python

zach.the.hammer
2018-11-28 22:26
@richard.jones oh wait, i may have been confused by this part of the pactman readme (that i believe was copied over from pact-python) https://github.com/reecetech/pactman#provider-states

zach.the.hammer
2018-11-28 22:27
>>> When setting up the testing of a provider you will also need to setup the management of these provider states. The Pact verifier does this by making additional HTTP requests to the <provider setup url> you provide. This URL could be on the provider application or a separate one. Some strategies for managing state include: Having endpoints in your application that are not active in production that create and delete your datastore state A separate application that has access to the same datastore to create and delete, like a separate App Engine module or Docker container pointing to the same datastore A standalone application that can start and stop the other server with different datastore states

richard.jones
2018-11-28 22:27
So pactman has two mocking modes: straight mocking of urllib3 which covers 90% of use cases, and a separate process for the 10% of folks not using `requests` :slightly_smiling_face:

zach.the.hammer
2018-11-28 22:28
so what i'm confused about is: can you do pact broker verification without using an external `<provider setup url>`? This is the one part puts me off of pact testing

zach.the.hammer
2018-11-28 22:29
i'm at work right now so i think i am typing/explaining rather quickly and not being very clear. i can follow up later

richard.jones
2018-11-28 22:30
oh, you can do pact verification without provider states but it?s *really strongly discouraged* as provider states are kinda a backbone of the pact philosophy

richard.jones
2018-11-28 22:30
I?m also in three convos at the moment, I?ll try to respond here in a timely manner

zach.the.hammer
2018-11-28 22:34
okay. i'll follow up once at home with time to give an example of what i'm looking for. as far as i can tell pact verification in `pact-ruby` can be done in the testing file, without having to both call a `setup url` and a `provider url`. this is what i'm looking at: https://github.com/pact-foundation/pact-ruby/wiki/Verifying-pacts#using-rake-pactverify (specifically `# Require the provider states files for each service consumer`) https://github.com/pact-foundation/pact-ruby/wiki/Provider-states#provider-codebase

richard.jones
2018-11-28 22:36
Pact verification isn?t done in a *test* it?s run as a separate process that slurps in a pact file and runs each interaction in the file against a provider, and records whether the interaction matches the expectation in the pact file. That?s not a *test* (in the ?unit test? or ?behave test? sense).

richard.jones
2018-11-28 22:37
In the ruby example you show above, that?s just configuring the verifier to be callable from rake (the python equivalent is how we invoke the pactman-verifier from tox)

richard.jones
2018-11-28 22:38
For example, from one of our tox.ini: ```[testenv:pact-verifier] envdir = {toxworkdir}/pactman deps = pactman whitelist_externals = sh setenv = PACT_BROKER_URL=http://pact-broker.reecenet.org/ commands = sh -c "pactman-verifier -r -v -p $(python setup.py --version) BranchServicePython \ http://localhost:8000/ http://localhost:8000/branches-service/pact/" ```

richard.jones
2018-11-28 22:39
(the need to `sh` it to get the version from the setup file is something I?d really like to figure a more elegant solution to :smile: )

bethskurrie
2018-11-28 22:42
The ruby version archives the "test" part by using metaprogramming, but I'm not sure if that works in other languages.

bethskurrie
2018-11-28 22:44
We're actually programmatically construct and execute an rspec test.

richard.jones
2018-11-28 22:45
?archives?? Is that just a typo of ?achieves??

bethskurrie
2018-11-28 22:45
Which means we can allow the user to do all the usual rspec things in a test like mocking

bethskurrie
2018-11-28 22:45
Achieve

bethskurrie
2018-11-28 22:45
Sorry typing and walking

richard.jones
2018-11-28 22:45
Yep. BRB, standup :slightly_smiling_face:

zach.the.hammer
2018-11-28 22:47
Haha i am walking while reading

zach.the.hammer
2018-11-28 22:48
This is really helpful @bethskurrie.

zach.the.hammer
2018-11-28 22:53
I?m going to try to write up a few of my questions / thoughts on this in one place for clarity instead of a lot of confused slacks

zach.the.hammer
2018-11-28 23:05
Basically pact seems awesome and i really want to experiment with it in my python services but feel like > Which means we can allow the user to do all the usual rspec things in a test like mocking is essential

zach.the.hammer
2018-11-28 23:09
i?m going to write up a few reasons why when i have time though so i can share / figure out if this is _actually_ essential or if i?m just not thinking this through

bethskurrie
2018-11-28 23:10
Most people get by without it, but I think it's quite handy

richard.jones
2018-11-28 23:10
@zach.the.hammer pactman mocks are basically a lot like regular mocks (using the default use_mocking_server=False) and your tests look like regular tests, and it?s all in-process

bethskurrie
2018-11-28 23:10
Most of the other languages (.net, javascript) wrap the ruby impl

zach.the.hammer
2018-11-28 23:11
@richard.jones when you say pactman mocks you?re talking about the mocks used on the consumer tests, right?

zach.the.hammer
2018-11-28 23:11
that?s where i?m a bit confused

richard.jones
2018-11-28 23:11
@zach.the.hammer yes, the mocks are used in the consumer tests (and not during verification)

zach.the.hammer
2018-11-28 23:11
i also realize ?tests? may not be the preferred word in pact since the code run on the consumer side is not just testing but also driving/creating the contract

richard.jones
2018-11-28 23:11
(pact can be quite confusing when you start out, that?s quite normal)

zach.the.hammer
2018-11-28 23:12
i?m talking about on the provider side.

zach.the.hammer
2018-11-28 23:12
re: verifying contracts w/ the provider. but doing so the way @bethskurrie is explaining is possible in ruby

richard.jones
2018-11-28 23:13
sorry I am in a meeting that I need to concentrate on for a bit, back in a while

zach.the.hammer
2018-11-28 23:13
no problem. i?m going to post a few slack messages here that i hope are clear! i?m about to go see my brother but will try to share the thoughts i have for now in this thread

zach.the.hammer
2018-11-28 23:14
or maybe i will post after drinks with my brother haha

zach.the.hammer
2018-11-28 23:51
okay here are some quickly jotted thoughts

zach.the.hammer
2018-11-28 23:51
pact feels so much like cucumber/gherkin that i instinctively want to setup my provider verification the same way i would a cucumber test. ``` Given there is an alligator named Mary When I send the request """ /alligators?name=Mary """ Then I get the response """ { "items": [{"name": "Mary"}] } """ ``` In python-behave (a python implementation of cucumber) I can define functions like (not perfect syntax) ``` @Given('there is an alligator named Mary') def ...: add_mary_to_db() def after_scenario(): clear_db() ``` And then in the same run of my testing framework use my service as validate my response. i understand that pact and cucumber are different tools for different uses, but the ability to verify specs / validate contracts inside a testing framework feels very crucial to me. a few things that seems like they?d be major headaches without being able to validate pacts inside a testing framework 1. mocking requests to external APIs / general monkeypatching using a call to a `<provider setup endpoint>` seems fine for setting up provider state in a datastore in most cases. in my circleci i already run a postgres instance that i communicate w/ for tests. my `<provider state endpoint>` for `there is an alligator named Mary` could put an alligator named mary in the db and then my call to my provider endpoint would read from that db. using a call to a `<provider setup endpoint>` seems like a MAJOR pain for mocking requests to external apis, however. if my `alligators` microservice is a wrapper service around some public alligator API `https://alligators.gov`, the way i want to do the provider setup is something like ```py def my_there_is_an_alligator_named_mary_fixture(): with mock_response_from('http://alligators.gov', to_be="{...a lot of alligator data including some info about mary}"): yield # my contract test would run here ``` i have no idea how i could do this in a not incredibly hacky / fragile / cumbersome way through a call to `<provder setup endpoint>` 2. tear down at the end of the test suite this is pretty minor, but when you only call a `<provider setup endpoint>` at the beginning of each provider test, you can reset state before each provider test, but you can?t cleanly tear down at the end of your pact test suite, which means there may be lingering state in a test database 3. aws lambda functions (and i imagine lots of functions as a service) don?t have easy ways to call locally as an endpoint if i?m testing a python service written in tornado, i can just have my `pact-verifier` send an HTTP request to my running service and that?ll look just like a real request the service would handle. for aws lambda, i?d have to use some api gateway emulator library (like [serverless-offline](https://github.com/dherault/serverless-offline)) to setup my service to respond to http events from `pact-verifier`. (and serverless offline doesn?t even work for python!) there?s also all sorts of other information aws api gateway passes to a lambda function handler that `pact-verifier` wouldn?t send which i could depend on for my request handling. i?d want / need to be able to control all of this w/in a testing framework.

zach.the.hammer
2018-11-28 23:52
basically i really would love to see what @bethskurrie & co. have implemented in the pact-ruby implementation implemented in python! there are a lot of similar tools in frameworks like `behave` or `pytest`. maybe i can try to write up an mvp of something like this when i have some time.

zach.the.hammer
2018-11-28 23:54
@richard.jones if you have run into any of these issues and have been able to resolve them using the current pactman pact verification, i?d love to hear / see how

richard.jones
2018-11-29 00:40
@zach.the.hammer Wow. That?s really hard to read in a slack thread :disappointed: how about we don?t use Threads :slightly_smiling_face: (I?m familiar with behave - I was a co-author :wink:) So? provider verification of pacts is *stateless* and done *entirely across a HTTP airgap* intentionally. That means pact states can *set up data* but not do any teardown. There may be hooks in ruby that the ruby verifier exploits (I *think* that?s what @bethskurrie is referring to as ?the usual rspec things in a test like mocking?, allowing stateful verification) but that?s not an option in Python (or any other language as far as I know) because of the process/TCP airgap that the ruby verifier forces you to have. I have previously experimented with a closer binding of verification with pytest, but it was a bit of a mess because at the time I?d not implemented my own Python verification code, I was still spawning the ruby process. It might be worth revisiting now that we?ve got a Python verifier. For now though, you need to run the pactman-verifier command line with the provider state URL to control the state of your provider.

richard.jones
2018-11-29 00:42
Our provider states consist of two things: very basic monkeypatching of calls outside of the provider (to other APIs) and creation of data in the database table(s) that the provider relies on to process the request, according to the provider state being requested. The pact state code also clears out any other data from the database (it?s a database brought up just for verification).

richard.jones
2018-11-29 00:42
But the key is: there is no ?after scenario? or other kind of teardown after a pact verification has been attempted. It?s just not part of the pact verification spec.

bethskurrie
2018-11-29 00:43
Regarding point 2, it's best practice to never assume state from a previous test, and to clean everything *before* a test runs, rather than after.

bethskurrie
2018-11-29 00:44
This has the added benefit of leaving your data in a state that you can investigate after a failing test (eg. inspect the database records)

bethskurrie
2018-11-29 00:44
That's why I haven't exposed the tear down hook in the pact-ruby-standalone.

bethskurrie
2018-11-29 00:44
(even though it exists in the ruby impl)

zach.the.hammer
2018-11-29 03:34
hey! first off i am super thankful for all the feedback on these questions.

zach.the.hammer
2018-11-29 03:34
so: point 2 was definitely the least important of the thoughts i?m having

bethskurrie
2018-11-29 03:35
it was the only one I could contribute to :stuck_out_tongue:

bethskurrie
2018-11-29 03:35
Not being a python person!

zach.the.hammer
2018-11-29 03:35
re: 1-- @richard.jones it seems like you have been able to set up mocking in provider verification tests > Our provider states consist of two things: very basic monkeypatching of calls outside of the provider (to other APIs) and creation of data in the database table(s) that the provider relies on to process the request, according to the provider state being requested. i?d be really curious to see how you?ve done monkeypatching here!

zach.the.hammer
2018-11-29 03:36
also @bethskurrie has the issue of functions as a service come up before?

bethskurrie
2018-11-29 03:36
yes, often.

bethskurrie
2018-11-29 03:36
we recommend using pact-message

zach.the.hammer
2018-11-29 03:36
it really is tough to figure out how to send an http request to a provider and make it prod-like

bethskurrie
2018-11-29 03:37
you test using only the function and the payload

bethskurrie
2018-11-29 03:37
sidestep the http

zach.the.hammer
2018-11-29 03:37
Ah! Let me check that out

bethskurrie
2018-11-29 03:37
Make sure you split your code into the "business logic" and the gateway handling parts.

bethskurrie
2018-11-29 03:38
only test the business logic.

zach.the.hammer
2018-11-29 03:38
Is there a pact-message repo?

bethskurrie
2018-11-29 03:38
Yes, for js.

bethskurrie
2018-11-29 03:38
it may be built in to the current pact-js

zach.the.hammer
2018-11-29 03:38
Yeah it seems js is the first class citizen for faas these days


bethskurrie
2018-11-29 03:39
There's no python support, however, given that Richard has already done the leg work on the matching, implementing the framework wouldn't be too much work.

richard.jones
2018-11-29 03:44
@zach.the.hammer yep, I?ll share a snippet of one of our pact provider state implementations

zach.the.hammer
2018-11-29 03:46
Awesome! I?ll look into pact message @bethskurrie. And @richard.jones i?d love to see the monkeypatching example!

richard.jones
2018-11-29 03:47
DM?ed you

zach.the.hammer
2018-11-30 01:48
hey @richard.jones ? is there no support for tags in pactman?


richard.jones
2018-11-30 02:45
tags to send to broker? not yet, no, since we (reecetech) don?t use them yet because we?re bad people :slightly_smiling_face:

richard.jones
2018-11-30 02:45
should be easy enough to add to the broker push tho

bethskurrie
2018-11-30 02:46
Tags are a PUT to /pacticipants/PACTICIPANT/versions/VERSON/tags/TAG

richard.jones
2018-11-30 02:46
(yes, Beth, we?re still running that dev/prod broker split because we?ve not had time to address that very early mistake :wink: )

bethskurrie
2018-11-30 02:46
Remember you can have multiple tags

richard.jones
2018-11-30 02:46
cool.

bethskurrie
2018-11-30 02:47
Fingers in ears, la la la!

richard.jones
2018-11-30 02:47
:smile:

richard.jones
2018-11-30 04:49
pactman version 2.4.0 has been released with some usability improvements and fixes to query parameter handling for pact v3 mocking and verification https://pypi.org/project/pactman/

zach.the.hammer
2018-11-30 20:30
@richard.jones -- I'm still poking around / getting a better understanding of the `pactman` repo. When I run a test with a pact mock, given that the contextmanager exists (/ `pact.verify()`) is called, the pact files will be created in the pact destination dir. But `pactman` doesn't actually publish the pact / check if the pact is 'verified', correct? That would be done separately in the CI / local environment using the `pact_broker-client`?

richard.jones
2018-12-02 21:07
@zach.the.hammer correct, the pact is published using curl at present (one of these days it?d be nice to write the trivial extra bit of pactman to do that) and provider verification is a very separate step using pactman-verifier (we run this as a daily job and also triggered at the end of a successful test run in the provider?s repos)

richard.jones
2018-12-02 21:10
So you?re partially correct in the second para. pactman doesn?t publish the pact, but does verify it.

zach.the.hammer
2018-12-02 21:31
Cool cool. So the bit i mentioned about tagging isn?t relevant since that occurs in the request to the broker and isn?t included inside of the pact file

richard.jones
2018-12-06 22:03
Sneak https://pypi.org/project/pactman/ release yesterday that I forgot to announce, version 2.5.0 fixes an issue we found around verifying empty arrays in body data.

zach.the.hammer
2018-12-12 04:31
hey richard

zach.the.hammer
2018-12-12 04:31
@richard.jones

zach.the.hammer
2018-12-12 04:32
going to post a question issue on the pactman github


zach.the.hammer
2018-12-12 04:43
here?s the issue

richard.jones
2018-12-12 04:45
Thanks, I?m just looking into that now!

zach.the.hammer
2018-12-12 04:47
Awesome! Yeah the implementation here seems to reflect what i?d imagine ?eachlike? would behave

zach.the.hammer
2018-12-12 04:48
Since it?s checking that each element in a list is like the provided spec element

richard.jones
2018-12-12 04:48
I?ve just added a comment in response

zach.the.hammer
2018-12-12 04:51
hmm.. it is an actual case i ran into but with a more complex pact

zach.the.hammer
2018-12-12 04:52
let me take a closer look

zach.the.hammer
2018-12-12 04:54
i?ll also look at those two testcases you mentioned

richard.jones
2018-12-12 04:54
added in some more in that comment you made. if you have an actual pact and failing payload I?d love to see it to run a test. feel free to make a private gist on github if you can share it (or email me directly if you like, I can give my email in DM)

zach.the.hammer
2018-12-12 04:54
sounds good. i will poke around for a bit first

zach.the.hammer
2018-12-12 04:54
make sure i?m not missing something simple

richard.jones
2018-12-12 04:55
sure. happy to be extra eyes if you like, especially to determine whether it?s an intended behaviour or not

richard.jones
2018-12-12 04:56
a lot of the pact edge cases are defined by the JVM test cases (the files in the pact repository ?testcases? folder) and there?s also a lot of edge cases not clearly defined, so I had to make a call on what seemed appropriate given the intent of pact

richard.jones
2018-12-12 04:56
I might have gotten that wrong :slightly_smiling_face:

richard.jones
2018-12-12 05:15
@zach.the.hammer I?m finishing up for the day, chuck me a message with a gist if you get sick of poking around :slightly_smiling_face:

zach.the.hammer
2018-12-12 05:22
haha i?m heading to sleep

zach.the.hammer
2018-12-12 05:23
i posted the test case that i thought would fail but actually seems to be working fine run as a direct test against the verifier

zach.the.hammer
2018-12-12 05:23
i have a feeling i?m missing something on my end. i?ll update once i get a chance to look closer

zach.the.hammer
2018-12-12 06:20
alright now i?m heading to sleep.

zach.the.hammer
2018-12-12 06:21
i just left a final comment. give it a look when you get the chance!

zach.the.hammer
2018-12-12 06:21
had fun `pdb`ing through the codebase

zach.the.hammer
2018-12-12 06:29
Also i deleted some previous comments with my complex case since i found a simpler test case to cause same issue

anushree.shenoy
2018-12-12 10:43
has joined #pact-python

zach.the.hammer
2018-12-13 16:02
@richard.jones commented on the gh issue. my test case now works. didn't get a chance to look over the code change but seems like it works!

anothonyvong
2018-12-13 16:39
has joined #pact-python

richard.jones
2018-12-13 22:21
@zach.the.hammer I?ve released pactman 2.6.0 which includes that fix

madhukar.mishra
2018-12-17 09:18
has joined #pact-python

madhukar.mishra
2018-12-17 09:31
is dius/pact-python unmaintained now?

bethskurrie
2018-12-17 09:36
I didn't even know it existed.

bethskurrie
2018-12-17 09:36
So, I'm going with yes.

bethskurrie
2018-12-17 09:36
There are two other maintained impls.

madhukar.mishra
2018-12-17 09:41
pactman requires python3.6+ only, so that's a dealbreaker, checking out pact-test. Is the ruby standalone also powered by the rust app for generating mocks?

bethskurrie
2018-12-17 09:50
Not yet.

madhukar.mishra
2018-12-17 10:11
dumb question :worried: but is `pact-mock_service` different from `pact-stub-server` functionality wise?

bethskurrie
2018-12-17 10:14
They're different implementations.

bethskurrie
2018-12-17 10:15
Pact mock service is the ruby one, pact stub server is rust, if it's the one I'm thinking of.

bethskurrie
2018-12-17 10:15
Stub server should implement v3 spec, but mock service only implements v2 so far.

madhukar.mishra
2018-12-17 10:34
so both will be maintained in the future, and will maintain parity?

madhukar.mishra
2018-12-17 10:37
pact-stub-server seems to be able to serve stubs for pacts for multiple providers at once, which isn't the case for the ruby mock-service apparently

madhukar.mishra
2018-12-17 10:39
We are using pacts to produce mocks for bigger tests as well (eg for functional testing - in form of testing API endpoints), which often require multiple upstream services. The problem we ran into is that for the first time they behaved differently.

madhukar.mishra
2018-12-17 10:40
So I'm trying to use the same program for both the cases, to avoid this problem if possible.

madhukar.mishra
2018-12-17 10:47
Patching `pact-python` to use the system `pact-stub-server` doesn't seem like a terrible idea

madhukar.mishra
2018-12-17 10:51
one is staler than pact-python, the other is python3 only, rip my hopes of an easy way out.

vishesh92
2018-12-17 10:54
has joined #pact-python

bethskurrie
2018-12-17 19:13
What's the problem with pact-python?

davegallant
2018-12-17 22:00
has joined #pact-python

davegallant
2018-12-17 22:45
hey, new to contract-based testing and love the concept. I'm wondering how well does Pact work with Python micro-services that use HTTP, but also some that use Kafka and S3?

matt.fellows
2018-12-17 22:52
I?m not sure if it _yet_ supports the latter just yet. But it should be fairly easy to add in (Golang and JS have it as first-class citizens now, as does JVM - the original)

matt.fellows
2018-12-17 22:52
the short answer is that the concept is completely transferable

davegallant
2018-12-17 22:54
thx, will look into it some more :slightly_smiling_face:

richard.jones
2018-12-18 02:45
@davegallant we?re only just starting to look at message pacts (we?ve done a ton of HTTP pacts) so we?re on the same journey I expect :slightly_smiling_face:


zach.the.hammer
2018-12-18 15:50
@richard.jones would love to follow your exploration there

zach.the.hammer
2018-12-18 15:50
i've been trying to figure out a good implementation for that

zach.the.hammer
2018-12-18 15:51
most obvious seems like just mocking out message queue service, not sure if that's the best

zach.the.hammer
2018-12-18 15:51
message queue api*

zach.the.hammer
2018-12-18 15:52
could do a decent POC just building on top of: https://github.com/spulec/moto

rjmcguinness
2018-12-18 16:04
has joined #pact-python

richard.jones
2018-12-18 20:59
@zach.the.hammer yep, those are similar to mu thoughts

richard.jones
2018-12-18 20:59
I?m not familiar with moto/boto tho

richard.jones
2018-12-18 22:14
FYI I?ve added this to the pactman API for the next release, since it seems like a good idea: ```pact .given("this is a simple state as in v2") .and_given("also the user must exist", username="alex")```

richard.jones
2018-12-18 22:15
and_given attaches the additional provider state to a pact interaction already being defined, so must follow a given()

zach.the.hammer
2018-12-18 22:52
i'm not familiar with moto. boto is the aws-maintained aws python client

zach.the.hammer
2018-12-18 22:53
moto is mock boto

iamjillsanluis
2018-12-19 04:09
has joined #pact-python

richard.jones
2018-12-20 22:44
pactman 2.8.0 has been released with the following changes (since my last release announcement, 2.6.0): ```2.8.0 - Close up some edge cases in body content during mocking, and document in README 2.7.0 - Added `and_given()` as a method of defining additonal provider states for v3+ pacts - Added more tests for pact generation (serialisation) which fixed a few edge case bugs - Fix handling of lower-case HTTP methods in verifier (thanks Cong!) 2.6.1 - Fix issue where mocked `urlopen` didn't handle the correct number of positional arguments ```

bethskurrie
2018-12-20 23:15
Nice work @richard.jones


richard.jones
2018-12-21 00:10
I tend to add a new validation test case when a pactman user reports a bizarro edge case :slightly_smiling_face:

bethskurrie
2018-12-21 01:13
They'll never stop...

richard.jones
2019-01-02 00:23
I?ve released pactman 2.9.0: ```- Fix with_request when called with a dict query (thanks Cong) - Make start_mocking() and stop_mocking() optional with non-server mocking (WOOT) - Add shortcut so python -m pactman.verifier.command_line is just python -m pactman (mostly used in testing before release) - Handle the None provider state (BLEAH) - Ensure pact spec versions are consistent across all mocks used to generate a pact file```

richard.jones
2019-01-02 00:24
The removal of needing start_mocking/stop_mocking is the final step in the pure-python mock implementation, and allows much cleaner test setup \o/

davegallant
2019-01-02 13:44
just upgraded. It's much cleaner now in my pytest fixture.

hacosta
2019-01-03 13:04
has joined #pact-python

jdesouza
2019-01-03 13:08
has joined #pact-python

hacosta
2019-01-03 14:39
Hi, I read in the pactman documentation that supports version 3 of the pact specification. Is there some example about creating a pact between two micro services ms1 and ms2 that communicates through kafka? suppose that ms2 consumes from a topic a message with json_message structure. I want to create a pact to preserve the json_message structure.

hacosta
2019-01-03 14:40
I appreciate any help

hacosta
2019-01-03 14:40
thanks

richard.jones
2019-01-03 22:10
@hacosta sorry, I?ve not done anything with message pacts yet

matt.fellows
2019-01-03 22:12
@hacosta would you be willing to submit a PR?

matt.fellows
2019-01-03 22:12
We'd love to see it make its way into python

richard.jones
2019-01-03 22:34
I?ve just released pactman 2.10.0 which fixes a bug introduced in 2.9.0 where only one interaction per pact was captured, oops.

richard.jones
2019-01-03 22:37
@matt.fellows are there any deviations in implementation from the pact-specification v3? The spec currently has `"providerState": "or maybe 'scenario'? not sure about this"`

matt.fellows
2019-01-03 22:42
Ah, I forgot that pactman is pure python so can't leverage existing Ruby behaviour.

richard.jones
2019-01-03 22:43
I?m trying to find information about how pact works for message broker pacts, but struggling.

matt.fellows
2019-01-03 22:43
I'm out and about so hard to answer, but I don't think that there are deviations from the spec apart from the fact that the message specific stuff is only a subset

richard.jones
2019-01-03 22:44
There?s JVM testcases, which is fine, I can make sure the matching logic works (trivial) but how does mocking and verification work?

richard.jones
2019-01-03 22:45
AFAIK the ruby impl. doesn?t do messages. Not that I can find in the docs anyway.



matt.fellows
2019-01-03 23:09
Those two links might help. Ruby DSL doesn't technically support it, but the underlying libraries and components do (i.e. the verifier)

richard.jones
2019-01-03 23:14
Thanks!

mtauraso
2019-01-09 19:23
has joined #pact-python

gbivins4
2019-01-12 00:24
has joined #pact-python

chris
2019-01-21 14:38
has joined #pact-python

yousafn
2019-02-01 11:18
has joined #pact-python

richard.jones
2019-02-07 21:02
I?ve just released pactman 2.12.0 which includes the following changes: - Add Equals and Includes matchers for pact v3+ - Make verification fail if missing header specified in interaction - Significantly improved support for pytest provider verification of pacts - Turned pact state call failures into warnings rather than errors

richard.jones
2019-02-07 21:03
pytest support now looks something like this to verify a provider?s pacts: ```from django.contrib.auth.models import User from pactman.verifier.verify import ProviderStateMissing def provider_state(name, **params): if name == 'the user "pat" exists': User.objects.create(username='pat', fullname=params['fullname']) else: raise ProviderStateMissing(name) def test_pacts(live_server, pact_verifier): pact_verifier.verify(live_server.url, provider_state) ``` with the ability to use all your usual pytest fixtures around the verify call, like `live_server` above, and `monkeypatch`, etc.

richard.jones
2019-02-08 02:56
I?ve released pactman 2.12.1 which fixes a pact-python compatibility issue :confused:

bilgehanl.03
2019-02-14 13:23
has joined #pact-python

arian.maykon
2019-03-13 03:43
has joined #pact-python

nikbarch
2019-03-19 02:05
has joined #pact-python

nikbarch
2019-03-19 02:34
Hi everyone! I have a rather silly question: Is there any production-like example pact test suite? I want to try to use pact, but I?m a bit confused of what code should I extract into fixtures and what they should look like. I use Pytest for testing. Any help or links would be appreciated

janneck.wullschleger
2019-03-19 12:18
has joined #pact-python

janneck.wullschleger
2019-03-19 12:18
@nikbarch we are using pytest as well for running our unit and contract tests. What kind of example/data do you need?

nikbarch
2019-03-19 12:40
Hello Janneck! I would like to understand how to setup the testing session, what actions should fixtures do. I suppose that in fixtures we should create provider states. Should we define relationships between consumer & provider in some kind of session test fixtures (i mean this `pact = Consumer('Consumer').has_pact_with(Provider('Provider'), version='3.0.0')`) ?

janneck.wullschleger
2019-03-19 12:52
In your unit-tests/contract generating tests you define what interactions your service/app is having with other services. Out of this interactions, the contracts are generated.

janneck.wullschleger
2019-03-19 12:52
Have you already looked into the examples?

richard.jones
2019-03-19 21:47
@nikbarch we have a large suite of services which use pact. We use pytest and pactman (rather than pact-python) which has a nicer coder experience and has support for pytest.

richard.jones
2019-03-20 21:51
I?ve released pactman version 2.13.0 which adds the ability to supply custom headers to the provider requests for verification (in command line and pytest mode) https://pypi.org/project/pactman/

richard.jones
2019-03-21 22:29
I?ve also just released pactman 2.14.0 which improves some of the verbose rule verification output to make things clearer during provider verification and pytest mock usage. Yay user feedback :slightly_smiling_face:

richard.jones
2019-03-24 23:46
The above was filed against pact-python but I?ve addressed it in a patch to pactman (yeah, I wasn?t handling application/x-www-form-urlencoded POST bodies in my mocking, but I do now thanks to https://github.com/reecetech/pactman/pull/48 which also fixes another issue in v3 pact serialisation of request headers, ugh)

kataramoonlight
2019-03-25 08:57
has joined #pact-python

lekocrod
2019-03-25 14:54
has joined #pact-python

richard.jones
2019-03-28 03:31
I?ve released pactman 2.15.0 which includes these changes: - Fix structure of serialisation for header matching rules. - Add `"never"` to the `file_write_mode` options. - Handle x-www-form-urlencoded POST request bodies. https://pypi.org/project/pactman/

richard.jones
2019-03-28 03:31
This addresses the issue raised by tknino against pact-python.

richard.jones
2019-03-28 03:35
FYI we have a frontend<>BFF<>backend-services architecture here and I?ve been experimenting with using the BFF->backends pact mocks in the BFF when running the frontend<>BFF in local isolated dev mode (ie no connections to backends) and for automated frontend UI testing (which traditionally would be run over a ?full stack?). Obviously any data mutation interactions can?t be completely handled as the mocks always return the same data, but it?s going well so far!

bethskurrie
2019-03-28 03:35
interesting!

richard.jones
2019-03-28 03:36
It requires a level of confidence in pact that my co-workers in other teams haven?t quite achieved :sweat_smile:

bethskurrie
2019-03-28 03:36
yes, I would imagine.

bethskurrie
2019-03-28 03:36
I've done it once, and I don't think anyone else understood it.

murphy.meng
2019-04-17 12:14
has joined #pact-python

murphy.meng
2019-04-18 07:33
@richard.jones, firstly great work for pactman! When I went through pact-python I was thinking oops it did not actually does the verification part itself really. And I am very happy pactman does so.

murphy.meng
2019-04-18 07:51
Contract testing is heavily used in your company right? Before I sell this concept to my company, I wanna double check one of my understanding so far, please help.

murphy.meng
2019-04-18 07:55
Since pact is consumer driven, it looks like the whole testing suites are defined in consumer testing part. Whilst in provider testing part, there is not quite too much too do expect verification. yes you can specify in detail in provider test the description of each test case and do fine granularity verification, but there is nothing more you can do than what is defined in a contract. And a contract is basically defined by consumer. Am I right?

murphy.meng
2019-04-18 08:01
So in a company, one team for building api, the other team builds component as client to the api. When we do pact here, the api consumer team writes all tests and send contracts to the other team for verification. In this case, it seems not a wise idea for the api provider team to create their own test cases again since it will bring tight coupling to the test codes of both teams.

murphy.meng
2019-04-18 08:02
Given any example, this is the example provided in pactman README, a Django project might have such provider test:

murphy.meng
2019-04-18 08:04
The ?the user ?pat? exists? string, being a state, which is defined by consumer testing, by someone in consumer team, in their own repo. What happens some day this guy wanna change it to be ?the user ?pat? does exists??

murphy.meng
2019-04-18 08:05
This will break the provider side testing won?t it? How do you see such coupling?

simon.nizov
2019-04-18 09:01
You consumer team needs to be aware that they are using Pact and that changing the text describing the provider state can break the provider build. The consumer team should communicate and collaborate with the provider team when making such changes to the pact.

murphy.meng
2019-04-18 09:33
That will be painful, particularly if the consumer team is simply doing minor changes, like typo or better description in states, or some refactoring, like merge, spliting, renaming states. In a fast developing company, this can happen often.

murphy.meng
2019-04-18 09:34
And when that happens, I can imagine how api provider team will complain: ?is it necessary??, ?can you be more careful?? ?My sprints finishes tomorrow and now it change the state????

murphy.meng
2019-04-18 09:36
So, back to my statement, creating provider side testing which must reference pact state, seems introducing tight coupling with pact consumer team and can be chaos.

murphy.meng
2019-04-18 09:37
And that is against to pact original purpose, to break integration test to component tests, and thus consumer and provider can test separately.

simon.nizov
2019-04-18 09:43
You should ask this in the #general channel

murphy.meng
2019-04-18 09:46
I will hold a bit till Richard Jones made some clarification. His company seems created tones of provider tests. He might got some best practice already.

matt.fellows
2019-04-18 12:40
Yes

matt.fellows
2019-04-18 12:42
In theory it might sound worse than reality. In most cases the new states don't cone out of thin air - you would talk to the providers

matt.fellows
2019-04-18 12:43
It's in possible to remove all coupling - the fact that 2 systems communicate is a form of coupling. This is a lot less painful than having to setup global state across an entire system of APIs

matt.fellows
2019-04-18 12:44
Everyone using pact has to write provider tests. Richard is a clever guy, but you might get more responses from a broader channel

matt.fellows
2019-04-18 12:46
I'm not sure I follow. The provider should definitely write test cases to ensure it's functionality works (at all levels you'd usually expect)

matt.fellows
2019-04-18 12:46
You wouldn't write consumer specific tests if that's what you're saying

simon.nizov
2019-04-18 12:51
I think another way to look at it is we?re coupling at the testing level in order to de-couple at the deployment level :smile:

murphy.meng
2019-04-18 13:00
Thanks for clarification. Glad to hear I was over concern.

chris.empson
2019-04-18 14:28
has joined #pact-python

richard.jones
2019-04-22 23:01
Hi folks, I?ve been on vacation for a week :slightly_smiling_face: and I?l just reading back thru the messages here.

richard.jones
2019-04-22 23:05
Looks like Murphy?s questions were all very general and thanks everyone for handling them :slightly_smiling_face:

matt.fellows
2019-04-22 23:07
:+1:

murphy.meng
2019-04-23 09:36
@richard.jones, I did not see examples about server side testing in pactman repo, did I miss anything? Really wanna to see some more practical examples in Python.

richard.jones
2019-04-23 22:01
@murphy.meng what do you mean by ?server side testing??

murphy.meng
2019-04-24 06:39
I mean, provider testing. Sorry. Does it make better sense?

ryan.wicken
2019-04-26 09:12
has joined #pact-python

richard.jones
2019-04-28 22:24
@murphy.meng the pactman docs have a section on verifying pacts against a service: https://github.com/reecetech/pactman#verifying-pacts-against-a-service

richard.jones
2019-04-28 23:28
@bethskurrie regarding the `"min": 0` confusion, the pact spec version 3 (https://github.com/pact-foundation/pact-specification/tree/version-3) currently has this in the ?example of a pact file?: ``` "$.data.array1": { "matchers": [ { "min": 0, "match": "type" } ] }, ```

bethskurrie
2019-04-28 23:29
@uglyog has recanted I believe

richard.jones
2019-04-28 23:29
AFAICT though the pactman implementation does not allow min 0

richard.jones
2019-04-28 23:29
I?m trying to trace down how the offending pact was generated

bethskurrie
2019-04-28 23:29
the ruby impl never allowed it, and then ron added that when I was on mat leave

richard.jones
2019-04-28 23:34
Looks like it might be the Java impl

bethskurrie
2019-04-28 23:35
this is what happens when I go away and have kids :stuck_out_tongue:

richard.jones
2019-04-29 00:05
Confirmed, it was generated with the JVM library, but version 3.6.2 (a couple of months out of date). I?m getting the folks here to re-run that pact generation with the latest version, 3.6.5 and we?ll follow up.

bethskurrie
2019-04-29 00:05
it may still allow 0

bethskurrie
2019-04-29 00:05
you can raise an issue in pact-jvm

richard.jones
2019-04-29 00:06
(in short, if you specify `.arrayEachLike()` in a Java pact declaration, it?ll set min 0)

bethskurrie
2019-04-29 00:06
I think we decided to log a warning if someone used 0

richard.jones
2019-04-29 00:06
I think maybe the default shouldn?t be 0 though :slightly_smiling_face:

bethskurrie
2019-04-29 00:06
but I don't think it was ever done

bethskurrie
2019-04-29 00:06
I agre

bethskurrie
2019-04-29 00:06
i agree.

bethskurrie
2019-04-29 00:06
bring it up please.

richard.jones
2019-04-29 00:06
pactman outright rejects min 0, not warn. Will raise it with pact-jvm

bethskurrie
2019-04-29 00:06
:thumbsup::skin-tone-3:

murphy.meng
2019-04-29 08:11
@richard.jones, pactman README does address how to do verification. But I am not after ?how?, but ?why? and ?what should?. I mean, provider side testing seems more than simply replay the contract and validate, is this correct?

richard.jones
2019-04-29 22:21
@murphy.meng no, and that?s why I explicitly call it ?provider verification? and not ?provider side testing? :slightly_smiling_face: It?s *only* about verifying the contract, *not* about testing the provider in any other sense.

richard.jones
2019-04-29 22:23
I think the questions you have are more general Pact questions, and are probably better directed to the #general channel. The pactman docs assume a general understanding of Pact, and I really should have some references in it to the general docs (oops!) I?ll look at adding a link to https://docs.pact.io/ ASAP :slightly_smiling_face:

richard.jones
2019-04-29 22:23
*cough* oh, I do have a link, at the top. heh :slightly_smiling_face:

murphy.meng
2019-04-30 08:04
You do. :smile: I basically look around for all implementions, python, jvm, go, etc. to get how people make use of pact concepts. I did read through pact doc, but some confusings still stay. And thank you for your clarification, that provider testing does not do more even in pactman impl.

richard.jones
2019-05-09 03:13
Hi folks, I?ve just released pactman 2.20.0 which includes: - Fix pytest mode to correctly detect array element rule failure as a pytest failure - Allow restricting pytest verification runs to a single consumer using --pact-consumer-name https://pypi.org/project/pactman/

iamjillsanluis
2019-05-15 14:07
I have a general question about pact-man. Does it have nifty feature that auto document the API? We notice that the ruby version does (`doc_generator`), but I can't seem to find documentation for that feature in pact-man.

iamjillsanluis
2019-05-15 14:08
Actually, the pact broker does this already, so I am happy. :smile:

richard.jones
2019-05-15 23:13
@iamjillsanluis are you referring to the API of pactman itself? Any standard tooling should be able to generate documentation for it, including the `pydoc` command (on the command line run either `pydoc pactman` or `pydoc -p 8001` and then hit `http://localhost:8001/pactman.html` ? and marvel at the color scheme :sweat_smile:)

richard.jones
2019-05-15 23:16
Your reference to the pact broker makes me think you?re referring to a different API though! :slightly_smiling_face:

bethskurrie
2019-05-15 23:42
The ruby cli allows you to generate markdown (which of course shows as HTML in github) from the local contracts.

bethskurrie
2019-05-15 23:43
It was written before the broker existed, so the functionality is basically redundant now.

richard.jones
2019-05-15 23:46
ah, thanks @bethskurrie, and since the broker does the thing I think that?s good enough for @iamjillsanluis? needs

iamjillsanluis
2019-05-16 13:07
> since the broker does the thing... :100:

edwin.tye
2019-05-16 21:22
has joined #pact-python

jinal
2019-05-24 16:04
has joined #pact-python

miiiiauu
2019-05-24 16:07
has joined #pact-python

diandra
2019-05-28 00:22
has joined #pact-python

thakkarjinal29
2019-06-01 11:24
has joined #pact-python

rob.clarken
2019-06-04 22:47
has joined #pact-python

n.chachampis
2019-06-11 06:50
has joined #pact-python

colin.moorehill
2019-06-11 15:48
has joined #pact-python

bxj231
2019-06-18 21:09
has joined #pact-python

richard.jones
2019-06-20 00:18
Ooh, that looks like a nice feature to have! I should add it to pactman :slightly_smiling_face:

matt.fellows
2019-06-20 00:20
Feel free to chat if you have q?s

richard.jones
2019-06-20 00:22
I?m currently working on pact submission/tagging to broker during pact generation at the moment.

richard.jones
2019-06-20 00:22
(saving the need for a separate set of curl commands)

mui_ume
2019-07-06 00:24
has joined #pact-python

mui_ume
2019-07-06 00:25
Hi guys Can I have a simple example of pact in python as provider ? Thanks

kashikar.harsh
2019-08-02 07:05
has joined #pact-python

kashikar.harsh
2019-08-03 15:22
Hey Guys

kashikar.harsh
2019-08-03 15:23
This is regarding pact message queue support implementation in Python. I am willing to contribute if anyone can guide me here *Disclaimer:* Neither I am expert in pact, nor have I contributed to any project yet. thank you

richard.jones
2019-08-05 00:09
Hey @kashikar.harsh and welcome! I?ve not really got a solid idea of how message queue pact mocking/verfication works in other languages, in order to apply those patterns to the Python world. Do you?

kashikar.harsh
2019-08-05 05:59
@richard.jones I did write some sample tests in node and has a high level idea

kashikar.harsh
2019-08-05 05:59
but not how it is implemented in js

richard.jones
2019-08-05 06:08
Ahh, ok. If you have something you could share I?d like to look.

richard.jones
2019-08-05 06:09
(but I?m just finishing up work soon, so will disappear until tomorrow)

richard.jones
2019-08-12 22:09
This is what we?ve mocked out in terms of pactman API for message pacts. We tried to address the two fundamental issues: 1) messaging APIs are all quite different in structure, so we need fairly generic mechanisms which can either call into that API or be monkeypatched into it, and 2) messaging APIs all use wildly differing names for ?content? and ?metadata?, so we need transformers to convert to/from the pact names. So, for verification (where MessageHandler is a stomp.py message handler) ```def test_pact(pact_verifier, patch): sub = Mock() handler = MessageHandler(sub) def handle(pact): handler.on_message(pact['metaData'], pact['contents']) pact_verifier.verify_message(handler=handle, provider_state=provider_state) sub.ack.assert_called_once()``` And for mocking (again, mocking a stomp connection) ```@pytest.fixture def MockConnection(mocker): mock = mocker.patch("stomp.Connection", autospec=True) def transform(**kwargs): return dict(contents=kwargs['body'], metaData=kwargs['headers']) mock.send = pactman.MessageMock() mock.send.register_pact( description="Published credit data", providerState="or maybe 'scenario'? not sure about this", contents={"foo": Like("bar")}, metaData={"contentType": "application/json"}, transform=transform ) yield mock ```

richard.jones
2019-08-12 22:10
We also mocked out what this would look like in AWS SQS as well, which has a very different shape to the API, and it still worked OK.

bethskurrie
2019-08-13 10:36
Please don't expose the unfortunate naming of "metaData" in the code @richard.jones! It should be metadata. It's one word.

bethskurrie
2019-08-13 10:36
I was on mat leave, or that would never have happened.

li.poltorak
2019-08-13 21:56
has joined #pact-python

richard.jones
2019-08-13 22:08
gotcha @bethskurrie! :sweat_smile:

richard.jones
2019-08-13 23:24
I?ve turned the above proposal into an issue in the pactman github https://github.com/reecetech/pactman/issues/68 /cc @kashikar.harsh

li.poltorak
2019-08-14 18:51
Does pact-python support the `--custom-provider-header` option? It's mentioned here in the docs https://docs.pact.io/faq#how-do-i-test-oauth-or-other-security-headers but I'm getting "Error: no such option" when I try to use it.


matt.fellows
2019-08-14 20:44
That seems to map to the underlying flag you?re after - I?ll update the docs

li.poltorak
2019-08-14 20:51
Oh, thank you! I'll give that a try.

li.poltorak
2019-08-14 20:58
Hmm, I'm still getting the same "no such option" error, maybe I'm doing something wrong: `pact-verifier --provider-base-url=(url here) --pact-url=./consumer-provider.json --header=(header goes here)`

matt.fellows
2019-08-14 21:03
oh

matt.fellows
2019-08-14 21:09
have you installed the latest?

matt.fellows
2019-08-14 21:09
I just did a `pip install pact-python` (I don?t use Python much)

li.poltorak
2019-08-14 21:12
I'll double check, I have 0.16.1 specified, but it certainly seems like it's an issue of not having the latest version installed. This specific functionality is the most recent release, I'm not sure why I'm not seeing it.

matt.fellows
2019-08-14 21:15
Hmm multiple versions of python?

matt.fellows
2019-08-14 21:16
Your using pact python, not pactman right?

li.poltorak
2019-08-14 21:16
Yeah, I am. Just one version of python, 3.7.1 if that helps.

kashikar.harsh
2019-08-19 05:16
Thanks @richard.jones

kashikar.harsh
2019-08-19 05:16
naive query, how will this handler handle instance creation of the object upon which the provider method needs to be called

kashikar.harsh
2019-08-19 05:17
also since the handler code will be inside the pactman library, how will it resolve the method? Since we cannot import the provider method's module

kashikar.harsh
2019-08-19 11:01
One more question is, as per the specification, the message part will look like this

kashikar.harsh
2019-08-19 11:02
How will handler know which method to call as I do not see any method name in the above specification

richard.jones
2019-08-19 22:14
I wasn?t clear then: the sample code I pasted is in *your* test suite, so you make any decisions about instantiation of handler objects or which methods to call.

simon.waterhouse
2019-08-20 14:16
has joined #pact-python

r.deboer
2019-08-26 14:42
has joined #pact-python

r.deboer
2019-08-26 14:53
Hi, I have a problem with my tests using Pact. I have set up several pacts with the same consumer, but with different providers. Most are working fine, but for one of the pacts I keep getting the problem that it can't find a matching interaction even though it is there. Looking at pact-mock-service.log, I see the following lines related to this pact: ```I, [2019-08-26T16:34:16.394161 #13280] INFO -- : Registered expected interaction GET /jobs/?workflow_step=foo:bar:/bars/1/steps/1/ I, [2019-08-26T16:34:16.472296 #13280] INFO -- : Received request GET /jobs/?workflow_step=foo:bar:/bars/1/steps/1/ E, [2019-08-26T16:34:16.472296 #13280] ERROR -- : No matching interaction found for GET /jobs/?workflow_step=foo:bar:/bars/1/steps/1/ E, [2019-08-26T16:34:16.472296 #13280] ERROR -- : Interaction diffs for that route: E, [2019-08-26T16:34:16.472296 #13280] ERROR -- : W, [2019-08-26T16:34:16.487924 #13280] WARN -- : Verifying - actual interactions do not match expected interactions. Missing requests: GET /jobs/?workflow_step=foo:bar:/bars/1/steps/1/ Unexpected requests: GET /jobs/?workflow_step=foo:bar:/bars/1/steps/1/ W, [2019-08-26T16:34:16.487924 #13280] WARN -- : Missing requests: GET /jobs/?workflow_step=foo:bar:/bars/1/steps/1/ Unexpected requests: GET /jobs/?workflow_step=foo:bar:/bars/1/steps/1/ ``` Why is it not recognizing the registered interaction?

matt.fellows
2019-08-27 05:29
hmm it looks like the interactions should have matched. Perhaps they should be URL encoded? I?m not sure the `/` is valid in a query string. Is it?

matt.fellows
2019-08-27 05:33
Try removing the extra bits of the query string (i.e. just make it something like `?workflow_step=foo`) and if that works, you know it?s probably the specific query string that?s the issue

r.deboer
2019-08-27 07:01
Thanks for your reply. It is a good suggestion. I will leave the `/` out in the query. It is, however, not the cause of the issue, because the interactions still don't match: ```W, [2019-08-27T08:56:28.164552 #16316] WARN -- : Verifying - actual interactions do not match expected interactions. Missing requests: GET /jobs?workflow_step=foo Unexpected requests: GET /jobs?workflow_step=foo``` Do you have any other suggestions that I can try?

bethskurrie
2019-08-27 07:14
Usually this happens when there is a timing issue, and the order goes: execute real request (that generates the unexpected one), set up expected request (that's what causes the missing one), verify.

bethskurrie
2019-08-27 07:15
It's obviously meant to go: set up expected request, execute real request, verify.

bethskurrie
2019-08-27 07:15
But your logs look like things are in the right order.

bethskurrie
2019-08-27 07:17
I can't see how those two paths don't match. It's like there's some magic character that's not being printed.

bethskurrie
2019-08-27 07:19
In the expectation, are you putting the query string into its own field? Or are you putting it with the path?

bethskurrie
2019-08-27 07:19
They should be declared separately. I suspect it's not matching because it's doing individual matches on path and and query, not a single match on the full path+query.

r.deboer
2019-08-27 07:29
Thanks, that is it! I forgot to put the query as `query=` argument. Thanks for your help!

bethskurrie
2019-08-27 07:32
Np

richard.jones
2019-08-29 05:07
Hey folks, just letting you all know that I finish up with Reece next week, so I won?t be as active in `pactman` land. Development has slowed down anyway, since it?s very stable now and pretty feature-complete (excepting the messages stuff, sadly). There will still be folks here at Reece who will be maintaining the code.

matt.fellows
2019-08-29 08:05
Well, thanks for taking it to where it is - amazing work! Hopefully wherever you go you?ll continue to evangelize!

matt.fellows
2019-08-29 08:05
Where to?

joao
2019-08-29 13:35
has joined #pact-python

richard.jones
2019-09-01 22:23
Off to Biarri Rail to play with trains :slightly_smiling_face:

sahil.goyal2
2019-09-09 12:24
has joined #pact-python

r.deboer
2019-09-13 08:32
Is there any chance that the fix for https://github.com/pact-foundation/pact-support/issues/68 can be included in the Pact-Python package soon?

c.metz
2019-09-13 08:37
has joined #pact-python

bethskurrie
2019-09-13 09:19
@r.deboer raise an issue in pact python to upgrade the version. Or, if you can work out where it's set, you could raise a PR to expedite the process.

bethskurrie
2019-09-13 09:20
With my husband's bestie, Rory Hart. He's happy you're joining him @richard.jones!

r.deboer
2019-09-13 14:04
Thanks for your quick reply. We tried (locally) to upgrade the version, because we hoped that the fix would also be a fix for our problem. Unfortunately that is not the case.

nithinmohan114
2019-09-20 07:44
has joined #pact-python

s.roodhorst
2019-09-24 09:48
has joined #pact-python

s.roodhorst
2019-09-24 09:57
Hi all, I was working on writing python tests for using secure requests over ssl. I noticed that this is not (correctly) implemented in the python pact library. It is still using the requests without https and without the certificates. Can I make an issue and pull-request for my changes to make it work?

matt.fellows
2019-09-24 10:37
yes please!

s.roodhorst
2019-09-24 11:36
It turns out that more changes are needed or I'm doing something wrong. I now added the sslcert, key and ca to the requests as arguments. This works for internal pact testing. But when I am debug the started mock server and do a curl -k https://localhost:1234 command I can also get the contents, without needing the certificate

matt.fellows
2019-09-24 20:50
`-k` says skip validating the certificate (from the clients? perspective). What are you expecting it to do?

jorge.florian
2019-09-25 13:16
has joined #pact-python

jorge.florian
2019-09-25 13:36
Hi guys, my team is planning to use Pact for our multiple web applications and our backend. Our backend is written in python I would like to know how stable is this library and if it's still maintained.

rootuid
2019-10-03 08:53
has joined #pact-python

rootuid
2019-10-04 08:42
Hi @channel, I'm making a requests.get to the pactman mock server but I get a 500 + "received but no interaction registered" back. It appears the mock server is up,returns a 500 and the message as per this code https://github.com/reecetech/pactman/blob/67e17532dc0dff4e41c33cb98cb747670fa6adf2/pactman/mock/mock_server.py#L104 . I don't however know why it's happening. Any tips appreciated

matt.fellows
2019-10-06 22:42
Have you first registered expectations such as a `GET /some/path 200`? If your code is making the call to the mock server, but has not first told it what it?s going to do, you?ll get that error

matt.fellows
2019-10-06 22:42
perhaps you could share some code?

matt.fellows
2019-10-06 22:43
That line would suggest there is no interactions registered, so it can?t find an appropriate response to your request

tony.ibbs
2019-10-07 14:20
has joined #pact-python

rbhati
2019-10-08 17:26
has joined #pact-python

harshavardhan.chowdar
2019-10-10 15:32
has joined #pact-python

ayip
2019-11-15 00:41
has joined #pact-python

rbhati
2019-11-18 22:15
#pact-python :pactman [https://pypi.org/project/pactman/] provides a kiss CLI called pactman_verifier to verify pact; And I wonder if I can achieve same goal of validating pact [available on pact-broker] via pact-python

rbhati
2019-11-18 22:16
any pointers and direction will be great help

rbhati
2019-11-19 16:43
any help here, anybody??

matt.fellows
2019-11-20 04:54
I think the model?s are slightly different. Have you read https://github.com/pact-foundation/pact-python#verifying-pacts-against-a-service ?

matt.fellows
2019-11-20 04:54
what else have you tried?

megha.agrawal
2019-11-26 18:34
has joined #pact-python

megha.agrawal
2019-11-26 18:35
Hi I am able to successfully run the provider tests when the pact file is stored locally but getting 401 error when the pact file is store in pact broker. I am using python. Here is the command I am using ```pact-verifier --pact-url="http://your-pact-broker/pacts/provider/PROVIDER/consumer/CONSUMER/latest" --custom-provider-header='Authorization: Bearer mytoken' --provider-base-url="http://localhost:8080"``` Where am I doing wrong?

megha.agrawal
2019-11-27 00:20
Can someone give me a simple example of provider test that uses pact file from broker?

gordo
2019-12-09 22:27
has joined #pact-python

taisedias
2019-12-22 21:53
has joined #pact-python

vasile.pop
2019-12-23 14:42
has joined #pact-python

david.wang3
2020-01-08 17:04
has joined #pact-python

bethskurrie
2020-01-11 04:33
Hey python users. Would anyone be up for submitting a PR to pact-python to allow pacts to be fetched dynamically from a Pact Broker? This is the issue https://github.com/pact-foundation/pact-python/issues/114

bethskurrie
2020-01-11 04:34
It should be a fairly straightforward change, and perfect for a beginner wanting to start contributing to OSS!

matt.fellows
2020-01-12 21:36
:pray:

dlmiddlecote
2020-01-12 23:39
has joined #pact-python

elliottmurray
2020-01-13 08:06
has joined #pact-python

bethskurrie
2020-01-13 08:55
@matthew.balvanz and @richard.jones, @elliottmurray is a (long standing, most excellent, and sadly, soon to be leaving :disappointed:) colleague from DiUS who is interested in making some python pact contributions. Doing some @ introductions so you'll know to keep an eye out for PRs and questions from him!

bethskurrie
2020-01-13 08:55
Matthew is one of the maintainers of the pact-python implementation, which wraps the Ruby CLI, and Richard is the maintainer of Pactman, which is an independent implementation that came out of Reece.

mokbat
2020-01-13 20:53
has joined #pact-python

dlmiddlecote
2020-01-16 17:34
Anyone available to review the above PR?

matt.fellows
2020-01-16 22:59
LGTM

matt.fellows
2020-01-16 22:59
As a non-Pythoner it?s exactly what I would have done. The code is very easy to comprehend

bethskurrie
2020-01-16 23:01
We may need @matthew.balvanz to do a release


bethskurrie
2020-01-16 23:02
Hm, though we may have permissions for that if he's not free, actually.

bethskurrie
2020-01-16 23:02
Nice docs, yeah, just read them.

matt.fellows
2020-01-16 23:02
I?ll give it a crack now

bethskurrie
2020-01-16 23:02
Nice work Matt B.

matt.fellows
2020-01-16 23:02
indeed

matt.fellows
2020-01-16 23:02
the code is very easy to understand too

matthew.balvanz
2020-01-16 23:10
Get things figured out? I?m on the road vacationing today but could check things out later tonight if needed.

matt.fellows
2020-01-16 23:10
I?ll let you know if I fail :slightly_smiling_face:

matt.fellows
2020-01-16 23:11
Enjoy your break!

matt.fellows
2020-01-16 23:14
Release should be on its way? :crossed_fingers:

matt.fellows
2020-01-16 23:17
#winning

elliottmurray
2020-01-17 00:45
Python guru!

matt.fellows
2020-01-17 00:59
More like the capability of a trained monkey

elliottmurray
2020-01-17 00:59
Your own worst critic!

matt.fellows
2020-01-17 01:00
Best to own that, then you can control the narrative

elliottmurray
2020-01-17 01:00
I?m English - self deprecation is a national past time

bethskurrie
2020-01-17 03:06
@dlmiddlecote @elliottmurray, David has started on pact message support, but has to put it aside for a few weeks while he works on other stuff. Mentioning it as it might be something one of you might be interested in picking up.

david.wang3
2020-01-17 03:07
this will allow you to construct a pact-message and create a pact-message file.. thats as far as I?ve gotten

david.wang3
2020-01-17 03:11
i?ve added a sample test case in the commit comments, you can take a look..

david.wang3
2020-01-17 03:14
additional work items to do is to pass in a event handler and then feed the messages to the handler?

elliottmurray
2020-01-19 20:38
There?s a dependency issue with older versions of python. I?ll look at it later

bethskurrie
2020-01-27 22:21
@matthew.balvanz I'd like to merge https://github.com/pact-foundation/pact-python/pull/106 if it's ok with you (sorry to ping you if you're still on holidays)

matthew.balvanz
2020-01-27 22:44
No worries. Taking a quick glance since I have a moment at work...

matthew.balvanz
2020-01-27 22:46
Looking good to me.

bethskurrie
2020-01-27 22:46
:thumbsup::skin-tone-3:

matthew.balvanz
2020-01-27 22:57
Did we want to get the proposed wording change about `broker_token`/`broker_password` in before merging (or am I missing where that change was made)?

elliottmurray
2020-01-29 00:58
I?ve had real problems re-creating the 27 problems for my changes so I?ve created a docker image to test (which now allows me to see my breaks) Any practices on how to contribute docker images? At the mo I?ve got a dockerfile under a docker folder

matthew.balvanz
2020-01-29 23:35
Is it something for devs to use locally or something you'd expect published to Docker Hub eventually? If it's just a local dev tool, the docker folder seems perfect.

elliottmurray
2020-01-30 05:24
mainly so you have local dev tools. Think I could eventually publish it to dockerhub though

elliottmurray
2020-01-30 05:24
Just a pain getting py27 working on a mac anymore

kulik.olenka
2020-02-07 20:57
has joined #pact-python

paul.white
2020-02-11 09:03
has joined #pact-python

ileshdarji
2020-02-11 11:29
has joined #pact-python

elliottmurray
2020-02-13 04:22
@bethskurrie @matt.fellows I think this is covered by my PR? What?s the process for merging?

bethskurrie
2020-02-13 05:59
If the tests are green and you're happy with it, I think we merge!

bethskurrie
2020-02-13 06:00
I'll see if @matthew.balvanz wants to have a squiz at it

matthew.balvanz
2020-02-13 14:20
Cold and snowy day here. With staying inside I'll try to work in some time today to look at PRs.

adrian.deanda
2020-02-13 15:57
has joined #pact-python

elliottmurray
2020-02-14 00:39
Thanks for the merges @matthew.balvanz

matt.fellows
2020-02-14 08:27
Where are you based again?

niciqy
2020-02-14 11:17
has joined #pact-python

matthew.balvanz
2020-02-14 14:44
Iowa, USA. Right about the middle. Dropped to -10F (-23C I think?) with a wind chill pushing it down toward -30F.

matt.fellows
2020-02-15 12:24
:grimacing:

matt.fellows
2020-02-17 23:47
thanks Beth

bethskurrie
2020-02-17 23:48
@matthew.balvanz a co-worker in aus needed the latest changes to the standalone, so I've taken the liberty of releasing.

bethskurrie
2020-02-17 23:48
Fingers crossed!

bethskurrie
2020-02-17 23:49
There is a bit of weirdness with that 0.20.0 commit going missing from Matt's machine (if it was ever there?). I pulled from the tag into master, so the history is a bit... strange... but the commits are there at least.

matthew.balvanz
2020-02-18 03:16
Thank you!

aorumbayev
2020-02-19 22:57
has joined #pact-python

aorumbayev
2020-02-19 22:59
Hi all, Could someone point out a reference/link to any issue related to v3 specs support? I'm specifically interested in async message contracts support (kafka and etc)

matthew.balvanz
2020-02-19 23:03
I think this is the original issue talking about adding v3 support: https://github.com/pact-foundation/pact-python/issues/88

aorumbayev
2020-02-19 23:12
Hey @david.wang3, looks lke your PR does the initial support for message contracts -> https://github.com/pact-foundation/pact-python/pull/119 . It seems like the travis failed on some basic formatting linting things, do you think this is gonna be merged anytime soon?

bheemreddy181
2020-02-20 04:00
has joined #pact-python

ckkinay
2020-02-26 09:36
has joined #pact-python

joel.whalen
2020-03-02 17:19
has joined #pact-python

osirisnos4a2
2020-03-03 23:51
has joined #pact-python

aaron
2020-03-09 21:35
has joined #pact-python

krosan
2020-03-21 19:29
has joined #pact-python

iamjillsanluis
2020-03-22 14:45
Good morning/afternoon/evening everyone. I hope all is staying safe and healthy. I was trying to get `pact-python` setup last night following the tutorial. As I was setting up the test on consumer side, running the test results in "cannot reach localhost:1234". I know the documentation mentions that the mock server should be reachable by the consumer, but something is not connecting to me. Is this mock server something that we (consumer side developers) have to implement? What I think makes sense to me of how it should work is, `pact-python` spins up a mock server for us when running the test, dumping the appropriate pact after test is run, then we take that pact and verify it against provider side. To spin up instances of mock service ourselves (consumer side) seems tedious/unnecessary. But please help me correct my mental model. This seems consistent with my mental model - https://docs.pact.io/pact_nirvana#2-spike-optional While missing in Python, here is related Ruby implementation of the step I am getting stuck on - https://docs.pact.io/implementation_guides/ruby#3-configure-the-mock-animal-service. In Ruby, seems like pact will spin up and manage that mock service for you and it will run it at host `localhost:1234`

iamjillsanluis
2020-03-22 18:03
alright, i am getting somewhere. I think I figured it out after trying my test in simpler environment (outside docker that is locked down) where ruby can freely spin up a mock server. I will poke around more to get this sorted out and find place to document how this can work for containerized environment that looks like my setup.

elliottmurray
2020-03-24 00:33
So running your consumer tests in a container should work. It is possibly a networking issue with your container struggling with either opening the port or resolving network address? Is there anything unusual with your setup?

matt.fellows
2020-03-24 00:52
Also confirming that you?ve read https://docs.pact.io/docker.

matt.fellows
2020-03-24 00:52
You?ll need to do a little more work if using Alpine

bethskurrie
2020-03-24 00:54
We have found that the underlying Ruby CLI for some reason takes a very long time to spin up on docker, especially when it's being run on a machine with not quite enough resources.

bethskurrie
2020-03-24 00:55
On a recent client, we almost got ot the stage where we ran our own dockerized mock service from `pactfoundation/pact-cli`

bethskurrie
2020-03-24 00:55
For some reason, that one runs perfectly quickly

iamjillsanluis
2020-03-24 01:19
The issue was different things for me: Alpine uses sh instead of bash by default. I managed to figure it out by digging in the guts of the packaged ruby starter scripts. The second issue was the missing APK installs that I found from the past issues. I would like to contribute to documenting this, but not sure where I should. I'm not sure if there is "get started section" this can be added or more appropriate place. Would be happy to document this if I was pointed to right place to do so. Maybe like python guide, kind of like it is done in ruby/java and I believe JS.

iamjillsanluis
2020-03-24 01:21
Interesting findings on slowness. I'm seeing myself spending my weekends getting the full set up in next coming weeks. If there is anything I can help with, would be happy to chip in.

elliottmurray
2020-03-24 01:22
I had a wip in looking at some of dockerizing for python - let me try and dig it out

bethskurrie
2020-03-24 01:22
Most of the scripts should be able to be converted to sh

bethskurrie
2020-03-24 01:23
there's an open issue for it if you're interested in looking at it

bethskurrie
2020-03-24 01:23
You'd need ruby 2.2 installed, but you don't really need to know ruby much.

matt.fellows
2020-03-24 01:25
Those issues / needs are discussed at Also confirming that you?ve read https://docs.pact.io/docker. but I understand that isn?t immediately visible in the Python page

matt.fellows
2020-03-24 01:25
Perhaps just a link from the repo?

elliottmurray
2020-03-24 01:25
I started working on some dockerfiles but now I remember - was for building pact-python not for using it. Though I?m sure they could be re-purposed. There is a python2.7 example docker file under the cryptic docker dir

iamjillsanluis
2020-03-24 01:26
im cool with ruby. i love ruby but i do python in my full time job. :slightly_smiling_face: If you can link the issue my way, i can check it out :slightly_smiling_face:

bethskurrie
2020-03-24 01:27
Ruby/Python - they're the same fam


elliottmurray
2020-03-24 01:27
Like siblings

iamjillsanluis
2020-03-24 01:27
i think this weekend, ill clean up my sample project a bit. I will also read the other lang?s guide maybe pattern the python guide close to those.

bethskurrie
2020-03-24 01:28
The complication is that Travelling Ruby, which is the tool we use to package the Ruby into the standalone CLI, does have some bash files I think.

bethskurrie
2020-03-24 01:28
We'd need to make our own versions and copy them over the bash ones.

bethskurrie
2020-03-24 01:28
Something to be aware of is that we're planning on retiring the standalone and moving to a shared rust impl which will be called via FFI bindings.

iamjillsanluis
2020-03-24 01:29
curious how much does bash actually add to image. if it is negligible, maybe just doing `apk add bash` is not too bad. This way we don?t have to play with the packager you were talking about.

bethskurrie
2020-03-24 01:29
I don't know what the timeline will be for that though. We're working on js at the moment but it's going to depend on who's available to pick it up for python.

iamjillsanluis
2020-03-24 01:29
> retiring ruby oh. i see

bethskurrie
2020-03-24 01:29
So it may or may not be worth the work to remove the bash dependency, and it's one of the reasons I hadn't picked it up.

elliottmurray
2020-03-24 01:29
Have you thought about your own pact alpine image @bethskurrie? It?s pretty easy to setup

iamjillsanluis
2020-03-24 01:29
i?d be interested in code reviewing the js impl and see how it goes for the python

bethskurrie
2020-03-24 01:29
It's already made

bethskurrie
2020-03-24 01:30
pactfoundation/pact-cli

bethskurrie
2020-03-24 01:30
it runs like a breeze.

bethskurrie
2020-03-24 01:30
it's the standalone that runs with the packaged Ruby 2.2 that seems to run like a dog on docker.

iamjillsanluis
2020-03-24 01:31


bethskurrie
2020-03-24 01:31
docker doesn't allow dashes in org names

elliottmurray
2020-03-24 01:32
ah yep - so you publish that to dockerhub?

elliottmurray
2020-03-24 01:35
also I might have a go at that later in the week - you can probably use multi stage bulids now

bethskurrie
2020-03-24 01:35
yes

bethskurrie
2020-03-24 01:35
its `pactfoundation/pact-cli`

iamjillsanluis
2020-03-24 01:37
so just to summarize the general direction the workflow you guys imagine for people building their CI is, when python contract tests from consumer are being run, developers would need an external container (`pactfoundation/pact-cli`) that runs alongside that the tests use for the standalone mock server. _My statement is only covering consumer right now because I haven?t gotten to the verification on the provider side yet._

bethskurrie
2020-03-24 01:38
It's not currently supported, but would be easy to do if the current way was not working for you.

bethskurrie
2020-03-24 01:39
It would just be an extra flag for the python code not to start up/shut down the mock service, and you'd be responsible for managing the docker mock service container.

bethskurrie
2020-03-24 01:40
The ruby impl allows you to manage your own mock service.

matt.fellows
2020-03-24 01:40
> the workflow you guys imagine for people building their CI is, when python contract tests from consumer are being run, developers would need an external container (pactfoundation/pact-cli) that runs alongside that the tests use for the standalone mock server. No. I think that?s the _less ideal_ flow. Ideally, it?s all wrapped up and happens automatically.

bethskurrie
2020-03-24 01:40
So the code already exists.

bethskurrie
2020-03-24 01:40
It would make *your* code a bit more complicated, but that's a trade off you might be willing to make if it wasn't working for you the normal way.

iamjillsanluis
2020-03-24 01:42
It is currently working now in current way after applying my fixes. So I guess I can continue doing that. I am not blocked at the moment. Just generally curious what is the direction of things/vision of how you guys see others integrating this in their CI

iamjillsanluis
2020-03-24 01:42
> No. I think that?s the _less ideal_ flow. Ideally, it?s all wrapped up and happens automatically. Seems like it is like we (users of pact) should not see changes and it is all under the hood.

bethskurrie
2020-03-24 01:42
medium term, we'll be doing away with the pact-ruby-standalone, so you shouldn't need bash

bethskurrie
2020-03-24 01:43
Ideally, the interface doesn't change, yes.

iamjillsanluis
2020-03-24 01:44
thanks for all the guidance.

christian.roepke
2020-03-24 07:47
has joined #pact-python

christian.roepke
2020-03-24 09:17
Hey everyone, good to be here! I?m relatively new to Pact and currently struggling to understand how inside my Python repository Pact `state` is kept. I wanted to simply change the names of the provider and consumer but even when deleting the cache, existing pact-JSON and re-setting the virtual env the ?old? pact keeps showing up when I execute my test with `pytest`. Is there anything that I?m missing? :thinking_face:

bethskurrie
2020-03-24 09:18
Is your mock service definitely shutting down?

bethskurrie
2020-03-24 09:19
Do a `ps -ef` and see if you can see a ruby process running.

bethskurrie
2020-03-24 09:20
The names should come from the pact set up config.

christian.roepke
2020-03-24 09:24
that was the problem!

christian.roepke
2020-03-24 09:25
i didn?t fully understand that in the background ruby is used, thanks so much!


bethskurrie
2020-03-24 09:28
We're hoping to get rid of it, but it's been a long time coming.

matt.fellows
2020-03-24 10:34
we should add a general ?debugging? section to most of our DSL if they don?t have already, to indicate this

matt.fellows
2020-03-24 10:34
> i didn?t fully understand that in the background ruby is used, thanks so much! That?s kind of intended, because you shouldn?t have to know. But you need to know when you need to know :slightly_smiling_face:

matt.fellows
2020-03-24 21:49
@mukheem you should ask your Python questions here

mukheem
2020-03-24 21:49
has joined #pact-python

mukheem
2020-03-24 21:50
Thanks @matt.fellows :slightly_smiling_face:

matt.fellows
2020-03-24 21:50
The reason it?s best to ask here, is that each language has its own nuances - there are general concepts (which http://docs.pact.io aims to teach) but languages have a way of wanting to do things differently

matt.fellows
2020-03-24 21:51
Does the example in the pact-python repository not work?

mukheem
2020-03-24 21:56
Unfortunately No.

mukheem
2020-03-24 22:09
I just went thru those animation slides and I am a bit more clear now.

mukheem
2020-03-24 22:09
Thanks Beth

mukheem
2020-03-24 22:44
Can i be helped in Simulating a PACT consumer server to hit Real HTTP server. Apparently, this code which is driving me skeptical. Question is live_server.url points to which server > -> Real world HTTP server or Simulating one ? Also, Why are we creating User when If condition is true. [ I never worked with Django earlier, so I have no idea ]

bethskurrie
2020-03-24 22:45
@mukheem do you mind if I ask if you're a developer or a tester?

mukheem
2020-03-24 22:47
I am an Automation Tester Beth. :neutral_face:

bethskurrie
2020-03-24 22:49
That'll help then! Pact requires a good knowledge of coding, and of the underlying provider and consumer implementations, so testers who have not coded much before often struggle.

bethskurrie
2020-03-24 22:50
As an automation tester, you may or may not be familiar with the web frameworks that each of the projects use, as often automation testers work from the "outside" of each service, being able to treat each service as a black box.

bethskurrie
2020-03-24 22:51
In this case, it is often beneficial for a tester and developer to pair together when setting up Pact.

bethskurrie
2020-03-24 22:52
The Pact maintainers cannot help you with web framework questions unfortunately. If you don't have experience in this area, is there a developer in your organisation who you can pair with?

mukheem
2020-03-24 22:53
Not Python Developers.(Unfortunately). Else i would have reached to them rather bothering you :white_frowning_face:

matthew.balvanz
2020-03-25 13:27
My hunch is that Django is loading the project configuration from disk in this context, which is verifying against a live Django server that is running locally with the same configuration. That means this code can reach into the database that the "live server" is also connected to and modify state so the database has any required data for the pact being verified. Having the code to manipulate the database mixed with the code to verify the pacts is a little unusual. Most of the other Pact implementations have the provider state logic built into the live server and HTTP requests are made to the a provider state endpoint on the service prior to the pact request.

mukheem
2020-03-25 14:42
Thanks @matthew.balvanz for helping me. I did raise a Server in Flask(by going thru a few tutorials). Now I'm in need to know how can I verify my PACT against provider. Now, I totally understood that the example stated in Documentation is not how most of the audience implement it.

mukheem
2020-03-25 16:44
Can someone help me in getting Pact provider Verification (PACT replayed against it's real server) please.

mukheem
2020-03-27 09:41
Can someone help me in letting me know ```pact_verifier``` fixture pls

mukheem
2020-03-27 11:49
it'd be really helpful if someone can corect me where i went wrong here

matt.fellows
2020-03-27 12:14
What is the problem you?re having. Please post logs, more context etc.

matt.fellows
2020-03-27 12:16
Assuming you are starting a local server on port `8081` and `8082` ? Is there are reason you have 2 servers (it?s OK, just want to make sure that?s what you?re intending)

mukheem
2020-03-27 13:09
Thanks Matt for responding. 8081 is my Live server.[Now my real application is turned down due to Epidemic so created one dummy on local machine to use it as real server] 8082 is my Provider states server. I wanted to make sure am i passingthe right parameters. There is no clear documentation to understand this. Unless it is clear what needs to be passed, mytest won't run succeed. Let me know if you want to see any logs

mukheem
2020-03-27 13:09
Regarding Context: I am trying to test PAC on provider side. and for that purpose I am using Pact_verifier.

elliottmurray
2020-03-27 16:38
So looking at pact-python is the provider only supporting the uri provider states? I take it no way (that I can see) to do what you have in ruby where you can actually write code? Is there a good example of python doing providers generally? Or is that a ?todo??

matt.fellows
2020-03-28 03:20
The parameters for provider states are defined at https://github.com/pact-foundation/pact-python#--provider-states-setup-url. There are just two properties that are passed in: the consumer name, and the state name

matt.fellows
2020-03-28 03:21
Your provide state setup URL needs to parse this, and decide what to do. For example, if the state is ?User A exists? then it may need to create a User in the database

matt.fellows
2020-03-28 03:21
no, this is a TODO from what I can see

matt.fellows
2020-03-28 03:23
The way it works in JS/Go for example, is that I actually spin up a proxy server that takes the provider state functions from the test (and similar features such as request filters) as arguments, and behind the scenes maps to HTTP endpoints for the verifier to call. When the setup endpoint is called, it simply invokes the functions passed in. This way, it appears to the user that it?s just invoking the function instead of all of the rigmarole / confusion of the endpoint

mukheem
2020-03-28 03:24
@matt.fellows I succeeded in executing thru command line and the result is as expected. [ Tested both positive and negative scenarios ] `pactman-verifier -l C:\Users\****\PycharmProjects\pact-python-master\Pact\ConsumerPOC-Provider-pact.json Provider http://localhost:8081/` `http://localhost:8082/setup`

matt.fellows
2020-03-28 03:25
I believe the docs on the Github page could be updated to make the provider side testing clearer - I?m supposing you?re supposed to just call the verifier CLI directly, but would be much nicer if Pact Python wrapped all that for the user

matt.fellows
2020-03-28 03:25
So I can see the confusion

matt.fellows
2020-03-28 03:25
Awesome!

mukheem
2020-03-28 03:25
now what i don't understand is which method is to be called to do it via code when i have n number of pacts. In the above SS, I tried using Pact_verify but i don't undersdtand what it accepts and how itexecuted..

matt.fellows
2020-03-28 03:30
You would usually publish pacts to a Pact Broker (there is an Open Source one and http://pactflow.io if you don?t want to host yourself) and then you can simply point the verifier at the broker - it will find all pacts for a provider and verify them


mukheem
2020-03-28 03:32
Yes @matt.fellows . i read that in documentation. But my organization has it's compliance not to expose things to out side world. Hence we would be hosting it internally or might be using a shared folder. That's where i am stuck. :white_frowning_face:

matt.fellows
2020-03-28 03:32
I would not go down the shared folder path.

matt.fellows
2020-03-28 03:33
You could check the contracts into github, and create your own script to pull down from known consumers

matt.fellows
2020-03-28 03:33
But really, just run the Pact Broker somewhere

matt.fellows
2020-03-28 03:33
If you can?t use a hosted provider that?s no problem, you?ll need to host it yourself is all

mukheem
2020-03-28 03:35
Got it. Say, We have hosted our own server to handle this stuff... Can you help me with the pytest method which helps me in taking the inputs from http://XYZ.com url and verify my pacts

matt.fellows
2020-03-28 03:35
I don?t know pyest I?m afraid

mukheem
2020-03-28 03:36
Any python method which i can use to pull this situation.

matt.fellows
2020-03-28 03:36
The help command will tell you all of the arguments `pact-provider-verifier help`

matt.fellows
2020-03-28 03:36
I don?t know Python that well so I won?t recommend anything there, but the command you have to call is the same (what?s shown above)

matt.fellows
2020-03-28 03:37
These are the general steps though: 1. Start your provider (and provider states server if that?s different) 2. Run the verifier, specifying how to reach your provider, and where to fetch the pacts 3. Check the exit code and print any errors

matt.fellows
2020-03-28 03:38
I?m afraid I can?t teach you anything with Python, you probably know more than me!

mukheem
2020-03-28 03:38
Start your provider --> This means Provider live server. .Am i right ?

matt.fellows
2020-03-28 03:39
It?s a real server, yes. When you run a consumer test, Pact mocks the provider. You?re testing the real consumer. When you run a provider tests, Pact pretends to be the consumer. You?re testing the real provider. The whole point of pact/contract-testing is to avoid testing both sides at the same time.

mukheem
2020-03-28 03:41
Yes. Got it. Thanks a lot @matt.fellows for taking out your precious time for me and explaining things. I'm indeed very grateful to you. It would have been really amazing if any puthon guy have turned up to answer. That's okay I will put it on github. Hopefully someone will answer.

matt.fellows
2020-03-28 03:42
no probs!

matt.fellows
2020-03-28 03:42
Things have been pretty quiet over the past few weeks.

mukheem
2020-03-28 03:44
Yeah. due to Pandemic. I understand, but being a software engineer, we are expected to work from Home as this is the only industry which has that flexibility to it's fullest. I am expected to submit it by Monday. Hoping for the best. :slightly_smiling_face:

mukheem
2020-03-28 03:49
Yes @matt.fellows.Actually we need that documentation to be updated so that audience could feel free to implement on their own servers. When CLI gives that flexibility code should also be giving that freedom.

mukheem
2020-03-28 03:50
i understood concepts by going thru documentation provided in js, Golang, ruby, it is pretty clear and easy to understand. I was wondering why python documentation is left that way. :neutral_face:

mukheem
2020-03-28 04:10
Just one more question @matt.fellows. when you say `Your provide state setup URL needs to parse this, and decide what to do. For example, if the state is "User A exists" then it may need to create a User in the database` For post/patch requests, I presume that the value returned by our provider state setup would be directly injected to request being sent in provider URL. is my understanding correct ?

matt.fellows
2020-03-28 04:15
No. the provider state is a request that is issued to the provider to get the _provider_ into a state, so that the interaction will work as expected

matt.fellows
2020-03-28 04:15
The response mody from the setup URL is completely discarded by the verifier. It just needs to know it was setup correctly (e.g. a `200`)

matt.fellows
2020-03-28 04:15
The state is independent of the type of request `GET` or `POST` etc.

mukheem
2020-03-28 04:16
If this the case, then hoe can i test my `post`requests ?

matt.fellows
2020-03-28 04:17
I'm not following the problem sorry.

mukheem
2020-03-28 04:17
Okay let me put it in another way

mukheem
2020-03-28 04:21
The example i did try and succeeded is a `get` request. My interaction says that it is a `get` request with path /api.[ I shall send you a SS later to this message ] so My Provider test also hits the live server with a `get` request to the path /api. Now, If my interaction is for `post` which takes a parameter say `employee id` as input to fetch details of that employee, then how that `employee id` is fed to the Provider while testing against a Live server

mukheem
2020-03-28 04:22
Here is my Pact for a get request

matt.fellows
2020-03-28 04:39
what is the post doing? Does it need the employee id to do something to that user?

matt.fellows
2020-03-28 04:40
If so, `employee id` is the state - e.g. you may need to use the state to ensure it exists so that your `POST` will work with that ID

mukheem
2020-03-28 04:41
Yes, Employeed Id is used by the request to fetch all the employees details.

mukheem
2020-03-28 04:42
I got your answer. But How does my post request on provider side understand that Empoyee X's details should be fetched. ?

mukheem
2020-03-28 04:43
I shall set up state saying that Employee X should be present. But Question is how will my request get that data during post. the value X . Because Provider state response is completely discarded by the Provider.

mukheem
2020-03-28 04:45
If not, I could fetch any employee id from DB during run time in setup state and return it to the provider so that i can post the request with that ID fetched from DB

matt.fellows
2020-03-28 04:45
You need to be able to control the id. Another option is to have a data fixture that you load where that ID is always present

mukheem
2020-03-28 04:48
let me check what data fixture is and how does it work. Thanks a lot @matt.fellows :pray:

matt.fellows
2020-03-28 05:35
What you're describing actually does exist in pact, but is only supported in JVM and Rust

matt.fellows
2020-03-28 05:35
(sorry didn't hit enter earlier)

matt.fellows
2020-03-28 05:37
What I mean by data fixture is to have something like an SQL script that will reliably create/setup a database with the same IDs etc each run. This way you don't even need to use states feature (although you should still document the states) to set things up

matt.fellows
2020-03-28 05:37
You could then use tools like docker compose to start your API with data already loaded

mukheem
2020-03-28 05:40
Alright. thanks for clearing smoke @matt.fellows

mukheem
2020-03-28 05:41
Any idea who owns/responsible for pact-python version ?

matt.fellows
2020-03-28 06:44
Yes. The maintainers hang in this channel and you can see on GitHub. Please refrain from DM ing people though

elliottmurray
2020-03-28 07:48
I?ll have a deeper look today. See what I come up with

mukheem
2020-03-28 12:31
Hey everyone, My test is failing during Provider verification when the route is not root. Command I am using is `pactman-verifier -l C:\Users\****\PycharmProjects\pact-python-master\Pact\ConsumerPOC-Provider-pact.json Provider http://localhost:8081` `http://localhost:8082/setup` where `http://localhost:8081` is my provider base url. There are two methods one is `/api` which is root route and the other one is `/api/users`. each time i run the verifier, it is hitting only root but not the `/api/users` I have two different pacts one with path `/api` and another one with `/api/users`. First pact is being verified with no issues but the second is always failing. Any help is really approciated.

elliottmurray
2020-03-28 17:56
Why do you have the proxy server in verifier.ts? I see you are setting up filters and states - is that it? Could you do it without a proxy?

elliottmurray
2020-03-28 17:56
And is this right?

elliottmurray
2020-03-28 17:58
Shouldn?t providerBaseUrl point to the proxy you set up in the provider.ts?

matt.fellows
2020-03-29 09:48
I don't believe I could do it without a proxy, because the provider states endpoint still needs to exist. Also, you can't do filters on the request if you don't have one - Ruby doesn't support it but if even if it did, it would be a native experience - so we're back to making the user do it

matt.fellows
2020-03-29 09:48
Also the proxy is completely hidden from the user

matt.fellows
2020-03-29 09:49
The framework does all of that magic behind the scenes

matt.fellows
2020-03-29 09:49
Can do a call or take you through it this week if you want?

elliottmurray
2020-03-29 09:50
Could you have monkey patched requests? I think I get the principle having looked at the code. Just want to make I got it all in my head!

elliottmurray
2020-03-29 09:50
Possibly - back in England now though!

elliottmurray
2020-03-29 09:50
I was a bit confused about the exmaple in the code snippet though - is it correct? Looks like it doesn?t go to the proxy but I?m obviously missing something

matt.fellows
2020-03-29 09:50
You probably could if it's running in the same process, but that's nit always the case

matt.fellows
2020-03-29 09:51
(a lot of people point pact at running staging environments - for better or for worse)

elliottmurray
2020-03-29 09:51
oh

elliottmurray
2020-03-29 09:51
yeah that?s? interesting

matt.fellows
2020-03-29 09:52
I spend a few nights a week talking to someone in Germany or England. I'm sure I could make time for you Elliot!

elliottmurray
2020-03-29 09:52
haha

matt.fellows
2020-03-29 09:52
This being said, I do need to run. Just put #1 down but need to set my wife up on a zoom call with her friends lol

elliottmurray
2020-03-29 09:52
well I?m gloriously unemployed so will work to your schedule!

matt.fellows
2020-03-29 09:52
And then... The cleanup

elliottmurray
2020-03-29 09:53
lol

elliottmurray
2020-03-29 09:53
sure - more important than chatting to me!

matt.fellows
2020-03-29 09:53
This is what happens when you leave DiUS :laughing:

matt.fellows
2020-03-29 11:25
I thought you were using `pact-python`?

matt.fellows
2020-03-29 11:25
Can you please share your pact file?

mukheem
2020-03-29 11:40
Apologies. I just figured out the issue. I was wrong in providing the path in pact.

mukheem
2020-03-29 11:40
thanks @matt.fellows

mukheem
2020-04-01 07:23
Hello everyone. During Provider verification test, Is there any way I can supply data dynamically to Provider as Input ? I know that provider states help us in laying the data setup ready. But what if my request body needs data ? How can i supply data to my request during POST or PATCH ?

matt.fellows
2020-04-01 11:45
Not that I'm aware of in Python @mukheem

matt.fellows
2020-04-01 11:46
It exists only in JVM and Rust at the moment. You can usually work around it though using provider states and better control over your API

mukheem
2020-04-01 14:39
That's okay @matt.fellows. I just wanted to know where i can incorporate as per the architecture of PACT. I will manage with my own code in python.

mukheem
2020-04-01 14:42
There are cases where we supply data by pulling from DB or by fetching value from 3rd party api , where can i put in the related DB Queries so that the output could be easily injected to provider before hitting live URL.

matt.fellows
2020-04-01 21:43
Are you talking about Pact having access to this data, and pact using this data to send the request to the provider? Or are you asking that the provider itself have access to this data? The former is not a feature in Python but the latter is provider states

matt.fellows
2020-04-01 21:43
Also, during pact tests you would typically mock or stub out 3rd party systems (and create pacts between them)

matt.fellows
2020-04-01 21:43
This way you control the data

mukheem
2020-04-02 05:03
Honestly @matt.fellows, Either of the above would suffice my need. So let's talk about the latter feature which is present in Python pact

mukheem
2020-04-02 05:04
How would my provider state define the data which is to be passed in the request hit to the provider(live server) ?

mukheem
2020-04-02 05:05
Because the response from Provider state is completely discarded. :neutral_face:

matt.fellows
2020-04-02 05:12
The state would be something like ?User with ID xyz exists?. The state handler would see this state, and create a record in the database with the ID `xyz`. Then when the real request comes through just after this is setup, `xyz` will exist and it should work. I think you?re trying to say that the test has value `xyz` but it needs to dynamically change to `123` because you can?t control that `xyz` can be created

mukheem
2020-04-02 05:20
yes, the latter is true. I wanted mostly data fetching and in few cases data updating. but not creation.

matt.fellows
2020-04-02 05:21
Pact is not designed that way. It?s designed to get away from that problem - where you have to orchestrate a bunch of calls (e.g. create user, get the id back, query get user) just to test `GET /user` type thing. Provider states are the means to do this sort of testing

mukheem
2020-04-02 05:22
I mean, In Provider state if i write a DB query to fetch a record and that value is to be used as body in Provider Request..!!! Is this possible in PACT now ?

matt.fellows
2020-04-02 05:22
You use the state to setup the test - think of it like the ?setup? step of your ?setup, do, assert? unit tests

matt.fellows
2020-04-02 05:22
> I mean, In Provider state if i write a DB query to fetch a record and that value is to be used as body in Provider Request..!!! Is this possible in PACT now ? No

matt.fellows
2020-04-02 05:23
Pact JVM has a facility like this, but for edge cases. It?s not in the other languages I?m afraid

mukheem
2020-04-02 05:24
Okay thanks @matt.fellows for your time. You have been very good help each time. with your Crisp answers. Thanks a lot. :slightly_smiling_face:

matt.fellows
2020-04-02 05:24
:slightly_smiling_face:

matt.fellows
2020-04-02 05:24
no worries

mukheem
2020-04-02 05:24
If I am interested, I can also join in the PACT development right ?

matt.fellows
2020-04-02 05:25
I know it?s a very different mindset, it does take a little bit of time to fully appreciate the different way of doing itall - but once you do, it will pay off I promise!

matt.fellows
2020-04-02 05:25
of course!

mukheem
2020-04-02 05:25
Yaay Let me think about it .. :slightly_smiling_face:

lbraymusso
2020-04-02 05:43
has joined #pact-python

noel.chin
2020-04-02 14:43
has joined #pact-python

noel.chin
2020-04-02 14:46
```FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/site-packages/pact/bin/pact/bin/pact-provider-verifier'```

noel.chin
2020-04-02 14:46
anyone encountered this area? is it an install issue?

elliottmurray
2020-04-02 14:53
Have you created a virtualenv and installed pact-python into that?

noel.chin
2020-04-02 14:55
Im not super familiar with python as I am new to the team but pact-python was installed in a docker container

noel.chin
2020-04-02 14:55
Sorry if this isn't the right response to your question

elliottmurray
2020-04-02 14:56
So pip list and you can see pact-python installed in the output?

noel.chin
2020-04-02 14:59
yup I see it installed

elliottmurray
2020-04-02 15:00
and how did you get that error?

elliottmurray
2020-04-02 15:00
pact-verifer?

noel.chin
2020-04-02 15:00
yeah running the verifier via cli

elliottmurray
2020-04-02 15:01
hmm it seems the install didn?t work - the python here is a wrapper around the ruby cli tool afaik

noel.chin
2020-04-02 15:01
give it the good old uninstall reinstall?

elliottmurray
2020-04-02 15:01
sure

elliottmurray
2020-04-02 15:01
and check the logs on install

elliottmurray
2020-04-02 15:01
so pip uninstall pact-python

elliottmurray
2020-04-02 15:02
why are you using a docker container for this?

noel.chin
2020-04-02 15:02
this is to be run in our ci

elliottmurray
2020-04-02 15:03
so if you just want to run the cli I think you might just be able to run it direct. Not sure on your context

noel.chin
2020-04-02 15:04
it was just a quick check (why I am using the cli)

elliottmurray
2020-04-02 15:04
So that thing you are running wraps this thing:


elliottmurray
2020-04-02 15:05
Which I think is


noel.chin
2020-04-02 15:05
Thanks for all the help Elliott

elliottmurray
2020-04-02 15:05
:+1:

noel.chin
2020-04-02 15:17
I can see that the file exists if I navigate to it

noel.chin
2020-04-02 15:17
so I am confused as to why it can't find it

elliottmurray
2020-04-02 17:20
Permissions?

elliottmurray
2020-04-02 17:21
Assume you are doing this all in the container itself

christopher.richard
2020-04-02 17:47
has joined #pact-python

matt.fellows
2020-04-02 21:54
Are you using Alpine Linux? Either way, Check http://docs.pact.io and read the section on docker and Alpine.

matt.fellows
2020-04-02 21:54
You might be missing one of more key dependencies in the container runtime

christopher.richard
2020-04-03 12:32
Hi everyone! @noel.chin and I figured it out. We were missing some dependencies in our docker-alpine runtime. https://docs.pact.io/docker#alpine-linux ^^ That helped :slightly_smiling_face:

iamjillsanluis
2020-04-03 12:59
nice to see you here @christopher.richard :smile:

christopher.richard
2020-04-03 13:00
Thank you!! @noel.chin and I are working on a POC of PACT for our org. My god is this toolset ever powerful

iamjillsanluis
2020-04-03 14:10
yep! we are bringing it in FreshBooks too. :slightly_smiling_face:

christopher.richard
2020-04-03 14:20
That's awesome!

christopher.richard
2020-04-03 14:20
Even without QAs you guys are still building good test systems :joy:

elliottmurray
2020-04-03 16:13
@bethskurrie @matt.fellows not sure whom I should be directing PR?s to for this repo but created a couple. This one was to help people get started (and also for me to understand all the bits!)

elliottmurray
2020-04-03 16:16
bah - breaking tests. Have to do some configuration first

elliottmurray
2020-04-03 16:24
fixed

matt.fellows
2020-04-03 22:17
Thanks Elliot. Feel free to include us on it, but @matthew.balvanz is the core maintainer. If you keep up the contributions I?m sure Matt would happily have another core maintainer on the list

matt.fellows
2020-04-03 22:17
What is clear is that pactman is a nicer experience, but it?s a) not built in a way that aligns with the long term Pact roadmap and b) is (basically) unsupported

matt.fellows
2020-04-03 22:17
so investing in Pact Python and the Rust lib is our goal

elliottmurray
2020-04-04 09:32
Thanks for the feedback. I kind of agree with reference to pactman though am taking inspiration from it

elliottmurray
2020-04-04 09:33
I?ll get some of your pr comments done over the weekend

bethskurrie
2020-04-04 09:34
Ideally whatever the implementation ends up looking like, it would be nice for it to be able to integrate with the python testing libraries like pactman does.

elliottmurray
2020-04-04 09:35
Pact python works with pytest. Pactman is using nosetest which I?ve had to learn about!

bethskurrie
2020-04-04 09:37
The ability to be able to mock things in the process using the test libraries would be great. Ruby does the verification using a Rack interface, rather than a running process, so it means that it runs really quickly and you can stub stuff out using the normal rspec methods.

elliottmurray
2020-04-04 09:37
Ah I see

elliottmurray
2020-04-04 09:38
Hmmm. That is a stretch for my current Python skills!

bethskurrie
2020-04-04 09:38
Not sure if there's a similar http interface for python or not.

elliottmurray
2020-04-04 09:40
I don?t think so. Forgot about the power of rack... I think you can bring Flask up easily but I?ll have to research a bit more

bethskurrie
2020-04-04 09:43
Ron and Matt have to put up with me raving about how good rack is quite often :-P

elliottmurray
2020-04-09 16:12
any news on my PR?s?

matthew.balvanz
2020-04-09 16:56
I've got a lighter load at work this afternoon. I'll see if I can work some time in to review those.

simon.nizov
2020-04-15 18:22
Hi all, A few months ago in a discussion here with @bethskurrie I asked about stubbing requests to 3rd party services (during pact verification) that are recorded with VCR. I finally got around to implementing this so let me shamelessly plug it :slightly_smiling_face: It?s a little tool that allows you to set up a live HTTP stub server that replays previously recorded VCR cassettes - basically `pact-stub-service` but for VCR. https://github.com/thatguysimon/vcr-stub-server I?m posting it here and not in #general because it currently only supports VCR cassettes generated by `VCR.py` but I figured it might be useful to some of the people here who use python. Cheers.

matt.fellows
2020-04-15 23:24
Awesome Simon!

matt.fellows
2020-04-15 23:25
I think I was in that convo, that sounds useful

matt.fellows
2020-04-15 23:25
> Unfortunately, there is no one standard for cassette YAML files, each VCR implementation is different grr yes! One of the reasons I never created a POC for it in JS land!

matt.fellows
2020-04-15 23:26
Because if it _was_ a standard, we could integrate into the pact ecosystem much better - that?s the benefit of a specification people!!

bethskurrie
2020-04-15 23:27
Very cool Simon!

jayeshdalal7
2020-04-19 12:29
has joined #pact-python

pravera
2020-04-20 14:47
has joined #pact-python

maciej.olko
2020-04-29 17:50
has joined #pact-python

malex.y
2020-04-30 20:19
has joined #pact-python

kaypee90
2020-05-01 00:18
has joined #pact-python

ajinkya.pande
2020-05-05 09:50
has joined #pact-python

ajinkya.pande
2020-05-05 09:51
Hello, a simple question does pact supports async testcases?

bethskurrie
2020-05-05 09:52
Yes, but it depends on which implementation you're using as to whether it's supported or not.

bethskurrie
2020-05-05 09:52
I assume you mean async message rather than HTTP websockets?

ajinkya.pande
2020-05-05 09:58
Actually , my test is running forever. I am using pytest for writing test cases. If i use *await async* then it is never-ending. But in case of eventloop fixture after terminating tests contract is generated. ```def test_get_projects(pact, client, event_loop): expected = json.load(open('qws_get_proj_resp.json')) (pact .given('Projects exists') .upon_receiving('a get projects request') .with_request('get', '/rest/projects') .will_respond_with(200, body=expected)) with pact: response = event_loop.run_until_complete(client.fetch('/rest/projects',method='GET')) print("Here after ") ```

bethskurrie
2020-05-05 09:59
Hm. I don

ajinkya.pande
2020-05-05 09:59
in fetch method getting stuck at this `response = await AsyncHTTPClient().fetch(http_request)`

bethskurrie
2020-05-05 09:59
I don't know. You'll need a python developer (which I am not) to help you there.

ajinkya.pande
2020-05-05 10:06
yes. thanks for replying. I hope someone will look into this.

nhodaly
2020-05-05 18:40
has joined #pact-python

pyasi
2020-05-08 13:47
has joined #pact-python

matt.fellows
2020-05-10 23:56
:clap: thanks Elliot!

elliottmurray
2020-05-11 10:28
:bow:

elliottmurray
2020-05-11 10:28
I?ll finish up one last merge later today or tomorrow and do my first proper release then.

matt.fellows
2020-05-11 10:29
Just don?t do what I did and remove the tag :wink:

elliottmurray
2020-05-11 10:29
git tag?

matt.fellows
2020-05-11 12:19
last time I performed a release, for whatever reason, I did the release, but we lost the tag attached to the release. So it was just _missing_ from git

matt.fellows
2020-05-11 12:19
strange, because from memory the tag is how we create the release!

elliottmurray
2020-05-11 12:48
lol - ok thanks for the heads up

elliottmurray
2020-05-11 15:58
Maybe someone wants to double check for me. But I can see it has been published to pypi (https://pypi.org/project/pact-python/)

pyasi
2020-05-11 17:59
It has indeed

matthew.balvanz
2020-05-11 18:59
Thanks for getting those PRs sorted @elliottmurray! Real life has kept me away for too long.

matt.fellows
2020-05-11 22:55
Man, how much does RL just get in the way of OSS. It's almost as if it matters more! :laughing:

elliottmurray
2020-05-12 06:19
I have pushed some docker files in the last release that might help in future. Initially more for me so I don?t have to install 5 versions of python but they might be useful

pyasi
2020-05-14 03:21
Hey! I really like the https://github.com/pact-foundation/pact-go#match-common-formats functionality in Go. I was thinking about implementing it in the pact-python- seems like an easy enough feature that could be helpful. If agreed, what do you think of this approach in `matchers.py` ```class Format: def __init__(self): self.ip_address = self.ip_address() def ip_address(self): return Term(self.Regexes.ip_address.value, '127.0.0.1') class Regexes(Enum): ip_address = '(\d{1,3}\.)+\d{1,3}'```

bethskurrie
2020-05-14 03:22
Sounds goof.

bethskurrie
2020-05-14 03:22
Good even.

pyasi
2020-05-14 03:22
I prefer goof.

bethskurrie
2020-05-14 03:22
Very goof then.

pyasi
2020-05-14 03:23
This would result in usage like this, if we?re okay with that. ``` expected = { 'username': 'UserA', 'ip': Format().ip_address, }```

bethskurrie
2020-05-14 03:28
:+1:

pyasi
2020-05-15 00:37
So my failure for the PR above is due to enum not being in the std lib for python2.7. However, `enum34` is already in the requirement_dev.txt file. Running `tox` for 2.7 does not install the `enum34` package, thus failing the script `python -c "import pact"` . It does however pass when i manually pip install enum34 prior to running `python -c "import pact"` . Why aren?t packaged being installed as part of that tox script?

pyasi
2020-05-15 00:42
FWIW the above is fixed easily by adding `install: -rrequirements_dev.txt` to the `deps` in `tox.ini` . I?m wondering if that?s intentionally not being done

matt.fellows
2020-05-15 00:43
I?m not a Python expert, but not installing dependencies on build seems strange

matt.fellows
2020-05-15 00:43
did you want to include that in your PR (or a separate one)? If it doesn?t break the build, but fixes yours, that seems like a good reason to bring it in

pyasi
2020-05-15 00:48
Sure! I?ll dig in a bit more to maybe see why it?s done this way, but if not can add it in

matt.fellows
2020-05-15 00:50
thx

pyasi
2020-05-15 00:55
Yep that did the trick. I added just `enum34` as a dependency to that build particular py2.7 build step as it shouldn?t be required for anything else

matt.fellows
2020-05-15 00:56
nice

elliottmurray
2020-05-15 10:03
@pyasi looking good. Couple of things - firstly can you rebase against master? Your version number is behind (there was a release since you started work)

elliottmurray
2020-05-15 10:04
I am looking at the enum dependency. I think it needs to go into setup.py too? requirements dev is for the pipeline not for the package release so I think you might need to add that too. I?ll test locally to check

elliottmurray
2020-05-15 10:04
I am actually thinking of doing a major release and deprecating 2.x support

elliottmurray
2020-05-15 10:04
This would avoid these scenarios

elliottmurray
2020-05-15 11:17
Also you need to make some changes to ?pact/_init_.py?

elliottmurray
2020-05-15 11:17
Otherwise you can?t import the Format into another project

elliottmurray
2020-05-15 11:17
I?ll add these to the PR

pyasi
2020-05-15 12:11
Ahh yeah, i had done this previously. I?ll double check that it works- i had it under the `if major version ==2` condition

pyasi
2020-05-15 12:39
Since ```from pact.matchers import get_generated_values self.assertEqual(result, get_generated_values(expected))``` Was in the docs (and works for me). I figured i wouldn?t have to be explicit in _init_


elliottmurray
2020-05-15 12:43
I have a seperate local install and it didn?t work for me when I tried to import format

elliottmurray
2020-05-15 12:43
not sure about get_generated_values

elliottmurray
2020-05-15 12:43
to replicate try a new virtualenv and install local

elliottmurray
2020-05-15 12:43
pip install -e I think

elliottmurray
2020-05-15 12:43
And then from a repl try

elliottmurray
2020-05-15 12:44
```from pact import Format```

elliottmurray
2020-05-15 12:44
It probably works in e2e because it is in that virtualenv and available

pyasi
2020-05-15 12:44
I?ll give it a shot

elliottmurray
2020-05-15 12:44
This is new to me so happy to be educated

elliottmurray
2020-05-15 12:49
Also in tox.ini should it be:

elliottmurray
2020-05-15 12:50
```envlist=py{27,34,35,36,37,38}-{install}```

elliottmurray
2020-05-15 12:50
?

pyasi
2020-05-15 12:50
Okay i reprod and fix via the import

elliottmurray
2020-05-15 12:50
Tox is a mystery to me

pyasi
2020-05-15 12:50
Yeah i messed that up :smiley:. I?ll put it back

elliottmurray
2020-05-15 12:50
:thumbsup:

pyasi
2020-05-15 12:50
But I?m all for deprecating 2.7 :grimacing:

elliottmurray
2020-05-15 12:51
I?m musing that because I think you also have to add enum to setup.py and I don?t want to do that coz it?s complicated

elliottmurray
2020-05-15 12:58
Did you mean to add the venv27 files?

pyasi
2020-05-15 12:58
Nope! Fixing now :facepalm:

elliottmurray
2020-05-15 13:00
I?m going to have a chat with Matt or Beth and see if I should deprecate 2.x. If I do that I think we can make this change a little easier and just apply yours to 3.x

pyasi
2020-05-15 13:02
From what i can tell this should be safe for 2.7 now since i?ve included setup.py change

elliottmurray
2020-05-15 13:02
ok

elliottmurray
2020-05-15 13:04
If that passes I?ll merge it in for now then

pyasi
2020-05-15 13:09
All passed

elliottmurray
2020-05-15 13:16
merged

elliottmurray
2020-05-15 13:16
I won?t release yet though

pyasi
2020-05-15 13:20
Thanks, no rush on the release

lbraymusso
2020-05-19 17:49
@pyasi

pyasi
2020-05-19 17:50
Thank you!

elliottmurray
2020-05-22 12:55
Fail whale hit me before on publish hence 2nd release

elliottmurray
2020-05-22 12:56
Python-pact 1.x.x will now only support Python 3.x upwards.

zeldigas
2020-05-27 12:58
has joined #pact-python

uglyog
2020-05-30 05:02
has joined #pact-python

uglyog
2020-05-31 03:53
@elliottmurray @matt.fellows I got a initial prototype consumer test (a copy of the todo one in Pact-JS) running with the V3 Rust implementation. It's in the feat/V3 branch :point_right: https://github.com/pact-foundation/pact-python/blob/feat/V3/e2e/v3/todo/tests/test_todo_consumer.py

matt.fellows
2020-05-31 06:45
Wow nice man!

matt.fellows
2020-05-31 06:45
I'll take a look tomorrow

elliottmurray
2020-05-31 10:43
So what?s the roadmap and timeline for v3? I haven?t read the docs/impl - I suppose I should!?

uglyog
2020-05-31 22:57
Nah, nobody reads docs :smile: There is no roadmap or timeline, because nobody has created one

matt.fellows
2020-05-31 23:40
Classic Ron tautological response

ajinkya.pande
2020-06-08 14:54
#pact-python is there any documentation or info about Pact with tornado unit tests?

elliottmurray
2020-06-08 19:35
I?m not aware of any. I?m not familiar with tornado. Does it use unit test as it?s default testing library?

cristian.schez
2020-06-09 11:20
has joined #pact-python

elliottmurray
2020-06-10 20:36
@matt.fellows or @bethskurrie I?ve spent a bit of time looking at doing a Python verifier for providers to create a more ?native? experience. Either of you have some time so I can bounce some ideas around?

matt.fellows
2020-06-10 23:36
Absolutely!

bethskurrie
2020-06-17 01:49
It would be good to look at integrating the Rust impl.

matt.fellows
2020-06-17 02:01
I had a good chat with Elliot yesterday Beth

matt.fellows
2020-06-17 02:01
or the other day

matt.fellows
2020-06-17 02:01
one of the days

bethskurrie
2020-06-17 02:01
oh good :thumbsup::skin-tone-3:

matt.fellows
2020-06-17 02:02
I suggested before jumping into Rust, to address some of the Python idioms first and to look at message support (because frankly, both of those things are more important)

bethskurrie
2020-06-17 02:02
true

matt.fellows
2020-06-17 02:02
Once he wraps his head around those, he?ll be much better placed to do any rust integration because most of the core concepts will be pretty clear

bethskurrie
2020-06-17 02:02
:thumbsup::skin-tone-3:

matt.fellows
2020-06-17 02:03
Also, the provider side is not yet ready for Rust just yet - and I?m going through that exercise (slowly) with Go. So once I?ve pushed through it a bit further I?ll be able to provide much better guidance anyway

sklein
2020-06-19 19:35
has joined #pact-python

joel.whalen
2020-06-22 19:43
Hello, I am using pactman and was wondering if there?s any support for it here. I?ve set up pactman correctly according to the docs, but am getting a `NoneType` error for the `_mock_handler` ```test/util/pact/test_order_service_pact.py:87: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <pactman.mock.pact.Pact object at 0x7ff830112a90> def setup(self): > self._mock_handler.setup(self._interactions) E AttributeError: 'NoneType' object has no attribute 'setup' ../.local/lib/python3.7/site-packages/pactman/mock/pact.py:221: AttributeError``` My test class with some sensitive info edited: ```class TestPactOrderService: def test_pact_submit_order(self): expected = { 'orderId': '<orderId>' } pact.given( '<orderId> exists and has a cart <cartId>, with shippingaddress, billingaddress, and shippingmethod' ).upon_receiving( 'a request to submit order' ).with_request( method = 'POST', path = '/v1/order', headers = { 'Content-Type': 'application/json', # TODO: Make this a global variable/secret 'apikey': 'fakeKey', 'Content-Type': 'text/plain' }, body = mock_submit_cart_fixture ).will_respond_with(200, body=expected) pact.setup() try: # Some additional steps before running the code under test result = OrderServiceClientHelper.submit_order(mock_submit_cart_fixture) # Some additional steps before verifying all interactions have occurred finally: pact.verify() self.assertEqual(result, expected)``` Thanks in advance.

joel.whalen
2020-06-22 19:50
Furthermore, if I do it the other way like this: ``` with pact: result = OrderServiceClientHelper.submit_order(mock_submit_cart_fixture)``` It is failing to catch the request with the mock server and so tries to make a real request to the actual URL: ```E urllib3.exceptions.MaxRetryError: MockConnectionPool(host='localhost', port=5020): Max retries exceeded with url: /v1/order (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3c52683048>: Failed to establish a new connection: [Errno 111] Connection refused')) ../.local/lib/python3.7/site-packages/urllib3/util/retry.py:439: MaxRetryError```

matt.fellows
2020-06-22 23:59
Hi Joel, pactman is not supported by the foundation - pact-python is

matt.fellows
2020-06-23 01:20
But hopefully somebody else here can help

matt.fellows
2020-06-23 01:20
We are investing in pact-python, as it lines up with our strategic direction

mukheem
2020-06-23 07:21
Hello @joel.whalen, Though I am not an official member of pactman, I would like to take a chance if I could help. ( I've also started practicing pact recently) Upon going thru the code snippets, I don't see you made a pact In the very first place...

mukheem
2020-06-23 07:21
or did you make it and isn't shown up here ?

joel.whalen
2020-06-23 13:55
I did, I just didn?t post it. In that case I think I?m going to switch to pact-python

joel.whalen
2020-06-23 13:57
here?s the pact ```pact = Consumer('cart-service').has_pact_with(Provider('order-service'))```

joel.whalen
2020-06-23 18:16
So funnily enough, I switched to `pact-python` from `pactman` and am getting the same error. It?s also telling me to check `pact-mock-service.log` for details, but I don?t see that file anywhere. ```E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=5020): Max retries exceeded with url: /v1/order (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff80005db70>: Failed to establish a new connection: [Errno 111] Connection refused')) ../.local/lib/python3.7/site-packages/urllib3/util/retry.py:439: MaxRetryError``` Here?s my test code with some info removed: ```import unittest import atexit from cart_service.util.order_service_client_helper import OrderServiceClientHelper from pact import Consumer, Provider pact = Consumer('cart-service').has_pact_with(Provider('order-service')) pact.start_service() atexit.register(pact.stop_service) mock_submit_cart_fixture = { "some":"JSON" } class TestPactOrderService(unittest.TestCase): def test_pact_submit_order(self): expected = { 'orderId': 'WB3386288919' } pact.given( 'WB3386288919 exists and has a cart yvjJEDY87VAaXw7ZGSOF, with shippingaddress, billingaddress, and shippingmethod' ).upon_receiving( 'a request to submit order' ).with_request( method = 'POST', path = '/v1/order', headers = { 'Content-Type': 'application/json', # TODO: Make this a global variable/secret 'apikey': 'fakeKey', 'Content-Type': 'text/plain' }, body = mock_submit_cart_fixture ).will_respond_with(200, body=expected) pact.setup() try: # Some additional steps before running the code under test result = OrderServiceClientHelper.submit_order(mock_submit_cart_fixture) # Some additional steps before verifying all interactions have occurred finally: pact.verify() self.assertEqual(result, expected)``` I am also running this in a container using `docker-compose` if that is affecting anything network related. Is it possible that?s the issue?

elliottmurray
2020-06-23 18:27
I?d have to look closer but the docker compose is a bit suspicious. How are you invoking that?

joel.whalen
2020-06-23 18:29
@elliottmurray Sure. Here?s the `docker-compose.yml` ```version: '3.7' services: cart-service-redis: container_name: cart-service-redis image: redis stdin_open: true tty: true networks: - cart-service volumes: - $WORKING_DIR/cart_service/redis.conf:/usr/local/etc/redis/redis.conf entrypoint: - /usr/local/bin/redis-server - /usr/local/etc/redis/redis.conf cart-service: depends_on: - cart-service-redis container_name: cart-service image: zorotools/cart-service build: context: $WORKING_DIR/cart_service dockerfile: $WORKING_DIR/cart_service/Dockerfile.k8s stdin_open: true tty: true networks: - zorotools-net - cart-service ports: - ${CART_SERVICE_PORT:-5040}:5040 environment: GOOGLE_CLOUD_PROJECT: $GOOGLE_CLOUD_PROJECT GOOGLE_PROJECT_ID: $GOOGLE_PROJECT_ID GOOGLE_APPLICATION_CREDENTIALS: /home/zoro/credentials/google-product.json REDISHOST: cart-service-redis PRODUCT_CACHE_HOST: $PRODUCT_CACHE_HOST PRODUCT_CACHE_PORT: $PRODUCT_CACHE_PORT PRODUCT_CACHE_COLLECTION: $PRODUCT_CACHE_COLLECTION LOGGING_SERVICE_ENDPOINT: $LOGGING_SERVICE_ENDPOINT SHIPPING_SERVICE_ENDPOINT: $SHIPPING_SERVICE_ENDPOINT ORDER_SERVICE_ENDPOINT: $ORDER_SERVICE_ENDPOINT PROMO_SERVICE_ENDPOINT: $PROMO_SERVICE_ENDPOINT TAX_SERVICE_ENDPOINT: $TAX_SERVICE_ENDPOINT RUN_GUNICORN: ${RUN_GUNICORN:-false} FIRESTORE_MIN_DELAY_SECONDS: $FIRESTORE_MIN_DELAY_SECONDS FIRESTORE_MAX_DELAY_SECONDS: $FIRESTORE_MAX_DELAY_SECONDS FIRESTORE_DELAY_MULTIPLIER: $FIRESTORE_DELAY_MULTIPLIER FIRESTORE_CALL_DEADLINE_SECONDS: $FIRESTORE_CALL_DEADLINE_SECONDS volumes: - $WORKING_DIR/cart_service:/home/zoro/app - $GOOGLE_APPLICATION_CREDENTIALS:/home/zoro/credentials/google-product.json entrypoint: - docker_vm/run.sh cart-service-test: depends_on: - cart-service container_name: cart-service-test image: zorotools/cart-service stdin_open: true tty: true networks: - cart-service-test volumes: - $WORKING_DIR/cart_service:/home/zoro/app entrypoint: - docker_vm/test.sh # Pact consumer tests cart-service-pact: depends_on: - cart-service container_name: cart-service-pact image: zorotools/cart-service stdin_open: true tty: true volumes: - $WORKING_DIR/cart_service:/home/zoro/app entrypoint: - docker_vm/pact.sh # Pact verification cart-service-verify: networks: - zorotools-net image: pactfoundation/pact-cli:latest container_name: cart-service-verify volumes: - $WORKING_DIR/cart_service:/home/zoro/app depends_on: - cart-service environment: PACT_BROKER_TOKEN: $PACT_BROKER_TOKEN PACT_BROKER_BASE_URL: $PACT_BROKER_BASE_URL CONSUMER_VERSION_TAG: $CONSUMER_VERSION_TAG PROVIDER_APP_VERSION: $PROVIDER_APP_VERSION command: > verify --provider-base-url http://cart-service:5040/v1 --provider "cart-service" --broker-token $PACT_BROKER_TOKEN --pact-broker-base-url $PACT_BROKER_BASE_URL --publish-verification-results --consumer-version-tag=$CONSUMER_VERSION_TAG --provider-app-version=$PROVIDER_APP_VERSION networks: zorotools-net: external: True cart-service: cart-service-test:``` I am invoking this by running this command: ```docker-compose run cart-service-pact```

joel.whalen
2020-06-23 18:30
`pact.sh` just runs pytest

elliottmurray
2020-06-24 13:33
So I was able to reduce the compose file to this:

elliottmurray
2020-06-24 13:33
version: ?3.7? services: # Pact consumer tests pact: image: python:3.6 stdin_open: true tty: true working_dir: /usr/src/myapp volumes: - ./:/usr/src/myapp entrypoint: - bash networks: zorotools-net: external: True cart-service: cart-service-test:

elliottmurray
2020-06-24 13:34
and it works for me on my local test (you get a bash prompt as I have a couple of extra steps for my local test project)

elliottmurray
2020-06-24 13:35
`version: '3.7'` services: # Pact consumer tests pact: image: python:3.6 stdin_open: true tty: true working_dir: /usr/src/myapp volumes: - ./:/usr/src/myapp entrypoint: - bash networks: zorotools-net: external: True cart-service: cart-service-test:

elliottmurray
2020-06-24 13:35
So if you can do the same I suspect it?s something else

elliottmurray
2020-06-24 13:36
Also I could do this which is a lot quicker:

elliottmurray
2020-06-24 13:36
docker run -it -v `pwd`:/usr/src/myapp -w /usr/src/myapp python:3.6 bash

elliottmurray
2020-06-24 13:37
At least if that still breaks for you we?re at the same point - I?m using the python standard image

joel.whalen
2020-06-24 16:54
Running that docker-compose yields this when I run `pact.sh` ```bash: pytest: command not found```

joel.whalen
2020-06-24 16:54
the command is `pytest -k "test_pact"` because there are other unit tests I?m trying to exclude

joel.whalen
2020-06-24 16:58
The reason you?re not getting the error is you don?t have the code that?s making the request to the `order-service` at `localhost:5020`. I?m wondering why I?m getting this error because shouldn?t that request be intercepted and mocked? Why is it making a ?real? request? @matt.fellows if you could take a second look at this error I?d appreciate it, I?m still getting it after switching to `pact-python`

joel.whalen
2020-06-24 17:07
Here?s some more error output if that helps. Again, I cannot find the `pact-mock-service.log` file anywhere ```E AssertionError: Actual interactions do not match expected interactions for mock MockService. E E Missing requests: E POST /v1/order E E See pact-mock-service.log for details. ../.local/lib/python3.7/site-packages/pact/pact.py:293: AssertionError```

joel.whalen
2020-06-24 17:24
Ahah! I failed to setup my pact correctly. I changed from this: ```pact = Consumer('cart-service').has_pact_with(Provider('order-service')``` to this: ```pact = Consumer('cart-service').has_pact_with(Provider('order-service'), port=5020)``` Because the `order-service` default endpoint is on port 5020, that?s why I was getting the original error. I?m getting some different errors now, but I think it has more to do with how the `cart-service` code is executing requests I?m not expecting, which is easier to troubleshoot. Thanks for taking a look at this @elliottmurray, I?ll let you know if I resolve the rest of these issues.

joel.whalen
2020-06-24 17:30
However I still can?t find the log file, it has disappeared into the ether. Assuming related to docker-compose

elliottmurray
2020-06-24 18:37
Happy to be a rubber duck!

matt.fellows
2020-06-25 00:07
Thanks for your help Elliot. Joel - was it surprising to you that the request wasn?t _automatically_ sent to the mock server? In JS at least, it?s probably the second largest class of bug we get (Waaaaay behind people not understanding how promises work, but still a large %)

matt.fellows
2020-06-25 00:08
Perhaps that?s something we could look to address going forward - automatic interception of the requests and redirection to the target mock server

matt.fellows
2020-06-25 00:10
You might want to map the directory the log file is written to to a docker volume, and that way after the container is destroyed the log file remains on the host

elliottmurray
2020-06-25 08:54
Extra logging options for Pact released!

bethskurrie
2020-06-25 09:09
Thanks for the quick turnaround @elliottmurray

suma.papanna
2020-06-25 10:54
has joined #pact-python

tausif8709
2020-06-25 17:31
has joined #pact-python

tausif8709
2020-06-25 17:35
Hi Guys, I am doing a POC on pact-python for microservices , could you please advice on the best approach for testing the consumer pacts locally by setting up dummy provider states? Thanks in advance :slightly_smiling_face: Tausif

ayyamuthutechnical
2020-06-25 17:51
has joined #pact-python

ayyamuthutechnical
2020-06-25 17:53
@here, Currently working on pact-python for microservices, Is there any good documentation or tutorial available for python version as like javascript or Java. Thanks in advance for your support and help. Ayyamuthu

bethskurrie
2020-06-26 00:02
@elliottmurray and @matthew.balvanz would you guys be able to adopt semantic commits (and document this for PRs) for pact-python? I'm syncing the readme and changelog (and any other markdown files you'd like) into http://docs.pact.io to make everything super searchable. If you use semantic commits we can filter out all the noise (also, can completely automate the release note process if you're interested). Have a look at the jvm ones. https://docs.pact.io/implementation_guides/jvm/changelog

bethskurrie
2020-06-26 00:03
It means that any fixes or improvements to things will now come up in the search results on the website which will make finding things much easier.

bethskurrie
2020-06-26 01:35
Pact Python docs are now live at https://docs.pact.io/implementation_guides/python/readme :heart:

elliottmurray
2020-06-26 07:57
I did start looking at this a couple of weeks ago but it didn?t work first time and I got bored! I?ll have another crack at it. It?s been on my todo list

bethskurrie
2020-06-26 08:05
The crux of the logic is in this file here


bethskurrie
2020-06-26 08:06
It could be mostly done with a slight tweak to the current command.

bethskurrie
2020-06-26 08:06
But of course, all the formatting and grouping that you'd get with a package would be nice.



ayyamuthutechnical
2020-06-26 08:53
@elliottmurray thanks for the info.

elliottmurray
2020-06-26 08:54
So the samples need some love but does that not give you an example?

tausif8709
2020-06-26 09:19
@elliottmurray Yes , Thanks for the quick response :100:

elliottmurray
2020-06-26 09:30
@beth happy for me to merge? I?m happy with the PR for the gh action but haven?t tested it.

naz
2020-06-26 13:06
has joined #pact-python

matthew.balvanz
2020-06-26 13:27
I like automating things, so I'd be happy to use semantic commits.

joel.whalen
2020-06-26 14:08
oh that?s a good idea I?ll try that today

joel.whalen
2020-06-26 14:48
Yes it was surprising it wasn?t automatic, but seeing as I didn?t tell the mock server *where* to listen for requests it?s understandable why it didn?t.

amaljayaraj07
2020-06-30 08:30
has joined #pact-python

ayyamuthutechnical
2020-07-03 10:15
@here, Hi team, I am using the pact-python e2e for poc,https://github.com/pact-foundation/pact-python/tree/master/examples/e2e While running the test for provider states using the shell script like ./verify_pact.sh 1 I am getting the below error, Can you please help me on this. Thanks

ayyamuthutechnical
2020-07-03 10:15
```Traceback (most recent call last): File "pact_provider.py", line 3, in <module> from .src.provider import app, fakedb ImportError: attempted relative import with no known parent package Error reading file from http://127.0.0.1/pacts/provider/UserService/consumer/UserServiceClient/latest HTTP request failed: status=404 /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:71:in `block in get_remote_with_retry' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:60:in `times' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:60:in `get_remote_with_retry' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:41:in `render_pact' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:22:in `read' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_source.rb:16:in `pact_json' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_spec_runner.rb:115:in `collect' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_spec_runner.rb:115:in `pact_jsons' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_spec_runner.rb:78:in `configure_rspec' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_spec_runner.rb:32:in `run' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/cli/run_pact_verification.rb:69:in `run_with_pact_uri_object' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/cli/run_pact_verification.rb:50:in `run_specs' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/cli/run_pact_verification.rb:21:in `call' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/cli/run_pact_verification.rb:13:in `call' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:171:in `verify_pact' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:43:in `block in call' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:42:in `collect' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:42:in `call' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:34:in `call' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/cli/verify.rb:58:in `verify' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/app/pact-provider-verifier.rb:33:in `<main>' /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:71:in `block in get_remote_with_retry': HTTP request failed: status=404 (Pact::PactFile::HttpError) from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:60:in `times' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:60:in `get_remote_with_retry' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:41:in `render_pact' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.0/lib/pact/consumer_contract/pact_file.rb:22:in `read' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_source.rb:16:in `pact_json' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_spec_runner.rb:115:in `collect' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_spec_runner.rb:115:in `pact_jsons' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_spec_runner.rb:78:in `configure_rspec' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/provider/pact_spec_runner.rb:32:in `run' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/cli/run_pact_verification.rb:69:in `run_with_pact_uri_object' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/cli/run_pact_verification.rb:50:in `run_specs' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/cli/run_pact_verification.rb:21:in `call' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.50.1/lib/pact/cli/run_pact_verification.rb:13:in `call' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:171:in `verify_pact' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:43:in `block in call' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:42:in `collect' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:42:in `call' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/app.rb:34:in `call' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/cli/verify.rb:58:in `verify' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.31.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start' from /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/app/pact-provider-verifier.rb:33:in `<main>' Tearing down Flask server 7195 Kill provider app with pid kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]```

elliottmurray
2020-07-03 13:08
I?ll have a look over the weekend - they?re not yet rigged up to CI so it is very possible there are regressions

elliottmurray
2020-07-03 13:08
Can you check that broker pacts are present:


a.catalucci
2020-07-04 10:28
has joined #pact-python

ayyamuthutechnical
2020-07-06 05:21
No the pacts are not present in my local. How to make it available? How i should i proceed now? Can you please help Thanks

vasile.pop971
2020-07-06 07:44
has joined #pact-python

vasile.pop971
2020-07-06 07:48
Hi there. Does anybody have any documentation/examples on using pact-python for event messaging? (in my case, Kafka)

elliottmurray
2020-07-06 08:09
Hey vasile. Not yet. I believe there are some for other languages. It is on my radar. I?d be willing to work with you on it but at point I?m not sure how to do it!

vasile.pop971
2020-07-06 08:12
found some JVM example, but seems to have built-in functionality

elliottmurray
2020-07-06 08:50
So this worked straight out of the box for me.

elliottmurray
2020-07-06 08:50
I suggest a fresh install, make sure you have docker compose running in a separate shell (in the README)

elliottmurray
2020-07-06 08:50
Instructions I ran:

elliottmurray
2020-07-06 08:51
`git clone git@github.com:pact-foundation/pact-python.git && cd pact-python`

bethskurrie
2020-07-06 08:51
Yeah, pact python works differently

bethskurrie
2020-07-06 08:51
Someone may have started it already? But I lose track!

elliottmurray
2020-07-06 08:51
`# setup viritualenv - I use direnv but that is for you` `pip install -r requirements_dev.txt`

elliottmurray
2020-07-06 08:52
cd examples/e2e pytest --publish-pact=0.1 ./verify_pact.sh 1

elliottmurray
2020-07-06 08:53
sorry typo - above was: `pytest --publish-pact=1`

elliottmurray
2020-07-06 08:54
I get

elliottmurray
2020-07-06 08:55
There is currently nothing built into pact python to deal with Kafka afaik

bethskurrie
2020-07-06 09:51
Message pact just tests the business logic, and avoids testing the protocol.

bethskurrie
2020-07-06 09:52
So there won't ever be anything Kafka specific.

vasile.pop971
2020-07-06 09:54
of course, no messages sent via Kafka, but how do you test the event messages?

ayyamuthutechnical
2020-07-06 10:52
@elliottmurray, Thank you, i have tried to run the command pytest --publish-pact=1 and now i am getting latest pact in the localhost http://127.0.0.1/pacts/provider/UserService/consumer/UserServiceClient/latest But while running the command "./verify_pact.sh" I am getting below error ```Validating provider locally Traceback (most recent call last): File "pact_provider.py", line 3, in <module> from .src.provider import app, fakedb ImportError: attempted relative import with no known parent package INFO: Reading pact at tests/userserviceclient-userservice.json Verifying a pact between UserServiceClient and UserService Given UserA exists and is not an administrator a request for UserA with GET /users/UserA returns a response which has status code 200 (FAILED - 1) has a matching body (FAILED - 2) Given UserA does not exist a request for UserA with GET /users/UserA returns a response which has status code 404 (FAILED - 3) Failures: 1) Verifying a pact between UserServiceClient and UserService Given UserA exists and is not an administrator a request for UserA with GET /users/UserA returns a response which has status code 200 Failure/Error: set_up_provider_states interaction.provider_states, options[:consumer] Faraday::ConnectionFailed: Connection refused - connect(2) for "localhost" port 5001 # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `initialize' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `open' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `block in connect' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/timeout.rb:74:in `timeout' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:878:in `connect' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:863:in `do_start' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:852:in `start' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:1375:in `request' # ------------------ # --- Caused by: --- # Errno::ECONNREFUSED: # Connection refused - connect(2) for "localhost" port 5001 # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `initialize' 2) Verifying a pact between UserServiceClient and UserService Given UserA exists and is not an administrator a request for UserA with GET /users/UserA returns a response which has a matching body Failure/Error: set_up_provider_states interaction.provider_states, options[:consumer] Faraday::ConnectionFailed: Connection refused - connect(2) for "localhost" port 5001 # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `initialize' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `open' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `block in connect' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/timeout.rb:74:in `timeout' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:878:in `connect' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:863:in `do_start' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:852:in `start' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:1375:in `request' # ------------------ # --- Caused by: --- # Errno::ECONNREFUSED: # Connection refused - connect(2) for "localhost" port 5001 # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `initialize' 3) Verifying a pact between UserServiceClient and UserService Given UserA does not exist a request for UserA with GET /users/UserA returns a response which has status code 404 Failure/Error: set_up_provider_states interaction.provider_states, options[:consumer] Faraday::ConnectionFailed: Connection refused - connect(2) for "localhost" port 5001 # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `initialize' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `open' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `block in connect' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/timeout.rb:74:in `timeout' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:878:in `connect' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:863:in `do_start' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:852:in `start' # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:1375:in `request' # ------------------ # --- Caused by: --- # Errno::ECONNREFUSED: # Connection refused - connect(2) for "localhost" port 5001 # /Users/aarchunan/pactpython/lib/python3.7/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `initialize' 2 interactions, 2 failures Failed interactions: PACT_DESCRIPTION='a request for UserA' PACT_PROVIDER_STATE='UserA exists and is not an administrator' /Users/aarchunan/pactpython/bin/pact-verifier --provider-base-url=http://localhost:5001 --provider-states-setup-url=http://localhost:5001/_pact/provider_states tests/userserviceclient-userservice.json # A request for usera given UserA exists and is not an administrator PACT_DESCRIPTION='a request for UserA' PACT_PROVIDER_STATE='UserA does not exist' /Users/aarchunan/pactpython/bin/pact-verifier --provider-base-url=http://localhost:5001 --provider-states-setup-url=http://localhost:5001/_pact/provider_states tests/userserviceclient-userservice.json # A request for usera given UserA does not exist Tearing down Flask server 62907 Kill provider app with pid kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]```

elliottmurray
2020-07-06 10:56
I?m not at my computer but I think 5001 is the port that the provider in the example should be listening to. IIRC it?s a flask app. Make sure that started and shut down properly as I suspect that?s the problem

elliottmurray
2020-07-06 10:56
Ps -ef probably

matt.fellows
2020-07-06 11:26
Here's an example JS Kafka consumer that should help you understand the process https://github.com/pactflow/example-consumer-js-kafka

matt.fellows
2020-07-06 11:26
I responded to your GH issue. There is an Open PR and issues to track this

matt.fellows
2020-07-06 11:26
If you wanted to help I could assist in the how

vasile.pop971
2020-07-06 11:41
Thanks, very limited time, but I would like to try it. Will look at JS example

ayyamuthutechnical
2020-07-06 14:03
@elliottmurray, Now it is working. Thanks for your timely help.

matt.fellows
2020-07-07 11:15
WOW, we missed this: https://www.udemy.com/course/introduction-to-contract-testing-with-pact/ Lewis Prescott from Cancer Research UK created this course. Has anybody completed it?

elliottmurray
2020-07-07 12:56
Was this intended for general?

elliottmurray
2020-07-07 12:57
I have actually been playing around looking at Udemy for publishing content but might be worth an investment to get an official course?

matt.fellows
2020-07-07 13:10
Yes in hindsight. I was linked to it from a python project so assumed it was python content but the blurb doesn't match

camila.pinto-ext
2020-07-07 14:16
has joined #pact-python

fernando.martin
2020-07-07 14:55
has joined #pact-python

danhitchcock
2020-07-07 15:16
has joined #pact-python

danhitchcock
2020-07-07 15:31
Hi there, So i've been asked to write the provider test in Python (the client tests are in JS and i managed to set the state in a similar way to below when running the provider tests in JS, but i am unfamiliar with how i return a header in Python). ```from flask import jsonify, request @app.route('/_pact/provider_states', methods=['POST']) def provider_states(): mapping = {'with auth': setup_auth, 'without_auth': setup_no_auth} mapping[request.json['state']]() return jsonify({'result': request.json['state']}) def setup_auth(): authKey = 'Token abc132' def setup_no_auth(): authKey = 'Token' if __name__ == '__main__': app.run(debug=True, port=5001)```

chawlapriyanka29
2020-07-07 17:15
has joined #pact-python

danhitchcock
2020-07-08 15:52
So far I've yet to find that one liner in Python that sets the header, the provider states is working but setting the header is elusive

danhitchcock
2020-07-09 08:10
So my only other option is to split auth and non auth tests and use the add header command line for each set. I'll update the code if I find a way to update the auth header for each state, as this is my preferred option

joguespermana
2020-07-09 09:13
I would definitely enroll if we have one specifically for python :slightly_smiling_face:

matt.fellows
2020-07-09 10:34
calling @bernardoguerr :stuck_out_tongue:

danhitchcock
2020-07-09 14:02
6 hours later.... ARGGGGGG Ok so you can set env variables in python but there seem to be some conditions i am not meeting as the value isn't updated by ```os.environ["CUSTOM_PROVIDER_HEADER"]="some text" ```

danhitchcock
2020-07-10 07:32
I decided to just split the auth and non-auth tests, python seems to have some restrictions on how you change env variables at runtime. Despite a bit of reading on the pact docs, I am not sure if there is a way i can send back an updated header value to the pact process. Maybe this is my inexperience in python showing through, so more reading on the subject.

joel.whalen
2020-07-10 13:56
There aren?t many people in the ruby standalone channel, so I?ll link my question here as well. I?m using pact-python and am wondering how everyone here has implemented their publish step? I can?t seem to get it to work on the official docker image https://pact-foundation.slack.com/archives/C9WTB2JDV/p1594322837008800

sklein
2020-07-10 14:01
For python consumers... I wrote a base class that looks like ```from django.conf import settings from pact import Consumer, Provider, EachLike, Like, Term log = logging.getLogger(__name__) logging.basicConfig(level=http://logging.INFO) PACT_MOCK_HOST = "localhost" PACT_MOCK_PORT = 1234 PACT_DIR = os.path.dirname(os.path.realpath(__file__)) PACT_BROKER_BASE_URL = settings.PACT_BROKER_BASE_URL PACT_BROKER_TOKEN = settings.PACT_BROKER_TOKEN PACT_PUBLISH_TO_BROKER = settings.PACT_PUBLISH_TO_BROKER PACT_CONSUMER_BRANCH = settings.PACT_CONSUMER_BRANCH VERSION = settings.GIT_COMMIT_SHORT_HASH class PactConsumerSetup: def __init__(self, consumer, provider): self.consumer = consumer self.provider = provider def pact(self): return Consumer( self.consumer, tags=[PACT_CONSUMER_BRANCH], version=VERSION ).has_pact_with( Provider(self.provider), host_name=PACT_MOCK_HOST, port=PACT_MOCK_PORT, pact_dir=PACT_DIR, log_dir=PACT_DIR, publish_to_broker=PACT_PUBLISH_TO_BROKER, broker_base_url=PACT_BROKER_BASE_URL, broker_token=PACT_BROKER_TOKEN, )``` We use django as our web framework of choice so settings are read in using django.settings as environment variables

sklein
2020-07-10 14:02
the `has_pact_with` method takes in `publish_to_broker` flag that will push to the broker if true

joel.whalen
2020-07-10 14:03
oh the `pact` object itself can handle publishing? I had no idea I thought you needed an external CLI tool. The docs don?t mention this at all https://github.com/pact-foundation/pact-python


sklein
2020-07-10 14:04
correct not in the docs. i spent a lot of time in the code base to find some of this

joel.whalen
2020-07-10 14:04
thank you for pointing this out, those docs need some updates then for sure

sklein
2020-07-10 14:07
i've also found that the bundled `pact-verifier` installed with `pact-python` is a bit behind the ruby impl so i've defaulted to fall back to using the cli docker image and wrapping everything up in a compose stack as a part of our pipeline... but that's probably too much information you didnt need :slightly_smiling_face:

joel.whalen
2020-07-10 14:09
No, I definitely am thinking about doing the same thing. I did it that way for our pact-js implementation as well. Except our devops team doesn?t use docker-compose, but pod templates so I really need to learn that next?

sklein
2020-07-10 14:10
if you're using kube the service spec is really basically just a wrapper on top of docker-compose

joel.whalen
2020-07-10 14:11
I?ll take a look, thanks for the heads up

matt.fellows
2020-07-10 14:12
Joel can you elaborate on your pact JS case?

matt.fellows
2020-07-10 14:12
As in, why you don't use the JS verifier (it's good feedback for us)

joel.whalen
2020-07-10 14:15
Ah, sorry for the confusion: Our pact-js implementation is just on the consumer side; the verification happens on the provider which is written in python so we just used the pact CLI in docker to do that. Which is why the docker image was my first go-to for publishing python consumer tests, but as you can see I couldn?t get that to work. Here?s the verification step in docker-compose: ``` # Pact verification cart-service-verify: networks: - zorotools-net image: pactfoundation/pact-cli:latest container_name: cart-service-verify volumes: - $WORKING_DIR/cart_service:/home/zoro/app depends_on: - cart-service environment: PACT_BROKER_TOKEN: $PACT_BROKER_TOKEN PACT_BROKER_BASE_URL: $PACT_BROKER_BASE_URL CONSUMER_VERSION_TAG: $CONSUMER_VERSION_TAG PROVIDER_APP_VERSION: $PROVIDER_APP_VERSION command: > verify --provider-base-url http://cart-service:5040/v1 --provider "cart-service" --broker-token $PACT_BROKER_TOKEN --pact-broker-base-url $PACT_BROKER_BASE_URL --publish-verification-results --consumer-version-tag=$CONSUMER_VERSION_TAG --provider-app-version=$PROVIDER_APP_VERSION```

matt.fellows
2020-07-10 14:20
Ah cool. Gotcha. Thanks yes it looks like we have some docs work to do!

matt.fellows
2020-07-10 14:20
Elliot has recently added a PR to improve the verification there so hopefully that will go a way to improving things

joel.whalen
2020-07-10 14:21
Yes, for both pact-python and the docker hub instructions as well. Awesome, it?s good to see something like this develop and get active work done on it.

matt.fellows
2020-07-10 14:22
We've also got a v3 compatible verifier

joel.whalen
2020-07-10 14:23
I think I?m still on v2 but I?m not sure. That?ll be nice to upgrade to

matt.fellows
2020-07-10 14:23
It's missing a few of the Pact broker integrations but add soon as they are in we should swap over asap

joel.whalen
2020-07-10 14:24
I will keep that in mind. We?re still in the early stages so changing things around isn?t too difficult right now

joel.whalen
2020-07-10 18:51
Alright so I went off of @sklein?s suggestion to create a base pact setup class to handle pact publication, but I don?t think it?s working. For one, I?m getting an error related to `atexit` ```Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__ restore_signals, start_new_session) File "/usr/local/lib/python3.7/subprocess.py", line 1453, in _execute_child restore_signals, start_new_session, preexec_fn) TypeError: expected str, bytes or os.PathLike object, not Head ``` Secondly, the publish step never happens, even if I remove the `atexit.register(pact.stop_service)` call. Here is my setup class: ```from os import environ from pact import Consumer, Provider, EachLike, Like, Term import git repo = git.Repo('.') branch_name = repo.active_branch version_sha = repo.head.object.hexsha PACT_DIR = environ.get('PACT_DIR', 'pacts') PACT_BROKER_BASE_URL = environ.get('PACT_BROKER_BASE_URL', 'https://my.broker.url.au') PACT_BROKER_TOKEN = environ.get('PACT_BROKER_TOKEN') PACT_PUBLISH_TO_BROKER = environ.get('PACT_PUBLISH_TO_BROKER', True) PACT_CONSUMER_BRANCH = environ.get('PACT_CONSUMER_BRANCH', branch_name) VERSION = environ.get('VERSION', version_sha) class PactConsumerSetup: def __init__(self, consumer, provider, port): self.consumer = consumer self.provider = provider self.port = port def pact(self): return Consumer( self.consumer, tags=[PACT_CONSUMER_BRANCH], version=VERSION ).has_pact_with( Provider(self.provider), port=self.port, pact_dir=PACT_DIR, log_dir=PACT_DIR, publish_to_broker=PACT_PUBLISH_TO_BROKER, broker_base_url=PACT_BROKER_BASE_URL, broker_token=PACT_BROKER_TOKEN, )``` And here is the test code:

joel.whalen
2020-07-10 18:51
```import unittest import atexit from copy import deepcopy from cart_service.service.cart_service import CartService from cart_service.client.cart_firestore_client import CartFirestoreClient from cart_service.service.product_cache_service import ProductCacheService from test.fixtures.cart_fixtures import submit_cart_request, submit_payment_request from test.fixtures.product_cache_fixture import product_cache_response from pact import Consumer, Provider import pytest from .pact_setup import PactConsumerSetup pact = PactConsumerSetup(consumer='cart-service', provider='order-service', port=5020).pact() pact.start_service() atexit.register(pact.stop_service) # Module Namespaces cart_service_ns = "cart_service.service.cart_service" service_ns = "cart_service.service" cart_firestore_client_ns = "cart_service.client.cart_firestore_client" pc_ns = "cart_service.service.product_cache_service" mock_submit_order_fixture = { "some":"JSON" } class TestPactOrderService: def test_pact_submit_order(self, mocker): mocker.patch(f"{cart_service_ns}.app") mocker.patch(f"{cart_firestore_client_ns}.app") mocker.patch(f"{pc_ns}.app") mocker.patch(f"{service_ns}.cart_service_decorator.cart_mutating", lambda x: x) mock_firestore_client_init = mocker.patch.object(CartFirestoreClient, "__init__") mock_firestore_client_init.return_value = None mock_firestore_get_cart = mocker.patch(f"{cart_service_ns}.CartFirestoreClient.get_cart") mock_firestore_get_cart.return_value = submit_cart_request mock_cache_helper = mocker.patch(f"{cart_service_ns}.CacheHelper.set") mock_cache_helper.return_value = True mock_cache_get = mocker.patch(f"{cart_service_ns}.CacheHelper.get") mock_cache_get.return_value = {} mocker.patch(f"{cart_service_ns}.CartFirestoreClient.update_cart_status") mocker.patch(f"{cart_service_ns}.CacheHelper.bust_cache") mock_prod_cache_init = mocker.patch.object(ProductCacheService, "__init__") mock_prod_cache_init.return_value = None product_cache_response_c = deepcopy(product_cache_response) mock_get_products = mocker.patch(f"{pc_ns}.ProductCacheService.get_products") mock_get_products.return_value = product_cache_response_c expected = { 'orderId': 'wacky_test_order' } pact.given( 'order does not exist, but cart yvjJEDY87VAaXw7ZGSOF does exist' ).upon_receiving( 'a request to submit order' ).with_request( method='POST', path='/v1/order', headers={ 'Content-Type': 'application/json', }, body=mock_submit_order_fixture ).will_respond_with(200, body=expected) pact.setup() try: # Some additional steps before running the code under test result = CartService().submit_order('yvjJEDY87VAaXw7ZGSOF', submit_payment_request) # Some additional steps before verifying all interactions have occurred finally: pact.verify() assert result == expected``` To recap: Pact is being generated just fine with this method, but publish is failing to happen. `atexit` doesn?t seem to be related, whether I include it or not the publish step doesn?t work.

joel.whalen
2020-07-10 18:58
Sidenote: This is a python newbie question, but how do I get my linter to agree that the class signature for `Consumer` is correct? It seems to think it can only take 2 options instead of 4.

matt.fellows
2020-07-11 03:34
I do know much Python, but will make a note to revisit this convo on Monday

matt.fellows
2020-07-11 03:35
FWIW I typically don?t have the publish as part of the test itself

elliottmurray
2020-07-15 20:50
So I actually didn?t know there was a publish to broker in the consumer interface!

elliottmurray
2020-07-15 20:52
My test project does something like:

elliottmurray
2020-07-15 20:53
`S> 41 def push_to_broker(version):` with open(os.path.join(PACT_DIR, PACT_FILE), ?rb?) as pact_file: pact_file_json = json.load(pact_file) basic_auth = HTTPBasicAuth(PACT_BROKER_USERNAME, PACT_BROKER_PASSWORD) r = requests.put( ?{}/{}?.format(PACT_UPLOAD_URL, version), auth=basic_auth, json=pact_file_json, verify=False ) if not r.ok: log.error(?Error uploading: %s?, r.content) r.raise_for_status()

elliottmurray
2020-07-15 20:53
I?ll have a look at it in a bit

elliottmurray
2020-07-15 21:03
Looking for a volunteer - will be less than an hour of your time if you have a working python pact project. I have a largish refactor waiting to be merged in. I am fairly comfortable I have covered all regressions but it?s a bigger change than I normally like to make and more testing is good. If anyone wants to help out testing it - should take about half hour of your time to get me some quick feedback. In particular (though not only) interested in windows users, anyone doing provider/verification as that?s the bit with the biggest change. Something that is already running in CI extra cool. Please DM me - I?m on UK time.

sairsule
2020-07-20 16:10
has joined #pact-python

sairsule
2020-07-20 16:48
@sairsule has left the channel

ashish_garg5
2020-07-21 07:01
has joined #pact-python

ashish_garg5
2020-07-21 07:03
Hi All, ```http://localhost:8500/pacts/provider/provider/consumer/consumer/version/1.0.0``` I am using this broker url to make a put request in python now i want to add pact-broker-username and pact-broker-password as well, how to do that ? Can i pass in this same url or there is any other way. Thanks.

maciej.olko
2020-07-21 07:33
that may be question to ask on #pact-broker channel

matt.fellows
2020-07-21 07:34
lol he just got referred from that channel, as he?s asking a Python specific question

matt.fellows
2020-07-21 07:34
Sorry Ashish

matt.fellows
2020-07-21 07:34
Look, If we understand correctly, you?re asking a really basic question about how to add basic auth to a python request

matt.fellows
2020-07-21 07:34
For example, if you?re using the Python Requests library, you do it this way: https://requests.readthedocs.io/en/master/user/authentication/#basic-authentication

matt.fellows
2020-07-21 07:35
If you use the Pact CLI docker tools (https://hub.docker.com/r/pactfoundation/pact-cli) you just execute the docker command and pass in the token that way

elliottmurray
2020-07-21 08:17
verifying or publishing?


elliottmurray
2020-07-21 08:18
I?m close to having an api for the provider that is more native (I?ve been stalling) if that?s what you?re after. I?m hoping to have a sample in pytest (actually the sample is there in master but I haven?t finished implementing it fully yet)

elliottmurray
2020-07-21 08:19
It?ll allow broker authentication

elliottmurray
2020-07-21 08:19
Also yes you can use requests

elliottmurray
2020-07-21 08:20
```def push_to_broker(version): """TODO: see if we can dynamically learn the pact file name, version, etc.""" with open(os.path.join(PACT_DIR, PACT_FILE), 'rb') as pact_file: pact_file_json = json.load(pact_file) basic_auth = HTTPBasicAuth(PACT_BROKER_USERNAME, PACT_BROKER_PASSWORD) http://log.info("Uploading pact file to pact broker...") r = requests.put( "{}/{}".format(PACT_UPLOAD_URL, version), auth=basic_auth, json=pact_file_json ) if not r.ok: log.error("Error uploading: %s", r.content) r.raise_for_status()```

elliottmurray
2020-07-21 08:21
urgh - why does threads code blocks suck?

elliottmurray
2020-07-21 08:21
anyway you get the idea from that

ashish_garg5
2020-07-21 08:22
yes exactly m looking for this - ```r = requests.put( "{}/{}".format(PACT_UPLOAD_URL, version), auth=basic_auth, json=pact_file_json )``` but addinglike this auth=basic_auth doesn't work for me

elliottmurray
2020-07-21 08:23
http not https right?

ashish_garg5
2020-07-21 08:24
yes http

elliottmurray
2020-07-21 08:24
and works with something like curl or wget or httpie?

elliottmurray
2020-07-21 08:24
Just reducing the problem to python

ashish_garg5
2020-07-21 08:25
```PACT_BROKER_USERNAME = 'test' PACT_BROKER_PASSWORD = 'test' basic_auth = HTTPBasicAuth(PACT_BROKER_USERNAME, PACT_BROKER_PASSWORD) broker_url = 'http://localhost:8500/pacts/provider/provider/consumer/consumer/version/1.0.0'.format( provider='provider', consumer='consumer', consumerApplicationVersion='1.0.0', auth=basic_auth)```

ashish_garg5
2020-07-21 08:26
so like this m doing

ashish_garg5
2020-07-21 08:26
```resp = requests.put(broker_url, data = open(pactfile, 'rb'), headers=headers)``` and then making this put request

elliottmurray
2020-07-21 08:28
sorry I?m missing something - is broker url a string? Why do you format with those params (as there doesn?t seem to be placeholders for them)

ashish_garg5
2020-07-21 08:29
so i took this from some example not sure why this format is required

elliottmurray
2020-07-21 08:30
I?d expect the auth key to be used in the requests put method

elliottmurray
2020-07-21 08:30
```r = requests.put( "{}/{}".format(PACT_UPLOAD_URL, version), auth=basic_auth, json=pact_file_json )```

elliottmurray
2020-07-21 08:30
Change ?{}/{}?.format(PACT_UPLOAD_URL, version) for broker url

ashish_garg5
2020-07-21 08:31
ok let me try

ashish_garg5
2020-07-21 08:31
thanks

elliottmurray
2020-07-21 08:32
So for my context - would you describe yourself as a dev or a tester?

ashish_garg5
2020-07-21 08:33
dev

elliottmurray
2020-07-21 08:33
ok - if you?re struggling with the python I do find some of the cli tools like curl a way of debugging these calls

elliottmurray
2020-07-21 08:34
as you can demonstrate it is broker or not brokers fault in this case

ashish_garg5
2020-07-21 08:34
ok

ashish_garg5
2020-07-22 06:24
Hi All, I am making a put request to publish the PACT. ```PACT_BROKER_URL+'/pacts/provider/provider/consumer/consumer/version/1.0.0'``` how can i publish TAG to the broker ? Thanks.

bethskurrie
2020-07-22 06:26
@ashish_garg5 please look for the documentation on http://docs.pact.io

bethskurrie
2020-07-22 06:26
There is a search bar in the top right.

bethskurrie
2020-07-22 06:26
type in the word "tags"

bethskurrie
2020-07-22 06:27
I am pretty sure there is support for publishing pacts with tags using the pact python library

bethskurrie
2020-07-22 06:28
Why are you doing manual PUT requests?

ashish_garg5
2020-07-22 06:29
```PACT_BROKER_URL+'/pacts/provider/provider/consumer/consumer/version/1.0.0/tags/tagName'``` yeah there they have given /tags/tagname but its not working for me


ashish_garg5
2020-07-22 06:30
so i am doing the poc so for testing purpose i am doing manually as of now later i will change

bethskurrie
2020-07-22 06:32
can you use docker?

ashish_garg5
2020-07-22 06:33
ok let me check thanks

bethskurrie
2020-07-22 06:34
You should be able to publish pacts with tags via the python interface. if you can't do that, then you can use the pact-cli in the docker container here https://hub.docker.com/r/pactfoundation/pact-cli


bethskurrie
2020-07-22 06:34
If you really must do it manually (which I don't recommend), then you can look at the docs here https://docs.pact.io/pact_broker/tags#creating-tags

matt.fellows
2020-07-22 06:39
@ashish_garg5 the amount of effort in ?doing it manually? seems backwards to me. Use the tools that already exist for this purpose, and ?do it manually? when you need to customise and know what you?re doing

matt.fellows
2020-07-22 06:40
Because after you publish and then tag, I expect the next request will be how do I retrieve based on tags, publish results etc. etc.

bethskurrie
2020-07-22 06:40
Exactly. Manually is much harder and requires you to understand all the underlying APIs.

matt.fellows
2020-07-22 06:40
you?re just going to be building out a CLI that already exists

ashish_garg5
2020-07-22 07:40
ok thanks @matt.fellows and @bethskurrie for your inputs. i will consider this :slightly_smiling_face:

ashish_garg5
2020-07-22 11:12
Hi, Now i am using CLI and running the below command. pact-broker publish PACT_DIRS_OR_FILES ./pacts --consumer-app-version 1.0.0 --tag dev --broker-base-url http://localhost:8500 I have created folder with name pacts in my project and my json is inside that, but getting below error. Not sure if PACT_DIRS_OR_FILES path i have to give like this Errno::ENOENT: No such file or directory @ rb_sysopen - PACT_DIRS_OR_FILES

matt.fellows
2020-07-22 11:40
Ashish, that message looks very clear to me.

matt.fellows
2020-07-22 11:40
`PACT_DIRS_OR_FILES` is not a file or a path. just remove it, it is a placeholder for where you can put a path to a file, a directory or multiple files/directories

ashish_garg5
2020-07-22 11:44
ohh ok thanks

bethskurrie
2020-07-25 03:24
@elliottmurray you've been keeping Github busy. Appreciate your work!

matt.fellows
2020-07-25 10:57
Yes - it?s awesome to see!

matt.fellows
2020-07-25 10:58
Pact for Data Science, Elliot?

wesleythomaswilliams
2020-07-27 11:48
has joined #pact-python

david025
2020-07-29 11:19
has joined #pact-python

vishwa.amit
2020-07-30 12:39
has joined #pact-python

maciej.olko
2020-07-31 11:33
Hi, after bumping pact-python to 1.2.0 one of our contract verifications fails with: ```$ pact-verifier --provider-base-url http://fake-?:8000 https://?/pacts/provider/?/consumer/?/latest --custom-provider-header "?" --provider-states-setup-url http://fake-?:8000/setup_states/ --provider-app-version $CI_COMMIT_REF_NAME 87 WARN: Ignoring unsupported matching rules {"match"=>"type"} for path $['query']['start'][0] 88 WARN: Ignoring unsupported matching rules {"match"=>"type"} for path $['query']['end'][0] 89 INFO: Reading pact at https://?/pacts/provider/?/consumer/?/latest 90 Verifying a pact between ? and ? 91 Given ? 92 ? 93 with GET ? 94 returns a response which 95 has status code 200 (FAILED - 1) 96 has a matching body (FAILED - 2) 97 includes headers 98 "Content-Type" which equals "application/json" ? 1) Verifying a pact between ? and ? ? ? with GET ? returns a response which has status code 200 202 Failure/Error: expect(response_status).to eql expected_response_status 203 expected: 200 204 got: 401 205 (compared using eql?) 206 2) Verifying a pact between ? and ? ? ? with GET ? returns a response which has a matching body 207 Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example 208 Actual: {"error":true,"message":"The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required."} 209 Diff 210 -------------------------------------- 211 Key: - is expected 212 + is actual 213 Matching keys and values are not shown 214 -? 221 +{ 222 + "error": true, 223 + "message": "The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required." 224 +}``` Did something change with authorisation on mocks or headers? Do you have any hints?

elliottmurray
2020-07-31 14:27
Hmm it might have been an introduced bug. I did a refactor. I?ll look at it tomorrow. Take it it works on 1.1?

maciej.olko
2020-07-31 14:29
Yes, works on 1.1.0

maciej.olko
2020-07-31 14:32
Feel free to contact me if more details are needed.

elliottmurray
2020-08-01 10:06
Thanks - I think I have found the issue. Should be a small fix. Might get you to test it if you?re happy to do that? Shouldn?t be too hard


elliottmurray
2020-08-01 10:11
You should be able to download that commit locally and link via pip locally (and uninstall pact-python that you had) and see this work.

elliottmurray
2020-08-01 10:12
I?m on holiday next week so might be a bit slow in responding but don?t want to do a release if it?s not ?good?

maciej.olko
2020-08-03 11:20
I?m also on holiday this week, so it is the same with me ? but I will try to find a moment to check the fix, maybe closer to Wednesday, thanks

elliottmurray
2020-08-03 12:49
:+1:

maciej.olko
2020-08-06 21:22
Unfortunately setting up authentication for verification locally occurred not to be easy for me. Checking it on CI would be much faster for me. Would alpha release (or regular one) be an option?

vishwa.amit
2020-08-07 04:54
Hi I am trying to use pact-python with pactflow to run the published contract against the provider, I am providing all the details while running but it doesn't seem to `--custom-provider-header`.your inputs are really appreciated.. ```pipenv run pact-verifier --provider-base-url=http://0.0.0.0:8081 \ --pact-url="https://pactflow.int.co.uk/pacts/provider/UM Service/consumer/latest/0.1.0" \ --pact-broker-username username \ --pact-broker-password password \ --publish-verification-results \ --custom-provider-header='Authorization:Bearer tkn'``` output is ```Error: no such option: --custom-provider-header```

elliottmurray
2020-08-07 07:26
I should be able to do that. I?ll try and get it done over the weekend

elliottmurray
2020-08-07 07:30
There is a thread a little bit before this you might want to read specifically mentioning custom headers

elliottmurray
2020-08-07 07:44
Also try dropping the = for that param

vishwa.amit
2020-08-07 10:19
```so I have removed = and getting this error to while using it with pactflow .. pact-verifier --provider-base-url http://0.0.0.0:8081 \ --pact-url "https://pactflow.co.uk/pacts/provider/UM%20Service/consumer/Supplier%20Hub/latest" \ --pact-broker-username usrname \ --provider-app-version 0.1.0 \ --pact-broker-password pwd \ --publish-verification-results \ --custom-provider-header='Authorization:Bearer Tkn'```


vishwa.amit
2020-08-07 10:20
RESP ```Error: The following Pact files could not be found: "https://pactflow.pacts/provider/UM%20Service/consumer/Supplier%20Hub/latest" Aborted!```

matt.fellows
2020-08-07 10:42
Just confirming that you meant to use `--pact-url` and not `--pact-broker-url` also?

elliottmurray
2020-08-07 14:55
It looked like you were having problems with the custom header (an array) over the pact url? I?m away from a computer right now but IIRC pact url will need an = and custom headers is a list. I?ll try and get you an exact syntax example at some point

elliottmurray
2020-08-08 09:34
as I?m back now I just did a bump release with the bug fix - 1.2.1

maciej.olko
2020-08-08 09:35
thank you, I will try to confirm the fix asap

maciej.olko
2020-08-08 10:04
confirming the fix works, thank you @elliottmurray!

elliottmurray
2020-08-08 10:16
brilliant!

hzhang1
2020-08-10 13:20
has joined #pact-python

hzhang1
2020-08-11 14:13
hello all, anyone has some code sample for using pact-python against graphql endpoint?

ashish_garg5
2020-08-12 10:38
.

lbraymusso
2020-08-12 18:09
if not pact-python, i'm similarly curious if there's any GraphQL reference examples available for the `pactman` library fork :slightly_smiling_face:

matt.fellows
2020-08-13 01:00
You could probably look to the Pact JS repository. There is an example there

matt.fellows
2020-08-13 01:00
GraphQL is just a basic layer on top of HTTP, so it?s doable right now

alecgerona
2020-08-24 03:32
has joined #pact-python

alecgerona
2020-08-24 03:33
Hi all, really interested in implementing Pact for our microservices architecture testing. I'm currently at the last stages of our POC at our company and am currently stuck at implementing the contract verification. For context, we're using a Django backend as the provider with Gitlab CI. I've implemented the webhook that calls the pipeline but that's where it falls short. I'm using the pact-cli docker image to call the `verify` command that will publish the results to our broker. Now this requires a url to replay the requests to. I was hoping to use Gitlab CI to run the Django app for me then just have verify call it since `pact-python`'s `Verifier` class doesn't appear to have a publish option as of yet and/or I haven't yet seen a guide that can run a local instance of a Django app during a pytest run unlike, say, a Flask app that is shown on the `pact-python` example. Problem is it seems like it's not possible for Gitlab CI to run a standalone server on itself if it's using a docker based runner? Am I overcomplicating things or is there a simple way to do this? I would hate for our POC for Pact to be wasted at this final step. Any help is much appreciated. Thank you! Relevant part for pact verification step on my `.gitlab-ci.yml` file: ```test: image: alecgerona/python-docker:python3.6 services: - postgres:11 - docker:dind stage: test script: - build server here - setsid nohup python manage.py runserver > nohup.out & - make verify_publish # Call pact-cli's verify command with appropriate arguments``` Reposting here for relevance.

matt.fellows
2020-08-24 03:33
Thanks, I?ll move my answers heere too

matt.fellows
2020-08-24 03:34
> > I haven?t yet seen a guide that can run a local instance of a Django app during a pytest run unlike, say, a Flask app that is shown on the `pact-python` example. I assume there must be a way to startup your Django app like the python example, but I?m not familiar enough with Python to suggest how to do it intelligently

matt.fellows
2020-08-24 03:34
But even if you can?t do that, your `setid nohup?` option should work just fine - is it not working and if so, what?s the issue?

matt.fellows
2020-08-24 03:35
>  Problem is it seems like it?s not possible for Gitlab CI to run a standalone server on itself if it?s using a docker based runner Can you please elaborate on this? What is not possible by running in docker? (running docker in docker, for example might be a pain)

alecgerona
2020-08-24 03:36
> I assume there must be a way to startup your Django app like the python example, but I?m not familiar enough with Python to suggest how to do it intelligently Even if I can do this, `pact-python` has no publish option. It just verifies. I suppose I'll have to fire the webhook manually if I somehow manage to spin up the Django app during the test-runner?

matt.fellows
2020-08-24 03:36
you mean publish the verification results?

alecgerona
2020-08-24 03:38
> But even if you can?t do that, your `setid nohup?` option should work just fine - is it not working and if so, what?s the issue? It runs. Its logs look okay as well. It's just that it's not a valid connection? I keep getting ``Address not available - connect(2) for "localhost" port 8000`` I tried all possible hosts, "localhost", "docker", "0.0.0.0". Nada.

matt.fellows
2020-08-24 03:39
hmmm, that seems very strange and likely some artifact of how your pipeline runs or the CI container.

matt.fellows
2020-08-24 03:39
Is it Pact libraries that are failing or something else?


matt.fellows
2020-08-24 03:39
`--publish-verification-results`

alecgerona
2020-08-24 03:40
Oh not the cli, the internal class for test runner usage. I suppose I can use the cli to avoid the docker in docker scenario...

matt.fellows
2020-08-24 03:40
ahhh

alecgerona
2020-08-24 03:41
So I'm following the e2e example on the Pact guide. It's using a Makefile to centralize all these commands from publish contracts to publishing verification results. That's why I didn't use the cli option.

matt.fellows
2020-08-24 03:41
Should be easy enough to add to the Verifier class - probably faster just to submit a PR and get a new release out than any shims around it

alecgerona
2020-08-24 03:42
Still the same issue about getting the app to run during a test. Afaik it needs a live URL to point to yes?

matt.fellows
2020-08-24 03:42
yes, the HTTP app needs to be started

matt.fellows
2020-08-24 03:43
Is it possible that by the time the verification step runs the server hasn?t yet been started?

matt.fellows
2020-08-24 03:43
i.e. you might need a ?wait for port 8000` to be ready before executing `verify_publish`?

matt.fellows
2020-08-24 03:44
FWIW the underling verification library has a `--wait-for` option, it just doesn?t seem to be exposed in the python interface

matt.fellows
2020-08-24 03:44
again, just a simple flag so easy enough to get in

alecgerona
2020-08-24 03:44
I already added a sleep 10 to the nohup command. And before the verification job happened the nohup command is already on "listening"

matt.fellows
2020-08-24 03:45
can you `curl localhost:8000` type thing in place of the `verify_publish`? Does that work? Just trying to rule out pact problem vs gitlab issue

alecgerona
2020-08-24 03:45
Also, since the Makefile command is using the pact-cli docker image it needs to pull it everytime so that adds to the sleep 10.

alecgerona
2020-08-24 03:46
Okay will try curling it now.

matt.fellows
2020-08-24 03:46
ah, that sounds more like the `verify_publish` command is running in a separate docker container on another network. So no suprises it can?t access the hosts network (by default)

alecgerona
2020-08-24 03:47
This is possible, yes. Is there a way to workaround it?

matt.fellows
2020-08-24 03:47
i.e. from within the pact-cli docker container, `localhost` may not be the same `localhost` as the host system

matt.fellows
2020-08-24 03:47
I?m not familiar enough with your gitlab/docker setup

alecgerona
2020-08-24 03:47
But I think curling the route should work first if that is indeed the case.

matt.fellows
2020-08-24 03:47
yeah

matt.fellows
2020-08-24 03:48
you can kind of prove that problem by running some other arbitrary linux host and doing a curl from that

alecgerona
2020-08-24 03:48
If that is indeed the problem, might be easier to incorporate the pact-cli to my image.

alecgerona
2020-08-24 03:49
My image right now is just python base image with docker support.

matt.fellows
2020-08-24 03:49
what cli command are you actually running in that step, btw?+

alecgerona
2020-08-24 03:49
```verify_publish: @"${PACT_CLI}" \ verify \ --provider ${PARTICIPANT} \ --provider-base-url ${PROVIDER_BASE_URL} \ --consumer-version-selector '{"tag":"master", "latest": true}' \ --consumer-version-selector '{"tag":"staging", "latest": true}' \ --publish-verification-results \ --provider-app-version ${CI_COMMIT_SHORT_SHA} \ --provider-version-tag ${CI_COMMIT_REF_NAME}```

alecgerona
2020-08-24 03:50
where PACT_CLI is ```PACT_CLI="docker run --rm -v ${PWD}:${PWD} -e PACT_BROKER_BASE_URL -e PACT_BROKER_USERNAME -e PACT_BROKER_PASSWORD pactfoundation/pact-cli:latest"```

alecgerona
2020-08-24 03:50
Just like the example.

matt.fellows
2020-08-24 03:50
cool, looks good but just wanted to check!

matt.fellows
2020-08-24 03:51
you may still want the `--wait-for` but as you say, the pull will likely impact it

matt.fellows
2020-08-24 03:52
So my guess is that it?s going to be the network. You may need to explore the various network flags e.g. bridge/host: https://docs.docker.com/network/network-tutorial-host/

matt.fellows
2020-08-24 03:52
again, this advice is without knowing the gitlab dind setup very well

matt.fellows
2020-08-24 03:52
? or at all

alecgerona
2020-08-24 04:14
Will try. I'm currently rerunning the pipeline as I forgot to add the sleep to the new curl so it's connection refused again.

alecgerona
2020-08-24 04:34
@matt.fellows it worked! Haha. It really was because of the docker network. Now to figure out how to access the host network.

matt.fellows
2020-08-24 04:34
:smile:

matt.fellows
2020-08-24 04:35
awesome, well that?s a form of progress :stuck_out_tongue:

alecgerona
2020-08-24 04:35
Weird tho, if I use the pact-cli docker image on my local, localhost works okay.

matt.fellows
2020-08-24 04:36
mac/linux/windows?

alecgerona
2020-08-24 04:36
linux

matt.fellows
2020-08-24 04:36
cool, the default network must be shared with the host

matt.fellows
2020-08-24 04:37
actually, is python running on your host, or another container?

matt.fellows
2020-08-24 04:38
`host <-[Docker [container 1] [container ?]]` (docker next to docker) `host <- [Docker [container 1 [container 2]]` (docker in docker)

alecgerona
2020-08-24 04:38
it's running on the gitlab docker runner

matt.fellows
2020-08-24 04:38
ah ok, no idea how that works

alecgerona
2020-08-24 04:38
```test: image: alecgerona/python-docker:python3.6 services: - postgres:11 - docker:dind stage: test script: - build server here - setsid nohup python manage.py runserver > nohup.out & # HERE - make verify_publish # Call pact-cli's verify command with appropriate arguments```

matt.fellows
2020-08-24 04:38
:man-shrugging:

alecgerona
2020-08-24 04:39
That's what I said.

matt.fellows
2020-08-24 04:39
:smile:

alecgerona
2020-08-24 04:39
I kinda don't like the idea of installing the pact-cli to the base image.

alecgerona
2020-08-24 04:40
Since that would add friction to developer adoption

alecgerona
2020-08-24 04:40
Since they have to install it on their local machines

matt.fellows
2020-08-24 04:40
ah

matt.fellows
2020-08-24 04:41
so you don?t even need the CLI docker image, because pact-python installs the CLI for you anyway

alecgerona
2020-08-24 04:41
but that's the pact-python cli. Not pact-cli.

alecgerona
2020-08-24 04:41
I'm using pact-cli for my Makefile.

matt.fellows
2020-08-24 04:41
actually, pact python installs the _actual_ pact CLI (i.e. the ones the docker cli version exposes)

matt.fellows
2020-08-24 04:42
this may be confusing, I know

alecgerona
2020-08-24 04:42
oh really?

alecgerona
2020-08-24 04:42
Can I call it directly then?

matt.fellows
2020-08-24 04:42
so wait for it. Actually, pact-python wraps a set of Ruby ?binaries? :exploding_head:

alecgerona
2020-08-24 04:42
Okay that I know.

matt.fellows
2020-08-24 04:42
you can just call them directly

matt.fellows
2020-08-24 04:42
ok then it?s not so confusing :stuck_out_tongue:

matt.fellows
2020-08-24 04:42
Those binaries get installed when you install pact-python anyway

matt.fellows
2020-08-24 04:42
I just forget where they go, but probably on some Python path

matt.fellows
2020-08-24 04:43
something like `find <python package dir> -name pact-broker` should help you

alecgerona
2020-08-24 04:44
so my Makefile will call this instead?

matt.fellows
2020-08-24 04:44
```? find /usr/local/lib/python3.8/site-packages -name pact-broker /usr/local/lib/python3.8/site-packages/pact/bin/pact/bin/pact-broker /usr/local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/bin/pact-broker /usr/local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact_broker-client-1.27.0/bin/pact-broker```

matt.fellows
2020-08-24 04:44
there you go

alecgerona
2020-08-24 04:44
No need to download the release binaries from pact-cli? :thinking_face: interesting. In our part of the world downloading from Github is at a breakneck speed of 20 kB/s :smile:

matt.fellows
2020-08-24 04:45
so all of the binaries are in `/usr/local/lib/python3.8/site-packages/pact/bin/pact/bin/` already

matt.fellows
2020-08-24 04:45
(or whatever python equiv for you)

matt.fellows
2020-08-24 04:45
> No need to download the release binaries from pact-cli? :thinking_face: interesting. In our part of the world downloading from Github is at a breakneck speed of 20 kB/s :smile: Ah, I see you have the NBN

alecgerona
2020-08-24 04:46
Hahahah you with NBN? It only happens with Github tho. Maybe they don't have an oceanic/SEA CDN? Idk.

matt.fellows
2020-08-24 04:47
:man-shrugging:

matt.fellows
2020-08-24 04:48
I?m with Aussie Broadband and it?s actually pretty good (I get basically what I paid for 100/20)

matt.fellows
2020-08-24 04:48
Uplink not looking amazing right now, but.. it?s pretty good

alecgerona
2020-08-24 04:50
How much you paying for that?

matt.fellows
2020-08-24 04:51
$89 /mth

matt.fellows
2020-08-24 04:51
It was worth it, doubly so now that we?re all WFH

alecgerona
2020-08-24 04:52
hmm. I'm paying $50 for 50/10.

alecgerona
2020-08-24 04:52
How's your github download speed?

matt.fellows
2020-08-24 04:52
I splurged.

matt.fellows
2020-08-24 04:52
I don?t recall it ever being slow

alecgerona
2020-08-24 04:53
I downloaded the pip source code the other week and wow was it slow. 20 kB/s

matt.fellows
2020-08-24 04:53
I?m working on a few wip repos with binaries in them - not noticing any differeneces

matt.fellows
2020-08-24 04:53
are you with Aussie or somebody else?

matt.fellows
2020-08-24 04:53
Aussie have laid their own sea cables, so they don?t share

alecgerona
2020-08-24 04:54
I'm not in Aus actually :joy:

alecgerona
2020-08-24 04:55
Anyway, so I have pact-python installed. And the only executable I have is the pact-verifier.

matt.fellows
2020-08-24 04:55
ah, sorry. I?m guessing nearby - Tasmania? :stuck_out_tongue:

matt.fellows
2020-08-24 04:56
> Anyway, so I have pact-python installed. And the only executable I have is the pact-verifier. Where is that located?

alecgerona
2020-08-24 04:57
located on my virtualenv's bin.

alecgerona
2020-08-24 04:58
I should already be able to call pact-broker from here right?


matt.fellows
2020-08-24 04:59
they are wrapped by python and not exposed as local binaries, so you?ll need to reference them absolutely for now

alecgerona
2020-08-24 05:00
Ahh.

alecgerona
2020-08-24 05:05
Hmm. Seem to be getting some ruby specific issues.

matt.fellows
2020-08-24 05:05
such as?

matt.fellows
2020-08-24 05:06
just ensure you run the ones _not_ in the `gems` subfolder

matt.fellows
2020-08-24 05:06
e.g. this is a good one `/usr/local/lib/python3.8/site-packages/pact/bin/pact/bin/pact-broker`

alecgerona
2020-08-24 05:06
How do I run the binaries? `sh`?

matt.fellows
2020-08-24 05:07
they should be executable by default, I believe they do need Bash though


matt.fellows
2020-08-24 05:07
(if using Alpine)

alecgerona
2020-08-24 05:07
yup I've tried it. `venv/lib/python3.6/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/bin/pact-broker: line 9: require: command not found` Got this.

alecgerona
2020-08-24 05:08
I think simplest is the pact-verifier exposed by pact-python

matt.fellows
2020-08-24 05:08
strange, because it will literally send the command direct to the same binary

matt.fellows
2020-08-24 05:08
it might be a virtualenv related thing though

matt.fellows
2020-08-24 05:08
but yes, it seems that might be the way to go

matt.fellows
2020-08-24 05:09
any flags missing that are available on the CLI should be a cinch to add, and we?ll merge / release quickly if you need

alecgerona
2020-08-24 05:09
Thank you so much! I'll try incorporating this first and get back to you. Would love to open some PRs regarding docs as I think the python section of it is lacking.

matt.fellows
2020-08-24 05:10
thx, that?d be great

alecgerona
2020-08-24 05:10
Might be nice if we have some great examples good to go for frameworks such as Django and Fastapi.

matt.fellows
2020-08-24 05:10
Elliot has started to pickup a lot of the work here, and would be great to have more contirbutors so let us know how we can support you

alecgerona
2020-08-24 05:10
Developers I believe tend to ask how can I use this new service for my framework.

alecgerona
2020-08-24 05:13
Ah I think I already found an option missing. The `consumer-version-selector`

alecgerona
2020-08-24 05:20
I've created the issue

alecgerona
2020-08-24 06:00
Also @matt.fellows I've noticed that the pact-python cli does not read from environment? Such as the pact-broker-url? Hmm.

elliottmurray
2020-08-24 11:23
Looking at it I think it?s just token and password. Easy to add - you want broker username and url?

alecgerona
2020-08-24 11:44
Hi @elliottmurray, I think username, password, and token should be great. It's the same environment variable as the one with pact-cli's right?

elliottmurray
2020-08-24 11:45
BROKER_USERNAME & PACT_BROKER_BASE_URL?

ashish_garg5
2020-08-24 12:18
Hi, Does pact-python supports MQ communication ? I saw before that it has some restrictions and supports only REST communication. Thanks.

charliemic
2020-08-24 14:15
has joined #pact-python

elliottmurray
2020-08-24 15:03
PACT_BROKER_USERNAME & PACT_BROKER_BASE_URL

elliottmurray
2020-08-24 15:03
I settled on - doing a release

alecgerona
2020-08-24 20:09
AFAIK you have to mock your publisher. Instead of publishing to a real queue you just send the message to Pact.

matt.fellows
2020-08-24 23:42
Awesome, thanks Elliot

matt.fellows
2020-08-24 23:42
they map to the same ones as the CLI - so that?s :ok_hand:

heytaco
2020-08-25 03:57
has joined #pact-python

heytaco
2020-08-25 03:57
Hi there! My name is HeyTaco!, and you can use me to give people tacos to show your appreciation. My tacos will spread joy through Slack!

maciej.olko
2020-08-25 06:35
@elliottmurray :taco:

alecgerona
2020-08-25 09:16
@elliottmurray thanks for the help! :taco:

matt.fellows
2020-08-26 12:15
:tada:

alecgerona
2020-08-27 07:59
Who can I ask to review this? :heartpulse: @elliottmurray? @matt.fellows? Haha

elliottmurray
2020-08-27 12:21
I?ve already looked at it and looking good! I?ll try and carve out some time to test it locally and approve. Assuming I can?t see any issues I?ll merge and release. Probably tomorrow my time?

alecgerona
2020-08-27 14:20
Great! Thanks @elliottmurray!

elliottmurray
2020-08-27 14:25
@alecgerona this one?s for you. Thanks for the contribution.

elliottmurray
2020-08-27 14:25
:taco: @alecgerona

matt.fellows
2020-08-27 23:48
Awesome, thanks Elliot - you just ticked off an item from today?s TODO

matt.fellows
2020-08-27 23:48
@elliottmurray :taco:


elliottmurray
2020-08-28 08:26
Thanks! Done


alecgerona
2020-08-28 13:19
Is there someone who's working on messaging implementation? This is a core requirement for our architecture and would like to take over if people would be willing to guide me.

maciej.olko
2020-08-31 07:21
I don?t know about anyone. There is a small pull request with some changes connected to messaging: https://github.com/pact-foundation/pact-python/pull/119/files

maciej.olko
2020-09-01 13:04
Hi, is there a way in pact-python to match format of dicts which are list elements without fixed order?

gianrubio
2020-09-01 13:51
has joined #pact-python

maciej.olko
2020-09-07 15:50
@elliottmurray could you take a look at my pull request at your leisure? :slightly_smiling_face:

elliottmurray
2020-09-07 18:43
Sorry mate. Been a bit offline last week or two. I?ll have a proper look tomorrow

maciej.olko
2020-09-07 18:45
No worries. Thank you!

elliottmurray
2020-09-08 08:46
Hey. Checked it out and looks good but Beth has one query around the cli flags. We get this to resolution I?ll merge and release. Good work. I?m still learning Python and liked the multi test options!

maciej.olko
2020-09-08 09:26
Ok, thank you!

francesco.bartoli
2020-09-08 09:29
has joined #pact-python

maciej.olko
2020-09-09 08:12
@elliottmurray do we plan to drop support for Python 3.4? that would enable us to use type annotations which make maintenance easier Python 3.4 reached end of life on March 16, 2019 by the way Python 3.5 reaches end of life on September 13th, 2020 so we could also consider dropping its support

elliottmurray
2020-09-09 09:00
I only dropped python 2.7 support a couple of months ago!

elliottmurray
2020-09-09 09:00
But yes we probably should. I?m a little wary - normally needs a bump in versioning

elliottmurray
2020-09-09 09:00
I?ll have a think about it

elliottmurray
2020-09-09 09:01
The thing I struggle with on this is knowing who is using pact and what versions they are running. User testing is hard in OSS it seems

elliottmurray
2020-09-10 09:25
Thanks to @maciej.olko pending flags added to the verifier cli

matt.fellows
2020-09-10 12:17
@maciej.olko :taco:

copalco
2020-09-10 12:53
has joined #pact-python

maciej.olko
2020-09-10 12:54
@copalco :taco:

matt.fellows
2020-09-10 21:39
@elliottmurray :taco: awesome work keeping all of this moving forward!

copalco
2020-09-11 07:59
:taco: @elliottmurray

maciej.olko
2020-09-11 08:00
:taco: @elliottmurray thank you for those releases!

elliottmurray
2020-09-11 08:00
~:taco @copalco~

elliottmurray
2020-09-11 08:01
:taco: @copalco

elliottmurray
2020-09-11 08:01
typo damn it!

elliottmurray
2020-09-11 08:01
Thanks for all the contributions!

elliottmurray
2020-09-11 08:02
I?m going to look at Python deprections now btw but need to gather some stats first

ctelles
2020-09-21 19:05
has joined #pact-python

ajayarooon
2020-09-22 07:56
has joined #pact-python

ajayarooon
2020-09-22 07:58
@here I'm trying to perform contract testing using pact-python. Due to less number of resources, I couldn't proceed. Could anyone please guide me?

matt.fellows
2020-09-22 10:48
:wave:

matt.fellows
2020-09-22 10:48
what help do you need? Perhaps it?s worth trying a workshop in another language, and then looking at https://github.com/pactflow/example-consumer-python and https://github.com/pactflow/example-provider-python

matt.fellows
2020-09-22 10:48
howtolearn

2020-09-22 10:48
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

matt.fellows
2020-09-22 10:48
:point_up: workshops

ajayarooon
2020-09-22 13:06
Thanks @matt.fellows. Let me explore it.

bethskurrie
2020-09-25 01:00
There's a pact python question here on stackoverflow if anyone has a minute https://stackoverflow.com/questions/64046658/pact-error-when-trying-to-setup-mock-provider

elliottmurray
2020-09-25 07:21
As I DM?d you I believe this is a configuration issue and am helping him fix it

ajayarooon
2020-09-25 10:11
Yes @bethskurrie. I sought @elliottmurray's help. Posted in stackoverflow before my conversation with Elliot. Thanks anyway!!

nazar.khmil
2020-10-05 10:34
has joined #pact-python

xandebianchi
2020-10-05 13:05
has joined #pact-python

dorin.enache
2020-10-05 15:01
has joined #pact-python

ledinhcuong99
2020-10-06 12:53
has joined #pact-python

dothetan.040490
2020-10-07 09:14
has joined #pact-python

dagostino.remy
2020-10-07 23:03
has joined #pact-python

abhi.nandan
2020-10-08 06:38
has joined #pact-python

przemyslaw.dabrowski
2020-10-08 12:36
has joined #pact-python

emiliano.righi
2020-10-08 13:25
has joined #pact-python

sklein
2020-10-08 15:29
Running into some interesting behavior when using the `Verifier` with `consumer_selectors` where in addition to the correct contracts it also seems to be pulling back the api root as a part of the pacts to verify :shrug:. The pacts return a successful verification but then the ruby library is throwing a `Pact::UnrecognizePactFormatError` because the root payload doesn't contain the `interactions` attribute in the payload. Anybody else run into anything weird like this before?

sklein
2020-10-08 15:32
Here's the stack trace with the company obfuscated

sklein
2020-10-08 15:32
```/home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/consumer_contract.rb:47:in `from_hash': This document does not use a recognised Pact format: {"_links"=>{"self"=>{"href"=>"https://mycompany.pactflow.io", "title"=>"Index", "templated"=>false}, "pb:publish-pact"=>{"href"=>"https://mycompany.pactflow.io/pacts/provider/{provider}/consumer/{consumer}/version/{consumerApplicationVersion}", "title"=>"Publish a pact", "templated"=>true}, "pb:latest-pact-versions"=>{"href"=>"https://mycompany.pactflow.io/pacts/latest", "title"=>"Latest pact versions", "templated"=>false}, "pb:tagged-pact-versions"=>{"href"=>"https://mycompany.pactflow.io/pacts/provider/{provider}/consumer/{consumer}/tag/{tag}", "title"=>"All versions of a pact for a given consumer, provider and consumer version tag", "templated"=>false}, "pb:pacticipants"=>{"href"=>"https://mycompany.pactflow.io/pacticipants", "title"=>"Pacticipants", "templated"=>false}, "pb:pacticipant"=>{"href"=>"https://mycompany.pactflow.io/pacticipants/{pacticipant}", "title"=>"Fetch pacticipant by name", "templated"=>true}, "pb:latest-provider-pacts"=>{"href"=>"https://mycompany.pactflow.io/pacts/provider/{provider}/latest", "title"=>"Latest pacts by provider", "templated"=>true}, "pb:latest-provider-pacts-with-tag"=>{"href"=>"https://mycompany.pactflow.io/pacts/provider/{provider}/latest/{tag}", "title"=>"Latest pacts for provider with the specified tag", "templated"=>true}, "pb:provider-pacts-with-tag"=>{"href"=>"https://mycompany.pactflow.io/pacts/provider/{provider}/tag/{tag}", "title"=>"All pact versions for the provider with the specified consumer version tag", "templated"=>true}, "pb:provider-pacts"=>{"href"=>"https://mycompany.pactflow.io/pacts/provider/{provider}", "title"=>"All pact versions for the specified provider", "templated"=>true}, "pb:latest-version"=>{"href"=>"https://mycompany.pactflow.io/pacticipants/{pacticipant}/latest-version", "title"=>"Latest pacticipant version", "templated"=>true}, "pb:latest-tagged-version"=>{"href"=>"https://mycompany.pactflow.io/pacticipants/{pacticipant}/latest-version/{tag}", "title"=>"Latest pacticipant version with the specified tag", "templated"=>true}, "pb:webhooks"=>{"href"=>"https://mycompany.pactflow.io/webhooks", "title"=>"Webhooks", "templated"=>false}, "pb:webhook"=>{"href"=>"https://mycompany.pactflow.io/webhooks/{uuid}", "title"=>"Webhook", "templated"=>true}, "pb:integrations"=>{"href"=>"https://mycompany.pactflow.io/integrations", "title"=>"Integrations", "templated"=>false}, "pb:pacticipant-version-tag"=>{"href"=>"https://mycompany.pactflow.io/pacticipants/{pacticipant}/versions/{version}/tags/{tag}", "title"=>"Get, create or delete a tag for a pacticipant version", "templated"=>true}, "pb:metrics"=>{"href"=>"https://mycompany.pactflow.io/metrics", "title"=>"Get Pact Broker metrics"}, "pb:can-i-deploy-pacticipant-version-to-tag"=>{"href"=>"https://mycompany.pactflow.io/can-i-deploy?pacticipant={pacticipant}&version={version}&to={tag}", "title"=>"Determine if an application can be safely deployed to an environment identified by the given tag", "templated"=>true}, "pb:provider-pacts-for-verification"=>{"href"=>"https://mycompany.pactflow.io/pacts/provider/{provider}/for-verification", "title"=>"Pact versions to be verified for the specified provider", "templated"=>true}, "beta:provider-pacts-for-verification"=>{"name"=>"beta", "href"=>"https://mycompany.pactflow.io/pacts/provider/{provider}/for-verification", "title"=>"DEPRECATED - please use pb:provider-pacts-for-verification", "templated"=>true}, "curies"=>[{"name"=>"pb", "href"=>"https://mycompany.pactflow.io/doc/{rel}?context=index", "templated"=>true}, {"name"=>"beta", "href"=>"https://mycompany.pactflow.io/doc/{rel}?context=index", "templated"=>true}], "pb:api-tokens"=>{"href"=>"https://mycompany.pactflow.io/settings/tokens", "title"=>"API tokens", "templated"=>false}, "pb:audit"=>{"href"=>"https://mycompany.pactflow.io/audit", "title"=>"Audit trail", "templated"=>false}, "pb:secrets"=>{"href"=>"https://mycompany.pactflow.io/secrets", "title"=>"Secrets", "templated"=>false}, "pf:admin-users"=>{"href"=>"https://mycompany.pactflow.io/admin/users", "title"=>"Admin users", "templated"=>false}, "pf:admin-teams"=>{"href"=>"https://mycompany.pactflow.io/admin/teams", "title"=>"Admin teams", "templated"=>false}, "pf:admin-system-accounts"=>{"href"=>"https://mycompany.pactflow.io/admin/system-accounts", "title"=>"System accounts", "templated"=>false}}} (Pact::UnrecognizePactFormatError) from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.15.1/lib/pact/consumer_contract/consumer_contract.rb:52:in `from_json' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/rspec.rb:34:in `honour_pactfile' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:125:in `block in initialize_specs' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:119:in `each' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:119:in `initialize_specs' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/provider/pact_spec_runner.rb:33:in `run' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:69:in `run_with_pact_uri_object' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:50:in `run_specs' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:21:in `call' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.51.1/lib/pact/cli/run_pact_verification.rb:13:in `call' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:171:in `verify_pact' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:43:in `block in call' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:42:in `collect' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:42:in `call' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/app.rb:34:in `call' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/cli/verify.rb:47:in `verify' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.32.1/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start' from /home/vscode/.local/lib/python3.8/site-packages/pact/bin/pact/lib/app/pact-provider-verifier.rb:33:in `<main>' INFO: Reading pact at https://mycompany.pactflow.io ```

cariaga.bh
2020-10-08 21:03
has joined #pact-python

matt.fellows
2020-10-08 23:57
hmm

campellcl
2020-10-09 00:06
has joined #pact-python

elenitsaa043
2020-10-09 10:00
has joined #pact-python

adriangabrieloros
2020-10-09 11:05
has joined #pact-python

adriangabrieloros
2020-10-09 11:06
hey guys, i just opened an issue -> https://github.com/pact-foundation/pact-python/issues/176 if there is anything I can do to help, let me know. cheers

elliottmurray
2020-10-09 11:11
I?ve responsed - thanks for that

elliottmurray
2020-10-09 11:11
I just want a quick clarification on something

adriangabrieloros
2020-10-09 11:14
responded :smile:


elliottmurray
2020-10-09 11:25
Would that fix it?

adriangabrieloros
2020-10-09 11:32
think so, by the looks of it

elliottmurray
2020-10-09 11:54
@adriangabrieloros I?ve pushed a release just now (1.2.7) Give it five minutes to publish and let me know if any problems

adriangabrieloros
2020-10-09 11:55
okay, will wait

elliottmurray
2020-10-09 11:57
Shouold be there now

sh.ilgam_pact
2020-10-11 16:13
has joined #pact-python

anastasiia.bielik
2020-10-12 11:13
has joined #pact-python

deepika.krishnakumar
2020-10-12 15:03
has joined #pact-python

anbansal27
2020-10-12 23:02
has joined #pact-python

prabhakar.thippa
2020-10-13 04:58
has joined #pact-python

giadinhluong
2020-10-13 06:24
has joined #pact-python

pavank
2020-10-13 08:41
has joined #pact-python

stephane.meng
2020-10-13 09:06
has joined #pact-python

abirlal.bose
2020-10-13 09:45
has joined #pact-python

campellcl
2020-10-13 23:13
Hey all, got a noob question for you. In the Serverless JS example of pact available here: https://github.com/pact-foundation/pact-js/blob/7174a7c1fdf40425df262a93ee73fcaacbf429c5/examples/serverless/provider/message-provider.spec.js#L14 they actually exercise the producer's logic during the pact verification test on the producer side. In the Python version of this available here: https://github.com/pact-foundation/pact-python/blob/master/examples/e2e/tests/provider/test_provider.py#L66 the logic does not appear to use the provider at all. I understand that they are using an external server to configure the pact provider states. But shouldn't the Python Producer logic still be executed to get the response from the producer that is compared against the pact? I'm having trouble figuring out where the output of the producer should go when calling `verifier.verify_pacts(...)` on the producer side. What am I missing here?

bethskurrie
2020-10-13 23:15
I wrote the underlying verification engine that the python lib uses, but I'm not familiar with the python lib itself.

bethskurrie
2020-10-13 23:15
Under the hood, it starts an HTTP server, that then makes the call to the producer code to get the message, and then verify it against the pact.

bethskurrie
2020-10-13 23:16
The reason there is a proxy in the middle is to allow us to re-use the existing verification infrastructure, and provider a technology agnostic interface between the verifier and the producer.

bethskurrie
2020-10-13 23:17
under the hood, I would expect there to be some configuration that hooks the proxy up to the producer.

bethskurrie
2020-10-13 23:17
it may just be that this particular example isn't actually exercising any producer logic.

campellcl
2020-10-13 23:20
Well, then, I guess my question becomes: How do I exercise the producer logic in the python version of pact? Does anyone have a good example of this where the provider logic is actually included in the `verifier.verify_pacts(...)` call? Because from the source code here: https://github.com/pact-foundation/pact-python/blob/f4787ed659a84eae28622f0ac84d3af78f0ee371/pact/verifier.py#L33 it is not at all evident that the method can take the actual output of the provider to do a comparison against the existing pact. Unless its in the `**kwargs` , but I can't find any documentation on this as it pertains to the Python lib.

campellcl
2020-10-13 23:21
In the readme, they also don't actually use the output of the provider in the verification: https://github.com/pact-foundation/pact-python#python-api

bethskurrie
2020-10-13 23:21
@matt.fellows?s fingerprints are all over that file, but it looks pretty old. He may be able to remember how it works.

campellcl
2020-10-13 23:26
Hopefully @matt.fellows will come to the rescue yet again. haha. I'm starting to get the feeling that Python is not really a first class citizen here. :grin: Or at least, not using the same architectural paradigms as on the Node side of things.

bethskurrie
2020-10-13 23:26
It's not.

bethskurrie
2020-10-13 23:26
It's a sad fact.

campellcl
2020-10-13 23:26
I also checked out @matt.fellows example here: https://github.com/pactflow/example-provider-python/blob/master/app/main.py but that doesn't really give me a clear picture of how the provider verification is supposed to work in code. It is helpful for the CI/CD setup however.

bethskurrie
2020-10-13 23:27
Node and JVM get the most attention.

matt.fellows
2020-10-13 23:27
So I?ll qualify with I?m not a python expert

matt.fellows
2020-10-13 23:27
The JS example you linked to is specifically for messages (think MQ etc.), but the process is similar for regular HTTP provider verification

matt.fellows
2020-10-13 23:28
I know Elliot is working to tidy up and improve the Python project - you?ll see it?s under quite active development

matt.fellows
2020-10-13 23:29
for provider verification, I think the example you referred to does actually exercise the real provider

matt.fellows
2020-10-13 23:29
I think the example is misleading though, because of prefixes like `PACT_MOCK_`


matt.fellows
2020-10-13 23:30
If I read that correctly, it?s starting a new server using `app` (which is the actual provider code)

matt.fellows
2020-10-13 23:30
The verifier then uses a local pact json file as the contract source

matt.fellows
2020-10-13 23:31
I think you?d use `verify_with_broker` for pactflow with the `broker_token` auth option: https://github.com/pact-foundation/pact-python/blob/f4787ed659a84eae28622f0ac84d3af78f0ee371/pact/verifier.py#L61

matt.fellows
2020-10-13 23:31
The example I put together used the CLI verifier, literally because I had less than one hour to scrap together a python example for a demo

matt.fellows
2020-10-13 23:32
honestly though, in many cases, the CLI verifier is what you want (in fact, at least one of the maintainers things it?s a better approach altogether and I have put forward a case that we should improve the CLI and do away with language specific verifiers altogether - but that?s another thing)

campellcl
2020-10-13 23:33
Good to know, thanks Matt! Yup it does seem to be actively maintained, always a plus. So, I see that they are starting a flask server. I see them passing the provider server to the `test_get_user_non_admin(...)` method as a PyTest test fixture. I don't see them ever using `provider` in that context though. And looking at https://github.com/pact-foundation/pact-python/blob/f4787ed659a84eae28622f0ac84d3af78f0ee371/pact/verifier.py#L61 its the same problem. No where does that method take the actual output of the provider to send to the broker for verification.

campellcl
2020-10-13 23:34
I'm just confused on how you can verify a pact without providing the output from the provider.

matt.fellows
2020-10-13 23:34
That method simply invokes the underlying CLI process Beth was alluding to (the very same CLI I use in my demo you linked to)

matt.fellows
2020-10-13 23:35
so https://github.com/pact-foundation/pact-python/blob/f4787ed659a84eae28622f0ac84d3af78f0ee371/pact/verifier.py#L85 is the argument that is passed to the CLI, which in turn will issue HTTP requests to that flask server

matt.fellows
2020-10-13 23:35
`test_get_user_non_admin` -> `verify_pacts` -> `underlying provider verifier CLI` -> `calls your actual provider over HTTP`

matt.fellows
2020-10-13 23:36
something like that

matt.fellows
2020-10-13 23:36
Have you tried running it? If you add logging, you?ll see the actual server is hit. You should be able to alter how it responds to see if it breaks the contract

matt.fellows
2020-10-13 23:36
suffice to say - if it _doesn?t_ actually call the provider, this is a bad thing!

campellcl
2020-10-13 23:42
That is very helpful, thanks Matt. I see what you are saying now about the Python implementation being a wrapper for the CLI. Looking at the CLI documentation helps: https://github.com/pact-foundation/pact-python#cli Your right, it appears to be issuing calls to the provider at the localhost address to retrieve the providers output.... although that documentation is not very clear as well. They appear to be passing local files to `--pact-url=...` which I assume is overloading what that argument would actually be if the provider was not running on localhost.

matt.fellows
2020-10-13 23:43
So the provider base URL passes the address of the running service - whether it?s running on localhost or somewhere else

matt.fellows
2020-10-13 23:44
the pact URL is where to find the contract - most of the time this will be from the pact broker, but in the example here it?s using a locally stored contract file (presumably to prevent flakiness in the test suite)

campellcl
2020-10-13 23:49
Right, that was my interpretation. In our case, we would be running the verification code inside Python though. The code itself would be producing the output to be fed to the `--provider-base-url`. Our logic would not necessarily have a host behind it (localhost or otherwise). That's somewhat on us. We have a serverless IaaS application. So we don't really have a dedicated producer and consumer pipeline. Sometimes our lambdas are producers, and sometimes they are consumers. We want pacts in place to cover both functionalities, when the lambda is producing, and when the lambda is consuming. But we don't necessarily want to open up our lambda endpoint to API Gateway just for pact to be able to issue HTTP requests to the endpoint. Instead, we would rather run our lambda locally, take the output JSON that in production would be serialized and send over HTTP, and we want to relay that to the pact broker for verification.

campellcl
2020-10-13 23:49
It's looking like that is not really feasible?

matt.fellows
2020-10-13 23:50
aha - yes this is referred to as message pacts

campellcl
2020-10-13 23:51
Is there support for message pacts in Python like there is in the NodeJS version?

matt.fellows
2020-10-13 23:52
I believe there are a few open issues for it, but it looks like currently no

campellcl
2020-10-13 23:53
Or do you have to use the CLI and target localhost or a running provider?

campellcl
2020-10-13 23:53
Dang it.

matt.fellows
2020-10-13 23:53
From last talking to Elliot (a new core contributor) he was refactoring the provider verification first as a pre-requisite to doing the message bit

matt.fellows
2020-10-13 23:53
as you saw in the NodeJS example, there is some infrastructure required to make that work (basically, the ?architecture? is a transparent proxy that registers handlers etc.)

matt.fellows
2020-10-13 23:54
So you have a couple of options


matt.fellows
2020-10-13 23:54
(I can?t vouch for it?s goodness)

campellcl
2020-10-13 23:55
Ah, so I'm too early. Hmmmm. Well that's a bummer.

matt.fellows
2020-10-13 23:55
I know others have added a test-phase-only HTTP server in front of their lambdas/message functions and used the standard tooling. It?s a bit shit, but I believe it should work

matt.fellows
2020-10-13 23:56
alternatively, the underlying infrastructure is there and I can give you some pointers

campellcl
2020-10-14 00:03
Good to know. I'm unfortunately fighting an uphill battle here with management. They are wondering why it is taking so long to implement a testing framework. I was able to sell them on Pact because of the multi-language support (as our other dev uses NodeJS). I'll have to relay that information to the higher-ups and see if they are still willing to approve additional dev time on the testing infrastructure. I know that we are using pact not really in the way it was meant to be used. So thanks a ton for taking the time to explain all of the above. Your explanations were super helpful. That definitely gives me three paths to go forward with. Let me see what the consensus is on the dev team, about how they want to proceed and i'll be sure to let you know!

campellcl
2020-10-14 00:04
HTTP server is not a bad idea for a workaround.

matt.fellows
2020-10-14 00:04
no, you are definitely _not_ using it the way it?s not intended to be used

matt.fellows
2020-10-14 00:04
Everything you?re asking for is totally reasonable

matt.fellows
2020-10-14 00:05
(I use AWS/lambda/kinesis etc. heavily and Pact is perfectly suited to those use cases)

bethskurrie
2020-10-14 00:06
> I know others have added a test-phase-only HTTP server in front of their lambdas/message functions and used the standard tooling. @tjones had a nice pattern for this. Having done some pact work with some offline serverless stuff that required docker containers to start up each time you needed to run tests, I 100% prefer the little http wrapper. It's so much quicker.

bethskurrie
2020-10-14 00:06
I don't want to wait 30 seconds for a docker container to start every time I want to run my pact tests.

bethskurrie
2020-10-14 00:07
Insert eye stabbing emoji

matt.fellows
2020-10-14 00:07
:point_up: I think you?re referring to SAM. the serverless framework is much better

bethskurrie
2020-10-14 00:07
You're probably right.

matt.fellows
2020-10-14 00:07
(in that specific regard)

campellcl
2020-10-14 00:07
@matt.fellows Well I can tell from the documentation that it seems to be designed for more traditional HTTP workflows with dedicated producer and consumer build pipelines that are seperate. That doesn't really fit too well with the Serverless IaaS infrastructure. There isn't really a concept of a separate build pipeline.

bethskurrie
2020-10-14 00:07
I get confused between Serverless and generic serverless.

campellcl
2020-10-14 00:07
Oh yeah, Serverless is way better than SAM.

matt.fellows
2020-10-14 00:08
> There isn?t really a concept of a separate build pipeline. We?ll have to agree to disagree there in general terms, but I think your point is that it?s common for a single ?serverless app? to have many discrete components that are still deployed together, which is very common indeed

campellcl
2020-10-14 00:12
Yes, that is what I meant. What is a "provider build pipeline" and "consumer build pipeline" in the serverless context? There isn't a clear cut definition. That clear cut distinction in tutorials such as: https://docs.pactflow.io/docs/workshops/ci-cd/set-up-ci/ is what made me think I wasn't really using pact for what it was intended to be used for. Although, clearly it can still be used in our context, hence me being here right now trying to get it to work haha.

matt.fellows
2020-10-14 00:12
Yes, our documentation / workshops are lacking in this space, so I can see how many people would have this very impression

campellcl
2020-10-14 00:18
@bethskurrie We already have a pretty complex build process. Running dockerized Jenkins in EC2 (with a persistent EFS store), with https://hub.docker.com/r/lambci/lambda/ as the underlying docker configuration for our Jenkin's build agents. So although we are not opposed to running more docker containers.... as I previously mentioned, whenever we start running docker-in-docker-in-docker that's when I start questioning my sanity. Which is partially why we were avoiding the dockerized pact CLI. haha

campellcl
2020-10-14 00:19
@matt.fellows The CI/CD workshop is great! But yeah, having one for Serverless would be good. As well as Jenkins. Although I understand that TravisCI is way easier to set up for demo purposes than Jenkins can be.

matt.fellows
2020-10-14 00:59
I actually wrote one for a customer (albeit it was in Go) and was hoping to open source that. But then we need to 11x it to _all the languages_. You can see the challenge!

elliottmurray
2020-10-14 09:11
I think I?m not needed here! But to confirm?

elliottmurray
2020-10-14 09:11
I did make some changes to start putting in native Python features but haven?t added new ones in a while as I?m not personally using it and not sure what people out there are. If there?s a strong push to get a messaging or serverless example could plan that out.

matt.fellows
2020-10-14 09:17
Cc: @sklein if I recall you may have wanted this?

mateusz.mrzyglod
2020-10-14 09:32
has joined #pact-python

cathleen.yuan
2020-10-14 11:16
has joined #pact-python

ramana.jaladurgam
2020-10-14 16:10
has joined #pact-python

ramana.jaladurgam
2020-10-14 16:12
HI, https://docs.pact.io/implementation_guides/python/ Pact Python doesn't seem to support AMQP based tests. Is there any plan to upgrade Pact Python or any alternatives for writing AMQP based tests on python tests. Thank you for the references.

alik.berezovsky
2020-10-14 18:38
has joined #pact-python

a.robecke
2020-10-14 19:24
has joined #pact-python

campellcl
2020-10-14 19:46
@elliottmurray We could definitely use it. I'm about to be instructed not to use Pact specifically because we can't get Message Pacts working with the Python producer verifier in a trivial way. I was about to implement @matt.fellows?s solution of having an API Gateway and lambda function which the CLI can hit as the `--provider-base-url`. But that lambda method will then need to handle the routing to the actual provider logic. I'm not convinced that what is sent by the pact CLI is enough to do that routing. I will most likely have to include the intended lambda ARN in the pact itself, only for the purposes of routing based on that ARN. That's overall a pretty hacky solution for getting it to work in Python. The alternative would be to stick an HTTP API Gateway in front of every single lambda method, which we aren't going to do. More importantly, having to hit an external API Gateway endpoint means that I can no longer run pact verification tests locally. I have to deploy the full platform, in order to run pact tests against the live endpoint. Which defeats the purpose of the async testing paradigm.

campellcl
2020-10-14 19:46
But I can't speak to the popularity of Pact among other Python devs.

campellcl
2020-10-14 19:47
For us it may end up being the difference between rolling our own bare-bones solution, and leveraging Pact.

campellcl
2020-10-14 20:24
Does anyone know where I can find the CLI documentation specifically for https://github.com/pact-foundation/pact-ruby-standalone? Does this take the same commands as the Pact Broker CLI, or the Pact CLI?

mikahchapman
2020-10-14 21:47
has joined #pact-python

matt.fellows
2020-10-14 23:00
Thanks Chris

matt.fellows
2020-10-14 23:00
it?s helpful feedback!

matt.fellows
2020-10-14 23:00
Just so my point is clear though

matt.fellows
2020-10-14 23:00
I?m _not_ suggesting putting an API gateway in front of your lambdas - that would result in a number of complications as you?ve mentioned

matt.fellows
2020-10-14 23:01
I?m suggesting (and have suggested to others in the past) to be able to abstract away your function code (essentially the lambda handler) from the exact runtime - which in this case is the Lambda runtime. One approach is to put a really simple http wrapper (e.g. with Flask/FastAPI) in front of your lambda function, and then use standard HTTP pact

matt.fellows
2020-10-14 23:02
this way you can still run locally and do all of those things

matt.fellows
2020-10-14 23:02
If you go down the pact path. Of course, a message pact contribution would be awesome :stuck_out_tongue:

matt.fellows
2020-10-14 23:03
@ramana.jaladurgam saw your question in the channel - please see this thread :point_up:


matt.fellows
2020-10-14 23:04
this sort of thing?

matt.fellows
2020-10-14 23:04
The pact broker CLI is one of the utilities provided in that package

campellcl
2020-10-14 23:31
@matt.fellows Thank you for clarifying. I had misunderstood you! That is a much better idea than my misinterpretation of what you said. If I am understanding you correctly now, you think we should do: PactPythonLib -> PactRubyCLI -> LocalFlaskServer -> LocalPythonLambda Is that right? Basically have the localhost Flask service perform the routing to the lambdas on disk? The idea is that the Pact CLI can then still hit the flask server as the provider endpoint, while still executing locally?

matt.fellows
2020-10-14 23:47
yes! exactly

matt.fellows
2020-10-14 23:48
I?ve had this idea for a ?recipe? book for these sorts of (current edge cases) but also other things - i?ll try and prioritise in the next week or so.


hem_kec
2020-10-15 00:44
has joined #pact-python

campellcl
2020-10-15 01:02
@elliottmurray I can't get example https://github.com/pact-foundation/pact-python/tree/master/examples/e2e to run and pass all the test cases, only 2/3 pass. I have the broker up and running per your instructions (although Docker desktop threw an error warning about using windows files when WSL2 is being used instead of the Windows Hypervisor so you might want to look into that). The broker appears to be working though, I can login and see the pact broker screen. But running `pytest` in the `e2e` root directory returns an error in `e2e/tests/provider/test_provider.py` on line 54 when the Flask server is supposed to start with: `server.start()`. It looks like an internal Flask error.

campellcl
2020-10-15 01:07
Also, you might want to cleanup the command arguments in `e2e/README.md` on lines 14-17. You may have meant to have them in the `bash` section of the markdown. I'm using Anaconda and can't get `pipenv` to work inside Anaconda. So I just ran `pip install -r requirements.txt` and `pip install ../../` then skipped the `pipenv` section of the readme. Which might be part of the problem. Have you encountered this issue with `pipenv install` from within Anaconda?

campellcl
2020-10-15 01:11
Anaconda works nicely with `pip` but I'm not sure how nicely it plays with `pipenv`. I get `Failed to create virtual environment` with `pipenv` looking for a file/directory that does not exist in the Anaconda `Anaconda3/venv/scripts/nt/python.exe` directory.

campellcl
2020-10-15 01:16
So for me at least @matt.fellows, the current python example in `master` does not run fully.

elliottmurray
2020-10-15 08:59
So pipenv was inherited from a previous example. To keep it simpler I can probably remove that. It does manage having a separate virtualenv for examples a bit easier.

elliottmurray
2020-10-15 08:59
Thanks for pointing out the readme. I?ll have a look

elliottmurray
2020-10-15 09:12
So I checked Makefile and it is using plain old pip for examples in CI. I think that should be ok and I?ve updated the readme to reflect that

elliottmurray
2020-10-15 09:13
I?m not sure I can help you with Anaconda/Flask. I suspect it will be to do with processes

elliottmurray
2020-10-15 09:14
You can share some of the stack trace and I can see if something is obvious

marco.cordeiro
2020-10-15 10:54
has joined #pact-python

adriangabrieloros
2020-10-15 11:39
hey guys! j have a question: can we use pact for contract tests that involve kafka and not endpoints? thanks

betty.he
2020-10-15 14:32
has joined #pact-python

maciej.olko
2020-10-15 14:50
hi, unfortunately pact-python doesn?t support messaging contracts yet

seda.urguplu6
2020-10-15 15:15
has joined #pact-python

seda.urguplu6
2020-10-15 15:42
Hi everyone. I wrote only a basic consumer side test using pact-python. It takes more than 1 minute for start_service() method to run. Also as I see in the pact-mock-service.log, test completed in 4 minutes. Is there a problem with me or is it a normal situation?

elliottmurray
2020-10-15 17:19
That is a lot longer than it takes for me

matt.fellows
2020-10-15 23:23
hi @adriangabrieloros take a look at this thread: https://pact-foundation.slack.com/archives/C9VECUP6E/p1602630833022400

matt.fellows
2020-10-15 23:24
There is a strategy to do this sort of thing, I?d like to document it up to make it easy for people to understand

matt.fellows
2020-10-15 23:24
To be honest, it?s not a huge amount of work to add to python library itself (based on my experience doing it for both JS and Go). It should be a couple of days work MAX

matt.fellows
2020-10-15 23:24
so if you wanted the feature, and didn?t want to spend as much time doing workarounds, a contribution would be the simplest way forward (I think)

tamer
2020-10-16 09:08
has joined #pact-python

mario.gioiosa
2020-10-16 18:57
has joined #pact-python

campellcl
2020-10-16 19:01
@matt.fellows @bethskurrie Me and @elliottmurray were discussing the Python side of things. It turns out that it is non-trivial to get the example logic working on a Windows machine due to a bug in the `multiprocessing` module on Windows. The guys over at Flask do not recommend running Flask in a separate thread the way it is being leveraged currently in `pact-python`. It's looking like Pact is going to need to fundamentally revisit how it does things on the Python side in order to support Windows with the multiprocessing constraints. After looking into this for 8+ hours I do not believe this will be a couple days of work to fix. The Flask guys were adamant about using their `test_client` instead of a seperate thread. The `test_client` does not dispatch external HTTP calls, and as such cannot be used with `pact-python` to dispatch HTTP calls via the Ruby CLI to the Flask server.

campellcl
2020-10-16 19:03
Since using the `test_client` will not work with the Python wrapper around the Ruby CLI, they suggested using a separate process to spin up the Flask server and then returning control to Pact to handle the `Verifier` logic. That is not an ideal solution by any means. The other suggestion they gave was to use a proper WSGI server in conjunction with Flask. This is also outside the purview of Pact's currently functionality.

campellcl
2020-10-16 19:06
So, in its current state. It appears that `pact-python` does not fully support Windows. The pact mock provider needs to be run externally of Pact, and monitored for deployment, before returning control to the Pact `Verifier` to dispatch calls via the Python wrapper (and hence the Ruby CLI) over HTTP on localhost.

campellcl
2020-10-16 19:15
In short, that is rather a mess. And it isn't at all easy to set up, defeating the purpose of Pact. I would strongly consider dropping support for Windows, or revisiting the idea of sending HTTP calls via the Ruby CLI (where the Python logic cannot intercept or modify the payloads). Ideally, I should be able to use the Flask `test_client` with the Pact `Verifier` internally, without needing to dispatch the actual HTTP call to the Pact mock provider. If you want to keep the paradigm of making the actual HTTP call (to simulate the network stack fully) then you have some non-trivial architectural decisions to make, in relation to supporting Python on the Windows environment with Flask.

simon.nizov
2020-10-17 12:56
Heya! Can we add the Hacktoberfest Topic/Label to the `pact-python` repo? :smile: https://hacktoberfest.digitalocean.com/hacktoberfest-update

elliottmurray
2020-10-17 14:11
@beth or @matt.fellows I?ll need you to do this I think. I?m not admin

matt.fellows
2020-10-17 21:34
done, sorry I thought I?d added them

matt.fellows
2020-10-17 21:40
The longer term plan is to use a shared library written in Rust (see https://github.com/pact-foundation/pact-reference). It?s currently used in a few of the implementations, and is in beta for JS. Hopefully in the next few months we?ll roll out the Golang and Swift iOS editions. It?s going to take some time to fully migrate of course, so it?s sad to hear stories like this (we know of some related underlying Ruby bundling issues, but this is a new one)

matt.fellows
2020-10-17 23:57
For now, I'd recommend running the CLI verifier directly (as per the example I think you've seen that uses Docker) - that's of course if you even stick with Pact!

alik.berezovsky
2020-10-18 17:58
@alik.berezovsky has left the channel

lior.baber
2020-10-19 07:33
has joined #pact-python

matt.fellows
2020-10-19 13:27
@simon.nizov thanks for your contributions! :taco:

simon.nizov
2020-10-19 14:23
Got that Hacktoberfest spirit :all_the_things:

jeffbdye
2020-10-19 17:10
has joined #pact-python

jace
2020-10-19 19:22
has joined #pact-python

almaak
2020-10-20 09:35
has joined #pact-python

andra.moraru
2020-10-20 14:13
has joined #pact-python

camila.coder91
2020-10-20 17:06
has joined #pact-python

julzelements
2020-10-21 05:25
has joined #pact-python

kapil.mathur
2020-10-21 06:40
has joined #pact-python

kapil.mathur
2020-10-21 06:43
Hi team, I am trying to install pact-python in a python 3.8.2 virtualenv but its failing with a huge stack track complaining about something regarding the psutil package which seems to be a dependancy for pact-python this is the shorter version of the error i am getting ``` Running setup.py clean for psutil Failed to build psutil Installing collected packages: psutil, pact-python Running setup.py install for psutil ... error```

kapil.mathur
2020-10-21 06:44
has anyone else faced this issue as well.. if yes plz help me out

kapil.mathur
2020-10-21 06:44
Also sending the complete stacktrace below

kapil.mathur
2020-10-21 06:45
Any help is highly appreciated as this is a bit urgent for me..thanks in advance

maciej.olko
2020-10-21 06:51
which version of pip do you use?

maciej.olko
2020-10-21 06:51
have you tried with most recent version?

kapil.mathur
2020-10-21 08:34
actually i just upgraded my python3 version to 3.8.5 from 3.8.2 (installed 3.8.5 basically)

kapil.mathur
2020-10-21 08:34
and psutil got installed with the latest version

kapil.mathur
2020-10-21 08:35
and then the pact-python got installed with version1.2.9 as well

kapil.mathur
2020-10-21 08:35
basically just bumping the virtual env p ython3 version helped :neutral_face:

maciej.olko
2020-10-21 08:35
:+1:

mark.hudson
2020-10-21 10:45
has joined #pact-python

cluu
2020-10-21 17:16
has joined #pact-python

camila.campos
2020-10-21 21:35
has joined #pact-python

ajayarooon
2020-10-22 05:40
Hello People, Could someone please help me with setting up pact-broker using python? I succesfully created the consumer pact file. I'm a bit clueless how to move forward from here. Any help would be greatly appreciated

maciej.olko
2020-10-22 05:42
Hello, pact-broker is available as a Docker image, that?s the easiest way to set it up. Or do you mean setting up a connection with pact-broker?

ajayarooon
2020-10-22 06:18
@maciej.olko Thank you for the reply. Sure, I'll explore it. You're right, I'm trying to set up a connection with pact-broker.

maciej.olko
2020-10-22 06:25
The easiest way should be setting `publish_to_broker=True` in `has_pact_with()` method: ```Consumer('foo').has_pact_with( 'bar', publish_to_broker=True, broker_base_url="http://localhost:8000" )```

longlevan
2020-10-22 09:15
has joined #pact-python

ashish_garg5
2020-10-22 09:55
Hi All, I am trying to make use of provider_states_setup_url, but no matter whatever values i pass in response it's always passing. I am using the below line in my .verify_with_broker ```provider_states_setup_url="{}/_pact/provider_states".format(pact_mock_url)``` And added the below method for states mapping ```@app.route('/_pact/provider_states', methods=['GET', 'POST']) def states(): mapping = { 'get inventory': {"productName": "Laptops", "locationName": "Bangalore", "quantity": 1000} } mapping[request.json['state']]() return jsonify({'result': request.json['state']})``` Now if i change this get inventory response also then also build is not failing, it means it's not checking the state response at all. Could someone please help me. Not sure what i am missing here. Thanks.

justin.garfield
2020-10-22 16:15
has joined #pact-python

guppy0356.nakira
2020-10-23 00:34
has joined #pact-python

guppy0356.nakira
2020-10-23 00:43
Hi Team

guppy0356.nakira
2020-10-23 00:46
I try to use pact-python in Lmabda(Python) + WebAPI. `pact-python` is great package but it is not suitable in my case. I think following step is better. Would you give me some comments? Of course, It is not perfect because if Lambda use RDS, I have no idea to setup test dataset. ```1. Run `sam local start-api` 2. Run `pact-provider-verifier` 3. Check exit status code```

matt.fellows
2020-10-23 00:49
is https://pypi.org/project/webapi/ what you mean by WebAPI?

matt.fellows
2020-10-23 00:50
> Of course, It is not perfect because if Lambda use RDS, I have no idea to setup test dataset. I would either a) use a docker database locally or b) stub the database layer entirely for these tests

matt.fellows
2020-10-23 00:50
so when you run `sam local start-api` you might need to have a test variant, which has all downstream/external dependencies stubbed

matt.fellows
2020-10-23 00:51
What you?re suggesting is reasonable, I think

guppy0356.nakira
2020-10-23 00:55
Oops! WebAPI is not correct expression. It's API Gateway which is content in AWS.

matt.fellows
2020-10-23 00:56
OK yes that?s what I thought

matt.fellows
2020-10-23 00:57
Then I would go with your solution indeed. No need to use the Python verifier package, and you can use the same strategy for any other language behind API gateway too

guppy0356.nakira
2020-10-23 01:01
> you can use the same strategy for any other language behind API gateway too I think so too. By the way, Thank you for invitation for this Slack.

matt.fellows
2020-10-23 01:01
You?re most welcome!!

ashish_garg5
2020-10-23 05:44
Hi, Is there any examples for python AMQP ? If anyone can provide some reference. And i checked pact-python doesn't support AMQP and pactman doesn't support AMQP for version below 3.6. So is there any alternative ? Thanks.

bethskurrie
2020-10-23 06:01
Python doesn't support messages yet @ashish_garg5 but I believe the development is underway

ashish_garg5
2020-10-23 06:02
Is there any timeline ?

bethskurrie
2020-10-23 06:02
I'm not sure who is working on it, sorry.

ashish_garg5
2020-10-23 06:02
Ok np thanks :slightly_smiling_face:

bethskurrie
2020-10-23 06:02
I don't know much about the python impl.

bethskurrie
2020-10-23 06:03
Someone will probably reply over the next few days. @elliottmurray might be looking at it?

ashish_garg5
2020-10-23 06:06
ok sure :thumbsup:

ajayarooon
2020-10-23 07:06
Thanks @maciej.olko ... I'll try

elliottmurray
2020-10-23 09:52
Hey Ashish - unfortunately I haven?t been looking at messaging recently. I?ll try and carve some time out. It?s been on my radar but just hasn?t progressed yet.

seda.urguplu6
2020-10-23 11:28
Hi. Can you please check what is wrong with Eachlike here? Real response is like this: `{` `"count": 30,` `"results": [` `{"hotel_code": "111"},` `{"hotel_code": "222"},` `{"hotel_code": "333"}` `]` `}` `expected = {` `'count': 1,` `"results":` `EachLike({` `"hotel_code": "1"` `})` `}`

ercalbwar
2020-10-24 19:24
has joined #pact-python

andrewshtamburg
2020-10-25 13:04
has joined #pact-python

siad.ardroumli
2020-10-25 18:16
has joined #pact-python

srikanthpmailid
2020-10-26 01:02
has joined #pact-python

seda.urguplu6
2020-10-26 14:29
Can someone help me with this problem please? I'm getting AssertionError. Expected :{'count': 1, 'results': [{'hotel_code': '1'}]} Actual :{'count': 1, 'results': <pact.matchers.EachLike object at 0x103b38150>}

photesthesis_geospiza
2020-10-26 15:10
has joined #pact-python

sklein
2020-10-26 15:35
You're asserting on the EachLike object instead of asserting on an array of hotel_code object things. How i normally structure my assertions is something like this... ```expected = {"count": 1, "results":[{"hotel_code": "1"}]} ... .will_respond_with(body={"count":1, "results": EachLike(expected.get("results"))}) ... with pact: assert actual = expected ```

seda.urguplu6
2020-10-26 16:10
Thanks for your reply. I changed the code but now I'm getting this error. Expected :{'count': 1, 'results': [[{'hotel_code': '1'}]]} Actual :{'count': 1, 'results': [{'hotel_code': '1'}]}

matt.fellows
2020-10-26 21:33
Each like usually accepts an individual object which is used to match each item in the array. So you usually don't pass the array in to the matcher (hence the extra nested array)

ashish_garg5
2020-10-27 05:06
Sure @elliottmurray Thanks for the update.

seda.urguplu6
2020-10-27 08:45
This solved the problem ```body={"count":Like(1), "results": EachLike(expected["results"][0])}``` Thanks Sean and Matt :slightly_smiling_face:

matt.fellows
2020-10-27 09:02
Yep, that makes sense

jackbwheatley
2020-10-27 21:02
has joined #pact-python

carlosalmeida.xon
2020-10-27 22:06
has joined #pact-python

nasir.amin
2020-10-28 11:07
has joined #pact-python

jimish.shah.-nd
2020-10-28 11:26
has joined #pact-python

adam_figgins
2020-10-28 14:20
has joined #pact-python

aperdomobo
2020-10-28 15:42
has joined #pact-python

diazguerra2
2020-10-28 16:06
has joined #pact-python

xsamore
2020-10-28 19:52
has joined #pact-python

simon
2020-10-28 20:49
has joined #pact-python

ruben.cagnie
2020-10-29 01:24
has joined #pact-python

272939217
2020-10-29 05:33
has joined #pact-python

driloni92
2020-10-29 09:05
has joined #pact-python

pauloavra
2020-10-29 12:33
has joined #pact-python

cluu
2020-10-30 15:35
Hi, could someone please point me to an example of a file upload request? From what I?ve read so far, I have to place the content of the file in the body, which is not ideal. Any pointers will be greatly appreciated.

jikogay728
2020-10-30 17:20
has joined #pact-python

blmlcu
2020-10-31 14:51
has joined #pact-python

andrewshtamburg
2020-10-31 17:26
Hey! I?m trying to get started with pact. Tried to run tests from https://github.com/pact-foundation/pact-python/tree/master/examples/e2e and got this error. Anything obviously wrong I?m doing here? Python version: `3.8.2`

elliottmurray
2020-10-31 21:25
Are you on Windows? Flask has problems running in a back ground process on Windows. I do have an action to treat it out on fastapi. I don?t have Windows so it?s not trivial for me to test

andrewshtamburg
2020-11-01 08:21
Nope, I?m on mac OS Catalina. Version 10.15.3

elliottmurray
2020-11-01 10:56
Hmmm

elliottmurray
2020-11-01 10:57
Let me try updating python version

elliottmurray
2020-11-01 11:10
hmmm you?re right. I get the same issue on 3.8.3. Ok let me think about this. It?s something I need to have a better example of.

elliottmurray
2020-11-01 11:10
FYI it?s an issue with trying to run Flask as a subprocess

andrewshtamburg
2020-11-01 11:12
Ok, great, at least I didn?t waste your time on non issue. > FYI it?s an issue with trying to run Flask as a subprocess Actually, that is what I was about to ask. Is there a strong reason why you are running it as a subprocess in these examples?

elliottmurray
2020-11-01 11:45
Well to just use pytest as a testing framework so more a dev-ex thing


elliottmurray
2020-11-01 11:46
I have sh script that should be a good starting point

elliottmurray
2020-11-01 11:46
Let me know if that solves the immediate problem

elliottmurray
2020-11-01 11:47
I should do a FastApi example. That might work with pytest as is

andrewshtamburg
2020-11-01 12:12
The immediate issue seems to be resolved, thanks! Although, now I?m getting the same test failed. Seems like connection to broker refused? I have the broker running locally

andrewshtamburg
2020-11-01 12:24
Sorry, ignore all that. Wasn?t running provider service before executing tests All good

elliottmurray
2020-11-01 12:50
:+1:

272939217
2020-11-02 08:55
can anyone help me out? thanks a lot. i got an issue when to post a request

272939217
2020-11-02 08:56
the contract file is correct, like this.

272939217
2020-11-02 08:56
{ ?method?: ?post?, ?path?: ?/data?, ?body?: { ?username?: ?UserA? } }

272939217
2020-11-02 08:56
but when i try to verify the provider. the api said post.data is None (which is expect ?username: UserA?)

272939217
2020-11-02 08:57
File ?/Users/jfu/workspace/downstream/src/downstream.py?, line 32, in get_data name = data.get(?username?) AttributeError: ?NoneType? object has no attribute ?get?

matt.fellows
2020-11-02 09:18
Hmmm. Looks like the content-type header isnt set. Some API frameworks don't like this

272939217
2020-11-02 09:20
thanks, let me try with header

272939217
2020-11-02 09:37
?1 interaction, 0 failures? it works:)

matt.fellows
2020-11-02 09:41
Awesome. I think it's worth adding to the readme. I think I have it on both JS and Golang because it's common

272939217
2020-11-02 09:48
may i ask another generic question? our company?s microsystem is developed by JAVA mainly, our QA team are better in python. contract test is written by java version pact better, right? is it possible to write unit test by python on consumser side (which is by java)?

matt.fellows
2020-11-02 09:52
On the consumer side, it has to be Java. It?s a unit test, so there is really no other way

matt.fellows
2020-11-02 09:52
on the provider side, you could do it in Python, but it really is best done in Java also

272939217
2020-11-02 09:53
ok, got it

matt.fellows
2020-11-02 09:53
On the provider side, you could use the CLI verifier (https://docs.pact.io/implementation_guides/cli/#provider-verifier)

matt.fellows
2020-11-02 09:53
but provider states get hard, and almost certainly at some point you?ll need to change Java. So it?s just easier that way

272939217
2020-11-02 09:55
thanks, it seems our QA need to look into java version of pact now.


matt.fellows
2020-11-02 09:56
It?s not the most eloquently written, but it probably helps

272939217
2020-11-02 09:57
yes

jamescourtoy
2020-11-02 21:04
has joined #pact-python

telmo.ferreira.costa
2020-11-03 11:32
has joined #pact-python

sergii.kopovskyi
2020-11-03 12:35
has joined #pact-python

silverton.gimenes
2020-11-03 17:58
has joined #pact-python

colber16
2020-11-03 18:34
has joined #pact-python

cvoong
2020-11-03 18:55
has joined #pact-python

joel.whalen
2020-11-06 19:42
Hello, is there an easy way to configure multiple log files to be written across different pact tests? We currently have 4 pact files being written, but all the log outputs are going to the same file. This makes it confusing when working on individual tests.

elliottmurray
2020-11-06 20:17
A lot of the python impl uses a ruby subprocess. I?m guessing you?re giving them the same file handle and it?s overwriting rather than appending? You?d probably have to give me a bit more info about what you?re trying to do. Like is it a Consumer testing 4 Providers? Or vice versa? Different CI?s etc.

elliottmurray
2020-11-06 20:17
Cool profile pic btw

cluu
2020-11-06 20:19
Correct me if I?m wrong, the log file name is hard-coded to be `pact.log` for Provider test. You can change the `log_dir` value for each of your pact test though.

elliottmurray
2020-11-06 20:22
I think for Provider you are correct

elliottmurray
2020-11-06 20:22
```def call_verify( self, *pacts, provider_base_url, provider, enable_pending=False, include_wip_pacts_since=None, **kwargs ): """Call verify method.""" verbose = kwargs.get('verbose', False) self._validate_input(pacts, **kwargs) provider_app_version = kwargs.get('provider_app_version') options = { '--provider-base-url': provider_base_url, '--provider': provider, '--broker-username': kwargs.get('broker_username', None), '--broker-password': kwargs.get('broker_password', None), '--pact-broker-base-url': kwargs.get('broker_url', None), '--provider-states-setup-url': kwargs.get('provider_states_setup_url'), '--log-dir': kwargs.get('log_dir'), '--log-level': kwargs.get('log_level') }```

cluu
2020-11-06 20:35
Hi, I?m stuck on `EachLike` and hoping someone can provide a pointer. ``` expected = { "data": [ { "dataType": "numeric", "name": "code" }, { "dataType": "string", "name": "description" }], "results": [ [ { "name": "code", "value": 1233 }, { "name": "description", "value": "desc1" } ], [ { "name": "code", "value": 1234 }, { "name": "description", "value": "desc2" } ] ] }```

cluu
2020-11-06 20:35
```.will_respond_with(200, body={"data": Like(expected["data"]), "results": EachLike(Like(expected.get("results")[0]))}))```

cluu
2020-11-06 20:36
but it?s not working as expected.

cluu
2020-11-06 20:36
I?m getting assertion error ``````

elliottmurray
2020-11-06 20:39
I?m not totally sure but result has arrays in an array. So maybe EachLike(Like(expected.get(?results?)[0][0]

elliottmurray
2020-11-06 20:39
???

elliottmurray
2020-11-06 20:40
I?m not sure what you?re response is doing though?

cluu
2020-11-06 20:47
Each result is an object or a record. Below is a result. The results is an array of records ```[ { "name": "code", "value": 1233 }, { "name": "description", "value": "desc1" } ]```

cluu
2020-11-06 20:47
I hope that makes sense

elliottmurray
2020-11-06 21:09
So I think the extra [0] I put in is what you need?

cluu
2020-11-06 21:13
I tried that and it will not work since it only matches the first part of the record.

cluu
2020-11-06 21:14
I wanted to match an array containing like records

bethskurrie
2020-11-06 21:14
Each like doesn't need a like inside it.

bethskurrie
2020-11-06 21:15
it needs a single item. it looks like it was given an array.

cluu
2020-11-06 21:26
hmm?.I changed it to below and still does not work. My thought is that I want to match each record to be like `expected.get("results")[0]` ```.will_respond_with(200, body={"data": Like(expected["data"]), "results": EachLike((expected.get("results")[0])```

bethskurrie
2020-11-06 21:37
So, "data" is a hash with a name and value, and results is an array where each item has a name and value?

bethskurrie
2020-11-06 21:37
Oh, no, they're both arrays

bethskurrie
2020-11-06 21:38
```.will_respond_with(200, body={"data": EachLike({ "name": "", value: ""}), "results": EachLike({ "name": "", value: ""})```

bethskurrie
2020-11-06 21:38
Just try with the hardcoded stuff for now.

bethskurrie
2020-11-06 21:39
the looking up the data is confusing me :laughing:

cluu
2020-11-06 21:39
Thanks. I?ll give it a go. It can be. The reuse of name/value can be confusing, but it makes sense in a way :slightly_smiling_face:

cluu
2020-11-06 21:46
Still does not work. Looks like I?ll have to match exact value route.

cluu
2020-11-06 21:47
Thanks for your help though

joel.whalen
2020-11-09 18:43
It?s a consumer writing pact files for 4 different providers, yes. And that?s the thing, I?m not supplying the file name, just the directory. I think pact is defaulting to `pact-mock-service.log` as the file name

joel.whalen
2020-11-09 18:44
Yes, this is true. The issue is all 4 are writing to the same `pact-mock-service.log` file

cluu
2020-11-09 19:44
Does anyone know if there?s a way to pass parameters (or will it be implemented in the future) to call back functions for provider states?

elliottmurray
2020-11-09 20:25
Sorry I don?t understand

pbobba
2020-11-09 23:03
has joined #pact-python

jun.li
2020-11-09 23:05
has joined #pact-python

douweicai
2020-11-10 04:11
has joined #pact-python

christian.huber
2020-11-10 09:20
has joined #pact-python

vuttithatkrongyot
2020-11-10 10:57
has joined #pact-python

dan.iosif
2020-11-10 17:06
has joined #pact-python

rodrigo.costa20
2020-11-12 00:59
has joined #pact-python

yong.gong188
2020-11-12 09:13
has joined #pact-python

anandhadeepak
2020-11-12 13:03
has joined #pact-python

david.dias
2020-11-12 20:04
has joined #pact-python

billal.patel
2020-11-13 10:31
has joined #pact-python

billal.patel
2020-11-13 10:42
@billal.patel has left the channel

louis.oliver
2020-11-16 10:33
has joined #pact-python

ashishkujoy
2020-11-16 15:08
has joined #pact-python

pradeepchoube
2020-11-17 03:49
has joined #pact-python

meng-lingtao
2020-11-17 14:39
has joined #pact-python

pabvidcal
2020-11-17 15:30
has joined #pact-python

magesh.nagamani
2020-11-18 05:15
has joined #pact-python

jstoebel
2020-11-18 13:53
has joined #pact-python

daniel.sayer89
2020-11-19 10:33
has joined #pact-python

art.ptushkin
2020-11-19 10:34
has joined #pact-python

pact457
2020-11-19 10:36
has joined #pact-python

ajerthan.sivayoganath
2020-11-19 10:38
has joined #pact-python

philipchardwick
2020-11-19 11:05
has joined #pact-python

tanzmann
2020-11-19 11:09
has joined #pact-python

olivier.quere
2020-11-19 12:10
has joined #pact-python

wilfried.vandenberghe
2020-11-19 12:19
has joined #pact-python

alan.hanafy
2020-11-19 19:28
has joined #pact-python

michael.deutscher
2020-11-19 21:39
has joined #pact-python

gerry.power
2020-11-20 03:31
has joined #pact-python

alex900
2020-11-20 05:08
has joined #pact-python

tomas.panik
2020-11-20 08:28
has joined #pact-python

marc.ferland
2020-11-20 14:43
has joined #pact-python

sebastien.crapoulet
2020-11-20 15:24
has joined #pact-python

adutrillaux
2020-11-20 15:28
has joined #pact-python

he
2020-11-20 15:59
has joined #pact-python

ivgeni.slabkovski
2020-11-20 21:52
has joined #pact-python

serhatburakyildirim
2020-11-21 21:57
has joined #pact-python

alnasl
2020-11-22 18:46
has joined #pact-python

ashutosh23802
2020-11-23 06:20
has joined #pact-python

leonty
2020-11-23 10:33
has joined #pact-python

dariusz.piwko
2020-11-23 11:34
has joined #pact-python

praneeth.kumar
2020-11-23 16:18
has joined #pact-python

mark.white
2020-11-24 09:03
has joined #pact-python

ufuk.ozcelik
2020-11-24 14:58
has joined #pact-python

stefanos.varsanis
2020-11-24 16:48
has joined #pact-python

lalexander2810
2020-11-24 16:53
has joined #pact-python

sivaprasad9
2020-11-24 20:46
has joined #pact-python

scyr
2020-11-25 14:56
has joined #pact-python

timotheus.ruprecht
2020-11-25 22:12
has joined #pact-python

manali.mogre
2020-11-26 11:44
has joined #pact-python

erik.terpstra
2020-11-26 12:08
has joined #pact-python

kjayachandra2000
2020-11-26 20:40
has joined #pact-python

kjayachandra2000
2020-11-26 22:00
@kjayachandra2000 has left the channel

sushil.kumar
2020-11-27 01:45
has joined #pact-python

zhujian
2020-11-27 07:54
has joined #pact-python

h.octavian
2020-11-27 14:08
has joined #pact-python

noel
2020-11-28 23:12
has joined #pact-python

muraalee
2020-11-30 01:56
has joined #pact-python

pooja.sharma
2020-11-30 08:52
has joined #pact-python

mo
2020-11-30 09:24
has joined #pact-python

jstoebel
2020-11-30 14:29
Hello! I am new to the pact eco-system so feel free to route my question somewhere else if this is the wrong place to ask: I'm curious if there is a mechnisim to enforce uniformity in how services are referenced in pacts. For example let's say one consumer has this: ```Consumer('consumer-1').has_pact_with(Provider('users'))``` What's to stop another service from referring to the same users service by a different name? ```Consumer('consumer-service-2').has_pact_with(Provider('users-service'))```

maciej.olko
2020-11-30 14:37
Pact Broker has such a feature, it recognises similar names and suggests using same name for too similar but not equal name

david.greene
2020-11-30 21:47
has joined #pact-python

matt.fellows
2020-11-30 23:12
So there are a few options. There are no automatic standards at this moment in time (but you?re not the first, not just for naming things but also for APIs themselves): 1. In Pactflow, you can restrict creating of new contracts by using roles and permissions 2. Some customers/users have ?admins? who look after the broker and curate it regularly 3. One option would be to create a webhook that fires for new contracts, the target (e.g. a lambda) reads the contract and sends a notification to an admin if it?s not using a consistent style

matt.fellows
2020-11-30 23:12
just some thoughts on the top of my head!

jstoebel
2020-11-30 23:39
good ideas, thanks!

matt.fellows
2020-11-30 23:43
oh, you could also (probably) extend/modify the broker validation logic to ensure it matches your needs. I?m sure you could find a way to customise that without breaking upgrades etc.

jstoebel
2020-12-01 00:01
I bet I could. Because Ruby :slightly_smiling_face:

bas
2020-12-01 09:00
has joined #pact-python

wainstead
2020-12-01 14:57
has joined #pact-python

jerobinson
2020-12-01 20:32
has joined #pact-python

sumedhagamage
2020-12-02 03:33
has joined #pact-python

fealaer
2020-12-02 11:40
has joined #pact-python

fealaer
2020-12-02 11:58
@fealaer has left the channel

patrick.hendron
2020-12-02 14:44
has joined #pact-python

lpratt
2020-12-02 18:19
has joined #pact-python

sandragnzalez
2020-12-03 11:04
has joined #pact-python

kristian
2020-12-03 14:34
has joined #pact-python

me1466
2020-12-03 23:42
has joined #pact-python

wenfeng.li
2020-12-04 11:42
has joined #pact-python

cdambo
2020-12-05 11:59
has joined #pact-python

gayatree.eee
2020-12-08 04:50
has joined #pact-python

c.pavan1986
2020-12-09 04:18
has joined #pact-python

william.pritchard
2020-12-09 15:28
has joined #pact-python

parveshchaudhary111
2020-12-09 17:54
has joined #pact-python

w.sobasik
2020-12-10 10:39
has joined #pact-python

thanuxxxx
2020-12-12 22:41
has joined #pact-python

ian.hamilton
2020-12-13 06:53
has joined #pact-python

colm.j.murphy91
2020-12-13 07:02
has joined #pact-python

danhitchcock
2020-12-13 11:55
@danhitchcock has left the channel

victoria.kruczek
2020-12-13 14:13
has joined #pact-python

wuddarwin
2020-12-14 05:23
has joined #pact-python

connor.aird
2020-12-14 15:52
has joined #pact-python

arman.najafian
2020-12-14 15:52
has joined #pact-python

praveen.lakkaraju
2020-12-14 16:12
has joined #pact-python

alejandro.germain
2020-12-14 16:26
has joined #pact-python

josh.ellinger
2020-12-15 01:22
has joined #pact-python

nikitsenka
2020-12-15 09:35
has joined #pact-python

hibahawes
2020-12-15 09:53
has joined #pact-python

ashish_garg5
2020-12-15 10:00
Hi All, I am using consumer_tags in my provider Verifier.verify_with_broker(consumer_tags={"latest", "dev"}) I want to run my provider against latest dev tag of consumer and latest tag of consumer whatever is the latest tag present, but by writing this above line it is running against the latest dev tag but not running against the latest tag present in the broker. I think it is looking for latest latest tag in this case. Please let me know how i can fetch latest tag also from the broker with this. Thanks.

sarvar
2020-12-15 14:24
has joined #pact-python

suruchipatidar14
2020-12-16 05:35
has joined #pact-python

smatheson
2020-12-16 06:33
has joined #pact-python

elliottmurray
2020-12-16 15:05
I am actually not sure on this - have you tried #pact-broker as that may be a better answer for this. Python sdk just proxies calls in most cases.

olayemifolakemi
2020-12-16 15:23
has joined #pact-python

ania.kovalchuk
2020-12-17 00:09
has joined #pact-python

writetojoshma
2020-12-17 05:52
has joined #pact-python

rejeesh.g
2020-12-17 11:07
has joined #pact-python

lukas.kempec
2020-12-17 12:45
has joined #pact-python

vikas543
2020-12-17 16:28
has joined #pact-python

bpugh
2020-12-17 17:05
has joined #pact-python

elliottmurray
2020-12-19 12:45
Well that was unnecessarily painful (a bit of self harm I fear!) but pact-python now published via Github Actions. Thanks to @matthew.balvanz

jeff.burmood
2020-12-19 17:45
has joined #pact-python

kyle.florence
2020-12-19 19:21
has joined #pact-python

ankurmalik22
2020-12-19 21:14
has joined #pact-python

vsukumaran
2020-12-20 01:56
has joined #pact-python

omer.morad
2020-12-20 08:10
has joined #pact-python

ringo
2020-12-20 10:51
has joined #pact-python

omer.moradd
2020-12-20 18:01
has joined #pact-python

jeff.burmood
2020-12-20 18:07
Howdy, I'm relatively new to Pact and have, what might be, a rookie question. I'm trying to set up pacts for some PUT and POST endpoints where the request body is several hundred lines in a JSON file. There are updated_at timestamp fields in the response body so unless I use a Matcher on these timestamp fields, the pact verification always fails against the provider due to the timestamp in the actual response being different than the value in the associated pact. I'm trying to use a basic Term() call or a Like() call with these fields. Here's the issue, I store these huge response bodies in a file and read them into the test case when running the test. Since there is a Term() or Like() call for some fields, I can't treat these files as JSON since json.load can't parse the lines with Matcher function calls. Consequently the whole expected response body gets read in as a string (file.read().text). And I'm having a hard time figuring out how to then work with the body with embedded Matcher function calls. The method get_generated_values() won't work on these string objects that essentially contain the dict defining the response body, it just returns any string it encounters (rightly so I guess). Sorry for the long explanation, my question boils down to how to handle creating and using pacts created with Matcher functions on some fields in a request/response schema I read in from a file? Thanks for any thoughts!

elliottmurray
2020-12-20 18:30
Hey Jeff and welcome! I?m not sure I fully understand. Is this for a consumer test? If so I feel there?s a core misunderstanding. Define in the dsl the response you need to test and then pact will play that back for you when you call the relevant http end point. I?m not clear how the static json comes into play?

souravsen1
2020-12-21 11:28
has joined #pact-python

jeff.burmood
2020-12-21 14:10
Hi @elliottmurray thanks for jumping in, I appreciate it. OK, I'll try and provide a better explanation. I'm probably making this tougher than it is. I have test for a GET endpoint that will always return the same json formatted response body given the same request parameters so I can easily generate a pact that successfully verifies for the consumer and the provider. However, when I make a call to a particular PUT endpoint, the response body includes a new date-time stamp in a field called "updated-at". This is all perfectly normal behavior and, I assume, one of the reasons that Matchers exist. So, I use a Term() or Like() matcher to match the format of the updated-at field, but ignore the value. Here's an example and this is all working fine for this small example of an endpoint response (json) body: expected = { 'id': 1, 'name': 'Leanne Graham', 'username': 'Bret', 'email': ', 'address': {'street': 'Kulas Light', 'suite': 'Apt. 556', 'city': 'Gwenborough', 'zipcode': '92998-3874', 'geo': {'lat': '-37.3159', 'lng': '81.1496'}}, 'phone': Term(_r_'\d+-\d+-\d+-\d+(\s\w\d+)*',''), 'website': 'http://hildegard.org', 'company': {'name': 'Romaguera-Crona', 'catchPhrase': 'Multi-layered client-server neural-net', 'bs': 'harness real-time e-markets'} }

jeff.burmood
2020-12-21 14:12
OK, hopefully that help set the stage, here's where I'm stuck. The Matcher processing works fine because I can do this and the Matcher code generates the values I need for the assertion: _with_ pact: result = get_one_user(1) _assert_(result == get_generated_values(expected))

elliottmurray
2020-12-21 14:16
get_one_user is returning json itself?

jeff.burmood
2020-12-21 14:18
This works because the "expected" object in tis example is a python dict object so it gets processed properly by the get_generated_values() call. But, I have a scenario where the PUT endpoint returns a huge json response - hundreds of lines. I do not want to hard code this response body in the test code for the consumer and provider tests, I want to read it from a file, and then process it just like the example above. However, I cannot read in the response file as json because the Term() call cannot be json parsed: 'phone': Term(_r_'\d+-\d+-\d+-\d+(\s\w\d+)*',''), So I have to read it in as text (string). So now I have a response body with embedded Matcher code that is a string, not a dict and the get_generated_values() ignores the string when parsing, and I don;t have a clean way to convert the whole thing to dict. Soooo, I think I'm missing something because this has to be a common scenario.

jeff.burmood
2020-12-21 14:19
yes, get_one_user() is returning a json object


elliottmurray
2020-12-21 17:48
So do you need to test every value in that GET response or just a few? The point of CDC is that you test first so have only the things you need. Do you need all of those fields tested in this consumer that you had in the put? If you really do I'd take a one time task to create your dict with your matchers (might be a bit of copy and paste) and or have some smart json builder or template to help you out. It is white box testing remember so test the part of the contract you know you need to test. I know it's tempting to re-use the PUT response but I think the cyclical nature of that is setting yourself up for more problems later on.

andoni.arroyo
2020-12-21 17:51
has joined #pact-python

jeff.burmood
2020-12-21 18:06
Hi Elliot, so this is only a problem for the PUT, namely, when I'm updating an existing object and I'm comparing the expected response from the PUT with the actual response (and I do need to check all of the fields). The expected response I have stored in a file and used to create the pact during consumer-side testing, will not match the actual response from the endpoint because the "updated_at" field will have a different (newer) date-time stamp in the actual API response during the provider test. That's why I'm using Matchers, because they address this very scenario (which I know that you know better then I do, just want you to know that I think I understand how to use them). So I think my only course of action is to parse the huge json-like object (that I have to read in from the file as a string because of the embedded Matcher calls) into a Python dict() object and then everything should work fine. Someone has probably run into this scenario before because I'm not doing anything bizarre here, I just can't find a Google or Stackoverflow example for a solution on building a pact from an object read from a file that has Term() and Like() calls as some of the dictionary values. (again, it's because of these embedded Matcher function calls that the file won't load/parse into a python dict object using json.load(). So I'm probably not providing any real clarification here but I appreciate your efforts to help all the same.

elliottmurray
2020-12-21 20:37
Hey Jeff, thanks for clarifying the PUT bit and I understand a bit better but I think you're still missing the sweet spot for Pact a little. How I would go about testing your scenario. Firstly on the Provider have a test (can be unit or whatever type of test) that proves that if you give the endpoint a request a response is returned. There are plenty of unit testing tooling to allow you to match a map/dict for only certain key elements so ignore the date ones. Then on the consumer test the interaction happened as expected. Do you need values back from the PUT in your Consumer? Only test the ones your Consumer has a hard dependency on because that is your contract. Do not test for basic correctness of your Provider in your Consumer is the salient point I'm trying to make. It's subtle but Pact is to test contracts not behaviour.

elliottmurray
2020-12-21 20:39
This means your contract test should pass in a body on the 'REQUEST' but that will not need dates checking.

elliottmurray
2020-12-21 20:40
Oh and the Provider test in this scenario should again test that for the Consumer Contract Test you save or do whatever it is you need to do test Provider side.

elliottmurray
2020-12-21 20:41
That is obviously the whole point! Might seem you have an overlapping test on the Provider but they are for different things.

jeff.burmood
2020-12-21 21:15
OK, thanks @elliottmurray I think I'm following that, I'll do some experiments along the approach you've outlined. Again, I appreciate your time and help!

armorsmith42
2020-12-22 05:07
has joined #pact-python

theovanessen
2020-12-22 10:47
has joined #pact-python

stuart3166
2020-12-22 12:35
has joined #pact-python

winfante
2020-12-22 22:51
has joined #pact-python

lars.bonnes
2020-12-23 13:05
has joined #pact-python

eungjun.yi
2020-12-25 14:25
has joined #pact-python

ebanster
2020-12-27 13:18
has joined #pact-python

onur.baskirt
2020-12-28 10:48
has joined #pact-python

cdambo
2020-12-28 12:43
Hi I?ve installed pact-python 1.2.10 on my Mac, and I get the Linux ruby binary. On 1.2.9, I get the OSX binary.

elliottmurray
2020-12-28 20:58
What does the uname command return?

elliottmurray
2020-12-28 21:37
Or even better from the repl

elliottmurray
2020-12-28 21:37
import platform

elliottmurray
2020-12-28 21:37
platform.platform().lower()

cdambo
2020-12-28 22:46
On my machine? `macos-10.16-x86_64-i386-64bit`

elliottmurray
2020-12-29 09:09
So we?re expecting

elliottmurray
2020-12-29 09:09
`Darwin-19.6.0-x86_64-i386-64bit`

elliottmurray
2020-12-29 09:09
I?m on Catalina 10.15.7 and haven?t updated for a while. What are you on?

massimo.daros
2020-12-29 13:18
has joined #pact-python

cdambo
2020-12-29 14:08
Big Sur. Is it possible the 1.2.10 wheel points macOS installations to Linux ruby binary?

elliottmurray
2020-12-29 14:10
Let me update my mac now. I'm not sure but we haven't really changed that code as far as I can tell. You can see in setup.py what it is doing

elliottmurray
2020-12-29 14:10
We did change the CI actually - to github. Hmmmm

elliottmurray
2020-12-29 14:11
Still doesn't explain why you get a difference on the repl to me. That has nothing to do with Pact

elliottmurray
2020-12-29 14:15
tbh you should have got an error with that

elliottmurray
2020-12-29 14:23
hmm I think you might be on to something. I'll have a look this evening. Maybe just fix to 1.2.09 until then?

elliottmurray
2020-12-29 14:24
There is now a wheel where before there wasnt so I think a change in how we package

cdambo
2020-12-29 14:26
Thanks! :)

chris.fullinwider
2020-12-29 18:15
has joined #pact-python

elliottmurray
2020-12-29 20:14
Let me know if 1.2.11 works for you

cdambo
2020-12-30 16:42
Works! Thanks @elliottmurray :smile:

piotr.soltysiak
2020-12-30 16:55
has joined #pact-python

adrian.przybyla
2021-01-04 13:41
has joined #pact-python

dcorrales
2021-01-04 22:06
has joined #pact-python

jokubas.lekevicius
2021-01-04 22:10
has joined #pact-python

matt195
2021-01-05 16:35
has joined #pact-python

rafael.manzoni
2021-01-05 17:56
has joined #pact-python

animesh2712
2021-01-05 19:29
has joined #pact-python

info
2021-01-06 01:55
has joined #pact-python

pascal.libenzi
2021-01-06 10:57
has joined #pact-python

brett
2021-01-06 18:55
has joined #pact-python

josh.rosenfeld
2021-01-06 19:39
has joined #pact-python

carlo
2021-01-07 13:24
has joined #pact-python

danny.porrello
2021-01-07 16:48
has joined #pact-python

dawood.abbas
2021-01-08 07:00
has joined #pact-python

victoria.kruczek
2021-01-10 16:37
@victoria.kruczek has left the channel

cksharma122
2021-01-10 17:19
has joined #pact-python

caiquedpfc
2021-01-11 04:05
has joined #pact-python

henrik.rudstrom
2021-01-11 18:30
has joined #pact-python

eric
2021-01-12 10:23
has joined #pact-python

fnguyen
2021-01-13 00:39
has joined #pact-python

pollet_22
2021-01-13 16:04
has joined #pact-python

dshattuck
2021-01-13 20:49
has joined #pact-python

thomas.rosati
2021-01-13 21:58
has joined #pact-python

rahulsmalpani
2021-01-14 07:56
has joined #pact-python

sacha.camfferman768
2021-01-14 09:42
has joined #pact-python

brandonbeard86
2021-01-14 22:10
has joined #pact-python

geetishnayak
2021-01-15 01:02
has joined #pact-python

shettyg
2021-01-15 14:18
has joined #pact-python

natarajang1
2021-01-15 15:29
has joined #pact-python

elliottmurray
2021-01-15 22:11
closed?

winfante
2021-01-18 00:56
We will have another PR very soon. We?re just adding a message handler and possibly a publish to broker implementation

winfante
2021-01-18 04:25
we?ve created a PR now that should be ready for review https://github.com/pact-foundation/pact-python/pull/194

elliottmurray
2021-01-18 08:54
This looks great William but it's going to take me a few days to process

michel.neufeglise
2021-01-18 08:55
has joined #pact-python

bart.boersma
2021-01-18 10:48
has joined #pact-python

winfante
2021-01-18 21:44
no worries

monica.wu
2021-01-19 06:25
has joined #pact-python

makobernal
2021-01-19 08:23
has joined #pact-python

jibrail.idris
2021-01-19 10:11
has joined #pact-python

jmvb.registros
2021-01-19 11:01
has joined #pact-python

tpham
2021-01-19 22:36
has joined #pact-python

vishal.grover
2021-01-20 03:12
has joined #pact-python

priya.saraf
2021-01-20 08:43
has joined #pact-python

fahad.aj.khan
2021-01-20 08:58
has joined #pact-python

nicole.jaenchen
2021-01-20 09:38
has joined #pact-python

dinakaran.ulaganathan
2021-01-20 13:59
has joined #pact-python

ptsiakos77
2021-01-20 21:55
has joined #pact-python

lbraymusso
2021-01-20 23:57
:clap: So glad to see this! My company has been eager to leverage Message Pact support for their growing library of Python services that use Kafka. @winfante thanks to you and your colleague for the efforts here, very keen to try it out once it's gone under review!

mhdtouban
2021-01-21 01:58
has joined #pact-python

veeraprathap.n
2021-01-21 04:10
has joined #pact-python

tsiakos
2021-01-21 09:24
has joined #pact-python

oleg
2021-01-21 13:05
has joined #pact-python

thomas.powell
2021-01-22 10:18
has joined #pact-python

stefan.selent
2021-01-23 01:54
has joined #pact-python

paulo
2021-01-25 11:37
has joined #pact-python

kmckeever
2021-01-25 14:38
has joined #pact-python

robert.land
2021-01-25 19:25
has joined #pact-python

aparnachaudhari
2021-01-25 21:34
has joined #pact-python

gwhill7
2021-01-25 23:23
has joined #pact-python


bibinc99
2021-01-26 14:37
has joined #pact-python

tsiakos
2021-01-26 14:56
@elliottmurray I verified the proposed change it works file - here is the json produced ```{ "consumer": { "name": "TestConsumer_message" }, "provider": { "name": "TestProvider_message" }, "messages": [ { "description": "an account mesage", "providerStates": [ { "name": "Provider state", "params": null } ], "contents": { "id": 1, "uid": "fc763eba-0905-41c5-a27f-3934ab26786c", "name": "Winterfell", "website_url": "http://winterfell.com", "subdomain": "winterfell", "domain": "http://winterfell.com", "description": "Lorem ipsum dolor sit amet.", "style": "minimal", "translations": { "en": { "description": "Lorem ipsum dolor sit amet" } } }, "matchingRules": { "body": { "$.id": { "matchers": [ { "match": "type" } ] }, "$.uid": { "matchers": [ { "match": "regex", "regex": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" } ] }, "$.name": { "matchers": [ { "match": "type" } ] }, "$.website_url": { "matchers": [ { "match": "regex", "regex": "^(http|https):\\/\\/[a-z0-9]+(-[a-z0-9]+)*\\.+[a-z]{2,}$" } ] }, "$.subdomain": { "matchers": [ { "match": "type" } ] }, "$.domain": { "matchers": [ { "match": "regex", "regex": "^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}$" } ] }, "$.description": { "matchers": [ { "match": "type" } ] }, "$.style": { "matchers": [ { "match": "type" } ] }, "$.translations.en.description": { "matchers": [ { "match": "type" } ] } } }, "metaData": { "contentType": "application/json", "source": "legacy_api" } } ], "metadata": { "pactSpecification": { "version": "3.0.0" } } }```

elliottmurray
2021-01-26 15:52
@tsiakos I think they are working on this still. I can't take credit for this one! I am expecting a follow up PR soon

tsiakos
2021-01-26 15:54
ok thanks a lot!! maybe i will ping @winfante

winfante
2021-01-26 21:31
Thanks @tsiakos for raising this. I can verify in my local that your `from_term` suggestion is working :slightly_smiling_face: @tpham and I are still working on putting up a message provider PR soon. Whichever you prefer, you may file this as a separate PR or we can include it as part of our message provider pr. Thanks!

luisc.barretog
2021-01-27 00:42
has joined #pact-python

tsiakos
2021-01-27 06:33
@winfante  Thank you for your response! I am fine by including this as part of your message provider PR. Creat job once again!

laxmi.somni508
2021-01-27 10:27
has joined #pact-python

ryanding16
2021-01-27 20:25
has joined #pact-python

athurner
2021-01-28 13:55
has joined #pact-python

alex.mcnair
2021-01-28 18:35
has joined #pact-python

mailinglistsspammedme
2021-01-28 23:30
has joined #pact-python

steven.beaver.retail
2021-01-29 15:34
has joined #pact-python

ekberli.elbrus
2021-01-30 16:33
has joined #pact-python

george.south
2021-02-01 21:12
has joined #pact-python

twierzchowski
2021-02-03 07:05
has joined #pact-python

yassin.hajaj
2021-02-03 10:35
has joined #pact-python

dany.marques90
2021-02-03 12:48
has joined #pact-python

marcelo
2021-02-03 13:11
has joined #pact-python

sandeeparthur
2021-02-03 19:46
has joined #pact-python

octoberclub
2021-02-04 16:27
has joined #pact-python

slavick
2021-02-04 17:21
has joined #pact-python

imran.settuba
2021-02-04 18:57
has joined #pact-python

christopher.roberts
2021-02-05 01:02
has joined #pact-python

r.darcel
2021-02-05 09:15
has joined #pact-python

ashish.joshi
2021-02-06 01:07
has joined #pact-python

przemek.sech296
2021-02-08 23:18
has joined #pact-python

vplows
2021-02-09 06:00
has joined #pact-python

rodney.stromlund
2021-02-09 16:18
has joined #pact-python

nada
2021-02-09 19:00
has joined #pact-python

siddhardhan
2021-02-09 20:21
has joined #pact-python

sjdl
2021-02-09 22:14
has joined #pact-python

lars.hisken916
2021-02-10 08:08
has joined #pact-python

pauligoe10
2021-02-10 08:19
has joined #pact-python

tusharvarm
2021-02-10 09:38
has joined #pact-python

igorsharf
2021-02-10 10:39
has joined #pact-python

kieran
2021-02-10 17:13
has joined #pact-python

poward
2021-02-10 18:17
has joined #pact-python

ckhadilkar
2021-02-10 21:16
has joined #pact-python

neild
2021-02-11 18:53
has joined #pact-python

painenigowthami
2021-02-11 22:32
has joined #pact-python

stephenkilbourn
2021-02-11 23:02
has joined #pact-python

tcarlson
2021-02-11 23:05
has joined #pact-python

fnguyen
2021-02-12 01:34
@fnguyen has left the channel

r.strauch
2021-02-12 10:15
has joined #pact-python

ztlboy05
2021-02-12 14:57
has joined #pact-python

smith260194
2021-02-12 15:22
has joined #pact-python

marcelo
2021-02-12 15:25
Hello everyone I using pact-python for consumer and provider test. One of my provider APIs is a Django app and I need to handle the provider states there. Somebody can provide an example to handle this? My first approach was to setup a simple Flask app but it wont run in the same context of the Django app and I can?t access the objects needed to setup the states

elliottmurray
2021-02-12 17:50
I?ve never used django but flask can?t be run as a sub process from another python app. Fastapi can. However I?m not sure I understand what you?re trying to achieve. Why can?t you just use django to set up your provider states?

dabfleming
2021-02-12 20:34
has joined #pact-python

prasanthp
2021-02-13 00:45
has joined #pact-python

bhardwajdiwakar
2021-02-14 22:38
has joined #pact-python

hiteshpatadia
2021-02-15 06:29
has joined #pact-python

marcelo
2021-02-15 11:05
add a new django app for the provider states demands a lot of code that needs to be maintained. Using Flask I can have everithing I need in a single 100 lines file.

marcelo
2021-02-15 11:06
Anyway I managed to create a flask app that uses the django orm of my django api :muscle:

vikrant.sarkaniya
2021-02-15 13:31
has joined #pact-python

lemitrou
2021-02-15 14:20
has joined #pact-python

helloraj
2021-02-16 08:09
has joined #pact-python

jamesmlucas
2021-02-16 19:29
has joined #pact-python

gabe707
2021-02-16 20:31
has joined #pact-python

wangpei9679
2021-02-16 21:29
has joined #pact-python

geir
2021-02-16 23:03
has joined #pact-python

soruma.net
2021-02-17 05:58
has joined #pact-python

therimpact
2021-02-17 12:30
has joined #pact-python

andrzej.igielski
2021-02-17 21:41
has joined #pact-python

mikewagner21
2021-02-18 03:15
has joined #pact-python

khandelwalbhushan
2021-02-18 08:10
has joined #pact-python

aniket.agarwal
2021-02-18 09:21
has joined #pact-python

arpit.modani
2021-02-18 09:43
has joined #pact-python

byronth
2021-02-18 11:45
has joined #pact-python

isa.levine
2021-02-18 23:37
has joined #pact-python

r.strauch
2021-02-19 08:41
@r.strauch has left the channel

brian.pfretzschner
2021-02-19 10:15
has joined #pact-python

chitra.adikesavan
2021-02-20 15:50
has joined #pact-python

ankita.soni
2021-02-22 07:26
has joined #pact-python

jacek.helper
2021-02-22 08:03
has joined #pact-python

dany.marques90
2021-02-22 13:54
@dany.marques90 has left the channel

seanw122
2021-02-22 15:36
has joined #pact-python

akennedy
2021-02-22 15:54
has joined #pact-python

esimpson
2021-02-22 16:42
has joined #pact-python

dagrawal
2021-02-22 17:24
has joined #pact-python

venkata.pro
2021-02-22 21:47
has joined #pact-python

jordan.levin
2021-02-23 19:14
has joined #pact-python

francesco.latorre
2021-02-24 05:59
has joined #pact-python

aniket.g2185
2021-02-24 09:13
has joined #pact-python

sundaresank360
2021-02-24 12:12
has joined #pact-python

jhawthor
2021-02-24 15:18
has joined #pact-python

chris.r.thomas
2021-02-24 16:54
has joined #pact-python

peter.cook
2021-02-24 17:05
has joined #pact-python

jayeshguru81
2021-02-24 18:34
has joined #pact-python

ben.kirberger
2021-02-24 19:16
has joined #pact-python

m.stephkan
2021-02-25 05:30
has joined #pact-python

stephen.tjasink
2021-02-25 08:23
has joined #pact-python

beatrizwaclawek
2021-02-25 20:27
has joined #pact-python

zhoutianli1234
2021-02-25 21:09
has joined #pact-python

travis.day
2021-02-26 04:06
has joined #pact-python

andrew.cunningham
2021-02-26 11:13
has joined #pact-python

andrew.cunningham
2021-02-26 11:54
@andrew.cunningham has left the channel

brianmasschaele
2021-02-27 13:27
has joined #pact-python

pedroefajardo_pactio
2021-02-27 17:18
has joined #pact-python

dominic_herrmann
2021-03-01 06:54
has joined #pact-python

matthew.long
2021-03-02 14:08
has joined #pact-python

tmoncm
2021-03-02 17:17
has joined #pact-python

phoenixcampos01
2021-03-02 21:25
has joined #pact-python

hugh.paul.mcgowan
2021-03-03 17:52
has joined #pact-python

normanrs
2021-03-04 11:18
has joined #pact-python

jayson.bailey
2021-03-04 19:18
has joined #pact-python

mjsmcp
2021-03-08 23:46
has joined #pact-python

javier.garcia_cotado
2021-03-09 21:52
has joined #pact-python

akos.csurai
2021-03-10 13:39
has joined #pact-python

akos.csurai
2021-03-10 14:12
@akos.csurai has left the channel

testme2020testme
2021-03-10 14:12
has joined #pact-python

tommy.mirchandani
2021-03-10 17:13
has joined #pact-python

varinderjitkaur13
2021-03-11 01:46
has joined #pact-python

krcl.dev
2021-03-11 05:11
has joined #pact-python

krishnaraoveera1294
2021-03-11 17:53
has joined #pact-python

raghavendra.kalakonda
2021-03-11 23:08
has joined #pact-python

andries.spies
2021-03-12 07:25
has joined #pact-python

kamil.klima
2021-03-12 11:38
has joined #pact-python

lswanborough
2021-03-15 00:50
has joined #pact-python

don.tobias
2021-03-15 19:35
has joined #pact-python

sagar.kathuria
2021-03-17 04:25
has joined #pact-python

shao.sum
2021-03-17 08:35
has joined #pact-python

riddhichopra
2021-03-18 01:28
has joined #pact-python

anu.de
2021-03-18 02:28
has joined #pact-python

sreyaslj
2021-03-18 04:25
has joined #pact-python

arvind1017
2021-03-18 22:48
has joined #pact-python

sushilvc84
2021-03-19 00:30
has joined #pact-python

tejakoshti7
2021-03-19 06:26
has joined #pact-python

yannick.adler
2021-03-19 12:44
has joined #pact-python

smith260194
2021-03-19 17:40
@smith260194 has left the channel

aelse
2021-03-19 23:54
has joined #pact-python

eric2323223
2021-03-20 01:35
has joined #pact-python

jordan.r.stewart
2021-03-20 16:07
has joined #pact-python

tmorrison
2021-03-21 21:45
has joined #pact-python

a.chandrasekaran
2021-03-22 00:50
has joined #pact-python

maksym.motornyi
2021-03-22 11:50
has joined #pact-python

gareth.somerville
2021-03-22 12:10
has joined #pact-python

joseph.method
2021-03-22 19:55
has joined #pact-python

dennyg666
2021-03-22 20:54
has joined #pact-python

me1295
2021-03-23 00:15
has joined #pact-python

anchit.99
2021-03-23 09:04
has joined #pact-python

danhitchcock
2021-03-23 09:28
has joined #pact-python

danhitchcock
2021-03-23 09:32
Hello there, So I am using python to verify my pacts and need to setup some state, that ideally returns an Id. Looking at various versions I've noted this is only possible with v3 pacts. Did I read this right? I am guessing the move to v3 will happen at some point so will see if this is mentioned on github. It is: https://github.com/pact-foundation/pact-python/issues/88

matt.fellows
2021-03-23 10:11
Yep, the specific feature I think you?re asking for is the ?value from provider state?, where the provider state can return one or more values, that the provider test process will then substitute in the request/payload before issuing to the provider

matt.fellows
2021-03-23 10:11
that?s only available in v3 pacts, as you say

joseph.method
2021-03-23 14:29
@joseph.method has left the channel

jayeshguru81
2021-03-23 14:36
how do we exclude `Authorization: Bearer <token>` from the pacts/<mypact>.json file which is autogenerated as this is sensitive information which should not be commited?

wola.adedeji
2021-03-23 16:25
has joined #pact-python

kenny.shobowale
2021-03-23 16:38
has joined #pact-python

matt.fellows
2021-03-23 21:13
I Don't use real tokens in pact tests

jayeshguru81
2021-03-23 21:14
yeah not in pact tests but while publishing pact it fails as it needs real url and real token

matt.fellows
2021-03-23 21:15
Do you mean when verifying the pact?

jayeshguru81
2021-03-23 21:15
yes

jayeshguru81
2021-03-23 21:16
I dont know the terminology but I think publish pact step in our BK pipeline publish the pact to the broker

matt.fellows
2021-03-23 21:16
Have a little search of the docs for strategies for auth

jayeshguru81
2021-03-23 21:16
Verification happens on the Provider side

matt.fellows
2021-03-23 21:16
Correct

anbu.pandian
2021-03-24 11:54
has joined #pact-python

anbu.pandian
2021-03-24 12:11
Hi, I am trying to setup Pact Tests using Pactflow. I am new to this and I am going through pact-python repo. Is there any pointer for pactflow demo or tutorial?

anbu.pandian
2021-03-24 12:11
A quick question - should we write the consumer test in the same language as the service is developed?

rachel.barton
2021-03-24 19:12
has joined #pact-python

james522
2021-03-24 22:06
has joined #pact-python

anne.schuth320
2021-03-25 07:49
has joined #pact-python

anne.schuth320
2021-03-25 07:50
Hi everyone!

anne.schuth320
2021-03-25 07:50
I?m getting started with message pact and run into a small issue for which I submitted a PR with a fix :point_up:

anne.schuth320
2021-03-25 07:51
Could someone maybe review that?

anne.schuth320
2021-03-25 07:52
And, is there something I can do to get this PR ready? https://github.com/pact-foundation/pact-python/pull/200

wesleythomaswilliams
2021-03-25 09:08
That's my understanding of the best practice Anbu, but you might be looking for an answer from someone other than a colleague :smile:

james.shirtcliffe
2021-03-25 12:04
has joined #pact-python

serhii.makarenko
2021-03-25 12:55
has joined #pact-python

mashabudryte
2021-03-25 14:35
has joined #pact-python

matthew.simon.barnes_
2021-03-25 16:08
has joined #pact-python

elliottmurray
2021-03-26 09:11
The work on this has stalled. I think work and life has got in the way with the original contributors! I had actually started looking at this last weekend and am intending to this one :crossed_fingers: but also help is always appreciated

elliottmurray
2021-03-26 09:12
I was going to flesh out an example around Kafka and drive it that way but if you have a specific example might influence my thinking

elliottmurray
2021-03-26 09:12
And I will have to remind myself what's in that PR too!

anne.schuth320
2021-03-26 09:27
Ok, thanks! I'll dive in, over the weekend or next week. An example around kafka would be perfect for me, that's what we're running in our stack. Are there any good examples lying around in other pact implementations that you are aware of?

elliottmurray
2021-03-26 13:37
They all seem to abstract it away. Which is what you are meant to do. As much for my own understanding wanted to make it a bit more 'real'

jose.manzano
2021-03-26 14:27
has joined #pact-python

chris.faulkner
2021-03-26 16:13
has joined #pact-python

bryanw
2021-03-26 18:46
has joined #pact-python

kerem.durak
2021-03-29 08:34
has joined #pact-python

dave.clissold
2021-03-29 12:40
has joined #pact-python

sidhant.bhayana.15
2021-03-29 18:34
has joined #pact-python

crhawkins85
2021-03-30 21:02
has joined #pact-python

pranav.gore
2021-03-31 01:58
has joined #pact-python

harsha6988
2021-03-31 12:19
has joined #pact-python

leixu
2021-03-31 14:42
has joined #pact-python

matthew.brown
2021-03-31 15:15
has joined #pact-python

oleksandr.tryshchenko
2021-03-31 19:54
has joined #pact-python

phelantomas
2021-04-01 13:13
has joined #pact-python

ktogias
2021-04-01 20:04
has joined #pact-python

balaji.sivakumar
2021-04-02 05:41
has joined #pact-python

ashish_garg5
2021-04-05 07:29
Hi All, I am using verify_with_broker *consumer_tags* to run my provider against the given tags. ex. - ```consumer_tags={"master"},``` So my provider is running against master tag of Consumer. Now I want to run against the latest version of Consumer also along with tag master. How I can do that ? If I don't specify consumer_tags here then by default it runs against the latest version of Consumer but I have to run against master as well. Thanks in advance.

andrewshtamburg
2021-04-05 16:44
Hey! Can someone please help out with that? For some reason I can't publish a pact, can't understand what is wrong. Will describe in thread

andrewshtamburg
2021-04-05 16:45
Here is my test file

andrewshtamburg
2021-04-05 16:47
Here is the structure of the project

andrewshtamburg
2021-04-05 16:48
Here is the thing I get. Test passes, but while trying to publish, I get error ```--------------------------------------------------------------------------------------------------------- Captured stderr teardown ---------------------------------------------------------------------------------------------------------- Failed to tag versions due to error: PactBroker::Client::Error - Authentication failed One or more pacts failed to be published ========================================================================================================== short test summary info ========================================================================================================== ERROR test_consumer_next.py::test_get_new_word - RuntimeError: There was an error while publishing to the pact broker at http://localhost/.```

elliottmurray
2021-04-05 16:51
So very quickly from the logs do you firstly have set the broker url properly and do you have a broker running on localhost? One of those seems to be a problem

andrewshtamburg
2021-04-05 16:52
Yes, broker is running locally

andrewshtamburg
2021-04-05 16:52
```PACT_BROKER_URL = "http://localhost/"```

uryadov212
2021-04-05 20:52
has joined #pact-python

elliottmurray
2021-04-05 21:01
If you look at the end of the lot it says it had an authentication error with pact broker. I would start there. Triple check you can log into the local broker console and you?re using the same creds in code

soumya.aithal966
2021-04-05 22:45
has joined #pact-python

sheyan.rizfee
2021-04-06 00:55
has joined #pact-python

piotr
2021-04-06 09:24
has joined #pact-python

dmitry.korolev
2021-04-06 11:47
has joined #pact-python

sravyavadrevu988
2021-04-06 20:40
has joined #pact-python

johnnycareer
2021-04-06 21:34
has joined #pact-python

johnnycareer
2021-04-06 21:41
@johnnycareer has left the channel

danil.nurgaliev
2021-04-07 12:26
has joined #pact-python

gtsifrikas
2021-04-08 08:53
has joined #pact-python

kanapuramamarnath
2021-04-08 09:18
has joined #pact-python

arnaud.dutrillaux
2021-04-09 10:59
has joined #pact-python

gsinghania
2021-04-09 15:40
has joined #pact-python

souravmohanty35
2021-04-09 16:34
has joined #pact-python

itzdavey
2021-04-09 17:23
has joined #pact-python

andrewshtamburg
2021-04-10 14:00
OMG, I'm so stupid. Indeed, it was a problem with credentials. Thanks for you help

elliottmurray
2021-04-10 15:24
Glad you fixed it - if it helps lost a day this week hunting a one line bug fix! It's the gig.

tmorrison
2021-04-12 00:18
@tmorrison has left the channel

matt.fellows
2021-04-12 01:34
@winfante @tpham  if you get a moment, @elliottmurray has put in an example kafka consumer using your new stuff. Mind casting your eyes over it? https://github.com/pact-foundation/pact-python/blob/docs/kafka_example/examples/kafka/tests/test_consumer.py

matt.fellows
2021-04-12 01:34
Should this be `receive_dog_event` (rather than send) https://github.com/pact-foundation/pact-python/blob/docs/kafka_example/examples/kafka/tests/test_consumer.py#L48   IIUC this is the handler that receives the message from Kafka?


elliottmurray
2021-04-12 06:20
It should be. In my head I had renamed it! The foo method is me experimenting with the pact interface. Verify can accept a function it will call with the message. But if you can't do that for any reason the foo example is how you might test

elliottmurray
2021-04-12 07:43
renamed. I'll add some docs about the foo case. Need a better name but wanted to simulate a few scenarios

laura.edington
2021-04-13 17:45
has joined #pact-python

liam.mcdermott
2021-04-13 22:38
has joined #pact-python

tpham
2021-04-14 01:38
Take me sometime to get back to the previous implementation of message pact. So far so good on the example you put in @elliottmurray. I like the improved message pact with verify function https://github.com/pact-foundation/pact-python/blob/docs/kafka_example/pact/message_pact.py#L174. Although the message handler does not always return value but it?s good that you provide it so we can assert it later on (in your example using Kafka).

winfante
2021-04-14 02:53
was just thinking if for https://github.com/pact-foundation/pact-python/blob/docs/kafka_example/pact/message_pact.py#L139 , we should also have an equivalent `from_term` like ```self._messages[0]['contents'] = from_term(contents)``` based on https://github.com/pact-foundation/pact-python/pull/194#issuecomment-767568953 @elliottmurray

wedlaaa
2021-04-14 13:33
has joined #pact-python

wderksen
2021-04-14 22:26
has joined #pact-python

mail_4brad
2021-04-15 02:34
has joined #pact-python

goncalosamuel
2021-04-15 15:08
has joined #pact-python

matthew.hall
2021-04-15 17:36
has joined #pact-python

raony
2021-04-15 19:21
has joined #pact-python

gupta.ratnesh9
2021-04-16 04:48
has joined #pact-python

greg595au
2021-04-16 10:00
has joined #pact-python

manel_ben_yahia
2021-04-16 13:59
has joined #pact-python

github
2021-04-16 16:54
:warning: *Action required - upgrade app for Pact Foundation* :warning:

matt.fellows
2021-04-17 01:15
gah

maxence
2021-04-17 11:07
has joined #pact-python

kranti.deep
2021-04-17 14:17
has joined #pact-python

aaronw153
2021-04-17 21:42
has joined #pact-python

github
2021-04-19 00:57
GitHub app is successfully upgraded in your workspace :tada: To receive notifications in your private channels, you need to invite the GitHub app `/invite @GitHub`

kranti.deep
2021-04-19 06:59
@kranti.deep has left the channel

dwmahieddine
2021-04-19 12:44
has joined #pact-python

garrettmichael
2021-04-19 18:34
has joined #pact-python

daniel.kalleward
2021-04-20 08:16
has joined #pact-python

mattias.persson
2021-04-20 12:45
has joined #pact-python

martin.eklund
2021-04-20 12:47
has joined #pact-python

github2
2021-04-20 16:56
[pact-foundation/pact-python] Issue opened by ngufra

enda.brody
2021-04-20 17:37
has joined #pact-python

cristian.moisa
2021-04-20 18:25
has joined #pact-python

github2
2021-04-20 19:58
[pact-foundation/pact-python] Pull request merged by elliottmurray

github2
2021-04-20 20:00
[pact-foundation/pact-python] New release _https://github.com/pact-foundation/pact-python/releases/tag/v1.3.6_ published by elliottmurray

github2
2021-04-20 20:08
[pact-foundation/pact-python] Issue closed by elliottmurray

github2
2021-04-20 20:16
[pact-foundation/pact-python] Pull request opened by elliottmurray

darccide
2021-04-21 01:35
has joined #pact-python

stain.witness
2021-04-22 02:43
has joined #pact-python

oleksandra.pishcheiko
2021-04-22 08:31
has joined #pact-python

akos.csurai.4github
2021-04-22 10:01
has joined #pact-python

christosbouloumpasis
2021-04-22 10:38
has joined #pact-python

temanibeck
2021-04-22 16:04
has joined #pact-python

michael_swiss
2021-04-22 21:04
has joined #pact-python

dawoud.sheraz
2021-04-23 09:34
has joined #pact-python

adriano.tanoue
2021-04-23 12:01
has joined #pact-python

github2
2021-04-24 12:47
[pact-foundation/pact-python] Pull request merged by elliottmurray

github2
2021-04-24 12:50
[pact-foundation/pact-python] New release _https://github.com/pact-foundation/pact-python/releases/tag/v1.3.7_ published by elliottmurray

saurabh.goel
2021-04-24 20:10
has joined #pact-python

cemal.onder
2021-04-25 12:22
has joined #pact-python

richard.forjoe
2021-04-26 00:52
has joined #pact-python

ron.aharoni
2021-04-26 11:03
has joined #pact-python

dawoud.sheraz
2021-04-26 12:39
Hello. I am facing an issue with Format().timestamp in will_respond_with. When creating an expected body and running the test, I am getting the following error: ```TypeError: Object of type datetime is not JSON serializable``` I have to use `datetime.now().isoformat()` to generate the pact. The code snippet is like: ```will_respond_with(200, EachLike({'created': Format().timestamp, 'id': Format().integer}, minimum=2))```

matt.fellows
2021-04-26 13:10
Is `Format().timestamp` a value or a function? If it?s a value, then I?m confused.

matt.fellows
2021-04-26 13:11
You also mention `datetime.now().isoformat()` but I don?t see where in that code you use it

dawoud.sheraz
2021-04-26 13:11
In place of Format().timestamp.

matt.fellows
2021-04-26 13:12
If you could please just share your actual code, because without context it?s a bit difficult to help

dawoud.sheraz
2021-04-26 13:13
I am afraid the code is private and I can?t share the exact code. I can add a near-alternative to give more context.

matt.fellows
2021-04-26 13:14
that would be fine

matt.fellows
2021-04-26 13:14
even just doing a `print` of the contents of the object you pass to `EachLike`. That would help

matt.fellows
2021-04-26 13:15
(also not I?m not a pythonista, so i?m just going to be doing general debugging here)

andrewmorton
2021-04-26 13:33
has joined #pact-python

dawoud.sheraz
2021-04-26 14:13
When used `generate` on the EachLike object, following is the breakdown ```'created': {'json_class': 'Pact::Term', 'data': {'generate': datetime.datetime(2000, 2, 1, 12, 30), 'matcher': {'json_class': 'Regexp', 'o': 0, 's': '^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$'}}}}```

aram
2021-04-26 15:24
has joined #pact-python

marcelo.souzameinberg
2021-04-26 21:32
has joined #pact-python

matt.fellows
2021-04-26 22:16
It looks like you're passing a function and not a value, so the function of course can't be serialised

matt.fellows
2021-04-26 22:16
Again, without the actual code it's hard to say

songqing.gu
2021-04-27 01:25
has joined #pact-python


matt.fellows
2021-04-27 06:46
hmmm maybe it?s a Python thing

matt.fellows
2021-04-27 06:47
it looks like `Format().timestamp` should be `Format().timestamp()` (i.e. a function call, but maybe Python knows that?)

dawoud.sheraz
2021-04-27 06:47
nope, doesn?t work that way either. `Term object not callable` error if used `Format().timestamp()` .

matt.fellows
2021-04-27 06:50
OK I?m a bit out of ideas

matt.fellows
2021-04-27 06:51
The best thing to be able to do is raise an issue on the github page with a reproducable example, and then it can get fixed

dawoud.sheraz
2021-04-27 06:51
Yes, I am thinking the same. Thanks

matt.fellows
2021-04-27 06:52
Thanks, sorry I couldn?t help further!

dawoud.sheraz
2021-04-27 06:52
No worries. Thanks for your constant input on this matter :slightly_smiling_face:

elliottmurray
2021-04-27 08:04
If it's easily reproducible I'll try to get around to it at the weekend.

github2
2021-04-27 08:49
[pact-foundation/pact-python] Issue opened by mefellows


matt.fellows
2021-04-27 08:49
(sorry I was on a call right after this chat and repro?d it)

dawoud.sheraz
2021-04-27 08:54
Oh, great.

dawoud.sheraz
2021-04-27 08:54
thanks

dawoud.sheraz
2021-04-27 09:12
@matt.fellows If you don?t mind, I can create a possible fix PR later today. I am starting to get a bit more context. Adding isoformat in timestamp call of Format will fix the issue. Although I would like to see why the unit tests didn?t catch this issue.

matt.fellows
2021-04-27 09:15
That be be great!

matt.fellows
2021-04-27 09:15
thank you

dawoud.sheraz
2021-04-27 09:16
Great

fortiss.anita
2021-04-27 09:34
has joined #pact-python

github2
2021-04-27 09:40
[pact-foundation/pact-python] Issue opened by xiaobeon

github2
2021-04-27 11:20
[pact-foundation/pact-python] Pull request opened by DawoudSheraz


keshav.reddy503
2021-04-27 12:06
has joined #pact-python

jeremykeczan
2021-04-27 14:57
has joined #pact-python

yeseniavega411
2021-04-27 15:31
has joined #pact-python

almantusk
2021-04-27 16:56
has joined #pact-python

alexandra.huamani
2021-04-28 00:12
has joined #pact-python

tonynguyenit18
2021-04-28 02:12
has joined #pact-python

agrawalneeraj43
2021-04-28 04:37
has joined #pact-python

shixun.liu1023
2021-04-28 04:39
has joined #pact-python

narendra.pathai
2021-04-28 06:21
has joined #pact-python

marcin.grzejszczak
2021-04-28 13:53
has joined #pact-python

flubniewski
2021-04-28 17:01
has joined #pact-python

github2
2021-04-28 20:49
[pact-foundation/pact-python] Pull request merged by elliottmurray

github2
2021-04-28 20:51
[pact-foundation/pact-python] Issue closed by elliottmurray

roy_collings
2021-04-30 15:15
has joined #pact-python

github2
2021-04-30 16:37
[pact-foundation/pact-python] Issue closed by ngufra

github2
2021-05-01 08:34
[pact-foundation/pact-python] Pull request opened by elliottmurray

github2
2021-05-01 10:51
[pact-foundation/pact-python] Pull request merged by elliottmurray

github2
2021-05-01 11:29
[pact-foundation/pact-python] New release _https://github.com/pact-foundation/pact-python/releases/tag/v1.3.8_ published by elliottmurray

prachi_mangesh_edake
2021-05-03 04:43
has joined #pact-python

sams.prashanth
2021-05-03 08:04
has joined #pact-python

philip.m.wood
2021-05-03 12:46
has joined #pact-python

github2
2021-05-03 14:57
[pact-foundation/pact-python] Issue closed by elliottmurray

github2
2021-05-03 14:58
[pact-foundation/pact-python] Issue closed by elliottmurray

github2
2021-05-03 14:58
[pact-foundation/pact-python] Issue closed by elliottmurray

amiller
2021-05-03 15:27
has joined #pact-python

agarwal.akash333
2021-05-03 23:14
has joined #pact-python

marcin.grzejszczak
2021-05-04 07:26
@marcin.grzejszczak has left the channel

anand.ilkal
2021-05-04 08:01
has joined #pact-python

dennis.minard
2021-05-04 16:23
has joined #pact-python

chris.williams
2021-05-04 16:41
has joined #pact-python

ssorcnafets
2021-05-04 19:20
has joined #pact-python

kowalczuk.jnr
2021-05-04 22:24
has joined #pact-python

hugo
2021-05-05 00:48
has joined #pact-python

jadelong
2021-05-05 15:51
has joined #pact-python

alexei.solcanu
2021-05-06 02:01
has joined #pact-python

zonkor
2021-05-06 08:08
has joined #pact-python

florian.mautendorfer
2021-05-06 14:04
has joined #pact-python

john.mcnulty
2021-05-06 16:49
has joined #pact-python

github2
2021-05-07 13:17
[pact-foundation/pact-python] Issue opened by artamonovkirill

tarunmehrotra3
2021-05-10 06:31
has joined #pact-python

jbecker
2021-05-10 16:31
has joined #pact-python

james.wettenhall
2021-05-11 04:54
has joined #pact-python

eduardo.marques
2021-05-11 09:19
has joined #pact-python

al8x.romanov
2021-05-11 13:09
has joined #pact-python

github2
2021-05-11 18:24
[pact-foundation/pact-python] Pull request opened by elliottmurray

github2
2021-05-11 21:05
[pact-foundation/pact-python] Issue opened by elliottmurray

jr.jenks
2021-05-11 21:46
has joined #pact-python

matt.fellows
2021-05-11 23:01
@al8x.romanov :wave: Thanks for putting your hand up to help with some contributions here. Please meet @elliottmurray and @matthew.balvanz, the two core maintainers of the project. Alex is keen to help out with small contributions. He?s going to first learn a bit more about how it works by implementing it on a personal project. Alex, would you mind doing a little intro about yourself?

sammomichael
2021-05-12 02:27
has joined #pact-python

tony.foster
2021-05-12 03:44
has joined #pact-python

jan.businsky
2021-05-12 09:10
has joined #pact-python

github2
2021-05-12 13:47
[pact-foundation/pact-python] Pull request opened by tephe

yann.courtel
2021-05-12 15:05
has joined #pact-python

dale.bennett
2021-05-12 18:14
has joined #pact-python

lreisch
2021-05-12 19:23
has joined #pact-python

jorge.curima.corp
2021-05-13 01:37
has joined #pact-python

anh.evizi.test
2021-05-13 05:56
has joined #pact-python

yka259
2021-05-13 08:22
has joined #pact-python

joshibharat
2021-05-13 11:43
has joined #pact-python

github2
2021-05-13 19:20
[pact-foundation/pact-python] Pull request merged by elliottmurray

github2
2021-05-13 19:21
[pact-foundation/pact-python] Pull request merged by elliottmurray

smankala
2021-05-13 20:55
has joined #pact-python

github2
2021-05-13 20:56
[pact-foundation/pact-python] New release _https://github.com/pact-foundation/pact-python/releases/tag/v1.3.9_ published by elliottmurray

martin.pelikan
2021-05-14 06:48
has joined #pact-python

joao_glorioso
2021-05-14 08:41
has joined #pact-python

ashok.jan31
2021-05-14 12:25
has joined #pact-python

gusfisha
2021-05-14 19:52
has joined #pact-python

keithgutfreund
2021-05-14 20:13
has joined #pact-python

k.gutfreund
2021-05-15 03:47
has joined #pact-python

siegcollado
2021-05-17 05:03
has joined #pact-python

simon.thomas1978
2021-05-17 08:53
has joined #pact-python

keimiokamoto
2021-05-17 10:36
has joined #pact-python

fabian.feary
2021-05-17 11:52
has joined #pact-python

josh.brangwyn
2021-05-17 12:19
has joined #pact-python

xiao.liang
2021-05-17 16:41
has joined #pact-python

bhattacharyyasom
2021-05-18 14:05
has joined #pact-python

lalit210784
2021-05-18 17:55
has joined #pact-python

zaxosdimi
2021-05-18 22:14
has joined #pact-python

viktor.trako
2021-05-19 15:45
has joined #pact-python

github2
2021-05-19 16:04
[pact-foundation/pact-python] Issue opened by asivasankari

abdel.akkoub
2021-05-19 17:27
has joined #pact-python

akrala
2021-05-19 21:22
has joined #pact-python

mazi.fayazfar
2021-05-19 22:23
has joined #pact-python

daniel.qu
2021-05-20 18:03
has joined #pact-python

github2
2021-05-20 19:58
[pact-foundation/pact-python] Issue closed by elliottmurray

vijay.chawla
2021-05-21 08:37
has joined #pact-python

tim.walter
2021-05-21 09:12
has joined #pact-python

ankit.laddha
2021-05-21 14:03
has joined #pact-python

dimundo
2021-05-21 14:09
has joined #pact-python

include.melaz
2021-05-22 13:15
has joined #pact-python

uddhavchopade
2021-05-23 08:32
has joined #pact-python

lukasz.wlosek
2021-05-24 08:03
has joined #pact-python

komathy_priya_dhanas
2021-05-24 09:26
has joined #pact-python

nh.salah
2021-05-24 11:46
has joined #pact-python

erinc1915
2021-05-24 16:11
has joined #pact-python

nzarate
2021-05-24 18:11
has joined #pact-python

jonathan.arreola
2021-05-24 21:20
has joined #pact-python

cesar.consultorjr
2021-05-24 21:39
has joined #pact-python

gdfesta
2021-05-25 00:44
has joined #pact-python

utsavk3210
2021-05-25 08:37
has joined #pact-python

daniel.cardinha
2021-05-25 10:06
has joined #pact-python

dan.haughey
2021-05-25 14:34
has joined #pact-python

vince.lee
2021-05-25 14:36
has joined #pact-python

pact544
2021-05-25 16:01
has joined #pact-python

shlomi
2021-05-25 22:41
has joined #pact-python

raquel.bautista
2021-05-26 09:38
has joined #pact-python

vince.lee
2021-05-26 09:41
@vince.lee has left the channel

aubilla
2021-05-26 09:52
has joined #pact-python

vishnuprakash323
2021-05-26 10:46
has joined #pact-python

rob.caiger
2021-05-26 11:54
has joined #pact-python

lio.lunesu
2021-05-26 17:55
has joined #pact-python

nahuel.dallavecchia
2021-05-26 20:24
has joined #pact-python

mathew.baltes
2021-05-26 23:33
has joined #pact-python

stephen.leece
2021-05-26 23:44
has joined #pact-python

james_fraser
2021-05-27 09:23
has joined #pact-python

mostafa.zaher
2021-05-27 10:13
has joined #pact-python

utsavtiwary10
2021-05-27 10:53
has joined #pact-python

hliulka15
2021-05-27 17:41
has joined #pact-python

kamoljan
2021-05-28 02:39
has joined #pact-python

mathias.duesterhoeft
2021-05-28 08:59
has joined #pact-python

matty_o_connor01
2021-05-28 15:57
has joined #pact-python

nathaniel.emmons
2021-05-28 18:25
has joined #pact-python

sapoho3257
2021-05-29 16:10
has joined #pact-python

andjela.rajic
2021-05-30 20:00
has joined #pact-python

sumitsg004
2021-05-31 05:10
has joined #pact-python

allan.barbosa
2021-05-31 14:08
has joined #pact-python

vinicius.grund
2021-05-31 14:35
has joined #pact-python

todd.lemmonds
2021-06-01 15:57
has joined #pact-python

alexander.infante
2021-06-01 15:57
has joined #pact-python

michael.doyle
2021-06-01 15:58
has joined #pact-python

paulorochag
2021-06-01 20:20
has joined #pact-python

jaspal.gill
2021-06-02 15:23
has joined #pact-python

wenqiglantz
2021-06-02 18:19
has joined #pact-python

ch.toimbetov
2021-06-02 21:46
has joined #pact-python

kyle.florence
2021-06-03 04:57
@kyle.florence has left the channel

xyz1kind
2021-06-03 05:03
has joined #pact-python

aftab.shamim2020
2021-06-03 06:02
has joined #pact-python

slu.mendozaharold
2021-06-03 10:33
has joined #pact-python

sergio.artero
2021-06-04 10:07
has joined #pact-python

slu.mendozaharold
2021-06-04 14:50
Is there a way to add a tag when using `request.put(PACT_URL, version)` to publish pacts?

v-gabriel.dantas
2021-06-04 15:26
has joined #pact-python

leonardo.viana
2021-06-04 18:52
has joined #pact-python

matt.fellows
2021-06-05 00:09
I don't think so, tags are separate resources


matt.fellows
2021-06-05 00:10
Why not just use the CLI?

bethskurrie
2021-06-05 00:10
Please don't publish the pacts manually if you can use the CLI @slu.mendozaharold. The ordering of the resource creation is important to make sure the webhooks fire correctly.

bethskurrie
2021-06-05 00:11
There is a new "all in one" api coming out soon that does the contract publishing and tagging etc in one request.

slu.mendozaharold
2021-06-05 03:11
I was using the CLI which works great but this assumes we already committed the pact/json files to the repo. So what we want to do is generate the json files in the CI pipeline and after the json generation I wrote a script that is just a `PUT` request to the broker with the json files. Which seems to trigger the webhook, but it never comes back with the provider verification.

slu.mendozaharold
2021-06-05 03:11
I was thinking because I am missing the `--tag` that `pact publish` has

slu.mendozaharold
2021-06-05 04:23
Nvm, I finally found the binaries for pact-broker in python and it nows works with our use case. Thanks!

leonardo.viana
2021-06-05 13:33
We have the following use case: ```1. GET request to static path /api/policy/v1/rules 2. PUT request do dynamic path /api/policy/v1/rules/cats/:id, where ":id" is a dynamic value returned from the request made in 1.``` Our problem is that the path in step 2 above is dynamic, and depends on the response from a previous request, which means we can?t simply hardcode an id value for the `path` in step 2 when the pact file is generated during the consumer testing. Is it possible (via pact-python or one of the pact libraries for other languages) to somehow have a dynamic value in the path within the pact file, such that when the provider tests are run it can be replaced with the correct value from the previous request?

elliottmurray
2021-06-05 13:38
Can you just have 2 tests? One for each case as they are in effect 2 contracts. You?ll need to set up provider states for that (so a cat with a known I'd

leonardo.viana
2021-06-05 13:50
I can?t simply set the state in the provider to some known id value, because the provider doesn?t work like that. The id value is random (and calculated internally within the provider itself), and all we can do is that first GET request to find out what the current id value is, and that?s the one that should be used in the subsequent PUT request.

elliottmurray
2021-06-05 16:40
You don't control the provider? So the normal approach is to separately create the cat with a specific id. That might mean exposing a hook to allow you to do this. An underlying principle of designing for testing. That might mean allowing your provider to be run a different way. Personally I'm not sure about dynamic urls in pact. If it's a local file some bash foo would probably solve it. If you?re using broker we?d need to create a way to intercept the pact file

matt.fellows
2021-06-06 00:10
In v3 there is a concept of injected values from provider states that solves this (where you can't control via state alone) It allows you to return for example, an ID of the resource, which can be substituted back in to the verification request. This would address your problem

matt.fellows
2021-06-06 00:11
The new rust lib supports this. Is your consumer also python?

matt.fellows
2021-06-06 00:12
I say that because the provider side replacement should be a breeze as it's almost a drop in replacement of what's currently there

matt.fellows
2021-06-06 00:13
The consumer side is more involved

leonardo.viana
2021-06-06 00:29
The consumer side is actually JS. Is this feature supported there?

matt.fellows
2021-06-06 01:03
Yes, but only via the v3 beta release

leonardo.viana
2021-06-06 01:43
How about python consumers, is it supported there too? Are there any links to documentation showing how to do this in code?



matt.fellows
2021-06-06 01:45
The warning in those doc's is slightly outdated. I'll update that tomorrow.

matt.fellows
2021-06-06 01:45
The main warning to heed is that the API will change

matt.fellows
2021-06-06 01:45
But it's basically at feature parity

leonardo.viana
2021-06-06 11:16
That's great, it seems to be exactly what I was looking for. Now, we may also need to do something similar in python... Is there a similar link showing how the code would look like in python?

matt.fellows
2021-06-06 23:59
So we?d need to replace the current Ruby verifier with this: https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_verifier_cli

leonardo.viana
2021-06-07 00:59
Regarding the Pact JS V3 beta, is there an estimate of the timeframe in which it will go out of beta and be officially released?

matt.fellows
2021-06-07 04:30
Hoping in the next 2-3 months

matt.fellows
2021-06-07 04:31
There has been a lot of behind the scenes changes to make it happen, so it?s more about execution now and agreement on the public facing API

yashdev963
2021-06-07 06:51
has joined #pact-python

leonardo.viana
2021-06-07 14:21
And just to be extra clear here: there?s currently no python library version that supports the sort of provider state injection (using `fromProviderState`) shown in the Pact JS V3 beta example above, correct?

i.pinzari
2021-06-07 17:27
has joined #pact-python

gurkiratguliani
2021-06-07 19:36
has joined #pact-python

matt.fellows
2021-06-07 21:46
Correct

krishna.ramnk
2021-06-08 13:24
has joined #pact-python

nathaniel.emmons
2021-06-08 18:50
@nathaniel.emmons has left the channel

sagar.kharab
2021-06-09 00:32
has joined #pact-python

sagar.kharab
2021-06-09 00:55
Hi Team, Greetings of the day! I am looking for an answer for below query. Unfortunately I couldn't find this in documents. my consumer let say called A  and I am setting up pact at the beginning of my python test file as below: ```pact_oauth = Consumer('Consumer').has_pact_with(Provider('Provider'), host='my.real.deployed.host.name' version='3.0.0', port=443, use_mocking_server=True)``` In this case is it likely to happen that the request will hit the real server and not return the mocked response (mock setup for this below) ```exp_response = { "access_token": "token", "expires_in": 120, "token_type": "Bearer" } parameter = {} (pact. given('Many people exists in database') .upon_receiving('a request for token') .with_request('POST', '/oauth/token', body=parameter, headers={'content-type': 'application/json'}) .will_respond_with(200, body=exp_response))``` Language: Python version: 3.9 OS: MacOS IDE: Pycharm Any guidance will be great, Please let me know if there are any queries

matt.fellows
2021-06-09 00:58
what is the flag `use_mocking_server`? I?ve not seen that before

matt.fellows
2021-06-09 00:58
Are you using Pact or Pactman?


matt.fellows
2021-06-09 00:59

matt.fellows
2021-06-09 00:59
it will mock the request lib altogether, which sounds like what you want

matt.fellows
2021-06-09 01:00
do note, however, that this is not a library supported by this community and I believe is no longer actively maintained. `pact-python` is the official one.

sagar.kharab
2021-06-09 01:18
Actually that's left there just, I had tried it without flag as well. I tried using both pact-python and pactman

matt.fellows
2021-06-09 01:37
For anyone else responding, some history here to avoid repeating common answers: https://pact-foundation.slack.com/archives/C9VBGLUM9/p1623199138144200?thread_ts=1619595038.210800&cid=C9VBGLUM9

david.vancouvering
2021-06-09 03:36
has joined #pact-python

nuno.pik
2021-06-09 06:58
has joined #pact-python

natashakdykes
2021-06-09 16:06
has joined #pact-python

torbjorn.vatn
2021-06-09 17:30
has joined #pact-python

sagar.kharab
2021-06-09 23:08
Hi Team, I have a question more of around a specific scenario. We are using microservice architecture in our project and hence for one consumer there are more than one provider, all part of one execution e.g. consumer 1 -> <- provider A (Auth token from provider A + additional request data) consumer 1 -> <- provider B (Auth token from provider A + Customer ID retrieved from Cache DB via provider B + additional request data) consumer 1 -> <- provider C so in this case consumer 1 is kind of passing response from one provider to another e.g. Auth token, ID from DB etc. with additional request context, however all this is all big one call for consumer, that's how the application is developed. So while writing pacts for this, how would it unfold in terms of interaction Since All providers are different (different hosts): they all would have separate pact specs with common consumer, but in when verification will happen, the real time request are made to the server, in that case cascaded requests are needed for success but here tests would be executing 1 provider after another. I am looking for the best practice in terms of how to avoid the complicated state setting thing, Since every verification runs in isolation. I am finding it hard to outline the process or best approach.

dawoud.sheraz
2021-06-10 06:52
Is this scenario related to https://docs.pact.io/faq/#why-pact-may-not-be-the-best-tool-for-testing-pass-through-apis? Because it seems like you are getting data from one provider and passing it to another. In any case, you would need some state configuration in each verification because they will be independent.

s.goel
2021-06-10 08:57
has joined #pact-python

sagar.kharab
2021-06-10 14:07
Hi team, Where can I find future release or announcement for pact-python. As of now it says it only supports pact v2, just want to know if there is scope of v3 release soon?

github2
2021-06-10 15:53
[pact-foundation/pact-python] Pull request opened by dependabot[bot]

kondal.ramidi
2021-06-10 16:13
has joined #pact-python

elliottmurray
2021-06-10 17:10
There is no roadmap per se. have been working on fixing messaging up and python updates to v3 would come after that. I?ve had a fair few personal things on and so has stalled a bit

richard
2021-06-11 00:13
has joined #pact-python

github2
2021-06-11 02:47
[pact-foundation/pact-python] Pull request opened by snyk-bot

github2
2021-06-11 07:57
[pact-foundation/pact-python] Pull request opened by elliottmurray

github2
2021-06-11 08:12
[pact-foundation/pact-python] Pull request merged by elliottmurray

github2
2021-06-11 08:12
[pact-foundation/pact-python] Pull request closed by elliottmurray

github2
2021-06-11 08:13
[pact-foundation/pact-python] Pull request closed by dependabot[bot]

jwcarman
2021-06-11 14:23
has joined #pact-python

hello370
2021-06-11 14:58
has joined #pact-python

vikrant82
2021-06-12 12:16
has joined #pact-python

daniel.bubenheim
2021-06-14 08:05
has joined #pact-python

sagar.kharab
2021-06-14 08:26
Thanks @elliottmurray

joaoproenca
2021-06-14 10:15
has joined #pact-python

e.pittaluga.b
2021-06-14 16:34
has joined #pact-python

npatil
2021-06-14 17:28
has joined #pact-python

lucas.rolle
2021-06-15 06:48
has joined #pact-python

caoilte
2021-06-15 11:36
has joined #pact-python

caoilte
2021-06-15 11:40
@caoilte has left the channel

danielabbitt
2021-06-15 17:12
has joined #pact-python

tom.borglum
2021-06-15 17:29
has joined #pact-python

michael.branders
2021-06-16 06:57
has joined #pact-python

jedlicka
2021-06-16 10:12
has joined #pact-python

jpasse
2021-06-16 13:45
has joined #pact-python

jan.malkiewicz
2021-06-16 14:48
has joined #pact-python

jeen.broekstra
2021-06-17 06:13
has joined #pact-python

minijb225
2021-06-17 06:44
has joined #pact-python

tomknee1
2021-06-18 08:15
has joined #pact-python

rockin291
2021-06-19 05:18
has joined #pact-python

zainamro1
2021-06-20 17:17
has joined #pact-python

nferrazzano
2021-06-21 05:23
has joined #pact-python

lewis.prescott079
2021-06-21 12:55
has joined #pact-python

vlad
2021-06-21 18:23
has joined #pact-python

christopher.doherty
2021-06-21 19:01
has joined #pact-python

liorra
2021-06-22 04:17
has joined #pact-python

stanojevic.boban
2021-06-22 10:20
has joined #pact-python

miguel.carneiro
2021-06-22 12:51
has joined #pact-python

srinagasai.krishnasan
2021-06-22 17:35
has joined #pact-python

varnit.garg2424
2021-06-23 06:19
has joined #pact-python

varun.patil
2021-06-23 12:44
has joined #pact-python

mselvakumar
2021-06-23 23:54
has joined #pact-python

srikanth.rachakonda
2021-06-24 02:32
has joined #pact-python

ali.akbar
2021-06-24 06:58
has joined #pact-python

erterpstra
2021-06-24 19:20
has joined #pact-python

abinzahid
2021-06-25 06:12
has joined #pact-python

jchandorkar
2021-06-26 09:01
has joined #pact-python

rani.sathya
2021-06-27 04:14
has joined #pact-python

cala.dev_pact
2021-06-28 04:07
has joined #pact-python

robert.rap
2021-06-28 06:34
has joined #pact-python

v-ratngupta
2021-06-28 07:13
has joined #pact-python

e.hallowell
2021-06-28 13:28
has joined #pact-python

mishalalexander20
2021-06-29 07:36
has joined #pact-python

lukemufc125
2021-06-29 07:57
has joined #pact-python

prash471
2021-06-29 09:43
has joined #pact-python

martijn.hagens
2021-06-29 10:12
has joined #pact-python

miguel.carneiro
2021-06-29 10:23
@miguel.carneiro has left the channel

mikko.s.koskinen
2021-06-29 17:05
has joined #pact-python

zhaoyi0113
2021-06-30 02:13
has joined #pact-python

sgottipati
2021-07-01 06:02
has joined #pact-python

vshankar
2021-07-01 06:06
has joined #pact-python

e.generalov
2021-07-01 07:19
has joined #pact-python

github2
2021-07-01 08:53
[pact-foundation/pact-python] Issue opened by mrlubos

github2
2021-07-01 11:52
[pact-foundation/pact-python] Issue closed by mefellows

eduards.klavins
2021-07-01 13:44
has joined #pact-python

felix.gomez
2021-07-01 14:38
has joined #pact-python

bbako
2021-07-01 20:51
has joined #pact-python

github2
2021-07-02 06:21
[pact-foundation/pact-python] Issue opened by stefanello8

phil.armstrong
2021-07-02 06:49
has joined #pact-python

gargshubham49
2021-07-02 07:21
has joined #pact-python

vinnys.lins
2021-07-05 13:49
has joined #pact-python

talank
2021-07-06 03:52
has joined #pact-python

juri.petersen
2021-07-06 07:29
has joined #pact-python

leolvicario
2021-07-06 07:36
has joined #pact-python

swoichhaa
2021-07-06 08:46
has joined #pact-python

ivo.velthoven174
2021-07-06 09:28
has joined #pact-python

fjtdg
2021-07-06 12:16
has joined #pact-python

steve.etherington
2021-07-06 16:44
has joined #pact-python

rosh.mjohn
2021-07-07 07:19
has joined #pact-python

mahajanalokkumar
2021-07-07 10:41
has joined #pact-python

jyiyng2002
2021-07-07 19:57
has joined #pact-python

splurgeop
2021-07-07 21:48
has joined #pact-python

kapoor.manil
2021-07-07 22:30
has joined #pact-python

pashas.2k3
2021-07-08 03:41
has joined #pact-python

vijayanaggella
2021-07-08 05:25
has joined #pact-python

ananthshenoy03
2021-07-08 05:46
has joined #pact-python

sai5i.islam
2021-07-08 06:40
has joined #pact-python

poorvasgokhale
2021-07-08 09:08
has joined #pact-python

suresh.thammishetti
2021-07-08 11:08
has joined #pact-python

michael.katende
2021-07-09 10:41
has joined #pact-python

marcin.baranowski953
2021-07-09 10:42
has joined #pact-python

bedfordwest
2021-07-10 22:21
has joined #pact-python

firstamit
2021-07-11 14:07
has joined #pact-python

omar554
2021-07-11 21:54
has joined #pact-python

k.deepupardha
2021-07-12 10:23
has joined #pact-python

lumenofor
2021-07-12 10:46
has joined #pact-python

jayr.motta
2021-07-12 13:57
has joined #pact-python

doug.shattuck
2021-07-12 20:26
has joined #pact-python

sorin_balbae
2021-07-13 07:41
has joined #pact-python

akara
2021-07-13 10:34
has joined #pact-python

nathan.derave
2021-07-13 12:28
has joined #pact-python

matthew.schaad
2021-07-13 21:29
has joined #pact-python

neenad.jadhavgre
2021-07-13 22:30
has joined #pact-python

cristian
2021-07-14 06:18
has joined #pact-python

michal.bernhard
2021-07-14 11:16
has joined #pact-python

richard.jones254
2021-07-14 23:53
has joined #pact-python

richard.jones254
2021-07-15 00:08
I've finally got time to work on pactman again, and have released 2.30.0 which merges some minor PRs that have been open a while https://pypi.org/project/pactman/

richard.jones254
2021-07-15 00:16
On my plate is finally getting to implement the publication workflow that was just being introduced back when I had to stop working on pactman. Specifically https://github.com/reecetech/pactman/issues/77

bethskurrie
2021-07-15 00:46
Hi @richard.jones254. Welcome back!

edanielsen
2021-07-15 00:46
has joined #pact-python

bethskurrie
2021-07-15 00:57
@richard.jones254 a lot has happened in the last couple of years of pact! Quick summary: * new pact specificaiton version https://github.com/pact-foundation/pact-specification/tree/version-4 * pending pacts https://docs.pact.io/pending * "work in progress pacts" https://docs.pact.io/wip * the "pacts for verification" API that you mentioned * We've been talking for ages about implementing a shared core library that can do the heavy lifting for a pact implementation in each language. This has been written in Rust, and each of the languages that was using the pact-ruby-standalone has been moving over to use it (pact-js, pact-python, pact-net etc). This has allowed the languages to provide nice, native language features while performing consistent matching logic and features across all the languages. * Soon to be out of beta support for first class environments, deployments and releases https://docs.pact.io/pact_broker/recording_deployments_and_releases/ * Up coming support for branches https://github.com/pact-foundation/docs.pact.io/blob/feat/deployments-and-releases/website/blog/2021-07-04-why-we-are-getting-rid-of-tags.md

richard.jones254
2021-07-15 00:58
Definitely keen to get up to date on all those things. Thanks for the update!!

abatan.k
2021-07-15 03:48
has joined #pact-python

mandeep302755
2021-07-15 04:49
has joined #pact-python

mahajanrupali22
2021-07-15 05:46
has joined #pact-python

hylke.de.jong
2021-07-15 12:49
has joined #pact-python

efemgy
2021-07-15 14:27
has joined #pact-python

github2
2021-07-15 16:15
[pact-foundation/pact-python] Issue opened by elliottmurray

github2
2021-07-15 16:17
[pact-foundation/pact-python] Issue opened by elliottmurray

amreenshaik.basha
2021-07-16 04:06
has joined #pact-python

github2
2021-07-16 09:13
[pact-foundation/pact-python] Issue opened by abhipsb

rhian.van.esch
2021-07-16 12:14
has joined #pact-python

wilco.van.esch
2021-07-16 12:30
has joined #pact-python

karl.morrison
2021-07-16 12:56
has joined #pact-python

timothyjabez
2021-07-16 17:23
has joined #pact-python

ppdnguyen
2021-07-18 16:23
has joined #pact-python

cgoodison
2021-07-18 23:56
has joined #pact-python

github2
2021-07-19 11:04
[pact-foundation/pact-python] Pull request opened by elliottmurray

sripathi
2021-07-19 12:30
has joined #pact-python

calvin.krist
2021-07-19 15:29
has joined #pact-python

vinay.viswanadha
2021-07-19 15:30
has joined #pact-python

brian.mitchell
2021-07-19 15:37
has joined #pact-python

mike.geeves064
2021-07-19 18:07
has joined #pact-python

ben.clare2
2021-07-20 08:16
has joined #pact-python

mike.geeves064
2021-07-20 08:46
Hi, it's been a while since using pact but starting to take another look as I need some contract testing for an event driven architecture. Are you still after contributors? I should have some time if that will help, subject to skillset required etc :smile:

elliottmurray
2021-07-20 08:48
All contributions are welcome! So there was some progress on implementing messaging but we've had a bit of a pivot to adopt the pact reference binaries using ffi. There is a feature branch for providers. Very early days but what we would need help with

mike.geeves064
2021-07-20 08:54
A little googling for ffi later, not used that before :slightly_smiling_face:

mike.geeves064
2021-07-20 09:01
I'll take a look at what's in the feat/ffi-provider branch and see if I can make sense of what's going on

elliottmurray
2021-07-20 09:04
Neither had I until yesterday! It?s very early. I?m on holiday until Friday but free to chat then

mike.geeves064
2021-07-20 09:05
:+1:

mike.geeves064
2021-07-20 10:54
Forgot to ask, so at a really high level, what's the next step approach, as in were you going to loosely take a look at say the go or .net etc implementation and add mirror their usage bit by bit?

matt.fellows
2021-07-20 11:23
I think the plan will be documented at a HL here: https://github.com/pact-foundation/pact-python/projects/1


mike.geeves064
2021-07-20 11:36
:+1:

mike.geeves064
2021-07-20 11:36
It makes more sense now knowing what FFI is :smile:

rafael.moral
2021-07-20 11:48
has joined #pact-python

andrii.rakhimov
2021-07-20 23:06
has joined #pact-python

boris.gordon
2021-07-20 23:25
has joined #pact-python

github2
2021-07-22 00:25
[pact-foundation/pact-python] Issue opened by bethesque

mike.geeves064
2021-07-22 09:47
[ I've got as far as getting it setup to run pact-python and pact-go tests etc, pact-python happy enough in my pycharm. I got a little confused with pact-go where it was even pulling in the ffi until a bit of reading up on go and now it makes sense why that's all in the comments :smile: I'm not about on Friday so let's try and pick up properly next week, although EuroPython is on so I'll be listening to that most of the day(s) ]

matt.fellows
2021-07-22 10:54
Ah sorry Mike, I haven?t compiled Developer documentation yet - so you?ve done well to get that going

matt.fellows
2021-07-22 10:55
I just pushed up a change last night to use the new `pact_ffi` single lib (previously it was several)

matt.fellows
2021-07-22 10:55
hope that didn?t confuse - enjoy the conf!

mike.geeves064
2021-07-22 12:16
:+1: Yeah, saw the merging all into one, it was the C go effectively running the code in the comments that threw me, I was thinking it was "this is how we do it in C, inserted for reference" rather than this is how it works! What's your stance on pedantry? :slightly_smiling_face: There were a couple of bits in the Dev docs that didn't quite tie up, can pass back feedback of helpful / if planned can run through as a noob (aware it can not be a good time for niggles, noise Vs value)

matt.fellows
2021-07-22 12:39
> What?s your stance on pedantry? my stance is wide

matt.fellows
2021-07-22 12:39
feedback welcome

github2
2021-07-22 12:59
[pact-foundation/pact-python] Pull request opened by pulphix

ryn.anderson
2021-07-22 17:41
has joined #pact-python

schakalabbi
2021-07-22 21:29
has joined #pact-python

uryadov212
2021-07-23 06:15
@uryadov212 has left the channel

consulting
2021-07-23 12:33
has joined #pact-python

galante2123
2021-07-23 14:14
has joined #pact-python

dc113604
2021-07-23 14:39
has joined #pact-python

dc113604
2021-07-23 16:22
Hi, I have question about setting up provider states. Sorry I'm a bit new to API e2e testing as well as pact. I have my provider api running locally using FastAPI + uvicorn, and verifying against a local broker using docker compose from the pact docs. My Verifier worked without the provider_states_setup_url param, but once I add it the verification fails as it can't find my states. My url is like, "http://localhost:8000/tests/data/provider_states" Which seems right from the e2e example in the docs. Is it maybe that the provider states need their own seperate server than the local provider? Also, I don't see an example of of the state file in the docs, it looks like fastapi_provider.py is hard coding the state in the test. Would it be possible to add this in the example?

elliottmurray
2021-07-23 17:54
The tests in this example actually wrap the target Provider app and adds some extra endpoints. Other SDK?s have more sophisticated means of doing this but this is the one I have provided for the example.


elliottmurray
2021-07-23 17:56
Which I think is what you?re saying. In, for example the JS version, they have the ability to run ?filters? or proxies to help with this and execute custom code.

matt.fellows
2021-07-23 22:35
When this is in would that provide some of the infra to achieve the proxy goodies https://github.com/pact-foundation/pact-python/pull/247?

dsinecos
2021-07-26 04:49
has joined #pact-python

mebenhoeh
2021-07-26 05:20
has joined #pact-python

github2
2021-07-26 07:59
[pact-foundation/pact-python] Pull request opened by maggieleake

matt.fellows
2021-07-26 08:00
Interesting. PR from. Outsystems (prospect)

dsmileb
2021-07-26 16:06
has joined #pact-python

hazel.wright
2021-07-26 19:04
has joined #pact-python

matt682
2021-07-27 01:32
has joined #pact-python

github2
2021-07-28 00:59
[pact-foundation/pact-python] Pull request opened by snyk-bot

github2
2021-07-28 04:03
[pact-foundation/pact-python] Pull request opened by snyk-bot

vbhardwaj.eminent
2021-07-28 05:15
has joined #pact-python

miguel.panelo
2021-07-28 07:29
has joined #pact-python

otaviio
2021-07-28 07:57
has joined #pact-python

patrice.krakow
2021-07-28 10:00
has joined #pact-python

david.simpson
2021-07-28 12:51
has joined #pact-python

mike.geeves064
2021-07-28 14:00
Last talk of the day, interesting one on "documentation driven development" :slightly_smiling_face: So, what would be helpful, I don't know if a quick call at some point to go through a "hi / can you do this" or just a "here's a ticket" etc, any preferences?

mike.geeves064
2021-07-28 14:03
Happy to take a look at the FFI stuff for example, but that might not be a great place to start if it's already in flight rather than "this would be nice but no time" etc

github2
2021-07-28 16:26
[pact-foundation/pact-python] Pull request opened by pulphix

github2
2021-07-28 16:26
[pact-foundation/pact-python] Pull request closed by pulphix

e.alderson004
2021-07-28 17:17
has joined #pact-python

jdalessandro
2021-07-29 07:27
has joined #pact-python

eric.tang1
2021-07-29 16:22
has joined #pact-python

antklim
2021-07-29 22:25
has joined #pact-python

toffer.lim87
2021-07-30 03:51
has joined #pact-python

dawoud.sheraz
2021-07-30 09:53
Hello. Is there an equivalent of stateHandlers in pact-python? In pact-python, the verifier only takes provider state url. Providing a dict results in bad URI error. https://docs.pact.io/implementation_guides/javascript/readme#api-with-provider-states

matt.fellows
2021-07-30 10:06
Not at the moment. You need to create a test specific endpoint/route that will receive the state change request from the verifier, which contains the state info to be setup

dawoud.sheraz
2021-07-30 10:07
Yes, following that process already. Thanks for the confirmation, Matt.

aphronio
2021-07-30 13:42
has joined #pact-python

github2
2021-07-31 11:24
[pact-foundation/pact-python] Pull request merged by elliottmurray

github2
2021-07-31 11:35
[pact-foundation/pact-python] Pull request opened by elliottmurray

github2
2021-07-31 11:46
[pact-foundation/pact-python] Pull request merged by elliottmurray

fabio882
2021-08-01 19:31
has joined #pact-python

fabio882
2021-08-01 19:32
@elliottmurray hi Elliott, I'm Pulphix, sorry I read your message just now

eddie
2021-08-02 04:08
has joined #pact-python

github2
2021-08-03 08:28
[pact-foundation/pact-python] Pull request closed by maggieleake

dawoud.sheraz
2021-08-03 12:01
Hi. What are the possible reasons for error `RuntimeError: There was an error when stopping the Pact mock service.` ? It has started appearing all of a sudden on my local machine.

marvin.kienitz
2021-08-05 07:20
has joined #pact-python

danieljak
2021-08-05 10:09
has joined #pact-python

univ.anirudh
2021-08-05 13:22
has joined #pact-python

james.perepiczka
2021-08-05 16:29
has joined #pact-python

j3rry.wan9
2021-08-05 21:44
has joined #pact-python

sadikshahidain
2021-08-06 02:14
has joined #pact-python

ganginenik
2021-08-06 18:14
has joined #pact-python

github2
2021-08-07 09:27
[pact-foundation/pact-python] New release _https://github.com/pact-foundation/pact-python/releases/tag/v1.4.0_ published by elliottmurray

elliottmurray
2021-08-09 12:31
So the above release contains full Messaging Support!

elliottmurray
2021-08-09 12:31
Thanks to @fabio882

matt.fellows
2021-08-09 12:36
That?s such amazing news - so many people to thank!

matt.fellows
2021-08-09 12:36
:taco: for @tpham

matt.fellows
2021-08-09 12:36
:taco: for @winfante

matt.fellows
2021-08-09 12:36
:taco: for @fabio882

matt.fellows
2021-08-09 12:36
and last, but not least

matt.fellows
2021-08-09 12:37
:taco: for @elliottmurray for pulling it together (which, frankly, is the hardest bit!)

elliottmurray
2021-08-09 14:24
Yes Fabio was kind enough to finish the provider bit off. Tuan and William did the Consumer side (and had a good initial crack at the Provider too)

fabio882
2021-08-09 15:51
Thank you everyone. I had just ported the amazing work done by Tuan and William. Thank you guys.

marcelo
2021-08-09 16:37
Hey guys! Can someone provide me an example of a request with `multipart/form-data` that uploads a file? I tried different things but I can?t make it work

george.south
2021-08-09 21:51
@george.south has left the channel

xiaoyewang
2021-08-10 01:13
has joined #pact-python

mfellows_admin
2021-08-10 02:52
has joined #pact-python

qingyuliu
2021-08-10 09:27
has joined #pact-python

github2
2021-08-10 18:20
[pact-foundation/pact-python] Issue opened by selin194

dhairyapatel071996
2021-08-10 20:06
has joined #pact-python

beem132
2021-08-10 21:21
has joined #pact-python

tpham
2021-08-11 00:49
Thanks for making it became true. Thanks @elliottmurray and @fabio882 for following up.

rfang
2021-08-11 00:49
has joined #pact-python

subhashnarla
2021-08-11 07:29
has joined #pact-python

jkdihenkar
2021-08-11 10:43
has joined #pact-python

christian.kampka
2021-08-11 10:51
has joined #pact-python

ashwinparthasarathy30
2021-08-11 11:23
has joined #pact-python

andrew.jensen
2021-08-11 16:18
has joined #pact-python

richard.jones254
2021-08-12 00:55
Is there an ETA for getting the library-based rust implementation into *pact-python*? One of the two key motivations for writing *pactman* was the user experience around launching a separate server process to do the pact creation / verification work. The other being a better pytest UX, but once the first is solved in pact-python I can look into migrating the pytest stuff in *pactman* to a thin wrapper over *pact-python*...

richard.jones254
2021-08-12 00:56
(to be clear, one implementation of pact for python is preferable, I don't have the time I used to have to support pactman, so it's in maintenance mode right now, not getting any fancy new features)

matt.fellows
2021-08-12 01:16
I don?t think there is an ETA, but @elliottmurray started doing some POC?ing some of the FFI bindings

richard.jones254
2021-08-12 03:37
Yeah, I saw a PR go thru with the basic FFI config.

vivekkurhe1993
2021-08-12 03:44
has joined #pact-python

aakbar
2021-08-12 06:05
has joined #pact-python

tm.buga
2021-08-12 08:55
has joined #pact-python

yanivhad
2021-08-12 08:58
has joined #pact-python

francois.fernandes
2021-08-12 11:55
has joined #pact-python

mike.geeves064
2021-08-13 08:07
Bump! Anything in particular that would be good to look at/preferences in how to get started? Couple of days of currently free time again next week :)


matt.fellows
2021-08-13 08:11
(can?t help much on the Python side)

matt.fellows
2021-08-13 08:11
but that?s the golang bindings (internal) that talk to the FFI boundary

mike.geeves064
2021-08-13 08:13
More around which bits, from past experiences of people trying to be helpful working on something which is already in progress / not as valuable etc

mike.geeves064
2021-08-13 08:13
:)

mike.geeves064
2021-08-13 08:14
Semi random unexpected pull requests can be more disruptive than useful

matt.fellows
2021-08-13 08:15
I?m not quite sure where Elliot is at, but worth checking out his branch

matt.fellows
2021-08-13 08:16
The provider side is definitely the easier side to get moving, once the mechanism to communicate to the FFI is in place

matt.fellows
2021-08-13 08:16
also, the recent PR that was merged (for message Pact) will be great infrastructure

matt.fellows
2021-08-13 08:16
but yeah, sorry not much more helpful than that!

mike.geeves064
2021-08-13 08:17
No problem :)

mike.geeves064
2021-08-13 08:17
If it's a just go and do some things that's ok :D

ashwinparthasarathy30
2021-08-13 09:16
able to run python pact in in my pc,facing ssl error while trying to publish in pactflow

ashwinparthasarathy30
2021-08-13 09:16
any help would be great

elliottmurray
2021-08-13 10:44
So I started looking at verify. Didn?t make much progress. There were 2 challenges. Has problems calling it (getting the syntax for a string array right in the CFFI bit) and also philosophical questions about hour to unit test it

dawoud.sheraz
2021-08-13 11:37
What?s the best way to cleanup db after each interaction during provider verification, in Django particularly? Right now, I am calling a clean DB method before each interaction?s state setup, only attempting to remove the data added in state. Are there any best practices?

mike.geeves064
2021-08-13 12:38
:thinking_face: It's almost like you want some sort of way to test the interface, sending a message from the python side to the CFFI side, and making sure the structure/content is correct, like some sort of contract... :smile:

elliottmurray
2021-08-13 12:42
Yes the meta nature of this hasn?t escape me!

mike.geeves064
2021-08-13 12:43
:joy:

mike.geeves064
2021-08-13 12:51
I'm not even sure if that's a silly idea or not :smile: I do quite like the idea of the thing you're testing with being the thing it's written in though :smile: Going via a broker might be a bit slow for unit tests though. I'll pull that down and take a look anyway :slightly_smiling_face:

mike.geeves064
2021-08-13 12:51
Are you in an actively working on that state, or pushed to the side for a while?

ashwinparthasarathy30
2021-08-13 14:14
what to put for provider setup url

elliottmurray
2021-08-13 14:26
I was going to have a look this weekend but was a slow burner. If you ran with it is have no problem with that

elliottmurray
2021-08-13 14:28
As for testing I think I'm preferring some functional unit tests that prove it being called. I don?t think I need to test basic correctness at a low level as they should already be done. Broker will be interesting. I have used test containers and might be an option

johnathan.gilday
2021-08-13 16:40
has joined #pact-python

ben.kaiser
2021-08-13 17:47
has joined #pact-python

johnathan.gilday
2021-08-13 20:03
@johnathan.gilday has left the channel

dbekman
2021-08-13 20:51
has joined #pact-python

matt.fellows
2021-08-13 22:29
Ssl error? Are you behind a corporate proxy?

matt.fellows
2021-08-13 22:30
I believe you're using Pactflow and our certificate is valid, unless your self hosting a broker with a self signed cert?

matt.fellows
2021-08-13 22:30
You may need to set proxy environment variables to tell any http client how to navigate the proxy

matt.fellows
2021-08-13 22:31
Please share the exact error

matt.fellows
2021-08-13 22:32
howtoask

2021-08-13 22:32
Please see this page for some tips on how to ask for help to get the best response from the community https://docs.pact.io/help/how_to_ask_for_help

matt.fellows
2021-08-13 22:32
Please see this page Ashwin

matt.fellows
2021-08-13 22:32
You may not be getting any answers because your questions are not very answerable

matt.fellows
2021-08-13 23:48
FWIW we're in the process of creating a plugin framework for Pact that uses protobufs/grpc and we'll be using the plugin to pact test that interface :rolling_on_the_floor_laughing:

matt.fellows
2021-08-13 23:48
We also pact test the pact broker in the OSS tools

matt.fellows
2021-08-13 23:48
(and Pactflow)

ashwinparthasarathy30
2021-08-14 05:25
iam behind a coprate

ashwinparthasarathy30
2021-08-14 05:25
and i tried running after putiing proxy

ashwinparthasarathy30
2021-08-14 05:25
when i ran with pact-python iam getting ssl error

ashwinparthasarathy30
2021-08-14 05:26
when i ran with pactman iam getting sssl1123

ashwinparthasarathy30
2021-08-14 05:26
error

ashwinparthasarathy30
2021-08-14 05:26
ok matt

ashwinparthasarathy30
2021-08-14 05:26
first time here

matt.fellows
2021-08-14 09:38
What have you tried and what's result have you got? Have you tried with the outgoing examples in the project yet?

matt.fellows
2021-08-14 09:38
Have you set the usual proxy env vars?

matt.fellows
2021-08-14 09:39
It's possible your corporate proxy is MITM your requests

matt.fellows
2021-08-14 09:39
You should talk to whoever manages that to stop interfering or provide a way to navigate it

matt.fellows
2021-08-14 09:39
See also the SSL environment variables documented here: https://github.com/pact-foundation/pact-ruby-standalone/releases

matt.fellows
2021-08-14 10:50
There is also this env var you can use to disable it altogether which you can use to test if that's the actual problem: PACT_BROKER_DISABLE_SSL_VERIFICATION

chen
2021-08-15 09:34
has joined #pact-python


dawoud.sheraz
2021-08-16 04:47
And another question, related to my :point_up: thread, to confirm if there is a way to run some method/function after each interaction to do the DB cleanup or other miscellaneous operations in pact-python. https://pact-foundation.slack.com/archives/C5F4KFKR8/p1629088943196700

github2
2021-08-16 09:47
[pact-foundation/pact-python] Issue opened by artamonovkirill

tom.willmott
2021-08-16 13:47
has joined #pact-python

franklin.lucena89
2021-08-16 16:52
has joined #pact-python

github2
2021-08-16 20:04
[pact-foundation/pact-python] Pull request opened by elliottmurray

ram.tripathi
2021-08-17 06:33
has joined #pact-python

ricardo.neto
2021-08-17 09:22
has joined #pact-python

andrew.patterson
2021-08-17 14:55
has joined #pact-python

pshah
2021-08-17 15:31
has joined #pact-python

github2
2021-08-17 17:51
[pact-foundation/pact-python] Pull request merged by elliottmurray

github2
2021-08-17 17:57
[pact-foundation/pact-python] New release _https://github.com/pact-foundation/pact-python/releases/tag/v1.4.1_ published by elliottmurray

github2
2021-08-17 17:57
[pact-foundation/pact-python] elliottmurray requested review to deploy

github2
2021-08-17 17:57
[pact-foundation/pact-python] elliottmurray approved 1 deployment

dylanchase26
2021-08-18 04:11
has joined #pact-python

satish.chandra
2021-08-18 05:54
has joined #pact-python

flynnhandley
2021-08-18 22:30
has joined #pact-python

mike.geeves064
2021-08-19 10:31
(still trying to get my head around the passing data types to get the 0.0.1 FFI libs to do anything other than segfault when calling verify :D)

matt.fellows
2021-08-19 11:15
If you have any code samples point them my way and I can chip in

matt.fellows
2021-08-19 11:15
Also share in #pact-rust, there a number of people doing this as we speak

thomaswtsang
2021-08-19 16:53
has joined #pact-python

chris005
2021-08-19 19:07
has joined #pact-python

chris005
2021-08-19 19:31
I have pretty much the same question. It seems one approach is to create some "set up" endpoint which `pact-verifier` will make requests to. It passes the desired provider state, and it would be up to that endpoint to reset the DB state before creating whatever state was desired. For various reasons, I'm hesitant to include such an endpoint in our services. We're working on an alternative approach: a CLI tool which generates unittest-style tests. We essentially leave the `setUp` method blank, so you'd just need to fill that in with whatever state creation you need. With this approach, we get test isolation essentially for free. Would something like that be of interest? It's in very early alpha at the moment, so not really ready to share publicly but it will be open source + freely available, hopefully fairly soon.

srimuralixi
2021-08-20 02:18
has joined #pact-python

manika.goel
2021-08-20 05:38
has joined #pact-python

dawoud.sheraz
2021-08-20 05:40
Provider state setup endpoint already does what you are suggesting(unless I misinterpreted something). What I was thinking is to have an endpoint that cleans-up DB after each provider state setup interaction.

akanksha.sharma
2021-08-20 06:31
has joined #pact-python

chris005
2021-08-20 13:40
Right. The DB cleanup part is handled by using Django's version of `TestCase`, so each test is ran inside a transaction which gets rolled back once it exits. So, you get DB cleanup essentially for free.

dawoud.sheraz
2021-08-20 13:42
Yes. But the way verifier calls each interaction is handled internally. If that were explicit and left to dev, using Django testcase would have helped.

chris005
2021-08-20 13:43
we're essentially replacing `pact-verifier`

jonah
2021-08-20 14:42
has joined #pact-python

tlzhou
2021-08-20 15:02
has joined #pact-python

mike.geeves064
2021-08-20 21:46
Thanks, mostly just noob early stage problems, it's starting to make sense though, will shout out with any specifics :)

mike.geeves064
2021-08-21 13:13
Mostly at @elliottmurray: In a lot of the existing (non-ffi) python tests, they are verifying that expected contents from the output match up, so I'm looking at at least mirroring some of that. However I had quite a few problems with the logging, I think to do with how CFFI works. Trying to create a new FFI() each time and calling dlopen *doesn't* seem to start from scratch, so it fell over because logging can only be setup once (probably there is a one line CFFI option that I've missed which would have solved this :smile:). I've ended up currently with a parent class for the PactFFI overall, with then a Verifier class inheriting from it (the idea being to have an inheriting class per module in line with the pact_ffi) - but pulling the lib and ffi objects from the class. I don't really like (vs being able to have at least the lib object per class) this but I'm not sure a better way for now. Logging is going to a temporary file in a temporary directory which should get cleaned up, seems to work ok although a little clunky then having to make sure the file is cleared out between calls. Not a huge amount more from the version test so far but it's starting to make sense at least :slightly_smiling_face: Changes so far going in here: https://github.com/mikegeeves/pact-python/pull/1/files any input on "strongly prefer to not do x" welcome :slightly_smiling_face: Meanwhile I'll start looking at some of the actual tests to do something productive!

mike.geeves064
2021-08-21 13:17
Also, I noticed you're running tests with pytest and the ffi test at least wasn't using the UnitTest style class unlike older tests, am I correct in assuming the preference going ahead is pytest style? (I'm more comfortable with pytest so that is preferable for me anyway :slightly_smiling_face: )

elliottmurray
2021-08-22 10:44
I am not sure on the reasoning previously of not using Pytest - I suspect because we were supporting 2.x. I?ve slowly been moving over and while it?s not a big deal for me am preferring moving to a more idiomatic pytest setup so think we?re aligned!

elliottmurray
2021-08-22 10:45
I?ll have a look at your PR. Got stuck on some of the mechanics of CFFI especially around verify.

mike.geeves064
2021-08-22 11:21
Hardly anything in the PR yet but easier if there's some approach/style that's not preferred to change sooner rather than later :slightly_smiling_face: Have you tried black? I quite like it to avoid always having noise in PRs which are just because of IDEs fighting on formatting styles What I was trying (very unsuccessfully!) last night, was if it's possible to pull out the CLI arguments used in Rust into another FFI function. The idea being if we could just nicely pull them out into say a JSON structure (seemed easy at the time!) containing those --long-options -s short options and descriptions, if that could then be called on the python (and other languages ofc) side, then programatically add all of that into the python side click arguments. Rather than needing to maintain the arguments and corresponding tests. Thinking back to your comment about you want to check it's being called properly, but a load of testing around the actual behaviour is probably unnecessary at least to some extent. I'd quite like the idea of if they rename an arg or add a new one in, or improve a description, that it wouldn't require each language implementation to update, only bump up the version to use and everything goes in automatically :thinking_face: Wider discussion would be needed around that, I was hoping to have a code example to say "what about this" but Rust and pointers are making my eyes bleed :joy:

mike.geeves064
2021-08-22 20:44
Phew! Managed to get what I was wondering about working, just asked in #pact-rust if anyone else thinks it could be a good idea. The CLI wrapper using FFI is currently https://github.com/mikegeeves/pact-python/pull/1/files#diff-4d935290cd4b707d3487eda5c7a90daf7c5f79c22d85bba238f218068d501e05 i.e. all the click options are coming from an FFI call (it's not complete but working enough as a poc)

mike.geeves064
2021-08-22 20:46
:party_parrot:

ramya.sri
2021-08-23 03:52
has joined #pact-python

joseramonrivera21
2021-08-23 08:49
has joined #pact-python

mike.geeves064
2021-08-23 09:28
I await anyone saying it's an abomination, but I like this a lot :smile: > -l, --loglevel [error|warn|info|debug|trace|none] Options nicely getting automagically pulled out to go to click as well

denny.duttig
2021-08-23 10:10
has joined #pact-python

akansha.saraswat3
2021-08-23 10:50
has joined #pact-python

sushant.soni
2021-08-23 21:10
has joined #pact-python

ajaiswal595
2021-08-24 11:00
has joined #pact-python

pd287515778
2021-08-24 12:48
has joined #pact-python

hwebster
2021-08-25 05:30
has joined #pact-python

hoangvo
2021-08-25 05:43
has joined #pact-python

jobjingjo
2021-08-25 06:20
has joined #pact-python

sagarsitap596
2021-08-25 14:10
has joined #pact-python

kyle.fischer
2021-08-25 16:31
has joined #pact-python

datasmithadvtech
2021-08-25 19:43
has joined #pact-python

todor.m.kolev
2021-08-25 19:59
has joined #pact-python

sushmitha.amin
2021-08-26 04:31
has joined #pact-python

shwetastar98
2021-08-26 12:35
has joined #pact-python

contact
2021-08-26 12:44
has joined #pact-python

malena.cadima
2021-08-26 16:07
has joined #pact-python

louis.ss
2021-08-27 01:42
has joined #pact-python

mike.geeves064
2021-08-27 13:27
@elliottmurray Aside from I haven't actually run any "successful" pacts yet, do you think this approach for the CLI verifier wrapper looks ok so far? https://github.com/mikegeeves/pact-python/pull/1/files#diff-4d935290cd4b707d3487eda5c7a90daf7c5f79c22d85bba238f218068d501e05

sergio.amorim
2021-08-27 14:40
has joined #pact-python

slin
2021-08-29 23:51
has joined #pact-python

shane.robinson
2021-08-30 00:30
has joined #pact-python

br.maher
2021-08-30 04:35
has joined #pact-python

kwongyun
2021-08-30 15:57
has joined #pact-python

0x06065a
2021-08-31 00:02
has joined #pact-python

matt.thomas
2021-08-31 05:29
has joined #pact-python

abhi.nandan964
2021-08-31 10:19
has joined #pact-python

shivi.btech08
2021-08-31 21:03
has joined #pact-python

kpuengpanich
2021-09-01 07:14
has joined #pact-python

mhmtyuceoz
2021-09-01 07:35
has joined #pact-python

fabio882
2021-09-01 11:56
Hi guys, I sent a pull request to support pact broker, let me know what you think :)

volkan.tufekci
2021-09-02 08:47
has joined #pact-python

fabio882
2021-09-02 09:05
@elliottmurray @tpham, hey guys any thoughts on the pull request?

yassine
2021-09-02 10:59
has joined #pact-python

connor.beck
2021-09-02 13:39
has joined #pact-python

maurits.out
2021-09-02 15:12
has joined #pact-python

kumasaka.tk
2021-09-02 21:24
has joined #pact-python

valeriia.danylenko
2021-09-03 18:26
has joined #pact-python

irmt06
2021-09-04 22:51
has joined #pact-python

irmt06
2021-09-05 10:20
:wave: Hello everyone! I?m currently working on setting up pact for a consumer (JS) and a provider (Python). I?ve been able to setup everything until generating the pact (currently in pactflow). I?m writing the provider test, however, I?m encountering problems because of the way states are setup. My provider has a dependency with a data storage which I?m trying to mock, it?s not feasible for me to do it as shown in the examples (writing the data at the application level). In the method where I?m setting the provider states I can?t mock the api calling the data store because that occurs in a different request than the one testing the contracts. I?ve read a lot about this and I couldn?t find a definite answer either in the slack history or a working example. I?ve also noticed in some places like `pactman` docs that it?s possible, I?m just not sure how. My first guess is that the documentation mentions that it?s possible if you run the mock in the test that executes the `verify_with_broker` call. But that would mean that the mock will run for all the pacts. What would be a good strategy to mock my _upstream_ data store calls? I?m exploring solutions before thinking of adding an extra ?test? data store with the data I want, a test user with everything setup in a test environment (or staging), or hardcoding test responses in the code (which I don?t love).

elliottmurray
2021-09-05 21:07
I think I understand the problem. Your provider X has a provider of its own Y. You can?t mock Y through provider states? Or not easily. So I?m not totally sure in your situation how I?d solve it but I?d make the observation that the whole point of contract testing is to at any one time reduce your collaborators to 2 in any contract test scenario. You effectively have 3. (The Consumer and then your chain of providers) I would lean to some redesign so that you are able to do this. You are not testing the contract between X and Y here (which is creeping into your tests) Otherwise you?re going to need some way to get a hook in. The bit at the end of having test data makes me feel uneasy too and I would steer clear.

irmt06
2021-09-06 09:53
Hey @elliottmurray Thanks for your answer!

irmt06
2021-09-06 09:54
Actually it?s not another provider, it?s a data storage, it?s elasticsearch to be exact

irmt06
2021-09-06 09:54
the thing is that the data stored in that elasticsearch is written by another provider

irmt06
2021-09-06 09:54
so I don?t really have the control during states to write to Elasticsearch

irmt06
2021-09-06 09:55
unless I do some tricky workarounds ;D, that I want to avoid

irmt06
2021-09-06 09:55
however, there?s something I don?t have 100% clear. Yesterday, I did manage to mock some of the data returned by elasticsearch using `mock.patch().start()` , inside a state

irmt06
2021-09-06 09:56
I had the idea that the state call was done in a different process than the contract test, so I?m not very sure why it worked

divyalakshmi.gk
2021-09-07 01:46
has joined #pact-python

constantin.jaeck
2021-09-07 02:24
has joined #pact-python

narendra_uppara
2021-09-07 07:17
has joined #pact-python

nikuplanchiwar
2021-09-07 08:03
has joined #pact-python

sdomeracki
2021-09-07 10:22
has joined #pact-python

gibraltor999
2021-09-07 12:03
has joined #pact-python

norway.martin
2021-09-07 18:38
has joined #pact-python

fabio882
2021-09-07 21:06
Did someone have some examples to how to integrate pact-python with aws-lambda and AWS API gateway?

adamdullenty
2021-09-08 08:23
has joined #pact-python

martin.a.harkins
2021-09-08 12:15
has joined #pact-python

rocco.smit
2021-09-09 06:20
has joined #pact-python

andrei_mironau
2021-09-09 10:00
has joined #pact-python

febin.sathar
2021-09-09 10:17
has joined #pact-python

jcaromiq
2021-09-09 11:47
has joined #pact-python

mirko.zipris
2021-09-09 20:08
has joined #pact-python

dotelnp
2021-09-10 06:48
has joined #pact-python

sameer.patil
2021-09-10 18:42
has joined #pact-python

b.1.alpha
2021-09-10 19:17
has joined #pact-python

naushad_amin
2021-09-11 23:15
has joined #pact-python

jose_rodriguez
2021-09-13 13:16
has joined #pact-python

kyle_evans
2021-09-13 13:16
has joined #pact-python

rahul.louis
2021-09-13 15:55
has joined #pact-python

a.koka
2021-09-13 17:01
has joined #pact-python

efloresambrosio
2021-09-13 20:09
has joined #pact-python

olle_hallin
2021-09-14 05:50
has joined #pact-python

a.babenko
2021-09-14 14:00
has joined #pact-python

vasavi.balanagu
2021-09-14 16:49
has joined #pact-python

samuel.sjoberg
2021-09-14 21:49
has joined #pact-python

domingo
2021-09-14 23:51
has joined #pact-python

pradeepkumarstudent20
2021-09-15 03:32
has joined #pact-python

bryan
2021-09-15 15:16
has joined #pact-python

dboxler
2021-09-15 18:35
has joined #pact-python

keerthisiv
2021-09-16 03:59
has joined #pact-python

timothyjabez
2021-09-16 07:52
Hello all. I?m currently working on generating a provider pact. The consumer has published a pact already with the pact broker. When I try to run my pact, I?m getting the error ``` { "testDescription": "has status code 200", "testFullDescription": "Verifying a pact between DataAccessLayer and Metadata Given There are some sites A Get request to retrieve the sites from metadata service with GET /api/sites returns a response which has status code 200", "status": "failed", "interactionProviderState": "There are some sites", "interactionDescription": "A Get request to retrieve the sites from metadata service", "exception": { "class": "Faraday::TimeoutError", "message": "Net::ReadTimeout" } },``` I tried to lookup what this `Faraday::TimeoutError` is, but couldn?t get anything that seemed useful. There is another test which tests the same endpoint, and that seems to work fine. I?ve got no clue what could have gone wrong here. Could someone please help me out here. Thanks in advance!

elliottmurray
2021-09-16 07:58
Another Pact test passes? It looks like this is a timeout from Broker (I'm assuming a local version?)

timothyjabez
2021-09-16 08:00
There are multiple interactions that are being tested in the provider pact test. This one interaction is failing, but the other interactions are passing.

fnguyen
2021-09-16 08:15
has joined #pact-python

fnguyen
2021-09-16 08:16
Isn't the broker used just to pull the pact and then post result? why would it be involved in the interaction test?

adelina.simion
2021-09-16 08:41
has joined #pact-python

elliottmurray
2021-09-16 08:43
So yep it sounds like the mock server. Have you set up the expectations correctly? Run that test in isolation

fnguyen
2021-09-16 08:46
Timothy has the pact so the consumer test has been run against mock service, and he is doing provider test against actual service with a state endpoint. Wondering if the state endpoint is taking too much time to reply on first test which is why it times out but the further tests are passing as the state endpoint is replying faster.

matt.fellows
2021-09-16 10:16
Can you please enable verbose logging? You'll be able to see which request is indeed the problem

akke.luukkonen
2021-09-16 10:29
has joined #pact-python

alejandro.pena
2021-09-16 13:37
has joined #pact-python

bbleach
2021-09-17 07:30
has joined #pact-python

rushideshpandes
2021-09-20 13:11
has joined #pact-python

gemhar
2021-09-20 14:33
has joined #pact-python

jsegall
2021-09-20 21:37
has joined #pact-python

dalkire
2021-09-21 13:30
has joined #pact-python

hakan.celebi
2021-09-21 19:43
has joined #pact-python

samuel.sjoberg
2021-09-21 20:11
@samuel.sjoberg has left the channel

nrobison
2021-09-22 15:39
has joined #pact-python

calise
2021-09-22 17:06
has joined #pact-python

nareshnavinash
2021-09-23 09:28
has joined #pact-python

radu.simu
2021-09-23 09:38
has joined #pact-python

aterrong
2021-09-23 09:42
has joined #pact-python

nisharaveendran30
2021-09-23 10:34
has joined #pact-python

sujithsukumaranm
2021-09-23 10:36
has joined #pact-python

sureshbabudevaki
2021-09-23 12:01
has joined #pact-python

greg.hinsley
2021-09-23 12:29
has joined #pact-python

nyman.robin
2021-09-24 07:07
has joined #pact-python

ricardo.paquito
2021-09-24 10:36
has joined #pact-python

abramenkov.valentin
2021-09-24 12:42
has joined #pact-python

leo.tang
2021-09-24 17:56
has joined #pact-python

jyotiguptaofficial
2021-09-25 13:00
has joined #pact-python

mattandaey
2021-09-25 20:32
has joined #pact-python

saurelio58
2021-09-27 12:39
has joined #pact-python

francisco
2021-09-27 18:27
has joined #pact-python

jamesatroughton
2021-09-28 10:42
has joined #pact-python

jake.thacker
2021-09-28 22:06
has joined #pact-python

craig.schwarzwald
2021-09-28 22:37
has joined #pact-python

owain.hunt
2021-09-29 12:58
has joined #pact-python

damtsisa
2021-09-30 06:58
has joined #pact-python

morsisdivine
2021-09-30 09:23
has joined #pact-python

patrice.jy.thomas
2021-09-30 15:05
has joined #pact-python

kschendster
2021-09-30 16:46
has joined #pact-python

adam.dubnytskyy
2021-09-30 17:49
has joined #pact-python

stefano.varesi
2021-09-30 17:51
has joined #pact-python

steven.yi
2021-09-30 20:17
has joined #pact-python

calcorbin
2021-09-30 23:09
has joined #pact-python

osikwemhev
2021-10-01 01:45
has joined #pact-python

kentaro
2021-10-01 10:05
has joined #pact-python

vitali.domashkevitsh
2021-10-01 10:08
has joined #pact-python

maciej.olko
2021-10-01 10:41
@matt.fellows would it be possible for you to merge and release? :point_up: it should fix SSL verification problem which blocks our pipeline

maciej.olko
2021-10-01 10:42
sorry, I shall ask @elliottmurray for that, right?

matt.fellows
2021-10-01 10:55
Yeah I don?t have the context for a safe release sorry Maciej

matt.fellows
2021-10-01 10:56
From memory, this is patchable if you add the new (Let?s Encrypt) CA to the embedded CA bundle. I can?t remember the path, but it should be searchable where the ruby standalone is unpacked

maciej.olko
2021-10-01 11:13
hm, thanks, will try to do it I was trying to set the new cert with `SSL_CERT_FILE` environment variable, but without luck

matt.fellows
2021-10-01 11:14
You could also just extract the latest https://github.com/pact-foundation/pact-ruby-standalone/releases over wherever it is installed for python in CI directly

seb983
2021-10-01 11:30
has joined #pact-python

maciej.olko
2021-10-01 12:25
for the record the path to certificate bundle is: `site-packages/pact/bin/pact/lib/ruby/lib/ca-bundle.crt`

maciej.olko
2021-10-01 13:24
(my CI image is based on `python:3.6-slim`)

maciej.olko
2021-10-01 13:24
no luck :( `cat ISRG_Root_X1.crt >> /usr/local/lib/python3.6/site-packages/pact/bin/pact/lib/ruby/lib/ca-bundle.crt` doesn?t help; trying to debug

elliottmurray
2021-10-01 13:50
Apologies I am currently on holiday away from a pc. I?ll look at this urgently next week

vannessa.andrade
2021-10-01 14:44
has joined #pact-python

maciej.olko
2021-10-01 15:23
just FYI I wasn?t successful with replacing the bundle, forked and used latest standalone script and disabled verfication using env variable

mickfagan
2021-10-02 10:36
has joined #pact-python

maxim.matviyuk
2021-10-03 16:48
has joined #pact-python

jonathan.a.stern
2021-10-03 20:38
has joined #pact-python

chris.ramsden
2021-10-04 16:40
has joined #pact-python

brian.fung
2021-10-05 04:57
has joined #pact-python

elekberhacizade
2021-10-05 05:27
has joined #pact-python

ankit.wadhwana
2021-10-05 12:23
has joined #pact-python

zhaopeng
2021-10-05 12:24
has joined #pact-python

bjorn.johansson
2021-10-05 13:16
has joined #pact-python


malena.cadima
2021-10-05 18:50
I need help to write a test pact :pray: ```@pytest.fixture def consumer(): return UserConsumer( 'http://{host}:{port}' .format(host=PACT_MOCK_HOST, port=PACT_MOCK_PORT) )``` in my test-pact-consumer, can i use my real host or only mock host?

pcting
2021-10-05 18:57
has joined #pact-python

pcting
2021-10-05 19:26
@pcting has left the channel

matt.fellows
2021-10-05 20:43
Only mock

matt.fellows
2021-10-05 20:43
Pact is a unit testing tool


malena.cadima
2021-10-05 21:02
the mock host is my mock provider ?

pcting
2021-10-05 23:28
has joined #pact-python

matt.fellows
2021-10-05 23:54
Pact starts a mock, and the host/port is the address of the Pact mock



matt.fellows
2021-10-05 23:56
This bit sets the expectation for the current test (i.e. sets up the actual mock interaction): https://github.com/pact-foundation/pact-python/blob/master/examples/fastapi_e2e/tests/consumer/test_user_consumer.py#L53-L68


aulia.ahn
2021-10-06 00:01
has joined #pact-python

muralis
2021-10-06 01:21
has joined #pact-python

lakapoor777
2021-10-06 08:47
has joined #pact-python

garry.jeromson973
2021-10-06 09:52
has joined #pact-python

malena.cadima
2021-10-06 13:01
ahhh okokok. Thank you so much! I understand now :smile:

anagha.sulakhe
2021-10-06 16:27
has joined #pact-python

mesut.gunes
2021-10-07 09:03
has joined #pact-python

malena.cadima
2021-10-07 20:15
Hello everyone! How are you? I need help please. I try to publish my pact file :pouting_cat: I get a pact file but I can't publish the pact file in my brocker do you have any idea? ```PACT_BROKER_URL = "http://labsrv123:8081/" PACT_FILE = "consumidor-proveedor.json" PACT_MOCK_HOST = 'localhost' PACT_MOCK_PORT = 1234 PACT_DIR = os.path.dirname(os.path.realpath(__file__)) @pytest.fixture(scope='class') def pact(request): version = request.config.getoption('--publish-pact') publish = True if version else False pact = Consumer('consumidor').has_pact_with( Provider('proveedor'), host_name=PACT_MOCK_HOST, port=PACT_MOCK_PORT, pact_dir=PACT_DIR, publish_to_broker=publish, broker_base_url=PACT_BROKER_URL ) pact.start_service() yield pact pact.stop_service()``` Aslo I copy https://github.com/pact-foundation/pact-python/blob/master/examples/e2e/conftest.py#L7-L21

matt.fellows
2021-10-07 20:30
I can't see that you've used version there which is mandatory for publishing

matt.fellows
2021-10-07 20:30
Also what do the logs say?

mesut.gunes
2021-10-08 08:08
Hey do we have example for implementing the pact for Django project. Our provider is a Django project so I am having hard time implementing the provider for Django.

matt.fellows
2021-10-08 09:55
what are you struggling with? There is nothing specific to Django needed

matt.fellows
2021-10-08 09:55
start django provider server locally, point verification at your running Django server

matt.fellows
2021-10-08 09:56
Configure any provider states as necessary by adding a state handler endpoint: https://github.com/pact-foundation/pact-python/#provider-states

vandana.bhaskersen
2021-10-08 09:58
has joined #pact-python

mesut.gunes
2021-10-08 11:41
I got this error ``` Failure/Error: set_up_provider_states interaction.provider_states, options[:consumer] Faraday::ConnectionFailed: Cannot assign requested address - connect(2) for "localhost" port 5001```

matt.fellows
2021-10-08 11:42
Can you please share your setup/test?

mesut.gunes
2021-10-08 11:46
```PACT_MOCK_HOST = 'localhost' PACT_MOCK_PORT = 5001 PACT_URL = "http://{}:{}".format(PACT_MOCK_HOST, PACT_MOCK_PORT) PACT_DIR = os.path.dirname(os.path.realpath(__file__)) @pytest.fixture def default_opts(): return { 'broker_username': settings.PACT_BROKER_USERNAME, 'broker_password': settings.PACT_BROKER_PASSWORD, 'broker_url': settings.PACT_BROKER_URL, 'publish_version': '3', 'publish_verification_results': False } def test_verify_from_broker(default_opts): verifier = Verifier(provider='room_AreaService', provider_base_url=PACT_URL) output, logs = verifier.verify_with_broker(**default_opts, verbose=True, provider_states_setup_url="{}/_pact/provider_states".format(PACT_URL)) assert (output == 0)```

mesut.gunes
2021-10-08 11:48
this is the provider_state ```def provider_states(): mapping = { 'Pact room created': room_created, 'Pact room deleted': room_deleted } mapping[request.json['state']]() return jsonify({'result': request.json['state']})```

mesut.gunes
2021-10-08 11:48
should create pact in my provider ```pact = Consumer('consumer').has_pact_with(Provider('provider'))```

matt.fellows
2021-10-08 11:53
This is a provider test, Pact takes the contract (from the broker) and replays the requests against your provider. I can?t see where you are starting your provider (the Django service)

matt.fellows
2021-10-08 11:53
You need to start your provider, and configure Pact to verify against your locally running provider

matt.fellows
2021-10-08 11:55
It looks like you?re pointing at a non-existent mock server. i.e. the following has no effect (they aren?t passed to Pact) and is not what you want. Confirming your consumer pact test against a mock wouldn?t prove anything useful! :smile: ```PACT_MOCK_HOST = 'localhost' PACT_MOCK_PORT = 5001 PACT_URL = "http://{}:{}".format(PACT_MOCK_HOST, PACT_MOCK_PORT)```

mesut.gunes
2021-10-08 11:57
Whole project is in Django it running with runserver command in docker instance


matt.fellows
2021-10-08 11:58
is it running on port 5001?

mesut.gunes
2021-10-08 11:58
no it in different port

mesut.gunes
2021-10-08 11:58
should it be same

matt.fellows
2021-10-08 11:58
Yeah I?m just looking at that, and I think the example is confusinsg - sorry about that. I think the maintainer might have copied and pasted because the naming of those variables is very misleading

matt.fellows
2021-10-08 11:58
there is no Pact mock on the provider side

mesut.gunes
2021-10-08 11:58
```Django version 3.2, using settings 'onsite.settings' Starting development server at http://0.0.0.0:8000/ Quit the server with CONTROL-C.```

matt.fellows
2021-10-08 12:00
You have currenly set `PACT_URL` to `localhost:5001` . Pact is trying to validate your provider on that port

matt.fellows
2021-10-08 12:00
You need to set it to `8000` , as that?s where your provider is running

matt.fellows
2021-10-08 12:01
For your own sanity, i?d change the `PACT_MOCK` bits to `PROVIDER`

mesut.gunes
2021-10-08 12:01
gotcha, let me try

matt.fellows
2021-10-08 12:05
If there is anybody participating in hacktober that is keen to help, this is a simple but nice https://github.com/pact-foundation/pact-python/issues/270


mike.geeves064
2021-10-08 16:21
Having a look through the examples, I need something lightweight to procrastinate on and avoid what I'm supposed to be doing :thinking_face: Tangenting slightly (yak yak yak), the various examples use the two different pact-brokers: > pact-js: pactfoundation/pact-broker > pact-js-core: dius/pact-broker > pact-workshop-js: pactfoundation/pact-broker > pact-go: dius/pact-broker > pact-net: none > pact-jvm: none > pact-php: dius/pact-broker > pact-python: dius/pact-broker That seems to be predominantly the dius one, but I'm not sure if that's legacy from when they were created? Would using the pactfoundation one which is probably more likely to be used by end users make more sense, or preferred to stick with dius? :thinking_face:

mike.geeves064
2021-10-08 18:06
:thinking_face: Starting off with what state is it in in general and a bit of a tidy: the FastAPI examples aren't included in the make examples, there's a mixup of requirement versions which conflict (for me at least) and the FastAPI examples currently fail if included because the scripts refer to Flask. Looks like there's a fair bit in there in need of fixing, happy to tidy up as part of doing that or prefer to keep separate and to that ticket?

mike.geeves064
2021-10-08 21:15
Hmm, I don't really like the duplication of consumer.py for e2e and fastapi, I would propose moving that out to have the consumer separate since the test is supposed to be demonstrating the provider from each, but that will have to wait for tomorrow :slightly_smiling_face:

matt.fellows
2021-10-08 21:48
Oh that all sounds sensible to me, Elliot might disagree but any help is appreciated

matt.fellows
2021-10-08 21:49
Functional changes are good to keep separate because change log and all of that

matt.fellows
2021-10-08 21:50
And yes, I'd actually suggest moving away from the DiUS image to the foundation Alpine one

mike.geeves064
2021-10-09 10:15
:smiling_face_with_tear:

mike.geeves064
2021-10-09 10:15
I have changed a bit more than intended

ad.redouani
2021-10-09 15:11
has joined #pact-python

mike.geeves064
2021-10-09 15:17
I'm up to here so far: https://github.com/pact-foundation/pact-python/pull/271/files feel free anyone to chip in with "for the love of [insert your diety of choice] please stop!" It's not adding in any *functionality* as such, but it's definitely a grey area around a refactor and bug fixing but still only actual tests/"docs" even. I have added comments. Technically "test(examples): tidy build and flask/fastapi examples, improve consistency" is true :innocent: :flushed:

mike.geeves064
2021-10-09 15:18
Definitely some suffering from some code rot with changes over time and copy pastes

amulyadoss
2021-10-09 21:09
has joined #pact-python

matt.fellows
2021-10-09 21:28
I'll take a look tomorrow at latest or today if I get some time away from kids

mike.geeves064
2021-10-09 21:29
No immediate rush, I still need to look at FastAPI and messenger

matt.fellows
2021-10-09 21:30
What we do in Pact JS is run all examples as part of the build and link to current build so they don't regress (and also sort of act as a feature test, but that's more of a accidental side effect that we tend to want to keep about)

mike.geeves064
2021-10-09 21:30
@tjones should try as a life coach, having seen the yak shaving talk I feel like my existence had been validated :joy:

matt.fellows
2021-10-09 21:30
Thank you tho!

matt.fellows
2021-10-09 21:30
You're in the right place Mike!

mike.geeves064
2021-10-09 21:30
:grinning:

mike.geeves064
2021-10-09 21:31
Back to consistency, it would be nice if the examples were the same across all languages

mike.geeves064
2021-10-09 21:32
Even within the python ones, Flask was validating against the broker while FastAPI was validating against the Pact JSON :thinking_face: I don't really like code duplication, but it would be easy to miss etc

mike.geeves064
2021-10-09 21:33
Yeah, the python one ran examples as part of the build, but examples was missing FastAPI in the list :thinking_face:

matt.fellows
2021-10-09 21:34
We've been trying to standardise on a product example


mike.geeves064
2021-10-09 21:35
I ran out of time for today anyway :grinning: learnt plenty though, so overall good :grinning: I was thinking about some of the gotchas, I saw someone recently asking about the test pass when the validation for but it didn't pass before... Thoughts like that would be nice to include in examples but it could get quite big

matt.fellows
2021-10-09 21:36
Having a single example would go a long way to consistent documentation and ideally a canonical template for documentation etc

mike.geeves064
2021-10-09 21:37
Nod. Happy to swap out "get user" for product while I'm at it

mike.geeves064
2021-10-09 21:37
Product isn't the most exciting example but I'm not one for good ideas for examples either soooi

mike.geeves064
2021-10-10 17:32
Thinking about it, there was another ticket from Beth on examples in multiple languages, I'll finish off this one with the current examples then swap for the Product one along with doing the language example, for python at least, against the other ticket, save doing things twice :thinking_face:

farshad.falaki
2021-10-10 19:13
has joined #pact-python

jhopkinwilliams
2021-10-12 02:01
has joined #pact-python

josephhaig
2021-10-12 08:52
has joined #pact-python

margarita.lukjanska
2021-10-12 10:12
has joined #pact-python


malena.cadima
2021-10-12 13:13
The logs: ```I, [2021-10-12T10:04:33.025824 #11461] INFO -- : Verifying - interactions matched I, [2021-10-12T10:04:33.031893 #11461] INFO -- : Writing pact for provider to /home/male/consumer/tests_pact/consumer-provider.json I, [2021-10-12T10:04:33.039351 #11461] INFO -- : Verifying - interactions matched I, [2021-10-12T10:04:33.044614 #11461] INFO -- : Writing pact for provider to /home/male/consumer/tests_pact/consumer-provider.json```

oak155online
2021-10-12 14:17
has joined #pact-python

mike.geeves064
2021-10-12 15:24
In the example: > pact = Consumer('UserServiceClient', version=version).has_pact_with(

mike.geeves064
2021-10-12 15:25
That's where the version is missing

malena.cadima
2021-10-12 17:59
Thank you! :heart:

mike.geeves064
2021-10-12 18:03
Welcome :)

matt.fellows
2021-10-12 20:56
:taco: for @mike.geeves064

mike.geeves064
2021-10-12 21:24
Yay! Munch munch munch

filipovic
2021-10-13 06:51
has joined #pact-python

stefan.smith
2021-10-13 09:37
has joined #pact-python

warren
2021-10-13 16:45
has joined #pact-python

michael.stein
2021-10-13 19:02
has joined #pact-python

hwillj
2021-10-14 14:52
has joined #pact-python

fengniy
2021-10-15 02:09
has joined #pact-python

mark.dathorne
2021-10-15 09:51
has joined #pact-python

haroldlearning93
2021-10-15 14:49
has joined #pact-python

vsrungar95
2021-10-15 22:14
has joined #pact-python

jsoto128
2021-10-16 20:45
has joined #pact-python

fiszczu
2021-10-17 17:04
has joined #pact-python

elliottmurray
2021-10-17 21:44
@mike.geeves064 I made a small change and this is now passing. It?s not running fastapi but if you give me the tick I?ll merge it in as it?s quite large

mike.geeves064
2021-10-17 21:49
yeah it ended up getting a bit bigger than originally intended, haven't gone through the fastapi and messenger sections, subject to any feedback on the first lot, anything to change or generally happy with how they were looking? thanks for the fix, hadn't got around to properly taking a look other than a quick 1 line "maybe it's that" fix after i saw the build fail :slightly_smiling_face:

matt.fellows
2021-10-17 22:29
Nice work team - I now feel bad about asking to rename 2 variables :laughing:

matt.fellows
2021-10-17 22:29
:taco: for @elliottmurray

matt.fellows
2021-10-17 22:29
:taco: for @mike.geeves064

brocheleau
2021-10-18 03:23
has joined #pact-python

elliottmurray
2021-10-18 08:15
I really don't deserve this taco - all @mike.geeves064! I'm still digesting some if it but awesome job mate. I'll merge it in later today and we can work on the rest. Really need to get back to FFI at some point!

mike.geeves064
2021-10-18 08:30
Does it help if I say I'm not actually sure about the conftest.py in the root (vs all test related code under tests) :smile: I think my overzealous cleaning out __ init __.py files broke it :thinking_face:

mike.geeves064
2021-10-18 08:45
All good though, not in it for the glory :joy:

elliottmurray
2021-10-18 09:08
I did first play with moving back an init file but was Sunday and I had a roast to cook!

elliottmurray
2021-10-18 09:08
I'm never sure where conftest should be - I thought root was ok?

mike.geeves064
2021-10-18 09:50
I think it's one of those "up to you", I just prefer anything test related out of the way :thinking_face:


mike.geeves064
2021-10-18 09:51
following the convention of.... :smile:

wesleythomaswilliams
2021-10-18 10:35
Hi all, quick question on the python implementation of pact (as I'm from the java pact world). Does pact support messaging contracts with python?

andrerc
2021-10-18 22:11
has joined #pact-python

rodolfo.valenzuela
2021-10-19 07:43
has joined #pact-python

elliottmurray
2021-10-19 08:10
It?s not as fully featured as other implementations but:


kamilyrb
2021-10-19 22:31
has joined #pact-python

joel.whalen588
2021-10-20 20:27
has joined #pact-python

vasil.vasilev
2021-10-21 08:41
has joined #pact-python

mike.geeves064
2021-10-21 09:06
Ahh I got distracted. Is it ok with the current changes then, where FastAPI and messenger examples are "Todo", and do them in a follow-up PR then? I think the most recent change I tried, with the empty init.py files instead of conftest in the root worked ok, which would be my preference

ben.crinion
2021-10-21 11:09
has joined #pact-python

estephania.calvo
2021-10-21 19:27
has joined #pact-python

estephania.calvo
2021-10-21 20:28
Hello! I'm working in a python 3 project that use AWS SQS, but I was reviewing the documentation for python and I couldn't see an example for an Asynchronous API Testing. Does anyone have a clue to help found an example?


matt.fellows
2021-10-21 21:20
Probably just needs to be added to the readme to make that clearer

estephania.calvo
2021-10-21 21:32
Nice thank you!

ahmetbcakici
2021-10-21 22:38
has joined #pact-python

abarcadabra
2021-10-22 12:30
has joined #pact-python

harwin1494
2021-10-22 19:04
has joined #pact-python

anindita.ghosh
2021-10-22 23:26
has joined #pact-python

mike.geeves064
2021-10-24 13:33
:thinking_face: I've set as ready for review for this first lot. Not had time still to progress the FastAPI/message ones yet. Think it builds ok now with the init files ("works for me") Could do with some general input on comment levels/docs, if that's yes please like that / overkill in some places / gaps etc

rajnish.maurya
2021-10-25 06:47
has joined #pact-python

alanbos
2021-10-25 10:11
has joined #pact-python

kuzmanovid
2021-10-25 13:59
has joined #pact-python

j.malyjasiak
2021-10-25 14:24
has joined #pact-python

rtbhosale17
2021-10-25 14:25
has joined #pact-python

stefano.mantini
2021-10-25 14:31
has joined #pact-python

r.muthukumar136
2021-10-25 14:59
has joined #pact-python

gravis54
2021-10-25 21:46
has joined #pact-python

misha.antipenko
2021-10-25 21:57
has joined #pact-python

j.malyjasiak
2021-10-26 06:01
@j.malyjasiak has left the channel

adomanski
2021-10-26 10:43
has joined #pact-python

kriegster108
2021-10-26 14:58
has joined #pact-python

elliottmurray
2021-10-26 20:53
I forgot to merge - in my head it was!

elliottmurray
2021-10-26 20:54
So I think some todo?s is better than massive PR?s so lets just iterate and fix them

mike.geeves064
2021-10-26 20:54
:+1:

mike.geeves064
2021-10-26 20:55
Yeah, it really wasn't intended to get that big, I don't like either, got a bit stuck with what made sense to do little bits :thinking_face:

elliottmurray
2021-10-26 20:56
We?ve all been there!

mike.geeves064
2021-10-26 20:56
:grinning:

adam.witko
2021-10-27 07:36
has joined #pact-python

alex.macpherson
2021-10-27 08:28
has joined #pact-python

yurich00
2021-10-27 18:10
has joined #pact-python

jarmy
2021-10-27 20:55
has joined #pact-python

lincolnf
2021-10-27 23:30
has joined #pact-python

lawrencemajmacdonald
2021-10-28 07:33
has joined #pact-python

zsolt.vilagos
2021-10-28 10:00
has joined #pact-python

zsolt.vilagos
2021-10-28 10:00
@zsolt.vilagos has left the channel

norway.martin
2021-10-28 16:00
@norway.martin has left the channel

jarmy
2021-10-28 21:16
How does one publish pacts with pact-python? Are we're supposed to use the `publish` option of the pact-broker cli?

maciej.olko
2021-10-28 22:20
you have to options: either set `publish_to_broker=True` of `has_pact_with()` method when declaring a pact in your tests or generate files from tests and upload with the cli in a separate step

matt.fellows
2021-10-29 01:49
I'd use the CLI Jason


ramesh.dhanasekaran
2021-10-29 02:20
has joined #pact-python

christopher.mcewen
2021-10-29 12:14
has joined #pact-python

catalin.comarnescu
2021-10-29 12:31
has joined #pact-python

labardinim
2021-10-29 12:51
has joined #pact-python

kiran.rudrangi
2021-10-29 16:48
has joined #pact-python

mike.geeves064
2021-10-30 13:37
Smaller this time :smile:

mike.geeves064
2021-10-30 13:39
There is then a followup "discussion" of it's adding in some duplication, since FastAPI and Flask examples are doing the same, so preferences of having a shared "common" for them both, or if for the purpose of an example it's nicer having them as complete as possible in one place :thinking_face:

mike.geeves064
2021-10-30 18:25
Frown. Looks like some of the existing code wasn't working with python 3.6, but previously didn't get used :thinking_face: See if that's better now....

ahmed_syed
2021-11-01 20:46
has joined #pact-python

somayajulaas
2021-11-02 00:38
has joined #pact-python

john
2021-11-02 03:32
has joined #pact-python

rochitsen
2021-11-02 10:49
has joined #pact-python

finta.pl
2021-11-02 14:43
has joined #pact-python

alessandro.borraccino
2021-11-02 17:04
has joined #pact-python

matti.anusha
2021-11-03 02:58
has joined #pact-python

mesut.gunes
2021-11-03 06:15
Hi friends, I am using pytest and pytest.fixture for object creation that creates object in test db instance, however the `verifier.verify_with_broker` requests to service that uses the local db so objects are not present in there. Is there a way to use `client` instance for sending requests? or what is the best practice here?

matt.fellows
2021-11-03 06:16
can you not point your local provider at an in memory database replacement during the test phase?

matt.fellows
2021-11-03 06:16
(I don?t know the Python specific tools/terminology here, but most languages can do it)

ozgurerisir
2021-11-03 10:30
has joined #pact-python

dawoud.sheraz
2021-11-03 16:08
Hi folks. A question about consumer_version_selector usage in pact-python. As per the documentation on https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors/, the version selector list is set when initializing Verifier object. See an example: ```verifier = Verifier( provider="Your provider", broker_url="...", consumer_version_selectors=[ {"tag": "main", "latest": True}, {"tag": "test", "latest": True}, {"tag": "production", "latest": True}, ], # ... )``` However, the verifier _init_ call ignores kwargs(https://github.com/pact-foundation/pact-python/blob/master/pact/verifier.py#L7). Instead, when calling verify_with_broker, the data is read from consumer_selectors kwarg among others(https://github.com/pact-foundation/pact-python/blob/02643d4fb89ff7baad63e6436f6a929256c6bf12/pact/verify_wrapper.py#L184). What?s the right way and syntax to determine the version/tag of consumer when running provider verification? Thank you

jordan.r.stewart
2021-11-04 08:47
@jordan.r.stewart has left the channel

dawoud.sheraz
2021-11-04 09:54
Verifies performs params extraction when `verify_with_broker` is called(https://github.com/pact-foundation/pact-python/blob/02643d4fb89ff7baad63e6436f6a929256c6bf12/pact/verifier.py#L88). consumer_version_selectors is also among the extracted and converted.

aakbar
2021-11-04 13:02
The previous question asked here leads to a problem that sounds kind of unexpected. We're currently trying to perform provider verification only for the pacts having `prod` tag. We did the following to perform provider verification: ```'consumer_version_selectors': [ { 'tag': 'prod', 'latest': True, } ], verifier.verify_with_broker( **self.default_opts, verbose=False, provider_states_setup_url=settings.PROVIDER_STATES_URL, )``` And when the tests run, it publishes the verification results for all the pacts (even to those not having `prod` tag). Are we doing something wrong here?

matt.fellows
2021-11-04 13:04
what?s the configuration look like? Is it possible you?re sending other arguments that select additional pacts?

aakbar
2021-11-04 13:05
These are the default options we're currently sending in our verifier: ```default_opts = { 'broker_url': getattr(settings, 'PACT_BROKER_BASE_URL', None), 'consumer_version_selectors': [ { 'tag': 'prod', 'latest': True, } ], 'publish_version': '1', 'publish_verification_results': getattr(settings, 'PUBLISH_VERIFICATION_RESULTS', False) }```

aakbar
2021-11-04 13:05
and the definition of the verifier: ```verifier = Verifier( provider=<provider_name>, provider_base_url=settings.PROVIDER_BASE_URL )```

matt.fellows
2021-11-04 13:07
:thinking_face:

matt.fellows
2021-11-04 13:08
It is possible that there are consumer versions tagged `prod` that have the exact same contract as those that aren?t, in which case, the broker knows they are the same and they are also marked as verified

matt.fellows
2021-11-04 13:08
If you enable verbose mode on the verification, you will see how many pacts are being validated

matt.fellows
2021-11-04 13:08
Your terminal output should also show this

aakbar
2021-11-04 13:09
Okay so does that really happen? Like, 2 pacts with same content and if one is verified, the other is also marked as verified?

aakbar
2021-11-04 13:09
I'll try verbose mode as well :thumbsup:

aakbar
2021-11-04 13:10
How do we enable the verbose mode in provider verification btw?

aakbar
2021-11-04 13:11
ah `--verbose=true`

matt.fellows
2021-11-04 13:12
> Okay so does that really happen? Like, 2 pacts with same content and if one is verified, the other is also marked as verified? yes. The broker hashes the contract contents. This is helpful, because otherwise you?d need a provider to verify every new version of a consumer, even if the contract doesn?t change

matt.fellows
2021-11-04 13:12
Once an integration becomes stable, the contract is unlikely to change, so having to wait for a provider build each time is a waste of everyone?s time

matt.fellows
2021-11-04 13:15
gotta run, but i?ll check in tomorrow :wave:

aakbar
2021-11-04 14:10
Right that was helpful. Thanks. I'll follow up if I have any other questions.

dean.miley1
2021-11-05 11:40
has joined #pact-python

martha.nolan
2021-11-05 11:50
has joined #pact-python

eniko_kollar
2021-11-05 16:46
has joined #pact-python

ashwin
2021-11-05 17:58
has joined #pact-python

d.philipp
2021-11-08 03:51
has joined #pact-python

hamzah.saleem
2021-11-08 11:22
has joined #pact-python

srividya.ece
2021-11-08 12:17
has joined #pact-python

markus.joschko
2021-11-08 13:13
has joined #pact-python

mesut.gunes
2021-11-08 14:10
Hi, I am having the following error while verification on gitlab-ci, while the local run OK ``` # Errno::ECONNREFUSED: # Connection refused - connect(2) for "0.0.0.0" port 8000 # /usr/local/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `initialize'``` when I change mock host to local host `PACT_MOCK_HOST = "127.0.0.1"` it gives the following error ``` # Errno::EADDRNOTAVAIL: # Cannot assign requested address - connect(2) for "localhost" port 8000 # /usr/local/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/net/http.rb:879:in `initialize'```

markus.joschko
2021-11-08 14:17
@markus.joschko has left the channel

mike.geeves064
2021-11-08 16:14
That looks like your provider isn't running, how are you trying to do the verify? Can you share the .gitlab-ci.yaml for the stage?

belugin.v
2021-11-08 17:16
has joined #pact-python

matt.fellows
2021-11-08 22:02
Is this a consumer or provider test?

matt.fellows
2021-11-08 22:02
You mention verification, but are talking about a mock host (which you would usually only use on the consumer side)

mike.geeves064
2021-11-08 22:12
I was wondering if that's back to the examples before renaming those vars :thinking_face:

will.griffiths
2021-11-09 05:25
has joined #pact-python

mesut.gunes
2021-11-09 08:24
This is the provider side when running pact-test

mesut.gunes
2021-11-09 08:25
I think I understand the problem @mike.geeves064 thank you, I will revise the ci yml

mike.geeves064
2021-11-09 08:47
There was something a little confusing in the examples where the variable was called mock, but actually wasn't :slightly_smiling_face: hopefully a little less confusing now, but no gitlab example there currently :thinking_face:

navilooz
2021-11-09 08:48
has joined #pact-python

keith.hirst
2021-11-09 12:13
has joined #pact-python

rbo
2021-11-09 17:47
has joined #pact-python

harshaan.n.khan
2021-11-10 05:38
has joined #pact-python

esparga
2021-11-10 14:32
has joined #pact-python

thales.areis
2021-11-10 19:33
has joined #pact-python

henk.koopman
2021-11-11 08:56
has joined #pact-python

lena.lindblad
2021-11-11 09:58
has joined #pact-python

radekkoubsky
2021-11-11 16:24
has joined #pact-python

aditya
2021-11-11 17:20
has joined #pact-python

claire
2021-11-11 17:55
has joined #pact-python

gentritmm
2021-11-12 08:35
has joined #pact-python

wilson.espina
2021-11-12 09:52
has joined #pact-python

megan.twyver
2021-11-12 18:39
has joined #pact-python

mischa.molhoek
2021-11-14 09:42
has joined #pact-python

69vron
2021-11-15 01:35
has joined #pact-python

james.sawle
2021-11-15 08:49
has joined #pact-python

pete.watts
2021-11-15 12:46
has joined #pact-python

joshua.badger
2021-11-15 17:10
has joined #pact-python

omarsaddaoui
2021-11-17 02:55
has joined #pact-python

mbyrne
2021-11-17 14:23
has joined #pact-python

matthew.drill
2021-11-18 01:08
has joined #pact-python

james.halsall
2021-11-18 12:02
has joined #pact-python

chvram
2021-11-19 14:09
has joined #pact-python

akhandalmani.malik
2021-11-19 14:17
has joined #pact-python

elias.frykholm
2021-11-19 15:17
has joined #pact-python

martin.carlin
2021-11-19 15:52
has joined #pact-python

paul.nardone
2021-11-19 16:12
has joined #pact-python

emily
2021-11-19 18:56
has joined #pact-python

joshua.badger
2021-11-19 22:24
Hi gents, I?m looking for documentation on how to use `pact.Verifier` with django. Right now I?m trying to follow along using https://github.com/pact-foundation/pact-python/blob/02643d4fb89ff7baad63e6436f6a929256c6bf12/examples/fastapi_provider/tests/provider/test_provider.py#L43 as an example. I have a test server that I am able to verify is being hit (pycharm debugger FTW). Where I?m struggling is this: each pact relies on specific conditions and mocking, since each one of THOSE is calling out to yet another web server (lots of microservices inter-communicating, and the one I?m testing is a hub of sorts). So it?s not as simple as setting up my database with requisite data that will fit all the pacts we?ll create. Some of them are mutually exclusive cases. Is it possible to get a list of pacts from the pact broker, and then access them individually so I can have separate setup/teardown for each one?

matt.fellows
2021-11-19 22:42
You would usually mock out external services



joshua.badger
2021-11-19 22:50
Yes, I was planning on stubbing out the downstream systems (thank you, my brain couldn?t come up with that phrase). It?s a great idea to plan out the pacts to intersect like https://gist.github.com/bethesque/43eef1bf47afea4445c8b8bdebf28df0 talks about. What I?m concerned about is this: Say `Service A -> Service B -> Service C`. A has at least three pacts with B on a particular endpoint: 1. An order doesn?t exist in `Service C`, so `Service B` can?t return information about it, so we return some blob to `Service A` 2. The order DOES exist in `Service C`, so `Service B` will return information about that order to `Service A` 3. The order DOES exist in `Service C`, but `Service B` has to handle an error condition based on the order?s state and return information about that error condition to `Service A` `Service B`?s behavior will depend on which state that `Service C` is in. For running verifier in `Service B`, for multiple consumer pacts created by `Service A`, how do I set up these multiple mock states?

joshua.badger
2021-11-19 22:58
Should I be regularly downloading all the pacts from the pact broker? Is there a way to use a verifier to separate out the various pacts with a particular consumer into separate, distinct tests? The example I linked to for its tests simply connects to the pact broker and says ?verify them all?. I don?t have much say over what order those pacts get verified, do I?

pietrucha.bartosz
2021-11-20 13:47
has joined #pact-python

mike.geeves064
2021-11-20 14:45
I haven't tried A->B->C so it may be trickier in practice, but could you just stub according to the states? You then just define each scenario as a separate test. With the examples in pact-python I mean: https://github.com/pact-foundation/pact-python/blob/02643d4fb89ff7baad63e6436f6a929256c6bf12/examples/consumer/tests/consumer/test_user_consumer.py#L93 and https://github.com/pact-foundation/pact-python/blob/02643d4fb89ff7baad63e6436f6a929256c6bf12/examples/consumer/tests/consumer/test_user_consumer.py#L114 In case you didn't come across that bit so far, the "given" part triggers an additional call to setup the state, so those setup the state of "UserA exists and is not an administrator" and "UserA does not exist" accordingly. On the FastAPI side you're then hitting the endpoint: https://github.com/pact-foundation/pact-python/blob/02643d4fb89ff7baad63e6436f6a929256c6bf12/examples/fastapi_provider/tests/pact_provider.py#L16 which causes the "fakedb" to be setup - that's where you could instead stub out the B->C behaviour for testing the A->B

mike.geeves064
2021-11-20 14:47
As an aside, I recently started to tidy up the examples a little, very much not complete yet, but they have a lot more comments etc. I'm not sure if it's a useful level or overkill, also as you found there's an example for FastAPI and Flask but not Django, did you find those two sufficient or would it have been really helpful to have one specific to Django as well? Feedback welcome :smile:

mastrobardo
2021-11-21 11:42
has joined #pact-python

fed
2021-11-22 04:20
has joined #pact-python

tumunshaily
2021-11-22 07:54
has joined #pact-python

yunfeng.wang
2021-11-22 09:25
has joined #pact-python

joshua.badger
2021-11-22 17:14
I mean, I?m a fan of having it already figured out for me, so Django examples would be cool, but since Django is so much more work to get even a ?hello world? app up and running it might be too much to include for an example.

joshua.badger
2021-11-22 17:19
> I haven?t tried A->B->C so it may be trickier in practice, but could you just stub according to the states? You then just define each scenario as a separate test. The issue is that during most of my API calls to B, B reaches out to C as part of calculating the return back to A. So my verifier test (which, as I currently understand it, grabs ALL contracts with a given consumer and runs them ALL in a single test) has to also be consumer tests for all its pacts at once, which is harder to set up and prevents us from having the fine-grained control over individual interactions like consumer tests seem favor.

joshua.badger
2021-11-22 17:20
I suppose I could possibly define the expected responses as json files that could be referenced multiple times. Then, on the verifier tests, use `respx` in a `pytest` fixture to bulk-manage the responses based on those json files, `pact-python` on consumer tests where I have more fine-grained control over the expected behaviors. This way, the verifier tests work while we?ve also built out consumer tests first.

joshua.badger
2021-11-22 17:42
I feel like managing this situation somehow would be beneficial not just to `pact-python`, but the `http://pact.io` ecosystem in general.

mike.geeves064
2021-11-22 17:58
I'm not quite sure I follow, you're defining multiple pacts to the provider, in the consumer test you define the "given" part, which can dictate the state that C is in and responds (mock) to B with

mike.geeves064
2021-11-22 17:59
Sounds like some examples around A B C would be helpful in any case :) I've seen it in flow diagrams but not seen in code (haven't looked so more than likely exists somewhere)

joshua.badger
2021-11-22 18:58
Essentially, we?re treating B as a gateway to collating data from multiple sources. Any number of consumers can get information from it without needing to know how to query service C (or D, E, F, and G, which B _also_ reaches out to). One API call to B gathers the data.

mike.geeves064
2021-11-22 20:57
I'll try and sketch out an example of how I think it could work if I get some time tomorrow :)

mike.geeves064
2021-11-22 21:26
(my .py on a mobile is not so great :D)

joshua.badger
2021-11-22 23:25
Thanks @mike.geeves064!

dawoud.sheraz
2021-11-23 12:42
Hi. I am facing a strange situation while attempting to do a pact verification against a contract url. What is happening that apart from verifying the pact against the url, the verifier is also running verification against latest version of the consumer for the provider. Now, as per verifier docs(https://github.com/pact-foundation/pact-provider-verifier#usage), this can happen if certain options(version selector, pending pacts, wip pacts) is enabled. But that is not the case. I am only supplying the pact url and there is no config set that can trigger dynamic pact fetch. I am using Verifier `verify_pacts` method.

matt.fellows
2021-11-23 12:42
how do you know it is doing that? Is it the logs showing you that it?s verifying multiple pacts or something else?

dawoud.sheraz
2021-11-23 12:44
Yes, in the logs, I can see verification taking place twice. The actual verification has the failure result. But before failure, there is a verification that results in success(old pact content).

dawoud.sheraz
2021-11-23 12:52
To ask for the clarification, to avoid dynamic fetch, the verifier suggest: ```To verify a pact at a known URL (eg. when a verification is triggered by a 'contract content changed' webhook), pass in the pact URL(s) as the first argument(s) to the command, and do NOT set any of the other parameters apart from the base URL and credentials.``` what does it mean by base url here? provider base url or broker base url? I have a hunch that since PACT_BROKER_BASE_URL environment variable is defined, the verifier is fetching pacts other than the pact from url.


dawoud.sheraz
2021-11-23 13:04
~But when I unset broker env variable, the verification process fails.~ Correction: I had to unset variable with `unset PACT_BROKER_BASE_URL` . I previously tried assigning empty value which the verifier was treating as a url.

christos.litsas
2021-11-23 13:05
has joined #pact-python

walter.psjr
2021-11-23 17:39
has joined #pact-python

steveforwork2
2021-11-24 08:47
has joined #pact-python

fredrik.ostling
2021-11-24 11:56
has joined #pact-python

jorge.nunez
2021-11-24 14:28
has joined #pact-python

mike.geeves064
2021-11-24 16:44
I've started looking at some examples which are hopefully in the right direction, WIP draft here: https://github.com/pact-foundation/pact-python/pull/276/files ? There's a Consumer A which makes calls to the Service B (hub) ? Consumer A creates the first Pact pair (https://github.com/pact-foundation/pact-python/pull/276/files#diff-3cff3194518c173df392526ba23535eefe3b4c3e7bb1120cda50144f07099e91) ? Provider B then handles the states defined, that there are some products etc to then intercept the session used to call Provider C and Provider D so that A->B can be verified ? Provider B then acts as a Consumer so includes the next pairs of Pacts (https://github.com/pact-foundation/pact-python/pull/276/files#diff-2c6f6d53965fdcc7903f2d6a397afbbde887f68c4d07b69643e5cbf72d58ac55 and https://github.com/pact-foundation/pact-python/pull/276/files#diff-00c5c15f92c6adaea29af6b8a6b75af942c2850e1042a1999a4421cb30cd565d) I'm not 100% this is best practice and the code is still a bit copy/paste from other examples, but hopefully makes sense enough, using the same broker setup and so on from the other examples. That's following the "option 1" approach mentioned in the gist, I'm not sure how "option 2" would work @matt.fellows does that roughly fit with how you would see it working, I'm interested in understanding better as well :smile:

asradhakrishnan
2021-11-24 17:20
has joined #pact-python

edouard.lopez
2021-11-25 11:01
has joined #pact-python

maxkitzing
2021-11-25 17:49
has joined #pact-python

cristian.carrillo
2021-11-26 00:06
has joined #pact-python

christoph.oswald
2021-11-26 09:53
has joined #pact-python

gjourdanweil
2021-11-26 14:39
has joined #pact-python

sean.pike
2021-11-26 14:48
has joined #pact-python

gjourdanweil
2021-11-28 20:08
@gjourdanweil has left the channel

michael.bannister
2021-11-29 07:43
has joined #pact-python

joshua.badger
2021-11-29 16:53
@mike.geeves064 Thank you for putting that together, and I?m sorry I didn?t see this until now. I?m going to start attempting to digest everything that you?re doing here. One concern I have with ?option 1? (Stub the C client or service class) is finding a way to guarantee the stubs created are consistent with real behavior (essentially the whole reason my org is looking into contract testing? we can manually stub all we want for our tests, but if those stubs don?t match real behavior we?ve wasted everyone?s time? and inevitably we?ll miss that boat). Finding a way to make option 2 (Use the pact that you have generated between B and C to create a stub server) seems like the greatest guarantee that everything would work consistently.

joshua.badger
2021-11-29 16:56
Do you mind if I comment on the PR to clarify what you?re doing?

mike.geeves064
2021-11-29 17:07
Sure, as mentioned I'm also trying to figure out what I'm doing :smile: This is how I think it could work but I haven't tried it for real yet either

mike.geeves064
2021-11-29 17:08
I agree option #2 sounds better, but I don't have steps on my head yet of how to take one and feed it to the next, one step at a time

mike.geeves064
2021-11-29 17:11
I'm not sure I'm as concerned about the stubbing at that part, since you cover this separately - you're using the stubs of C to verify behaviour when A talks to B. In that case you do have the "on the assumption that C will respond like this". For the actual B to C testing, you would be using a real C with "Given C is in some state. When C receives a request from B that looks like this. Then C should respond like this" - and that part should cover it

mike.geeves064
2021-11-29 17:15
i.e. each pair of consumer/providers you have, you're repeating the pattern as you go along the chain: consumer tests against a mock of the provider, provider tests against a mock of the consumer

mike.geeves064
2021-11-29 17:16
I didn't really like a copy/paste of the EXAMPLE_BOOKS in a few places though, I'd much prefer that shared in some way, which I think is where the option#2 approach could come in

joshua.badger
2021-11-29 17:18
Sure, but I?m worried (because I?ve run into this already) that the `B -> C` tests will work due to correctly defined pacts, but the stubs for C when checking `A -> B` that rely on C will get out of sync from the `B -> C` tests.

mike.geeves064
2021-11-29 17:21
which side of it? :slightly_smiling_face:

mike.geeves064
2021-11-29 17:21
I think this is solved with the "can-i-deploy" check

mike.geeves064
2021-11-29 17:23
:thinking_face:

mike.geeves064
2021-11-29 17:24
but maybe you do need option#2 to be sure

joshua.badger
2021-11-29 17:24
`B -> C` pacts should be the canonical reference for behavior, right? If we aren?t utilizing those pacts in our C stub for `A -> B` checks, then whatever the developer has defined in the B verifier test could pass without reflecting actual C behavior.

joshua.badger
2021-11-29 17:25
In that case, `can-i-deploy` would report that we were okay without actually confirming because B verifier was using inaccurate responses for downstream

joshua.badger
2021-11-29 17:29
I wonder if there would be a case for a `ConsumerProducer` verifier class that takes into account the `B -> C` `Consumer` during the verifying test? Perhaps adding a mark to get that test to run last so it can check all contracts that `B -> CConsumer` registered?

mike.geeves064
2021-11-29 17:32
I am scrolling up and down and thinking :smile:

mike.geeves064
2021-11-29 17:40
So for `A -> B` Consumer tests, we provide the example expected back from B given C is in some _named but not implemented/defined_ state Then for `A -> B` Provider tests, we use the same input example from A to send to itself (i.e. B) and implement the mocked behaviour of C If for the next step of `B -> C` Consumer test we use exactly the same data provided for the mocked response of the C stub, that would ensure that we are creating the Pact with examples that match up, so for the final `B -> C` Provider tests, it has the same input data going to the C provider as was sent back in the mock I don't think I've missed anything or have I? :thinking_face: One gap though, with the can-i-deploy, idk quite how that will go wrt the results because you might end up with the say Provider test for B being successful but then Consumer test of B (when talking to Provider C) failing - not sure how you account for both in the can-i-deploy :thinking_face:

mike.geeves064
2021-11-29 17:44
re > *Josh Badger*  [5:24 PM] > `B -> C` pacts should be the canonical reference for behavior, right? So, as it's Consumer driven, you are defining how C should behave according to B which creates the pacts. Which I think justifies if you mock the C stub for the B Provider tests.....and then go on to use that same mock for defining the Pact.... which then defines how C should be implemented. C shouldn't be changing the implementation without the contract change "requested" by B

mike.geeves064
2021-11-29 17:46
I add my disclaimer of, Pact user, thoughts on how I have understood things should be, `Mike -> Pact` is not a canonical reference point :smile:

mike.geeves064
2021-11-29 17:53
I'll move out the e.g. "get_books" data to a separate file which is then used by the A->B provider tests AND B->C consumer tests, rather than the copy/paste. I was hesitant to do much with shared files as it's all in a single repo for A, B, C and monorepo is unlikely (looking at Pact in Pants is on my todo list also!)... but shared files within B itself should be fine

mike.geeves064
2021-11-29 17:54
Totally feel your pain with the getting out of sync between services problem :sob:

joshua.badger
2021-11-29 17:56
I think that?s a fair compromise. Stub C for `A -> B` and build contract for `B -> C` using same request/response should be a good solution.

joshua.badger
2021-11-29 18:06
Perhaps something like the above, and then utilize them for both verifier and consumer.

mike.geeves064
2021-11-29 18:09
Nod

mike.geeves064
2021-11-29 18:10
I think that is then rapidly heading towards option#2

mike.geeves064
2021-11-29 18:10
As you're essentially then ripping out the name, args, status, content etc that would be in the Pact from the Consumer

joshua.badger
2021-11-29 18:12
Bonus that you could just use `respx` instead of spinning up a whole new server process and use the same things

joshua.badger
2021-11-29 18:12
I think I?m going to play with that on my end. Thanks for letting me rubber duck with you, and providing an example I could form ideas against!

mike.geeves064
2021-11-29 18:13
:smile:

mike.geeves064
2021-11-29 18:13
likewise

mike.geeves064
2021-11-29 18:14
If you get somewhere and can share examples to progress the WIP examples please do! :smile:

rjadams96
2021-11-29 18:47
has joined #pact-python

pavithz
2021-11-29 23:51
has joined #pact-python

mfellows_20211130
2021-11-30 06:57
has joined #pact-python

mfellows_20211130v2
2021-11-30 10:32
has joined #pact-python

mfellows_20211130v3
2021-11-30 10:57
has joined #pact-python

mfellows_20211130v4
2021-11-30 11:16
has joined #pact-python

agittcelik
2021-11-30 18:35
has joined #pact-python

alturil
2021-11-30 20:56
has joined #pact-python

draper.joseph
2021-12-01 06:50
has joined #pact-python

abhay175
2021-12-01 07:35
has joined #pact-python

joelgrimberg
2021-12-01 11:27
has joined #pact-python

reem.alashry
2021-12-01 12:09
has joined #pact-python

beshoy.ibrahim
2021-12-01 12:09
has joined #pact-python

omar.radi
2021-12-01 12:10
has joined #pact-python

mmudassar192
2021-12-01 12:11
has joined #pact-python

eric.seipold
2021-12-01 13:40
has joined #pact-python

apselsevier
2021-12-01 16:48
has joined #pact-python

ali.korayem
2021-12-01 18:55
has joined #pact-python

luiz.filipe.abrahao
2021-12-01 21:04
has joined #pact-python

david.cummings
2021-12-02 14:13
has joined #pact-python

miccagiann
2021-12-02 14:17
has joined #pact-python

praveen.em
2021-12-03 07:40
has joined #pact-python

ally.parker
2021-12-03 11:18
has joined #pact-python

rishabh.gaur
2021-12-03 11:43
has joined #pact-python

william.wallace
2021-12-03 15:12
has joined #pact-python

batiushkov.nik
2021-12-03 15:48
has joined #pact-python

keith.mcgrath
2021-12-03 18:28
has joined #pact-python

rchandragupthara
2021-12-03 19:32
has joined #pact-python

vinicius.cosmi
2021-12-03 20:01
has joined #pact-python

ichatterjee
2021-12-03 21:27
has joined #pact-python

ben.watts
2021-12-03 23:48
has joined #pact-python

imikhtyuk
2021-12-06 00:36
has joined #pact-python

norrischebl
2021-12-06 05:54
has joined #pact-python

smantini
2021-12-06 09:25
has joined #pact-python

gzinger
2021-12-06 11:19
has joined #pact-python

mesut.gunes
2021-12-06 12:03
This thread helped me a lot, thank you again

mahatmafatal
2021-12-06 13:50
has joined #pact-python

jacob.v.gardner
2021-12-06 14:59
has joined #pact-python

glebing2000
2021-12-07 07:28
has joined #pact-python

sergio.freire
2021-12-07 09:52
has joined #pact-python

sahoo.skumar
2021-12-07 10:55
has joined #pact-python

kingyang728
2021-12-07 15:58
has joined #pact-python

jesseaantebi
2021-12-07 19:36
has joined #pact-python

rsheikh
2021-12-07 22:34
has joined #pact-python

jorgwel
2021-12-08 01:22
has joined #pact-python

rahul.anwekar23
2021-12-08 04:19
has joined #pact-python

luanacosta05
2021-12-08 20:34
has joined #pact-python

saurabh.techiee
2021-12-09 09:41
has joined #pact-python

albertcabantog
2021-12-09 10:52
has joined #pact-python

paul.scholes
2021-12-10 10:21
has joined #pact-python

chris.sloan
2021-12-10 10:48
has joined #pact-python

leon.york
2021-12-10 12:42
has joined #pact-python

kyle.craviotto
2021-12-10 16:40
has joined #pact-python

lorenz.schumann
2021-12-10 18:33
has joined #pact-python

luispires.m
2021-12-13 12:32
has joined #pact-python

fabio.rodrigues
2021-12-13 16:22
has joined #pact-python

mbailey
2021-12-13 22:17
has joined #pact-python

dkwak
2021-12-14 03:47
has joined #pact-python

haoran.lin
2021-12-14 05:27
has joined #pact-python

tom450
2021-12-14 08:06
has joined #pact-python

pajaree.tuampitak
2021-12-14 10:00
has joined #pact-python

nitins333
2021-12-14 10:03
has joined #pact-python

jaakko.tompuri
2021-12-14 13:10
has joined #pact-python

albert.moreno
2021-12-14 17:01
has joined #pact-python

himanshu
2021-12-15 06:16
has joined #pact-python

diva.pant1
2021-12-15 14:21
has joined #pact-python

johnreilly100
2021-12-15 16:36
has joined #pact-python

elliot.weiser
2021-12-15 19:06
has joined #pact-python

sunit
2021-12-16 07:27
has joined #pact-python

felipe.simoes
2021-12-16 18:42
has joined #pact-python

ameadewi
2021-12-16 18:48
has joined #pact-python

michael.scheepers
2021-12-17 08:11
has joined #pact-python

yanis.benekaa
2021-12-17 16:05
has joined #pact-python

dilek
2021-12-20 12:42
has joined #pact-python

sadhana.0203
2021-12-21 07:55
has joined #pact-python

adrian.ernst.lgln
2021-12-21 08:36
has joined #pact-python

dalton.pinto
2021-12-21 09:53
has joined #pact-python

mike.geeves064
2021-12-21 15:13
@elliottmurray I've had a look at moving out the shared fixtures (such as spinning up the broker) into a separate dir, where the fixtures are then imported. I think this makes the examples themselves a lot nicer to look at since it's easier to see what is actually relevant for flask, fastapi, message - rather than having to filter out what is essentially boiler plate. What do you think? (aside from forgetting to lint first :open_mouth: )

mike.geeves064
2021-12-21 15:18
I think the build may still fail due to some timing weirdness I saw with GitHub, hopefully fixed along with my other PR from yesterday As an aside, Beth suggested it may be better using sqlite as the db for tests like this to spin up quicker, any thoughts? I like having more "real world" type examples where possible, but I'm not sure how helpful as a real world non persisting etc example it is directly anyway :thinking_face:

roman.rutkowski.87
2021-12-21 15:42
has joined #pact-python

maxwell.xandeco
2021-12-22 21:43
has joined #pact-python

lixiaoyan68
2021-12-23 06:50
has joined #pact-python

sashaavramchik
2021-12-23 09:07
has joined #pact-python

jamie.manson
2021-12-23 10:51
has joined #pact-python

colin.ansah
2021-12-23 13:21
has joined #pact-python

bruno855
2021-12-23 17:47
has joined #pact-python

appgify
2021-12-23 20:41
has joined #pact-python

jason329
2021-12-23 22:12
has joined #pact-python

shaheen.d2
2021-12-24 07:55
has joined #pact-python

laura.koekenberg
2021-12-24 10:32
has joined #pact-python

craiganthonyrichards
2021-12-25 05:01
has joined #pact-python

mch
2021-12-28 12:54
has joined #pact-python

florian.becker_pact-s
2021-12-28 14:49
has joined #pact-python

oblique
2021-12-28 18:45
has joined #pact-python

smalladi
2021-12-28 19:22
has joined #pact-python

jordan.nazemi
2021-12-28 19:24
has joined #pact-python

gbhusari
2021-12-28 21:22
has joined #pact-python

pghosh
2021-12-28 21:23
has joined #pact-python

carlos.agullo
2021-12-29 08:46
has joined #pact-python

cyrus.devnomad
2021-12-29 14:15
has joined #pact-python

muirandy
2021-12-30 17:57
has joined #pact-python

joshua.badger
2022-01-03 16:53
I?m taking a stab at https://github.com/pact-foundation/pact-python/issues/241 to help adoption at my company, but I?m running into a problem getting the virtual environment set up.

joshua.badger
2022-01-03 16:55
Pycharm attempted to create the virtual environment for me initially, failed and suggested I run `pip install -e <path/to/repo>` to see full output as to why virtual environment creation failed. Has anyone seen this before?

mike.geeves064
2022-01-03 17:07
Not failing like that, no :thinking_face:

mike.geeves064
2022-01-03 17:08
osx :open_mouth:

mike.geeves064
2022-01-03 17:12
it seems to be struggling to install the standalone ruby step :thinking_face:

mike.geeves064
2022-01-03 17:13
have you tried just downloading that manually? (obviously if it Just Works that's better but for the sake of seeing what's going on...)


mike.geeves064
2022-01-03 17:14
I'd grab that, move into /Users/jbadger/Documents/repos/pact-python/pact/bin/ and then see if anything different happens when you try to install again :thinking_face:

joshua.badger
2022-01-03 17:15
attempting now

joshua.badger
2022-01-03 17:17
seems to have done the trick, thanks!

mike.geeves064
2022-01-03 17:17
woop!

joshua.badger
2022-01-03 17:17
fingers crossed I can resolve the issue above!

joshua.badger
2022-01-03 17:18
seems like it should be a simple enough thing, but that?s how many year-long issues start, right? :stuck_out_tongue:

mike.geeves064
2022-01-03 17:18
np

mike.geeves064
2022-01-03 17:18
ha

mike.geeves064
2022-01-03 17:18
yes the last one I looked at was correcting confusing naming of some variables in examples which somehow ended up as 50 files changed in the end some days later :joy: I did not mean to

mike.geeves064
2022-01-03 17:18
good luck!

mike.geeves064
2022-01-03 17:20
might be worth trying to see what's up with osx downloading to a venv elsewhere, but that's probably best left a problem for another day :slightly_smiling_face:

joshua.badger
2022-01-03 17:23
and so begins the infinite recursion errors when running `make test`? this will be fun

joshua.badger
2022-01-03 17:25
during flake8 checking, looks like

joshua.badger
2022-01-03 17:30
What information can I provide to help with this? using python 3.6.10 due to `tox 3.14.0 has requirement importlib-metadata<1,>=0.12; python_version < "3.8", but you'll have importlib-metadata 4.8.3 which is incompatible.` , unsure if that could be causing the issue

elliottmurray
2022-01-03 17:41
So my local env also has this issue and I still haven?t resolved it either! It works on ci so I suspect a Mac issue too

joshua.badger
2022-01-03 17:44
huzzah magic powers

joshua.badger
2022-01-03 17:45
Fair enough, I have a change that the individual tests for `from_term` (the function changed) pass for. I cannot run the full suite.

joshua.badger
2022-01-03 17:45
Do I put the PR in my forked repo, or how does this work? (First time adding to an open-source repository, forgive my n00bness!)

elliottmurray
2022-01-03 17:52
Yes. GitHub will Allie you to merge back into the main repo

joshua.badger
2022-01-03 17:52
nevermind, Github guided me through it. Appears the only immediate issue is semantic pull request commit naming (plus issues noted during review): https://github.com/pact-foundation/pact-python/pull/281

joshua.badger
2022-01-03 18:05
Fixed the semantic naming, so supposedly it?s ready for review.

mike.geeves064
2022-01-03 18:23
Not always the best solution going straight to "have you tried upgrading", but the tox version looks pretty old: v3.14.0 (2019-09-03) :open_mouth:

joshua.badger
2022-01-03 18:26
Thanks @elliottmurray! So now my next question is how long until a new release? :smile:

joshua.badger
2022-01-03 18:47
Nvm, you commented on the PR. Looking forward to seeing it!

brocheleau
2022-01-03 21:24
@brocheleau has left the channel

elliottmurray
2022-01-04 08:57
It should be released now

joshua.badger
2022-01-04 16:08
Awesome, thanks. Now to get poetry to find it. :smile:

joshua.badger
2022-01-04 17:04
@elliottmurray if you don?t mind, we need to reopen the issue and revert that PR. I misunderstood something about how the internals work and did not test far enough. I will be more rigorous before submitting a new fix. My apologies for the inconvenience.

joshua.badger
2022-01-04 17:05
binary data does not serialize into json, so it doesn?t come through normal http responses. `pact` can?t do what http can?t do.

hocautomation
2022-01-05 09:54
has joined #pact-python

mike.geeves064
2022-01-05 13:48
could you base64 it, then you're back to strings

mike.geeves064
2022-01-05 13:49
since most places have on-the-fly compression anyway, the penalty for base64 isn't as huge as it used to be

joshua.badger
2022-01-05 16:17
Possibly. I?m just worried that if we base64 it, it no longer behaves like actual requests/responses because we have to do extra decoding to process it back to whatever we?re doing. Example: our use case is getting tarfile-formatted information back from an endpoint as the entire content of a response. No json to be found. If we encode it, then it?s not what we expect when we get it in the response.

mike.geeves064
2022-01-05 16:52
hm, that sounds like going outside the realms of Pact, you could Pact test getting something which you can verify (de)serialises for a hello world tar, but I'm not sure you'd want to Pact test large binaries for a contract :thinking_face: aside from say validating the content type

joshua.badger
2022-01-05 16:53
right. I just want to verify that it?s binary coming in, processing that binary is outside the scope of that particular test.

joshua.badger
2022-01-05 16:54
I?m playing with it right now. Still don?t have `make test` working, but Pycharm is able to run individual tests, so? :man-shrugging:

mike.geeves064
2022-01-05 16:58
I frequently have make test/Pycharm not working issues just from the different path being set, so files are/aren't where they are expected

joshua.badger
2022-01-05 16:59
What?s the minimum python version currently supported?

mike.geeves064
2022-01-05 17:01
I'd go by the tox config in there: ```[tox] envlist=py{36,37,38,39}-{test,install}```

mike.geeves064
2022-01-05 17:01
as in, should definitely work with at least 3.6, since that gets tested in the build

mike.geeves064
2022-01-05 17:03
idk if older would work or not, but who would want to not have f-strings :smile:

joshua.badger
2022-01-05 17:26
That was precisely the reason I asked. :sweat_smile:

mike.geeves064
2022-01-05 17:30
good reason to stick with "couldn't possibly use anything older" then :joy:

joshua.badger
2022-01-05 17:31
it appears that this is a multi-project issue. The mock service is what needs to return the value, so that needs to be updated in order to fully support binary. We can encode binary values to string at the very least and record that in our pacts (possibly with some prefix stating `hey i'm binary bzzt`) so the user can test as a workaround?. but the tests will still fail on the verifier side.

joshua.badger
2022-01-05 17:32
assuming I?ve correctly understood how the process works.

deepakdaga2007
2022-01-05 17:49
has joined #pact-python

tomas.hornak
2022-01-05 23:49
has joined #pact-python

juan.cruz
2022-01-06 02:44
has joined #pact-python

marconota.mac
2022-01-06 10:30
has joined #pact-python

marconota.mac
2022-01-06 10:34
@marconota.mac has left the channel

marta.rey-benito
2022-01-06 15:56
has joined #pact-python

fr4ngus
2022-01-06 16:20
has joined #pact-python

huhuang
2022-01-08 05:28
has joined #pact-python

frankfullstack
2022-01-09 20:33
has joined #pact-python

gkrawczyszyn
2022-01-10 06:51
has joined #pact-python

tom.kelly
2022-01-10 15:05
has joined #pact-python

dave.sorenson
2022-01-10 15:51
has joined #pact-python

gianni.araco
2022-01-11 16:13
has joined #pact-python

anu.johar
2022-01-11 20:25
has joined #pact-python

yann.danot
2022-01-12 10:15
has joined #pact-python

hsanghavi
2022-01-13 00:57
has joined #pact-python

vejeta
2022-01-13 03:19
has joined #pact-python

sweeneyrichard2
2022-01-13 15:43
has joined #pact-python

thuvu.se
2022-01-14 05:51
has joined #pact-python

rahul.meher
2022-01-14 09:02
has joined #pact-python

gavin.campbell
2022-01-14 17:31
has joined #pact-python

davideliu
2022-01-14 17:52
has joined #pact-python

pavlo.sprogis
2022-01-16 17:15
has joined #pact-python

jbrady
2022-01-16 21:54
has joined #pact-python

johnathan
2022-01-17 04:42
has joined #pact-python

dawoud.sheraz
2022-01-17 05:55
Hi everyone. Facing an issue with the latest release of *responses* with pact-python. Getting an error similar to the one described in https://github.com/getsentry/responses/issues/467. In the codebase, we use a custom OAuth client to get token from the service B and use that token to make calls to appropriate service A. In the consumer contract tests, we have mocked the oauth client token call via responses and letting responses ignore/passthrough any calls intended for service A. This was working all fine until the latest release of responses.

dawoud.sheraz
2022-01-17 05:57
Putting it here in case someone else faced this issue too. This might be fixed in https://github.com/getsentry/responses/pull/476

dimakos.neoklis
2022-01-17 15:04
has joined #pact-python

gueorgui
2022-01-17 16:43
has joined #pact-python

marcbetts
2022-01-17 22:35
has joined #pact-python

lambat.ishanya
2022-01-18 05:10
has joined #pact-python

sprathi
2022-01-18 13:40
has joined #pact-python

emanuela.ceuta
2022-01-18 16:25
has joined #pact-python

chaugule.sandeep
2022-01-19 05:00
has joined #pact-python

ajay.kawde
2022-01-19 13:34
has joined #pact-python

liam.chen
2022-01-19 21:19
has joined #pact-python

taylor.phillips01
2022-01-19 21:45
has joined #pact-python

sandeepa.kv
2022-01-20 06:46
has joined #pact-python

shane.dombowsky
2022-01-20 14:08
has joined #pact-python

jlbrown
2022-01-20 15:29
has joined #pact-python

gabriel.fatori
2022-01-20 18:36
has joined #pact-python

petersonbtah
2022-01-20 20:16
has joined #pact-python

llast
2022-01-20 21:44
has joined #pact-python

devesh.mishra
2022-01-21 04:26
has joined #pact-python

viveksingh.kiit
2022-01-21 09:29
has joined #pact-python

viveksingh.kiit
2022-01-21 09:58
@viveksingh.kiit has left the channel

james.demaine
2022-01-21 10:02
has joined #pact-python

james.demaine
2022-01-21 10:05
Hi Folks, I'm looking at learning pact-python to implement on a project and noticed that the readme has a link for 'e2e examples' which is broken at the moment. Would it be possible to get this fixed? It's under the python api section of the page https://docs.pact.io/implementation_guides/python/readme#python-api

mike.geeves064
2022-01-21 10:09
Whoops, probably my bad there. They've been split out a little as just e2e wasn't very helpful. You can still find them under the examples: https://github.com/pact-foundation/pact-python/tree/master/examples/

james.demaine
2022-01-21 10:10
Ah excellent, thanks

mike.geeves064
2022-01-21 10:13
Which reminds me, any thoughts on https://github.com/pact-foundation/pact-python/pull/280 @elliottmurray? Trying to avoid the fixture duplication so the examples show the relevant differences better

mike.geeves064
2022-01-21 10:19
Np, thanks for pointing it out, I'll fix later :slightly_smiling_face:

theferryatbuckland
2022-01-21 20:24
has joined #pact-python

mike.geeves064
2022-01-21 23:47
(?°?°)?? ??? Turns out the newer version of uvicorn dropped 3.6 support, so the FastAPI tests failed. Fixing at an older version does work it seems. I'll tidy up later. What are the thoughts on how important 3.6 support is? (somewhere deserves a note at least, either if 3.6 support is taken out that it would work but need newer uvicorn, or that newer uvicorn would break the tests)

matt.fellows
2022-01-22 00:24
We tend to follow where appropriate what the standard approach is for the language. E.g. in node, we only officially support the LTS editions

david.kormushoff
2022-01-22 00:54
has joined #pact-python

mike.geeves064
2022-01-22 09:06
Nod. Good timing, python 3.6 went EOL 2021-12-23 so I think that's grounds to keep things a bit cleaner and just drop support then (it's not actually impacting Pact usage, this is for the ASGI server used by FastAPI)

mike.geeves064
2022-01-22 09:07
That could make sense with timing actually, if that's why uvicorn then dropped support in their release 0.17.0 - 2022-01-14

mike.geeves064
2022-01-22 09:57
Let's try that again, without a tonne of other commits, need to get into the habit of checking "my" builds pass before a PR, even if it is a simple change link in README :joy:

tom.tantisalidchai
2022-01-25 05:43
has joined #pact-python

cedric.spengler
2022-01-25 15:09
has joined #pact-python

austin.reifsteck
2022-01-25 15:20
has joined #pact-python

hsd999
2022-01-25 19:06
has joined #pact-python

parasonbe
2022-01-25 20:31
has joined #pact-python

alex.diaz
2022-01-26 09:05
has joined #pact-python

kskowron
2022-01-26 11:30
has joined #pact-python

spencerm
2022-01-26 14:33
has joined #pact-python

cristiano.cunha
2022-01-26 14:55
has joined #pact-python

nish063
2022-01-27 02:42
has joined #pact-python

ingcmurcia
2022-01-27 04:41
has joined #pact-python

weijian.duan
2022-01-27 08:58
has joined #pact-python

abraham.gonzalez93
2022-01-27 10:39
has joined #pact-python

abraham.gonzalez93
2022-01-27 11:36
~Could someone help me giving access to the repo for opening a branch/PR?~

demna
2022-01-27 15:29
has joined #pact-python

mircea.ungureanu
2022-01-27 15:48
has joined #pact-python

nikhilwa84
2022-01-27 17:43
has joined #pact-python

bogdanm.rusu
2022-01-27 18:04
has joined #pact-python

cventcport
2022-01-27 22:29
has joined #pact-python

chaugule.sandeep
2022-01-28 08:58
Hello, I am trying to run my tests in Docker. When executed locally consumer tests work fine. The default mock server gets started and my tests run fine. But when running from Docker, I am getting connection refused . I am using default option localhost:1234 Failed to establish a new connection: [Errno 111] Connection refused

matt.fellows
2022-01-28 09:28
Can you please share the full logs? Within docker, this is usually outside of the scope of a Pact problem

matt.fellows
2022-01-28 09:28
also, please share your docker configuration

matt.fellows
2022-01-28 09:28
if Alpine, i?d check that you have the correct deps (http://docs.pact.io/docker)

matt.fellows
2022-01-28 09:28
also usually docker is slower, so check timeouts etc.

matt.fellows
2022-01-28 09:29
networking in docker may be very different, so that?s also worth looking into (e.g. `localhost` might be mapped differently)

mayuri.khemani
2022-01-28 09:43
has joined #pact-python

chaugule.sandeep
2022-01-28 10:37
Thanks Matt. I'll check on point 2 and 3 mentioned w.r.t docker[FYI, This was working fine with pactman in Docker but maybe specifically w.r.t Ruby I need to check

matt.fellows
2022-01-28 11:34
If you have the full logs, we might be able to give you better pointers

sujith.nair2
2022-01-28 12:33
has joined #pact-python

rob
2022-01-28 16:36
has joined #pact-python

radovan
2022-01-29 00:20
has joined #pact-python

mongeyc
2022-01-31 14:03
has joined #pact-python

mike.bernard
2022-01-31 21:14
has joined #pact-python

tjoy
2022-02-01 02:06
has joined #pact-python

max.tilford
2022-02-01 03:17
has joined #pact-python

chaugule.sandeep
2022-02-01 05:17
@matt.fellows: I am still checking how to share the logs (need to get an approval). I have looked at he docker documentation and we are using 1. bash--yes I am using bash 2. CA's for TLS: Not sure why it is required(Didn't set this when using PactMan) 3. glibc--> Yes this is installed This is acting as blocker now But the looks similar to this. ```requests.exceptions.ConnectionError: HTTPSConnectionPool(host='localhost, port=8080): Max retries exceeded with url:/ (Cause by NewConnectionError('urllib3 object...') Failed to establish a new connection': [Errno 111]: Connection refused))```

matt.fellows
2022-02-01 05:32
Jump into the container, and see if you can start the `pact-mock-service` manually (this is what pact-python should do under the hood)

matt.fellows
2022-02-01 05:32
I?m not sure where python/pip puts that file, but it?ll be in there somewhere

matt.fellows
2022-02-01 05:33
if that starts, that?s a good sign the container runtime has the appropriate pre-conditions

matt.fellows
2022-02-01 05:33
If you can create a repro for it, somebody might be able to help

matt.fellows
2022-02-01 05:35
Whatever you did that works with pactman is irrelevant, it?s a package we don?t know about nor support. It is as relevant to us helping you diagnose the problem as is your favourite genre of music

matt.fellows
2022-02-01 05:36
> Failed to establish a new connection: [Errno 111] Connection refused that basically means that something couldn?t connect to port `1234`. So whatever is supposed to start on that port (probably the mock server) either isn?t starting or hasn?t started by the time your code tries to talk to it

matt.fellows
2022-02-01 05:37
if you can share the code, that would certainly help (is that repo you shared a while back still relevant?)

chaugule.sandeep
2022-02-01 05:44
Okay Make sense. Will give this short. No the repo doesn't contain the docker steps.

chaugule.sandeep
2022-02-01 08:14
Got it working. One the key thing I had overlooked was the starting time. Logged into the container and that's when I realized it's takes time in Docker(which you had mentioned in the initial suggestion as a probable solution). Putting some sleep fixed the issue. Thanks a lot again. Appreciate it

matt.fellows
2022-02-01 08:15
what sleep is required - waiting the mock server? I?d assume Pact Python would automatically do that for you :thinking_face:

elliottmurray
2022-02-01 09:58
Looking at the log output and without rechecking the code there is retries built into that request. How long is it taking to start up roughly? Like over 30 seconds?

chaugule.sandeep
2022-02-01 11:32
Yeah there are retries, So I have put in sleep of 60 seconds

alex.diaz
2022-02-01 12:31
Hi! I am trying to use `consumer_selectors` to verify the provider using only the pacts with the tag `test`. However, it publishes the verification results for all the pacts. This is my code: ```@pytest.fixture def broker_opts(request): return { "broker_url": PACT_BROKER_BASE_URL, "publish_version": request.config.getoption("--publish-version"), "consumer_selectors": [{"tag": "test"}], "publish_verification_results": request.config.getoption( "--publish-verification-results" ), }``` And I attached a screenshot of my broker with 2 different pacts to check how only one contains tag=test

matt.fellows
2022-02-01 12:39
If the contents of the pact are the same the verification will automatically be applied to it

matt.fellows
2022-02-01 12:42
Pact broker is clever enough to do that. It's how two versions of a consumer that don't change their expectations of a provider can be pre verified and not wait for a provider to verify again

alex.diaz
2022-02-01 13:53
How can I specify multiple tags in the `consumer_selectors` option here? For example, if my pact contains tags: `tag2` and `tag3` (such as in the screenshot I sent before) is there any way to specify them? ```@pytest.fixture def broker_opts(request): return { "broker_url": PACT_BROKER_BASE_URL, "publish_version": request.config.getoption("--publish-version"), "consumer_selectors": [{"tag": "test"}], "publish_verification_results": request.config.getoption( "--publish-verification-results" ), }```

toanshukumar
2022-02-01 14:15
has joined #pact-python

juanquis419
2022-02-01 15:01
has joined #pact-python

juanquis419
2022-02-01 17:39
Hi, I'm trying to use Term or like, and when I try the assert process does not match because I got this <pactman.mock.matchers.Term object at 0x000001CCF2EF7E50>, how can I change it to a dict or json ? thanks

juanquis419
2022-02-01 17:51
Hi, I'm new to this topic and it's super interesting. I have a few questions about it because I have no idea to start using this. Can Someone give an example or a guide to starting with it? THANKS

elliottmurray
2022-02-01 19:31
The repo has examples. Also there is plenty of examples and guides on pact foundation site

matt.murray
2022-02-01 19:40
has joined #pact-python

matt.murray
2022-02-01 20:00
Hey folks, can anyone help me out with this issue. I'm seeing a route get registered w/ an expected interaction but when I make that request right after it doesn't recognize it

matt.murray
2022-02-01 20:00
Debug logs: ```I, [2022-02-01T13:59:19.878720 #33141] INFO -- : Cleared interactions I, [2022-02-01T13:59:19.885187 #33141] INFO -- : Registered expected interaction GET /api/people/?search=luke D, [2022-02-01T13:59:19.885359 #33141] DEBUG -- : { "description": "a request for a Person", "providerState": "Person in `Luke Skywalker`", "request": { "method": "get", "path": "/api/people/?search=luke" }, "response": { "status": 200, "headers": { }, "body": { "name": "Luke Skywalker", "height": "172", "mass": "77", "hair_color": "blond", "skin_color": "fair", "eye_color": "blue", "birth_year": "19BBY", "gender": "male", "homeworld": "https://swapi.dev/api/planets/1/", "films": [ "https://swapi.dev/api/films/1/", "https://swapi.dev/api/films/2/", "https://swapi.dev/api/films/3/", "https://swapi.dev/api/films/6/" ], "species": [ ], "vehicles": [ "https://swapi.dev/api/vehicles/14/", "https://swapi.dev/api/vehicles/30/" ], "starships": [ "https://swapi.dev/api/starships/12/", "https://swapi.dev/api/starships/22/" ], "created": "2014-12-09T13:50:51.644000Z", "edited": "2014-12-20T21:17:56.891000Z", "url": "https://swapi.dev/api/people/1/" } }, "metadata": null } I, [2022-02-01T13:59:19.892477 #33141] INFO -- : Received request GET /api/people/?search=luke D, [2022-02-01T13:59:19.892591 #33141] DEBUG -- : { "path": "/api/people/", "query": "search=luke", "method": "get", "headers": { "Host": "localhost:1234", "User-Agent": "python-requests/2.27.1", "Accept-Encoding": "gzip, deflate", "Accept": "*/*", "Connection": "keep-alive", "Version": "HTTP/1.1" } } E, [2022-02-01T13:59:19.892862 #33141] ERROR -- : No matching interaction found for GET /api/people/?search=luke E, [2022-02-01T13:59:19.892887 #33141] ERROR -- : Interaction diffs for that route: E, [2022-02-01T13:59:19.892906 #33141] ERROR -- : ```

elliottmurray
2022-02-01 20:41
Hmmm. Not sure. The url with the backslash is a little unconventional but it shouldn't Batista it to not match

matt.murray
2022-02-01 21:21
One thing I noticed was in the received request bit: it shows that the path is just `/api/people/` and separates out the query- would this have an affect?

matt.fellows
2022-02-02 00:26
Yes, the selectors takes an array of objects

matt.fellows
2022-02-02 00:26
so just specify multiple selector objects

matt.fellows
2022-02-02 00:26
``` "consumer_selectors": [{"tag": "test"}, {"tag": "tag2"}, ...],```

matt.fellows
2022-02-02 00:28
see the tutorials/workshops here :point_down: (howtolearn)

2022-02-02 00:28
Here are a number of useful hands-on labs that teach all of the key concepts: https://docs.pactflow.io/docs/workshops and https://docs.pact.io/implementation_guides/workshops

matt.fellows
2022-02-02 00:30
can you please share the consumer test setup? I think you?ll need to add the query portion to the `query` parameter, and not in the `path` one

matt.fellows
2022-02-02 00:31
So I think your guess is correct

matt.fellows
2022-02-02 00:31
i.e. ```.with_request('get', '/api/people', query={'search': 'luke'})```

frederic.gendebien
2022-02-02 08:54
has joined #pact-python

dougie.robertson
2022-02-02 11:15
has joined #pact-python

juan.avendano
2022-02-02 13:36
has joined #pact-python

matt.murray
2022-02-03 03:37
Hey folks, I started using pact-python with MessagePacts and I'm running into a funky design issue. The Message Consumers are working as expected- you tell it who you are (the consumer) and who you have a pact with (the provider) and then provide details and test it to capture the contract- Great! The Message Provider though is funky... it requires us to specify a consumer, which doesn't feel right. I tested it and it seems as though it requires that to verify the result. This seems like an anti-pattern in consumer-driven contract testing. The providers shouldn't know who the consumers are. Does anyone have any background here that they can provide?

matt.fellows
2022-02-03 04:31
Thanks Matt, beat me to it

matt.fellows
2022-02-03 04:32
I?m also confused as to why the consumer name is required

matt.fellows
2022-02-03 04:34
@fabio882 any ideas? I think you were very helpful in geting message support added

mike.geeves064
2022-02-03 11:15
I still haven't looked at MessagePact yet, but I vaguely remember something about the Consumer and Provider looking almost reversed compared to the http flow, as the source of where the request comes from is in effect the Provider and the message is received and processed by the Consumer which feels backwards but actually makes sense

mike.geeves064
2022-02-03 11:16
Not just that is it?

matt.fellows
2022-02-03 11:33
I don?t think so, but you?re right that it feels ?backwards?. The consumer is the one reading off of the queue (receiving the request, in a sense, which kind of feels like the provider because it?s not initiating the sequence). The provider is the _producer_ of the message (the one initiating it)

matt.fellows
2022-02-03 11:33
In this case, the provider still doesn?t care about who is reading the message, just that it can produce messages of a particular shape/type

mike.geeves064
2022-02-03 11:34
Yeah, I was just wondering if it could be from mixing up which is which

matt.fellows
2022-02-03 11:34
could be right about that

matt.fellows
2022-02-03 11:34
I remember it being confusing when I first saw it

mike.geeves064
2022-02-03 11:36
yeah. have a PR pending tidying up some of the test examples then I was going to look at the message examples, the ones there currently are pretty bare bones

mike.geeves064
2022-02-03 11:37
i need lots of comments :smile:

mike.geeves064
2022-02-03 11:39
eugh although i see there's now a conflict for that one hm

ausachov
2022-02-03 13:15
has joined #pact-python

matt.murray
2022-02-03 15:33
Hey folks, woke up to some great conversation in here! lol Thanks for hoping in and taking a look at this

aaron.kibbie
2022-02-03 15:59
has joined #pact-python

williangldzn
2022-02-03 20:23
has joined #pact-python

ricardo.gonzaga
2022-02-04 09:35
has joined #pact-python

robin.jacques
2022-02-04 10:51
has joined #pact-python

joaomiguel.rocha
2022-02-04 17:40
has joined #pact-python

jacek.sienniak
2022-02-07 08:45
has joined #pact-python

jamie.weatherby
2022-02-07 15:25
has joined #pact-python

joaobrandao.rodrigues
2022-02-07 16:30
has joined #pact-python

extra
2022-02-07 21:31
has joined #pact-python

joshua.badger
2022-02-07 22:45
I hope to have something to share in the next week or so, I?m taking what Tim described in the other thread to heart and am building out a different way to go about it. I think it will be a touch cleaner.

elenatuzel
2022-02-08 08:27
has joined #pact-python

vadim
2022-02-08 09:19
has joined #pact-python

anna.khv
2022-02-08 12:19
has joined #pact-python

jayeshguru81
2022-02-08 15:47
Hello Pact team, I am getting error for hardcoded token value in `Authorization: Bearer <hardcode token>` in verification step in Buildkite pipeline before publishing pact to the pact-broker, below are the steps in our BK pipeline 1. Run consumer Contract Test and upload pact.json file to the artifacts 2. Download pact.json file 3. Verify pact with Provider 4. Publish pacts to the pact-broker Getting below error for invalid authorization as hardcoded token was passed ```Verifying a pact between cmedia-distribute-api and vmedia-mats-app Given get schema tag enums return schema tags with GET /metadata/schema-tag-enums returns a response which has status code 200 (FAILED - 1) has a matching body (FAILED - 2)``` ``` Failure/Error: expect(response_status).to eql expected_response_status expected: 200 got: 401 (compared using eql?) # /pact/bin/pact:15:in `<top (required)>'``` ``` Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example Actual: {"title":"Unauthorized","message":"401 Unauthorized: Invalid token: Cannot extract header,payload and signature","mats_error_code":1001} Diff -------------------------------------- Key: - is expected + is actual ```

dhospital
2022-02-08 16:15
has joined #pact-python

jcabrera
2022-02-08 18:26
has joined #pact-python


jayeshguru81
2022-02-09 00:53
Yes I did

jayeshguru81
2022-02-09 00:53
but could not understand which one fits my use case

jayeshguru81
2022-02-09 00:54
definitely not 5 as we don't have long lived tokens

matt.fellows
2022-02-09 01:07
Usually, I?d go with request filters. I don?t think Python has that feature (shouldn?t? be hard to add). In your case, I?d stub the auth during provider test probably

jayeshguru81
2022-02-09 01:27
My test is failing on consumer side before publishing pacts to the broker

matt.fellows
2022-02-09 01:27
The error above is from a provider verification. What?s the problem with your consumer test?

matt.fellows
2022-02-09 01:28
Oh, your 4 steps above makes no sense

matt.fellows
2022-02-09 01:28
why are you verifying the provider in step (3)? That?s the job?of the provider.


jayeshguru81
2022-02-09 01:29
we have buildkite plugin which runs that for us

jayeshguru81
2022-02-09 01:31
So you are saying publishing pact is a job of consumer but verification should happen at provider side?

matt.fellows
2022-02-09 02:32
of course!

matt.fellows
2022-02-09 02:32
the whole point of pact is to _not_ having to build/test components together and remove this sort of coupling (independence)

ardiel.fuentes
2022-02-09 07:14
has joined #pact-python

ruud.von.faber
2022-02-09 09:11
has joined #pact-python

agustin.gomes
2022-02-09 13:23
has joined #pact-python

thijme.langelaar
2022-02-09 13:29
has joined #pact-python

jayeshguru81
2022-02-09 13:47
I asked this to our platform team who built the plugin and they said that verify step is intentionally kept to verify pacts before publishing to the broker

jayeshguru81
2022-02-09 13:47
Although verification is done on provider side as well

dharmesh.kumar
2022-02-09 13:52
has joined #pact-python

athaper
2022-02-09 14:14
has joined #pact-python

joshua.badger
2022-02-09 18:44
So I came up with a couple of things, vetting them out with my team, but I figured I could rubber duck here as well. Essentially, we take the `RequestResponsePair` that we previously defined, and change it to a `DownstreamMock` class. ```from dataclasses import dataclass from typing import Optional from typing import TypeVar from _pytest.nodes import Item as PytestItem # We expect to use unittest.mock.patch objects, but # we can't actually import the _patch objects they return # So we just document as best we can and wait until the # minimum version is python 3.8, where we can use Protocol # instead (much better) PatchType = TypeVar("PatchType") @dataclass class DownstreamMock: downstream_provider_name: str downstream_provider_state: str patch: PatchType # a unittest.mock._patch object requires_matching_pact: bool _pact_pytest_item: Optional[ PytestItem ] = None # Do not instantiate with this, use record_pact @property def pact_recorded(self): return self._pact_pytest_item is not None @pact_recorded.setter def pact_recorded(self, value): raise TypeError( f"Cannot directly set whether we've recorded a pact for a {self.__class__.__name__}" ) def record_pact(self, pytest_item): self._pact_pytest_item = pytest_item``` My current thought process is to register `DownstreamMock` objects to provider states on the current system under test. When a given provider state is called, all of the `DownstreamMock` objects start their patches. Once a new provider state is called, all patches running from `DownstreamMock` instances would be stopped and then the `DownstreamMock` instances registered to the new provider state would start their patches. You could then also add a decorator to any pact tests with these downstream on the Consumer side of the system under tests. From there, record the pact test with the `DownstreamMock`. Add a processing call to a hook in `pytest` to handle that. Then, in some teardown part of a session-level fixture, throw an exception if not all registered `DownstreamMock` objects that required a matching pact had a test registered to it.

joshua.badger
2022-02-09 19:06
Much looser coupling, not forcing HTTP responses for downstream stuff, but still allows us to enforce that services require contracts with downstream services in order to successfully fulfill upstream requests.

svranyes
2022-02-09 20:16
has joined #pact-python

joshua.badger
2022-02-09 23:37
> When a given provider state is called, all of the `DownstreamMock` objects start their patches. This should say all of the _relevant_ `DownstreamMock` objects start their patches

samuel.whittaker
2022-02-09 23:40
has joined #pact-python

matt.fellows
2022-02-09 23:44
this is not how it?s supposed to work. You can do it, but it?s not how it?s supposed to work

matt.fellows
2022-02-09 23:44
what if you have more than one provider down the track?

jayeshguru81
2022-02-09 23:45
yeah although plugin has a flag to make this verification as optional

jayeshguru81
2022-02-09 23:45
so we can skip it

jayeshguru81
2022-02-09 23:45
but in our company we use buildkite plugin

jayeshguru81
2022-02-09 23:46
which does verification step for us

jayeshguru81
2022-02-09 23:46
so not sure how we can stub auths as we have very little control over it

matt.fellows
2022-02-09 23:46
You?re really working against the grain here

matt.fellows
2022-02-09 23:47
It?s the provider team?s job to do the pact verification, and setup their code to be able to handle the various states

matt.fellows
2022-02-09 23:47
It?s not supposed to be a blackbox style test, it?s a white box style test that needs access to the code to work

matt.fellows
2022-02-09 23:48
You should go and talk to the provider team, and get them to implement a solution to the problem

jayeshguru81
2022-02-09 23:49
yeah you got me right, use of that plugin might limit us

jayeshguru81
2022-02-09 23:49
I have authority to add provider side tests

jayeshguru81
2022-02-09 23:49
but traditionally everyone in the company uses that plugin(?black box?)

jayeshguru81
2022-02-09 23:50
Do you have an example of python provider tests for handling authorization?

matt.fellows
2022-02-09 23:51
not off the top of my head, sorry

matt.fellows
2022-02-09 23:51
but I think the usually stubbing unit test tools are going to be your goto here

matt.fellows
2022-02-09 23:51
Might be worth searching history, I?m sure it?s come up before

jayeshguru81
2022-02-09 23:52
I see there was some discussion in history about consumer_provider_header


jayeshguru81
2022-02-09 23:54
this article deals with JS

jayeshguru81
2022-02-09 23:55
as you said python does not have that solution

jayeshguru81
2022-02-09 23:55
where I should request the same for python?

matt.fellows
2022-02-09 23:56
I would opt to stub out authorization, personally. To request the feature, you can raise a feature request on the github page

jayeshguru81
2022-02-09 23:57
ok got it

mike.geeves064
2022-02-10 10:45
Rebased this one to remove duplication of examples as there were conflicts since Dec: https://github.com/pact-foundation/pact-python/pull/280 Would be good to get some feedback or if that is an undesired approach etc, there are other examples still to do/complete but I don't really want to end up in a mess of conflicts so they're still on hold

david.hvilava
2022-02-10 10:53
has joined #pact-python

carlos.ferrao
2022-02-10 15:46
has joined #pact-python

rios.martinivan
2022-02-10 20:18
has joined #pact-python

charles.kuo
2022-02-10 21:42
has joined #pact-python

sudhanshu.testing
2022-02-11 05:12
has joined #pact-python

alessandro.polidori
2022-02-11 15:02
has joined #pact-python

krisakins
2022-02-12 20:19
has joined #pact-python

ian.cervantez
2022-02-13 03:32
has joined #pact-python

antonio.gamiz
2022-02-14 06:51
has joined #pact-python

antonio.gamiz
2022-02-14 09:26
Hi! Does anyone know where the documentation for the body of the POST request of the provider setup url parameter is? I get the following body: ```{ "consumer": "Consumer", "state": "User exists and has resources", "states": [ "User exists and has resources" ], "params": {} }```

mike.geeves064
2022-02-14 09:59
You only need to use that "state" string to identify what state it should be in, the body is empty. If you look in https://github.com/pact-foundation/pact-python/blob/master/examples/fastapi_provider/tests/pact_provider.py there's an example with state "UserA does not exist" -> call the function setup_no_user_a()

zish.gatrad
2022-02-14 16:01
has joined #pact-python

james.troughton
2022-02-14 16:08
has joined #pact-python

manuelam20
2022-02-15 00:41
has joined #pact-python

dchen
2022-02-15 08:03
has joined #pact-python

aristides.suarez
2022-02-15 08:14
has joined #pact-python

marcelino.garcia
2022-02-15 08:22
has joined #pact-python

varnika.singh
2022-02-15 09:11
has joined #pact-python

bernard
2022-02-15 16:22
has joined #pact-python

david.uzumaki
2022-02-15 16:33
has joined #pact-python

abhishekc.jh
2022-02-15 17:21
has joined #pact-python

nuno.frias
2022-02-15 19:28
has joined #pact-python

faran
2022-02-15 22:31
has joined #pact-python

andy
2022-02-16 00:35
has joined #pact-python

andy
2022-02-16 00:36
@andy has left the channel

fushinoryuu
2022-02-16 01:40
has joined #pact-python

abdelior
2022-02-16 08:48
has joined #pact-python

david.uzumaki
2022-02-16 11:41
Hey Team, getting an error `"message":"Error ocurred in mock service: RuntimeError - You must specify a consumer and provider name`when trying to start the pact service during a pytest run but I am providing them so not sure why it?s erroring out. I?ve added breakpoints to check that the pact does indeed use the correct consumer and provider name. So I?m pretty confused what?s missing where below is the code for the service ```@pytest.fixture(scope="session") def pact_service(request): version = _get_publish_version_number(request, "--publish-pact") publish = True if version else False pact = Consumer( settings.PACT_CONSUMER_NAME, tag_with_git_branch=True, version=version ).has_pact_with( Provider(settings.PACT_PROVIDER_NAME), publish_to_broker=publish, broker_base_url=settings.PACT_BROKER_URL, broker_username=settings.PACT_BROKER_USERNAME, broker_password=settings.PACT_BROKER_PASSWORD, ) pact.start_service() atexit.register(pact.stop_service) yield pact pact.stop_service()``` how I?m calling it ``` with pact_service: response = http://pact_consumer_client.post( path=constants.GRAPHQL_PATH, data=request_payload, token=constants.VALID_TOKEN )```

matt.fellows
2022-02-16 12:07
Positive that `settings.PACT_CONSUMER_NAME` (and the provider one) is defined?

david.uzumaki
2022-02-16 12:15
```ipdb> pprint(vars(pact.consumer)) {'name': {REDACTED}, 'service_cls': <class 'pact.pact.Pact'>, 'tag_with_git_branch': True, 'tags': None, 'version': None} ipdb> pprint(vars(pact.provider)) {'name': {REDACTED} }```

david.uzumaki
2022-02-16 12:15
can confirm, yes

matt.fellows
2022-02-16 12:18
are these debug statements within pact-python itself?

david.uzumaki
2022-02-16 12:28
ah thanks for mentioning that actually. Looking deeper at the pact-python logs I see it?s cause I had the standalone ruby binary running so it was stopping me from stop the service in my python code after it created the pact

david.uzumaki
2022-02-16 12:28
problem solved :white_check_mark:

misterjkl
2022-02-16 13:12
has joined #pact-python

jayeshguru81
2022-02-16 13:40
Hello Pact Team, I am getting connection refused error for `localhost:1234` while starting the pact service `pact.start_service()` in conftest.py. FYI, it is working fine in my local but failing in Buildkite Pipeline

brian.azizi
2022-02-16 14:05
has joined #pact-python

mike.geeves064
2022-02-16 15:07
Can you share more details on how this is setup? And the log output etc?

richelle.raaphorst
2022-02-16 15:17
has joined #pact-python

matt.fellows
2022-02-17 02:13
common things to check: ? Timeouts (CI often runs slower than your dev machine because less resources available / runs on commodity hardware). Docker adds to this if you?re using the BK docker plugins to execute jobs ? ipv4 vs ipv6 ? Port conflicts (are you hard coding ports or using random generated ones?) ? Networking restrictions that would prevent starting them Enabling debug level logs should help you see what?s happening

jayeshguru81
2022-02-17 02:15
yeah it was networking issue as I was running pytest within container in pipeline

jayeshguru81
2022-02-17 02:15
that's why localhost was not reachable

guillermo.aguirre
2022-02-17 20:06
has joined #pact-python

jayeshguru81
2022-02-17 22:42
Hello Team, I am using the `Term` for integer matching but it is failing ```expected = { "metadata_object_id": Term(r"^\\d{9}$", 890363965), "version_id": 1, "validation_errors": {"hard": {}, "soft": {}}, }```

jayeshguru81
2022-02-17 22:42
`E AssertionError: {"message":"Error ocurred in mock service: RuntimeError - Value to generate \"890363965\" does not match regular expression /^\\d{9}$/"`

jayeshguru81
2022-02-17 22:44
does this mean `Term` cannot be used for Integers?

bethskurrie
2022-02-17 22:44
Yes.

bethskurrie
2022-02-17 22:44
Terms are only for strings.

jayeshguru81
2022-02-17 22:45
so what is my alternative to match exact digits of an integer ?

bethskurrie
2022-02-17 22:45
I think for pact python at this stage, you can only assert a number's type (int/float).

bethskurrie
2022-02-17 22:46
if you want to match exact digits, then just put in the number without a Like around it.

bethskurrie
2022-02-17 22:47
unfortunately in pact python currently, ther'es no way to turn off the Like if you have turned it on in the top level.

jayeshguru81
2022-02-17 22:48
```expected = { "metadata_object_id": 890363965, "version_id": 1, "validation_errors": {"hard": {}, "soft": {}}, }```

jayeshguru81
2022-02-17 22:48
so you mean like direct number

bethskurrie
2022-02-17 22:48
yes

jayeshguru81
2022-02-17 22:48
will it not expect the same exact number ?

bethskurrie
2022-02-17 22:49
unless you turn on the Like it'll be exact matching

bethskurrie
2022-02-17 22:49
do you want flexible matching?

jayeshguru81
2022-02-17 22:49
So my usecase is `metadata_object_id` get 9 digit random numbers

bethskurrie
2022-02-17 22:49
Right, use the Like matcher.

jayeshguru81
2022-02-17 22:49
I am just sure that it is 9 digit

bethskurrie
2022-02-17 22:50
hm. is that a concern of the consumer? or are you trying to enforce a business rule?

jayeshguru81
2022-02-17 22:50
will `Like` enforce that its 9 digit

bethskurrie
2022-02-17 22:50
no


jayeshguru81
2022-02-17 22:50
hmm so `Like` just check the type

jayeshguru81
2022-02-17 22:51
oh ok I understand

jayeshguru81
2022-02-17 22:51
thanks for guiding

adamslack
2022-02-18 15:55
has joined #pact-python

darwin.cahyadi
2022-02-18 18:00
has joined #pact-python

jkdihenkar
2022-02-19 10:51
@jkdihenkar has left the channel

rishi.speets
2022-02-19 14:43
has joined #pact-python

caiquedpfc
2022-02-20 18:49
Hello everyone, I?m trying to use Verifier from pact-python in my Python Provider Api, but I?m getting failed responses in my verification. I think my problem is with Authentication, because I need to pass an Authorization Token in my request header. I?m already doing that passing the arg `custom_provider_headers` to my `verifier.verify_with_broker` but I still getting failures verifications. Someone can help me? I was wandering if there is any way to see the current response from the verification, because I only received a generic return like `has status code 200 (FAILED - 1)` there is any wait to see the actual status code return and the body response. I think if I can see the actual return will be more easy to understand what I?m doing wrong. I?m putting all my code in this thread, thank you all!

caiquedpfc
2022-02-20 18:51
```import logging from pact import Verifier log = logging.getLogger(__name__) logging.basicConfig(level=logging.DEBUG) PACT_BROKER_URL = "https://my_pact_broker_url.pactflow.io/" PACT_BROKER_TOKEN = "MY_TOKEN" PROVIDER_URL = "https://api.release.ze.delivery/public-api" default_opts = { 'broker_token': PACT_BROKER_TOKEN, 'broker_url': PACT_BROKER_URL, 'publish_version': '3', 'publish_verification_results': True, 'custom_provider_headers': ["Authorization:My_AUTH_TOKEN"], } def verify_contract(): verifier = Verifier(provider='courier-api', provider_base_url=PROVIDER_URL, ) output, logs = verifier.verify_with_broker( **default_opts, verbose=True ) print(output) print(logs) verify_contract()```

caiquedpfc
2022-02-20 18:54
I?m getting the error bellow: ```Verifying a pact between courier-phoenix and courier-api [PENDING] A request with a new show case with POST /public-api returns a response which has status code 200 (FAILED - 1) has a matching body (FAILED - 2) includes headers "Content-Type" which equals "application/json; charset=utf-8" (FAILED - 3) Failures: 1) Verifying a pact between courier-phoenix and courier-api [PENDING] A request with a new show case with POST /public-api returns a response which has status code 200 Failure/Error: replay_interaction interaction, options[:request_customizer] NoMethodError: undefined method `strip' for nil:NilClass```

caiquedpfc
2022-02-20 18:59
Should I pass `provider_states_setup_ur` with PROVIDER_URL value?

matt.fellows
2022-02-20 21:46
Is auth token still valid?

matt.fellows
2022-02-20 21:46
I would consider use provider states here, though, to enable/disable the authentication component on your service when you do the tests.

matt.fellows
2022-02-20 21:47
Also, there should be a provider log file - pact does log it. Not sure what the Python options are, but it should create a full file log that shows the request/responses it received from your server

ybergstrom
2022-02-21 03:24
has joined #pact-python

gyuvaraj10
2022-02-21 08:03
has joined #pact-python

athissen
2022-02-21 08:09
has joined #pact-python

andrefcsousa
2022-02-21 10:19
has joined #pact-python

katharina.pavic
2022-02-21 12:37
has joined #pact-python

ipoe
2022-02-21 14:54
has joined #pact-python

jeroen.vandijk
2022-02-21 16:40
has joined #pact-python

ondikumana
2022-02-21 22:13
has joined #pact-python

nithyag.ganesan
2022-02-22 10:01
has joined #pact-python

ntiwari
2022-02-22 11:48
has joined #pact-python

caiquedpfc
2022-02-22 13:54
Thank you so much for your reply @matt.fellows, my token still valid and I was able to see the logs now, right now I?m getting this error: ```GraphQL operations must contain a non-empty `query` or a `persistedQuery` extension``` I think probably I must to pass something to the Verifier class or verify_with_broker method to inform that my provider that I want to verify is a GraphQL provider. Can you help me with that, please?

matt.fellows
2022-02-22 21:24
It shouldn?t need anything specific on the provider side. GraphQL provider presents just like any other HTTP endpoint, so that tells me the contract is probably malformed / missing something important

matt.fellows
2022-02-22 21:24
can you please share the conttract?

phil.vint
2022-02-23 11:01
has joined #pact-python

phongthornk
2022-02-23 11:04
has joined #pact-python

lukasz
2022-02-23 14:55
has joined #pact-python

chaugule.sandeep
2022-02-25 11:40
Hello, While running provider tests, I am getting this error message. I am testing a against a real provider and it contains lot of entries. It is basically an array of dictionaries something like [ {"resource_type": "user", "resourceid": "userA", "name": "null", "path": "null", "version": "null"{, { "key": "pair", }, ] `"Actual array is too long and should not contain Hash at $[1]"` Any guidance what does this error message relates ?

matt.fellows
2022-02-25 11:55
that means your consumer test is expecting an exactly an array with a single item, instead of ?an array that contains objects of this shape?

matt.fellows
2022-02-25 11:56
you should look at using the array style matchers, probably called `eachLike` or similar

chaugule.sandeep
2022-02-25 12:11
But I would like to validate only the entries I care about[For ex: userA and hence in my consumer test, I am saying that something like this ```expected = [{"resource_type": "user", "resourceid": "userA", "name": "null", "path": "null", "version": "null"}] (pact .given("Service is running) .upon_receiving('a request for UserA') .with_request('GET', '/api/Users', headers=None, body=None) .will_respond_with(200, body=expected))```

ezequiel.uhrig
2022-02-25 13:46
has joined #pact-python

emin.sahin
2022-02-26 13:53
has joined #pact-python

ihassin
2022-02-27 21:20
has joined #pact-python

yumiihuang
2022-02-28 09:55
has joined #pact-python

yousaf
2022-02-28 11:57
has joined #pact-python

gerry
2022-02-28 12:56
has joined #pact-python

agustina.bosso
2022-02-28 16:04
has joined #pact-python

yumiihuang
2022-03-01 08:20
Hi, when using pact-verifier command with --custom-provider-header, I want to check the real header when request is replayed. I got a pact.log file after replay, however there is no custom header in it. It's like: ```I, [2022-03-01T16:05:12.110368 #6736] INFO -- : Sending PUT request to path: "/api/cartItems" with headers: {"CONTENT_TYPE"=>"application/json", "HTTP_X_PACT_ORIGINAL_HEADER_NAMES"=>"Content-Type"}, see debug logs for body D, [2022-03-01T16:05:12.113360 #6736] DEBUG -- : body :[{"duration":0,"id":"c3c46c8ccd254b32bfa52ba84aafa371","number":1}] I, [2022-03-01T16:05:15.427349 #6736] INFO -- : Received response with status: 200, headers: {"P3p"=>"CP=CAO PSA OUR", "Bluewareguid"=>"7b0774ea1ea787f7", "X-Blueware-App-Data"=>"Olx7QXtkY0UQancBBFEGGAsAJhgCCisNIA51JUI0PDgGcD0EHhw6FQ0bMD5hMyofbmkjZz0cMQsYGhwNBBMxPmFyciZnEnx0TRFiRFpMeVtRUHZVfGVqRwd+d3oPRj4GRkxiG1FJdVYrM2sTU3FtYQcEcDc=", "Content-Type"=>"application/json", "Date"=>"Tue, 01 Mar 2022 08:05:12 GMT", "Cache-Control"=>"no-cache, no-store, max-age=0, must-revalidate", "Pragma"=>"no-cache", "Expires"=>"0", "X-Xss-Protection"=>"1 ; mode=block", "Referrer-Policy"=>"no-referrer", "Vary"=>"Origin\nAccess-Control-Request-Method\nAccess-Control-Request-Headers", "Strict-Transport-Security"=>"max-age=16000000; includeSubDomains; preload;", "Content-Length"=>"79"}, see debug logs for body D, [2022-03-01T16:05:15.430341 #6736] DEBUG -- : body: {"state":"OK","body":null,"requestId":"reqId-171d3c0265906198b4f02-b83abbaa-1"}``` What I use to verify is like: ```pact-verifier --log-dir=F:\code\pact-python-master-1227\consumer\mop\pact_logs --provider-base-url=https://baseurl.cn --pact-ur l=F:\code\pact-python-master-1227\consumer\mop\contract_files\ECS\ECS-OP_EditCaterProduct.json --custom-provider-header=Cookie:CMECLOUDTOKEN=3a8c6ccb407e48bb8857535bc23cba37``` I'm wondering if there is a log that I can check when the request is replayed, it does request with what I provide in the custom-provider-header?

deactivateduser320370
2022-03-01 11:41
has joined #pact-python

yousafn
2022-03-01 12:47
Hey @yumiihuang, Are you using the https://docs.pact.io/implementation_guides/cli#provider-verifier, the https://github.com/pact-foundation/pact-python#--custom-provider-header or https://hub.docker.com/r/pactfoundation/pact-cli one? There are two settings `verbose` and and `log-level` although it looks like log level defaults to debug https://github.com/pact-foundation/pact-provider-verifier/#usage Most of the examples show a space after the cookie name, and then the value `--custom-provider-header "Authentication: Type VALUE"` so I wonder if the following might work ? `--custom-provider-header "Cookie: CMECLOUDTOKEN=3a8c6ccb407e48bb8857535bc23cba37"`

luke.bickell
2022-03-01 14:46
has joined #pact-python

agustina.bosso
2022-03-01 15:03
hello!!! nice to meet u :slightly_smiling_face: I am trying to execute this example locally: https://github.com/pact-foundation/pact-python/tree/master/examples and when I execute command in consumer I have this error

agustina.bosso
2022-03-01 15:03
```agustina.bosso@Agustinas-MBP in ~/Repos/pact-python/examples/consumer (master) > pytest --run-broker True --publish-pact 1 ImportError while loading conftest '/Users/agustina.bosso/Repos/pact-python/examples/consumer/conftest.py'. conftest.py:2: in <module> from testcontainers.compose import DockerCompose E ImportError: No module named testcontainers.compose```

agustina.bosso
2022-03-01 15:03
any ideas??

mike.geeves064
2022-03-01 15:09
Have you installed the necessary requirements? Probably the easiest way to get to a sensible starting point is just do a "make examples" which will go through and run the various examples, installing requirements for each

agustina.bosso
2022-03-01 15:14
awesome, where is make examples??

mike.geeves064
2022-03-01 15:14
you run it from the top of the repo

mike.geeves064
2022-03-01 15:15
"make" I mean, which then uses the Makefile, in the top of the repo

luke.bickell
2022-03-01 16:04
@luke.bickell has left the channel

james.williams
2022-03-01 16:29
has joined #pact-python

qluck
2022-03-01 22:15
has joined #pact-python

peter.pinda
2022-03-01 23:37
has joined #pact-python

yumiihuang
2022-03-02 03:12
hi @yousafn I'm using pact-python, and I tried the verbose and log-level settings, and changed the custom-provider-header velue as you suggest. however it seems no differnce from what I posted before. ```pact-verifier --log-dir=F:\op\pact_logs --provider-base-url=https://baseurl.cn --pact-url =F:\op\contract_files\ECS\ECS-OP_GetCaterProduct.json --verbose --custom-provider-header "Cookie:CMECLOUDTOKEN=ea072e6bcf7b451489e5ae95151c82be" --log-level=debug``` the log is: ```I, [2022-03-02T10:55:38.406632 #17956] INFO -- : Running example 'Verifying a pact between ECS and OP_GetCaterProduct A request for op with GET /api/web/core/op-cart/api/v1/cartItems/c3d5707fc3f7437f86d229687341f826 returns a response which has status code 200' I, [2022-03-02T10:55:38.409624 #17956] INFO -- : Sending GET request to path: "/api/web/core/op-cart/api/v1/cartItems/c3d5707fc3f7437f86d229687341f826" with headers: {}, see debug logs for body D, [2022-03-02T10:55:38.413614 #17956] DEBUG -- : body : I, [2022-03-02T10:55:41.505904 #17956] INFO -- : Received response with status: 200, headers: {"P3p"=>"CP=CAO PSA OUR", "Bluewareguid"=>"0fc65b96134ebd16", "X-Blueware-App-Data"=>"Olx7QXtlak8QancBBFEGGAsAJhgCCisNIA51JUI0PDgGcD0EHhw6FQ0bMD5hMyofbmkjZz0cMQsYGhwNBBMxQGJwalgCZHl0UR1jXVJeYUtZT2BOICc2Gh5kZTACBWcIU1hkSlUbIAZ/ZHgr", "Content-Type"=>"application/json", "Date"=>"Wed, 02 Mar 2022 02:55:38 GMT", "Cache-Control"=>"no-cache, no-store, max-age=0, must-revalidate", "Pragma"=>"no-cache", "Expires"=>"0", "X-Xss-Protection"=>"1 ; mode=block", "Referrer-Policy"=>"no-referrer", "Vary"=>"Origin\nAccess-Control-Request-Method\nAccess-Control-Request-Headers", "Strict-Transport-Security"=>"max-age=16000000; includeSubDomains; preload;", "Content-Length"=>"1234"}, see debug logs for body D, [2022-03-02T10:55:41.509884 #17956] DEBUG -- : body: {"state":"OK","body":null,"requestId":"reqId-171d3c0265906198b4f02-b83abbaa-1"}``` Yes the custom header works, but the log does't show the request header, I mean, is there a way the custom request header can be seen in the log, instead of showing `Sending GET request to path: ....with headers: {}.`is there a way that it shows like `Sending GET request to path: ....with headers: {"Cookie":"CMECLOUDTOKEN=ea072e6bcf7b451489e5ae95151c82be"}` I tried but found that only when I set the header in `pact.with_request`in consumer test it can be seen in logs. What I really want is to show the custom-provider-header in the log file.I'm wondering is there something wrong when I use the settings?

agustina.bosso
2022-03-02 13:26
perfect! thanksss!!

mike.geeves064
2022-03-02 13:45
great

mike.geeves064
2022-03-02 13:46
Can I ask, were you following the README in the examples folder? I notice the provider examples do include running a `pip install -r requirements.txt` but the consumer does not, I will add it, thanks for pointing it out :slightly_smiling_face:

mike.geeves064
2022-03-02 13:55
Tiny addition to examples README, missing pip install for the consumer, which is there for the provider examples

yousafn
2022-03-02 14:38
Story of my working life, touch a doc file and the builds turn red. :sweat_smile: Thanks for the change Mike

mike.geeves064
2022-03-02 14:41
:smile: yeah it's been doing that for a while, something isn't quite right with the examples. It's intermittent I think which is quite unhelpful

mike.geeves064
2022-03-02 14:42
I blame the last person to update the examples

mike.geeves064
2022-03-02 14:42
(which would be me :smile: )

mike.geeves064
2022-03-02 14:42
Although previously, half the examples weren't actually run as part of the build anyway :disappointed:

yousafn
2022-03-02 14:44
Reminds me of this Mike :joy: > "*Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live*. Good work on the improvements, I am sure we will sort the flakey builds out over time, getting them in there and getting full coverage is a first great start

mike.geeves064
2022-03-02 14:47
There are many ways to interpret that

mike.geeves064
2022-03-02 14:47
"will be"

mike.geeves064
2022-03-02 14:47
Perhaps they _didn't used to be_ until they discover your code and then have the _potential_ to become one :smile:

omer.bilgin
2022-03-02 15:51
has joined #pact-python

mike.geeves064
2022-03-02 18:28
^ build problem seems to be to do with a recent update to Flask [dependencies] which pulls in some recently updates which then cause problems :disappointed: What are thoughts on, for example poetry? :slightly_smiling_face:

elliottmurray
2022-03-02 18:32
I think it's time

mike.geeves064
2022-03-02 18:32
I'm using it for my projects over plain pip, I have found it nicer for packaging and so on as well as having a npm/yarn type lock file of dependencies of dependencies so you can pin everything much better. ...but I'm not sure if it's widespread enough yet to have as The Way in the repo :thinking_face: That said, FastAPI is using poetry if that counts for anything :smile:

elliottmurray
2022-03-02 18:33
I?m not an expert in it but seems to be gaining traction

mike.geeves064
2022-03-02 18:33
Nod

elliottmurray
2022-03-02 18:33
And yes pip is not enough in this day and age

elliottmurray
2022-03-02 18:33
Might look at it on Saturday

banolik
2022-03-02 18:35
has joined #pact-python

mike.geeves064
2022-03-02 19:17
[I'm probably about on Saturday if there's anything I can help with :slightly_smiling_face: ]

ancyaziz
2022-03-02 22:26
has joined #pact-python

timothyg
2022-03-02 23:40
has joined #pact-python

harihararaj.lk
2022-03-03 09:44
has joined #pact-python

chaugule.sandeep
2022-03-03 11:21
Hi, Had a basic query. How can I capture the comparison result when verifying a pact. ```verifier = Verifier(provider='UserService', provider_base_url=PACT_URL) output, logs = verifier.verify_pacts('./userserviceclient-userservice.json', log_dir='/tmp/logs/, log_level='DEBUG')``` For example: if the status code comparison fails, I would like to append it result to my test report

mircea.ungureanu
2022-03-03 11:40
@mircea.ungureanu has left the channel

toyamarinyon
2022-03-03 13:25
has joined #pact-python

david342
2022-03-03 13:26
has joined #pact-python

yesilmenadil
2022-03-03 16:14
has joined #pact-python

dajaman1
2022-03-03 20:30
has joined #pact-python

waqif
2022-03-03 23:32
has joined #pact-python

dmitry.matveev
2022-03-03 23:44
has joined #pact-python

chaugule.sandeep
2022-03-04 13:52
Any suggestions on this?

reuben.tonna
2022-03-04 14:32
has joined #pact-python

negrolyze
2022-03-04 15:34
has joined #pact-python

42amehmeto
2022-03-04 19:17
has joined #pact-python

rawatankit90
2022-03-04 22:33
has joined #pact-python

mike.geeves064
2022-03-06 12:21
:+1: assume that looked ok as an approach, the shared fixtures I mean, thanks!

elliottmurray
2022-03-06 15:01
Had had the same idea! More I'm sure we can do with this

mike.geeves064
2022-03-06 15:22
Awesome :slightly_smiling_face: I'll try and take a look at the message one, probably towards the end of next week

mike.geeves064
2022-03-06 15:23
Subject to any other suggestions instead? :slightly_smiling_face:

elliottmurray
2022-03-06 15:23
Sounds like a plan

matt.fellows
2022-03-06 21:58
I think there is an output option to the verifier where they can go. I do believe it can print an xunit output, but not sure if it can print xunit _and_ standard out

matt.fellows
2022-03-06 21:59
might be worth a feature request if you can?t do it

tom.daley
2022-03-07 09:09
has joined #pact-python

leon.brown
2022-03-07 09:26
has joined #pact-python

aurelia.rochat
2022-03-07 10:16
has joined #pact-python

caiquedpfc
2022-03-07 14:02
Hello @matt.fellows thank you so much for your help, how are you? Sorry for my delay, follow my contract bellow: ```{ "consumer": { "name": "courier-phoenix" }, "provider": { "name": "courier-api" }, "interactions": [ { "description": "A request with a new show case", "request": { "method": "POST", "path": "/public-api", "headers": { "content-type": "application/json" }, "body": { "operationName": "loadNewShowCase", "query": "query loadNewShowCase($filter: ShowCaseFilter) {\n loadNewShowCase(filter: $filter) {\n messages {\n category\n target\n key\n message\n }\n showCase {\n images\n shelves {\n id\n type\n displayName\n hasNextItems\n items {\n id\n type\n images\n displayName\n applicableDiscount {\n presentedDiscountValue\n discountType\n finalValue\n }\n category {\n id\n displayName\n }\n brand {\n id\n displayName\n }\n price {\n min\n max\n }\n }\n }\n }\n }\n}\n", "variables": { } }, "matchingRules": { "$.body.query": { "match": "regex", "regex": "query\\s*loadNewShowCase\\(\\$filter:\\s*ShowCaseFilter\\)\\s*\\{\\s*loadNewShowCase\\(filter:\\s*\\$filter\\)\\s*\\{\\s*messages\\s*\\{\\s*category\\s*target\\s*key\\s*message\\s*\\}\\s*showCase\\s*\\{\\s*images\\s*shelves\\s*\\{\\s*id\\s*type\\s*displayName\\s*hasNextItems\\s*items\\s*\\{\\s*id\\s*type\\s*images\\s*displayName\\s*applicableDiscount\\s*\\{\\s*presentedDiscountValue\\s*discountType\\s*finalValue\\s*\\}\\s*category\\s*\\{\\s*id\\s*displayName\\s*\\}\\s*brand\\s*\\{\\s*id\\s*displayName\\s*\\}\\s*price\\s*\\{\\s*min\\s*max\\s*\\}\\s*\\}\\s*\\}\\s*\\}\\s*\\}\\s*\\}\\s*" } } }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "data": { "loadNewShowCase": { "messages": null, "showCase": { "images": [ ], "shelves": [ { "id": "31239bf8-e8d8-4893-a3de-7e5316a8e6fd", "type": "BILLBOARD", "displayName": "Destaques", "hasNextItems": false, "items": [ { "id": "b7566f41-db87-4b03-bef2-4531a5b6de50", "type": "BANNER", "images": [ "https://courier-images-frontrelease.imgix.net/banner/b7566f41-db87-4b03-bef2-4531a5b6de50_180cab5b-ae61-4b28-9b6e-2124815cf974.jpg" ], "displayName": "TESTEQA10", "applicableDiscount": null, "category": null, "brand": null, "price": null } ] } ] } } }, "default": { "data": { "loadNewShowCase": { "messages": null, "showCase": { "images": [ ], "shelves": [ { "id": "31239bf8-e8d8-4893-a3de-7e5316a8e6fd", "type": "BILLBOARD", "displayName": "Destaques", "hasNextItems": false, "items": [ { "id": "b7566f41-db87-4b03-bef2-4531a5b6de50", "type": "BANNER", "images": [ "https://courier-images-frontrelease.imgix.net/banner/b7566f41-db87-4b03-bef2-4531a5b6de50_180cab5b-ae61-4b28-9b6e-2124815cf974.jpg" ], "displayName": "TESTEQA10", "applicableDiscount": null, "category": null, "brand": null, "price": null } ] } ] } } } } }, "matchingRules": { "$.body": { "match": "type" } } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } }```

jbecker
2022-03-07 15:26
Hey folks! I've been sort of just dipping my toe into the pact-python examples and was wondering why the pact fixture is https://github.com/pact-foundation/pact-python/blob/master/examples/consumer/tests/consumer/test_user_consumer.py#L62 _and_ https://github.com/pact-foundation/pact-python/blob/master/examples/consumer/tests/consumer/test_user_consumer.py#L68 after the test session is done? Isn't this redundant?

mike.geeves064
2022-03-07 16:13
imo you want to have the atexit to handle if you kill it uncleanly, to avoid the port being left open if you only have the atexit then the clean handling of stopping the service and pushing to the broker won't happen because it's too late, at the exit

mike.geeves064
2022-03-07 16:14
pretty sure I verified Bad Things happened with only atexit but let me know if that's not the case :slightly_smiling_face:

jbecker
2022-03-07 16:15
I thought I read that atexit doesn't work if you kill the program

jbecker
2022-03-07 16:17
> The functions registered via this module are not called when the program is killed by a signal not handled by Python, when a Python fatal internal error is detected, or when `os._exit()` is called. https://docs.python.org/3/library/atexit.html

mike.geeves064
2022-03-07 16:17
fair enough with a kill -9

mike.geeves064
2022-03-07 16:17
but if you're having exceptions raised etc that stops the flow

jbecker
2022-03-07 16:18
I think pytest will always run the cleanup if there is an error in the test though, won't it? At least, by design

jbecker
2022-03-07 16:19
It seems it doesn't if the error was within the fixture itself, but even then it'll still run the cleanup of any other fixture which it has finished setting up

mike.geeves064
2022-03-07 16:20
perhaps try it :slightly_smiling_face:

mike.geeves064
2022-03-07 16:20
examples are in progress, so they've been cleaned up a bit but there are probably extra bits not needed that may have been preferred previously etc

mike.geeves064
2022-03-07 16:21
*always in progress :slightly_smiling_face:

jbecker
2022-03-07 16:21
Oh sure. I'm fairly new to pytest fixtures anyways, so maybe I'm misunderstanding something. I actually learned about them just to understand the pact-python examples, ha

mike.geeves064
2022-03-07 16:22
always more to learn for sure! :slightly_smiling_face:

jbecker
2022-03-07 16:22
I like them a lot though, the design lends itself well to an inversion-of-control style of test setup

mike.geeves064
2022-03-07 16:23
glad to hear that :slightly_smiling_face:

mike.geeves064
2022-03-07 16:24
the approach of shared fixtures was new for me :slightly_smiling_face: it's a little hacky but works pretty nicely

jbecker
2022-03-07 16:26
Yeah, I might actually make the scope of the Pact fixture "package" instead of "session" and namespace my tests based on provider so I am automatically creating a new pact for each provider which my consumer has pacts with. Yay dependency injection!

mike.geeves064
2022-03-07 16:37
:thinking_face: that would make sense I think, simple examples are always fine until you try to do the next step :joy:

jbecker
2022-03-07 19:39
Hey, sorry, another question: I've got a pydantic model I'd like to use as my `expected` value in my pact. Are there any good examples out there how to do this? For example, I've got a model which takes: ```from datetime import datetime from pydantic import BaseModel class MyModel(BaseModel): message: str timestamp: datetime = datetime.now()``` But when I try to create an expected matcher: ```expected = MyModel( message="test message", timestamp=Like(datetime.now()) # <-- timestamp doesn't take a pact.Matcher! ).dict()``` Any suggestions?

jbecker
2022-03-07 21:24
To clarify a bit, this is the specific error I'm getting:

jbecker
2022-03-07 21:37
Alternatively, if I just use a string to represent the timestamp, like so: ```expected = MyModel( message="test message", timestamp=Like("2022-03-07T15:13:08.313994"), )``` , when I get a pydantic error when it tries to construct an instance of MyModel: ```E invalid type; expected datetime, string, bytes, int or float (type=type_error)```

jbecker
2022-03-07 21:38
I'm sure I'm not the first person who's had trouble getting pydantic models to work with pact, but I'm having a hard time googling for answers to this, so I appreciate any tips :slightly_smiling_face:

kabhatiya
2022-03-08 00:51
has joined #pact-python

luis.garelli
2022-03-08 09:29
has joined #pact-python

andrevdrodrigues
2022-03-08 12:50
has joined #pact-python

tobias
2022-03-08 13:11
has joined #pact-python

mutharaju.kk
2022-03-08 14:34
has joined #pact-python

will.robinson
2022-03-08 14:54
has joined #pact-python

fragonib
2022-03-08 16:22
has joined #pact-python

jason.wang
2022-03-08 19:05
has joined #pact-python

sam680
2022-03-09 05:12
has joined #pact-python

annette.reid
2022-03-09 07:44
has joined #pact-python

mike.geeves064
2022-03-09 09:26
[I haven't sorry! It does sound like something that would be useful to look at and add in though :thinking_face: ]

victor.lau
2022-03-09 20:46
has joined #pact-python

kenneth.krause
2022-03-10 16:41
has joined #pact-python

bergner
2022-03-11 06:19
has joined #pact-python

gotax80534
2022-03-11 06:55
has joined #pact-python

mathias
2022-03-11 10:17
has joined #pact-python

jtcsek
2022-03-11 13:02
has joined #pact-python

joachim005
2022-03-14 08:16
has joined #pact-python

joachim005
2022-03-14 12:31
Hello guys, I?m new at using pact-python and I?m trying to write a test for an application which is both a provider and a consumer. How do I write the tests? Will I try to use the pact server as a mocking server for the consumer part or do I use another library which can server as the mocking server (In that case I will have to write two tests, one which tests the providing part of the application and one which tests the consuming part of the application). In which of the two ways should I write the tests?

matt.fellows
2022-03-14 13:38
I think there is an FAQ and an AMA on http://docs.pact.io on this. See if you can dig it up otherwise I'll take a look tomorrow

alexstout009
2022-03-14 14:32
has joined #pact-python

paul.richards
2022-03-14 14:38
has joined #pact-python

akif.tahir
2022-03-14 15:00
has joined #pact-python

lramos
2022-03-14 16:29
has joined #pact-python

michael036
2022-03-14 18:31
has joined #pact-python

lauren.coggin
2022-03-14 19:27
has joined #pact-python

mkanika1811
2022-03-15 09:22
has joined #pact-python

ian.pringle
2022-03-15 11:02
has joined #pact-python

karl.wagner
2022-03-15 12:25
has joined #pact-python

chaitasi.patel988
2022-03-16 04:04
has joined #pact-python

jose.iglesias
2022-03-16 09:23
has joined #pact-python

alegab0710
2022-03-16 10:20
has joined #pact-python

serghei.pogodin
2022-03-16 12:31
has joined #pact-python

jeremy.vincent
2022-03-16 14:29
has joined #pact-python

1.g10squad
2022-03-16 16:01
has joined #pact-python

alistair.c.kung
2022-03-16 18:44
has joined #pact-python

adam.howard
2022-03-17 02:05
has joined #pact-python

jonatan.jaworski
2022-03-17 02:32
has joined #pact-python

lewis.greenway-jones
2022-03-17 08:52
has joined #pact-python

pierre.gerard
2022-03-17 11:59
has joined #pact-python

viswanathan.sarma
2022-03-17 22:39
has joined #pact-python

madhulika.mitra
2022-03-18 15:56
has joined #pact-python

david.uzumaki
2022-03-19 15:01
anyone here ever set up a graphql django mock provider to verify graphql consumer pacts with before? (actually I don?t think it even matters if it?s graphql. It?s really just about having some local test server spin up for the provider during the test) django is pretty annoying with this stuff

david.uzumaki
2022-03-19 15:37
If django doesn't play nice I'll just try use fast api inside of my django test case to start a server

rupam.saha
2022-03-21 09:26
has joined #pact-python

christian.jeppesen
2022-03-21 10:10
has joined #pact-python

anand.kannan
2022-03-21 10:10
has joined #pact-python

mikhail.yartsev
2022-03-21 10:10
has joined #pact-python

bblechman
2022-03-21 16:36
has joined #pact-python

jeffrey2011998
2022-03-22 09:22
has joined #pact-python

xavier.arque
2022-03-22 11:33
has joined #pact-python

aubrey
2022-03-22 14:32
has joined #pact-python

balazs
2022-03-22 15:51
has joined #pact-python

seasharp37
2022-03-22 22:17
has joined #pact-python

saritacutinha
2022-03-23 07:09
has joined #pact-python

rachelb
2022-03-23 10:16
has joined #pact-python

shaheen
2022-03-23 23:11
has joined #pact-python

david.uzumaki
2022-03-24 11:48
hi @mike.geeves064 I?m trying to reason with myself how that?s useful if we?re not getting anything in the body for a POST request. I thought the point of the provider was to actually use everything the consumer will send with the request against the provider

sentyaev
2022-03-24 12:36
has joined #pact-python

altan.demirkiran
2022-03-24 14:06
has joined #pact-python

jonathan.fortunati
2022-03-24 21:53
has joined #pact-python

simon.dicola
2022-03-25 10:25
has joined #pact-python

mrooschuz
2022-03-25 14:52
has joined #pact-python

ashok.pathak
2022-03-25 15:17
has joined #pact-python

david.uzumaki
2022-03-25 15:59
oh nvm, I get it now. It makes a call to my custom pact_provider_state endpoint then makes the real call to the provider server

mike.geeves064
2022-03-25 16:09
Yes that way you can do the consumer part first, you don't need knowledge of the provider implementation, it's a problem for the provider to worry about, only the expectation that the provider can implement an appropriate state

rdanthuluri
2022-03-27 03:28
has joined #pact-python

abhi.nandan964
2022-03-28 05:26
Hi, we have a polyglot scenario, where the consumer service is written in scala and the provider is written in python. We are able to publish the contract to the Pact Broker, however, on the provider side when we are trying to run the provider tests, it is throwing a `403` error. We are using the following command on the provider side ```pipenv run pact-verifier --provider-base-url=http://localhost:8000 \ --pact-url="<server_base_url>/pacts/provider/<provider>/consumer/<consumer>/latest" \ --provider-app-version $VERSION \ --pact-broker-username <pact_broker_user_name> \ --pact-broker-password <pact_broker_pwd> \ --publish-verification-results``` Provider application is running in docker container on `port 8000`. The above command is working fine from the local dev system, however it fails from our CI (GitLab), with the following error - ```HTTP request failed: status=403 /usr/local/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/consumer_contract/pact_file.rb:73:in `block in get_remote_with_retry'``` on Pact Broker log found this - ```WARN -- : attack prevented by Rack::protection::IPSpoofing``` nginx log shows the following - ```"GET /pacts/provider/<provider_name>/consumer/<consumer_name>/latest HTTP/1.1" 403 9 "-" "Ruby" "http://xx.xxx.xx.xxx"``` can anyone please help us with what is wrong here?

bethskurrie
2022-03-28 05:36
Just looking at the IP spoofing check code.

bethskurrie
2022-03-28 05:36
```def accepts?(env) return true unless env.include? 'HTTP_X_FORWARDED_FOR' ips = env['HTTP_X_FORWARDED_FOR'].split(/\s*,\s*/) return false if env.include? 'HTTP_CLIENT_IP' and not ips.include? env['HTTP_CLIENT_IP'] return false if env.include? 'HTTP_X_REAL_IP' and not ips.include? env['HTTP_X_REAL_IP'] true end```

bethskurrie
2022-03-28 05:36
do you have ngnix in front of your broker?

abhi.nandan964
2022-03-28 05:37
yes

bethskurrie
2022-03-28 05:37
your x-forwarded for headers may not be configured properly


bethskurrie
2022-03-28 05:38
On a side note, when you get this all working properly, you'll want to use "consumer version selectors" to select which pacts to verify, rather than a specific URL.


abhi.nandan964
2022-03-28 05:39
Thanks Beth, I will check this :+1:

cudi.unal
2022-03-28 11:25
has joined #pact-python

ashraf.anwar.iw
2022-03-28 13:12
has joined #pact-python

b.costa
2022-03-28 13:15
has joined #pact-python

mark.hopper
2022-03-28 14:53
has joined #pact-python

ashraf.anwar
2022-03-28 15:08
has joined #pact-python

damianruizdev
2022-03-28 18:44
has joined #pact-python

abhi.nandan964
2022-03-29 02:37
Hi @bethskurrie, I am using the default nginx configuration here - ```server { listen 443 ssl default_server; server_name localhost; ssl_certificate /etc/nginx/ssl/nginx-selfsigned.crt; ssl_certificate_key /etc/nginx/ssl/nginx-selfsigned.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp384r1; ssl_session_cache shared:SSL:10m; ssl_stapling on; ssl_stapling_verify on; location / { proxy_pass http://pact-broker:9292; proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme "https"; proxy_set_header X-Forwarded-Port "443"; proxy_set_header X-Forwarded-Ssl "on"; proxy_set_header X-Real-IP $remote_addr; } } server { listen 80 default_server; server_name localhost; location / { proxy_pass http://pact-broker:9292; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }``` am I missing anything?

bethskurrie
2022-03-29 02:38
nothing jumps out at me, but I'm not an ngnix expert


bethskurrie
2022-03-29 02:40
they look the same to me however

abhi.nandan964
2022-03-29 02:41
yeah, I checked this one, looks same, I will keep checking. Just wanted to confirm this is caused by nginx right and not by pact-broker?

bethskurrie
2022-03-29 02:42
ngnix is my guess, but I would never entirely rule out the code.

abhi.nandan964
2022-03-29 02:42
let me try by removing the nginx and check if I still face the issue

bethskurrie
2022-03-29 02:42
given you're the only one currently reporting this issue, my guess would be ngnix/other configuration issue.

bethskurrie
2022-03-29 02:43
it's curious that it works from your dev machine but not CI

bethskurrie
2022-03-29 02:43
that to me suggests there's something between your CI and the PB that doesn't exist between you and the PB.

bethskurrie
2022-03-29 02:44
something that does some kind of header/network transform.

bethskurrie
2022-03-29 05:46
@abhi.nandan964 I've just released a config option in the broker that will allow you to log the requests and responses at debug level


bethskurrie
2022-03-29 06:05
if the logs are full of SQL statements, set the sql_log_level to `none`

matthew.churcher
2022-03-29 08:48
has joined #pact-python

ben.brugman
2022-03-29 14:32
has joined #pact-python

hassan.shaikley
2022-03-29 16:14
has joined #pact-python

oakkub.1995
2022-03-30 07:10
has joined #pact-python

david.uzumaki
2022-03-30 14:12
Hey guys, how do I stop log files from being created during verification tests? I would have assumed not having any logging arguments passed in would not create it by default

hiqbal
2022-03-30 15:16
has joined #pact-python

sstenhouse
2022-03-30 15:16
has joined #pact-python

bmeyres
2022-03-30 17:37
has joined #pact-python

alejandro.velez
2022-03-30 18:42
has joined #pact-python

justin
2022-03-30 20:07
has joined #pact-python

matt.fellows
2022-03-30 21:43
Why is it a problem?

leo.adriano1994
2022-03-31 00:00
has joined #pact-python

hitesh.patadia
2022-03-31 04:27
has joined #pact-python

matt.cockayne
2022-03-31 11:02
has joined #pact-python

abhi.nandan964
2022-03-31 11:03
@bethskurrie it was caused by the SSL error, which was fixed by replacing the SSL cert with a valid one, that's in our corp domain :+1:

jimmy
2022-03-31 15:39
has joined #pact-python

bret.mcclory538
2022-04-01 01:10
has joined #pact-python

michael.d
2022-04-01 04:40
has joined #pact-python

yash.deole
2022-04-01 07:07
has joined #pact-python

alan.alie
2022-04-01 08:10
has joined #pact-python

jimmy
2022-04-01 08:11
@jimmy has left the channel

yumiihuang
2022-04-01 08:21
Hi, we have a API with GET method, and the params contains Chinese character.I'm using pact-python to write consumer test like the following: ``` def test_get_metadata(self): expected = { "body": [ { "name": "???1", "status": "ONLINE", "visible": True } ], "requestId": Like("abc"), "state": "OK" } # ????? headers = { "Content-Type": "application/json" } query = {"name":"???1","signature":"asdf"} (self.pact .upon_receiving('?????????') .with_request( method='GET', path=self.PATH, query=query, headers=headers ).will_respond_with(200, headers, expected)) with self.pact: resp = requests.get("http://localhost:{}{}".format(MOCK_SERVER_PORT,self.PATH), params=query,headers = headers) print('*******************************') print(resp.json()) self.assertEqual(resp.json(), get_generated_values(expected))``` when using pact-verifier command to verify the json file. It shows that the value of "name" in query parameters is urlencoded as "%E5%8F%AF%E7%94%A8%E5%8C%BA1". however when I change the query from list to string like this : ```query = "name=???1&signature=asdf"``` when using pact-varifier command,it shows: ```URI::InvalidURIError: URI must be ascii only "/api/change?name=\u{53ef}\u{7528}\u{533a}1&signature=asdf" # D:/python/Lib/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/uri/rfc3986_parser.rb:20:in `split' # D:/python/Lib/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/uri/rfc3986_parser.rb:72:in `parse' # D:/python/Lib/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/uri/common.rb:226:in `parse'``` Is there a way to deal with this kind of situation?I've found a issue https://github.com/pact-foundation/pact-provider-proxy/issues/6 but it seems different from @bethskurrie said.I thought hash form will not be encoded:smiling_face_with_tear:

ricardo.cruz
2022-04-01 11:54
has joined #pact-python

lauren.corderoy
2022-04-01 12:24
has joined #pact-python

jiayao.xu
2022-04-01 12:24
has joined #pact-python

bret.mcclory538
2022-04-01 14:36
@bret.mcclory538 has left the channel

shiva.velde0413
2022-04-01 14:44
has joined #pact-python

david.uzumaki
2022-04-01 16:18
It's not that useful. All It's doing is saying it ran the pact

david.uzumaki
2022-04-01 16:18
most of my problems were my own application code so it didn't help me in debugging anything

matt.fellows
2022-04-01 22:10
That's what most logs do. They are only helpful when there is a problem

npc1222
2022-04-04 04:37
has joined #pact-python

david.uzumaki
2022-04-04 11:35
Definitely, I think the biggest challenge I had was not anything to do with pact itself, but making it work with my current django setup. And when I think about it more, of course, that pact log is specifically for just any pact issues, not whatever framework I?m working in no problem, thanks

matt.fellows
2022-04-04 11:46
Yes, it?s one of the hardest things to do our ?our? side - tell you what is wrong with the setup around Pact.

matt.fellows
2022-04-04 11:46
Thanks for the feedback

arthur
2022-04-04 14:28
has joined #pact-python

agastiya.mohammad
2022-04-05 01:19
has joined #pact-python

caiquedpfc
2022-04-05 02:53
I?m using the pact-verifier cli command to verify a contract in a Github Actions workflow, but even returning the status code and the expected body, the workflow is failing because after publishing the verification result to the Broker I?m getting the error ?This document does not use a recognized Pact format?. Is there any way to successfully terminate the Github Action workflow after successfully publishing the result of the successful verification in Broker?

matt.fellows
2022-04-05 03:11
What arguments are you sending to the verifier? They look incorrect to me

matt.fellows
2022-04-05 03:13
My guess is you're passing the pact broker URL as pact file and it's trying to read a pact file from the root API at Pactflow when it's expecting a pact file there

caiquedpfc
2022-04-05 03:18
I?m sending: ```pact-verifier --provider-base-url=https://catalog-reader-api.dev.ze.in --pact-urls=https://zedelivery.pactflow.io/ --pact-broker-url=https://zedelivery.pactflow.io/ --provider=catalog-service --pact-broker-token=MY_TOKEN --publish-verification-results --provider-version-tag=1 --provider-app-version=1```

matt.fellows
2022-04-05 03:19
Remove pact urls, you already have the broker URL set

matt.fellows
2022-04-05 03:20
Also, you don't seem to be using any selectors. This is not recommended as it means it will be fetching the latest pact for each provider, which is unlikely to be what you want

caiquedpfc
2022-04-05 03:22
Thank you so much Matt, without pact-urls everything works fine. About selector how is the best way to use selectors?


matt.fellows
2022-04-05 03:23
See also the CI/CD workshop in howtolearn

2022-04-05 03:23
Here are a number of useful hands-on labs that teach all of the key concepts: https://docs.pactflow.io/docs/workshops and https://docs.pact.io/implementation_guides/workshops

caiquedpfc
2022-04-05 03:24
Thank you

matt.fellows
2022-04-05 03:24
You're welcome

bethskurrie
2022-04-05 04:42
URL params will be the death of me.

bethskurrie
2022-04-05 04:44
Sorry, I don't know how to fix this. Do other languages support non-ascii characters in query strings?

paul.stapleton
2022-04-05 07:33
has joined #pact-python

iurisoares1012
2022-04-05 09:53
has joined #pact-python

gocool9996
2022-04-05 10:04
has joined #pact-python

simrat.sidhu
2022-04-05 16:07
has joined #pact-python

gabriel.brazao
2022-04-05 17:42
has joined #pact-python

jhonataok01
2022-04-05 17:43
has joined #pact-python

andre.mariano
2022-04-05 19:10
has joined #pact-python

alex.zuliqiaer
2022-04-05 20:31
has joined #pact-python

lflores
2022-04-05 20:33
has joined #pact-python

keoma4
2022-04-05 21:17
has joined #pact-python

erick.belf
2022-04-05 21:46
has joined #pact-python

michaele
2022-04-06 03:40
has joined #pact-python

guillaume.camus
2022-04-06 12:47
has joined #pact-python

danielglazer123
2022-04-06 19:06
has joined #pact-python

ashish.goyal
2022-04-06 23:14
has joined #pact-python

pennellbeth
2022-04-07 08:04
has joined #pact-python

dominic.gara
2022-04-07 08:57
has joined #pact-python

ivan.cheung
2022-04-07 08:58
has joined #pact-python

omrieyal
2022-04-07 08:58
has joined #pact-python

drakulavich
2022-04-07 08:58
has joined #pact-python

jonoar22
2022-04-07 09:06
has joined #pact-python

josh.king
2022-04-07 09:06
has joined #pact-python

pitas01_lope
2022-04-07 09:35
has joined #pact-python

rarestomos
2022-04-07 09:40
has joined #pact-python

shuba.paripoornam
2022-04-07 09:59
has joined #pact-python

shivam.kumar
2022-04-07 11:00
has joined #pact-python

dgupta2
2022-04-07 13:26
has joined #pact-python

ashish.goyal
2022-04-07 18:48
Hello There, I am planning to use pact-python library for our APIs which are written in python. There has not been any update in changelog for the last one year.. So, i am assuming there is no active work happening on this. I am interested in knowing if Pending/WIP pacts features are supported by pact-python.

yousafn
2022-04-07 19:19
Hey @ashish.goyal The changelog for pact-python is here https://docs.pact.io/implementation_guides/python/changelog, it shows changes this year.

yousafn
2022-04-07 19:22
I don't think it was documented in a readme but I think v.1.2.5 version might be what you are after https://docs.pact.io/implementation_guides/python/changelog#125 https://github.com/pact-foundation/pact-python/pull/171/files

ashish.goyal
2022-04-07 19:29
Thank you so much!! It is very helpful.

ashish.goyal
2022-04-07 20:36
In my company, the team supporting contract testing has moved to v3 pact specification.. Most of the projects are being done in Java.. In my team, microservices are being developed in python.. Pact-python uses v2 specification. So, what challenges can i expect if we use pact-python for my project.. my apologies if i am not very clear, i am new to pact-python and learning how should i add it to my project and if there could be issues at later point.

elliottmurray
2022-04-07 20:47
Moving to v3 is a reasonable upgrade. It?s not that we don't want to just the maintainers haven?t found the time to do this for python. I include myself in this.

elliottmurray
2022-04-07 20:53
However, most http request/response interactions should work. Message pacts possibly won't though there is some python support for this. You should check that. Also some more advanced v3 features around matching rules t not work. But you have to check what is supported by each sdk

pankajarora512
2022-04-07 22:50
has joined #pact-python

aruncontacts
2022-04-07 22:54
has joined #pact-python

mira.kim
2022-04-07 23:59
has joined #pact-python

alphonse.bendt
2022-04-08 11:44
has joined #pact-python

wim.dupont
2022-04-08 11:49
has joined #pact-python

wilsonmar
2022-04-08 13:41
has joined #pact-python

henit.laxmicant
2022-04-08 14:19
has joined #pact-python

mateustalles
2022-04-08 17:35
has joined #pact-python

bioflash1
2022-04-11 09:21
has joined #pact-python

stambolaolya
2022-04-11 13:20
has joined #pact-python

elliottmurray
2022-04-11 13:28
Trying to use a new packaging system and there are a few teething issues with virtualenvs

souravmalhotra007
2022-04-11 15:56
has joined #pact-python

akshay.nm92
2022-04-11 17:48
has joined #pact-python

luxfactaest
2022-04-11 18:25
has joined #pact-python

cameron.allan
2022-04-12 00:15
has joined #pact-python

kendrickbong1996
2022-04-12 04:12
has joined #pact-python

timothy.osm
2022-04-12 05:16
has joined #pact-python

pact270
2022-04-12 08:53
has joined #pact-python

oytun
2022-04-12 13:12
has joined #pact-python

alessandrovermeulen
2022-04-12 14:00
has joined #pact-python

lucka
2022-04-12 15:25
has joined #pact-python

damon_walker
2022-04-12 15:26
has joined #pact-python

anusha_matti
2022-04-12 18:24
has joined #pact-python

albert.pincevic
2022-04-12 21:48
has joined #pact-python

marcello.rigan335
2022-04-13 12:07
has joined #pact-python

koel.misra
2022-04-13 13:31
has joined #pact-python

johnmichael.bullen
2022-04-13 15:04
has joined #pact-python

wng
2022-04-13 17:54
has joined #pact-python

connor.mcneil
2022-04-13 19:45
has joined #pact-python

henrry.salinas
2022-04-13 20:10
has joined #pact-python

danielflieger
2022-04-14 06:37
has joined #pact-python

elyas.najafizada
2022-04-14 11:01
has joined #pact-python

tasaki
2022-04-14 14:46
has joined #pact-python

caiquedpfc
2022-04-14 17:37
Hello everyone, how are you? I?ve a problem using Like match in my mock response. I?ve a mock body response in my consumer with an array with 3 elements inside, like this `Like({array: [1, 2, 3]})`, but when I?m running this contract in my provider verification the provider return an array with 6 elements and the validation fail. Is there any way to ignore the array length and just verify if the response in my provider contains an array with length greater than 0 in the body?

matt.fellows
2022-04-14 22:10
Yes. What shape is that actual response from your API you're trying to model? You probably want to use the `eachLike` variant which you use in place of arrays, and supply an example item and min length

caiquedpfc
2022-04-14 22:12
Thats good to know, thank you Matt. This is exactly my response: ```Like({ "shelves": [ { "id": "31239bf8-e8d8-4893-a3de-", "type": "BILLBOARD", "parentIds": [], "displayName": "Destaques", "order": 1, "active": True, "imageUrl": None, "state": None, "cities": None, "startsAt": "2020-10-01T03:00:00.000Z", "endsAt": None, "isRoot": True, "items": { "result": [ { "id": "b7566f41-db87-4b03-bef2", "type": "BANNER", "displayName": "TESTEQA10", "image": ".jpg", }, { "id": "14ed8ec5-bca2-426d-bbcc", "type": "BANNER", "displayName": "TESTE DE DATAs", "image": ".jpg", }, ], "hasMoreItems": False, }, } ], "hasNextPage": True, "nextCursor": "MQ==", "images": [], })```

caiquedpfc
2022-04-14 22:13
The problem i?m getting is with the `result` list

matt.fellows
2022-04-14 22:14
Hmm the top level like I thought should cascade

matt.fellows
2022-04-14 22:15
Try replacing the result value with the each like matcher (it accepts a single example value and a min length)

caiquedpfc
2022-04-14 22:16
Thank you, I will try

jithinjacob2011
2022-04-18 02:43
has joined #pact-python

james_fraser
2022-04-18 09:22
Hey folks :wave: our provider framework uses the Pact-Python library, we've started seeing some builds passing with the Pending Pact feature - we'd currently like these to fail so the build fails As far as I can tell the Pact Pending feature is meant to be off by default and I can't see anywhere that I'm enabling it, can anyone confirm if that's the case please? Or if not, how I can disable it

matt.fellows
2022-04-18 09:27
It should be, what version of the broker are you on? I believe it was a default on for a few minor versions before it was set to off by default

matt.fellows
2022-04-18 09:28
I'd suggest jumping to latest version of broker. If not that's not, it might be the version of python is not explicitly setting the flag as false

james_fraser
2022-04-18 09:40
So looks like the broker is on `Pactflow Version: 85e7754e3` (it's not self-hosted so not sure if we can even control the version) The verifier runs from a Docker container using `FROM --platform=linux/amd64 python:3.7` - is there a way to explicitly set the flag?

matt.fellows
2022-04-18 09:55
Thanks. So you'd be on the latest if Pactflow. I'm guessing something like pending = False

matt.fellows
2022-04-18 09:56
Worth checking if there are any related issues on GitHub.i can follow up tomorrow otherwise

james_fraser
2022-04-18 10:23
Looks like this could be related: https://github.com/pact-foundation/pact-python/issues/264 > The Pact Broker now defaults to true if the includePendingStatus field is not set I'll have a look at that and see if that sorts it :thumbsup:

matt.fellows
2022-04-18 10:24
Ah that rings a bell

james_fraser
2022-04-18 14:43
After a version bump and a bit of digging it looks like `--no-enable-pending` is what I was after, think that's it sorted now Cheers for the help Matt :thumbsup:

bkapadia
2022-04-18 17:25
has joined #pact-python

lewiscowles
2022-04-18 19:10
has joined #pact-python

florent
2022-04-19 16:02
has joined #pact-python

testingterrasoft
2022-04-19 19:19
has joined #pact-python

olivia.c
2022-04-19 23:27
has joined #pact-python

testingterrasoft
2022-04-20 14:30
@testingterrasoft has left the channel

ysuei.ygui
2022-04-20 20:42
has joined #pact-python

giuseppe.torchia
2022-04-22 08:25
has joined #pact-python

thadamski
2022-04-22 14:00
has joined #pact-python

druiz
2022-04-22 15:02
has joined #pact-python

tord.brokvist
2022-04-22 15:08
has joined #pact-python

gnanasekar69
2022-04-22 17:23
has joined #pact-python

himanshu.1046
2022-04-24 18:25
has joined #pact-python

himanshu.1046
2022-04-25 05:35
Hello folks, I wanted to have provider setup for pact-python? any refrences to that and what default port it uses? wanted to understand and setup that? Not sure how to setup pact provider? Can you please help me with refrence how we can setup this?


himanshu.1046
2022-04-25 06:29
Sure thanks for this refrence, actually i wanted to setup pact broker and provider in my lab, how i can do that? any references will surely help

matt.fellows
2022-04-25 07:12
What have you looked at so far?

matt.fellows
2022-04-25 07:13
http://docs.pact.io has most everything

himanshu.1046
2022-04-25 07:14
I have looked at pact python - example provider and consumer examples

yousafn
2022-04-25 09:10
Please check out the readme, both for pact Python and the pact broker https://github.com/pact-foundation/pact-python/ https://docs.pact.io/pact_broker You should have answers to all your questions. There are 2 example Python repos, a provider and consumer where you can see them working together

chris196
2022-04-25 09:51
has joined #pact-python

himanshu.1046
2022-04-25 10:00
Sure thanks, I am able to setup pact broker ..however i can access url with http://localhost:9292, Is there any way we can access it with 443?


himanshu.1046
2022-04-25 10:03
sure thanks , i will look into this

yousafn
2022-04-25 10:06
Example docker compose https://github.com/pact-foundation/pact-broker-docker/blob/master/docker-compose.yml the files it references are held in the repo.

matt.fellows
2022-04-25 10:28
When say "Running on 443" I assume you mean secure (https). This has nothing to do with Pact really, so just standard operational techniques are needed. If running docker, then this should be as you would run anything else on docker (and of course the links Yousaf shared will help)

himanshu.1046
2022-04-25 10:29
sure

matt.fellows
2022-04-25 10:29
:+1:

manu.vereecken
2022-04-25 11:06
has joined #pact-python

maltechristian.neuman
2022-04-25 11:52
has joined #pact-python

prashanth.ramadass
2022-04-25 14:04
has joined #pact-python

janarthanan.rajendras
2022-04-25 22:35
has joined #pact-python

shreyas.gowda
2022-04-26 02:14
has joined #pact-python

marxjo
2022-04-26 07:09
has joined #pact-python

andrew.fraser
2022-04-26 07:19
has joined #pact-python

lei.shi
2022-04-26 07:46
has joined #pact-python

himanshu.1046
2022-04-26 09:11
With help of docs you pointed I am able to setup pact broker in my lab and also i am able to publish contract on pact broker server.. Now actually i am looking to understand provider side , I tried using pact-verifier cli utilty but with base url passed as pact_broker url and pact_url = < json > generated i am not able to fetch proper responses..any reference would be useful here I am using pact-python

yousafn
2022-04-26 09:12
Please read the relevant documentation or ask a specific question please

yousafn
2022-04-26 09:12
we have full working examples of each of the consumer and provider side in each language available


yousafn
2022-04-26 09:14
We would also appreciate not direct tagging or messaging maintainers, the community is here to help, and we will aim to respond to messages as soon as possible but we also have day jobs :slightly_smiling_face: For reference - https://docs.pact.io/help/how_to_ask_for_help

himanshu.1046
2022-04-26 09:14
Sure thanks

akash.sharma5253
2022-04-26 11:50
has joined #pact-python

ashish.goyal
2022-04-26 21:07
Hi There- I am trying to follow the steps listed here - https://github.com/pact-foundation/pact-python/tree/master/examples . I was able to do successful publishing for pacts to the broker from the consumer end. However while running provider tests, i am seeing the below errors- ``` Creating /Users/ashishgoyal/gitrepos/pact-python/venv_pact/lib/python3.9/site-packages/pact-python.egg-link (link to .) Adding pact-python 1.5.2 to easy-install.pth file Installing pact-verifier script to /Users/ashishgoyal/gitrepos/pact-python/venv_pact/bin Installed /Users/ashishgoyal/gitrepos/pact-python Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/Users/ashishgoyal/gitrepos/pact-python/setup.py", line 212, in <module> setup( File "/Users/ashishgoyal/gitrepos/pact-python/venv_pact/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup return distutils.core.setup(**attrs) File "/Users/ashishgoyal/gitrepos/pact-python/venv_pact/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup return run_commands(dist) File "/Users/ashishgoyal/gitrepos/pact-python/venv_pact/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands dist.run_commands() File "/Users/ashishgoyal/gitrepos/pact-python/venv_pact/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands self.run_command(cmd) File "/Users/ashishgoyal/gitrepos/pact-python/venv_pact/lib/python3.9/site-packages/setuptools/dist.py", line 1214, in run_command super().run_command(command) File "/Users/ashishgoyal/gitrepos/pact-python/venv_pact/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/Users/ashishgoyal/gitrepos/pact-python/setup.py", line 64, in run install_ruby_app(package_bin_path, download_bin_path=None) File "/Users/ashishgoyal/gitrepos/pact-python/setup.py", line 118, in install_ruby_app raise RuntimeError('Could not find {} binary.'.format(path)) RuntimeError: Could not find /Users/ashishgoyal/gitrepos/pact-python/pact/bin/pact-1.88.83-osx.tar.gz binary.```

ashish.goyal
2022-04-26 21:08
Understand that it is looking for a file in pact/bin directory.. but not sure at what step it is supposed to get created.


yousafn
2022-04-26 22:09
you can install them via homebrew but it shouldn't be necessary, Simple stuff, mac wise, what are you running? intel/m1/darwin? python version are you running 3.9?

yousafn
2022-04-26 22:12
I think it only supports up to py 3.5 just from a quick scan of the readmes https://github.com/pact-foundation/pact-python#offline-installation-of-standalone-packages guide a PR where we are skipping the 3.6 py . hmm maybe thats out of date, looking at the PR, we test against 3.7/3.8 and 3.9

yousafn
2022-04-26 22:13
we have some docker containers if you are just stuck locally https://github.com/pact-foundation/pact-python/tree/master/docker

kannan.jai
2022-04-27 07:49
has joined #pact-python

c.giannakopoulos
2022-04-27 10:47
has joined #pact-python

sebastian.spiess
2022-04-27 11:43
has joined #pact-python

oury.diallo
2022-04-27 13:46
has joined #pact-python

yousafn
2022-04-27 17:04
better late than never :sweat_smile:

jean.paiva42
2022-04-27 18:58
has joined #pact-python

christoffer.vig
2022-04-28 06:09
has joined #pact-python

andrea.sangiorgio
2022-04-28 13:01
has joined #pact-python

jason.mcinerney
2022-04-28 19:14
has joined #pact-python

psnyder
2022-04-28 19:22
has joined #pact-python

dominique.cote
2022-04-29 01:17
has joined #pact-python

laura.walsh
2022-04-29 13:40
has joined #pact-python

mailtoadnan.ahmed
2022-04-30 08:56
has joined #pact-python

prasanna.mallisetty
2022-04-30 12:11
has joined #pact-python

marcelo.jaeggi
2022-05-02 16:26
has joined #pact-python

jaswanth.ooty
2022-05-03 00:26
has joined #pact-python

james.weng
2022-05-03 05:13
has joined #pact-python

jochen.kraushaar
2022-05-03 09:16
has joined #pact-python

anurag.soni1984
2022-05-03 10:58
has joined #pact-python

stephen.taylor
2022-05-03 14:26
has joined #pact-python

conrad
2022-05-03 18:41
has joined #pact-python

qamarlonalmeida
2022-05-05 05:24
has joined #pact-python

ben.pilgrim
2022-05-05 10:19
has joined #pact-python

lredpath
2022-05-05 11:21
has joined #pact-python

alex834
2022-05-05 11:26
has joined #pact-python

nachogonzalez
2022-05-05 15:51
has joined #pact-python

mounaouar
2022-05-05 18:00
has joined #pact-python

joanna.schloss
2022-05-06 04:45
has joined #pact-python

frank.kilcommins
2022-05-06 04:46
has joined #pact-python

douglas.clark
2022-05-06 04:46
has joined #pact-python

aaron.m.williams24
2022-05-06 07:50
has joined #pact-python

joanna.janiec
2022-05-06 08:14
has joined #pact-python

nicholas.simons
2022-05-06 11:02
has joined #pact-python

matias.cardenas
2022-05-06 13:44
has joined #pact-python

akash.srivastava.1911
2022-05-08 09:38
has joined #pact-python

gustavs.slutins
2022-05-09 11:51
has joined #pact-python

yhiamdan
2022-05-09 13:51
has joined #pact-python

thomas.cederholm
2022-05-09 14:48
has joined #pact-python

rakesh.arrepu
2022-05-09 15:22
has joined #pact-python

abhinavsharma333
2022-05-09 17:44
has joined #pact-python

orbit
2022-05-09 18:01
has joined #pact-python

eric.barrow
2022-05-10 03:50
has joined #pact-python

oprisor.cata24
2022-05-10 09:42
has joined #pact-python

jonathan.rice
2022-05-10 10:50
has joined #pact-python

vijayasaratha.v
2022-05-10 14:28
has joined #pact-python

radhika.madala
2022-05-10 18:10
has joined #pact-python

oscar.lopez
2022-05-10 20:39
has joined #pact-python

johnathan.pestano
2022-05-11 00:43
has joined #pact-python

milda.abromaviciute
2022-05-11 12:47
has joined #pact-python

matiasleandronunez
2022-05-11 13:22
has joined #pact-python

croudet
2022-05-11 14:07
has joined #pact-python

alex.bonstrom
2022-05-11 16:19
has joined #pact-python

cody.sims
2022-05-11 16:45
has joined #pact-python

harii.ravii
2022-05-11 22:02
has joined #pact-python

josh.kilazoglou
2022-05-12 04:17
has joined #pact-python

poojakunder1997
2022-05-12 07:25
has joined #pact-python

pekka.kiviniemi
2022-05-12 10:46
has joined #pact-python

sophie.bosse2
2022-05-12 12:45
has joined #pact-python

dimitris.schizas
2022-05-12 16:04
has joined #pact-python

j.shankarnath
2022-05-12 16:37
has joined #pact-python

yesh.veera
2022-05-12 17:35
has joined #pact-python

fabio.been
2022-05-12 18:04
has joined #pact-python

aliboztemir
2022-05-12 19:47
has joined #pact-python

luis.garcia
2022-05-13 09:06
has joined #pact-python

andreas.wiig
2022-05-13 14:18
has joined #pact-python

ocalderin14
2022-05-13 15:20
has joined #pact-python

jyoti.yennam
2022-05-13 17:28
has joined #pact-python

rberger
2022-05-13 21:06
has joined #pact-python

jsb0545
2022-05-15 18:55
has joined #pact-python

leon.luu2
2022-05-16 06:43
has joined #pact-python

samikshaphulzele
2022-05-16 09:53
has joined #pact-python

shiva.idc
2022-05-17 00:33
has joined #pact-python

joseph.joyce
2022-05-17 12:15
has joined #pact-python

vasanth.s
2022-05-17 13:36
has joined #pact-python

sri.kasturi
2022-05-17 14:21
has joined #pact-python

carlosh.carmo2
2022-05-17 22:43
has joined #pact-python

gchursov
2022-05-18 09:43
has joined #pact-python

berk.safranbolulu
2022-05-18 10:18
has joined #pact-python

larshoogma
2022-05-18 11:34
has joined #pact-python

malvika0810
2022-05-18 12:17
has joined #pact-python

nishant.shah
2022-05-18 13:38
has joined #pact-python

vorashil.farzaliyev
2022-05-19 10:59
has joined #pact-python

jlcrazzy
2022-05-19 13:38
has joined #pact-python

galveznairon
2022-05-19 13:40
has joined #pact-python

sunny.cheung
2022-05-19 20:43
has joined #pact-python

jbecker
2022-05-19 20:49
Hey there! I was just looking at the https://github.com/pact-foundation/pact-python/tree/master/examples for provider verification and just realized that it doesn't look like there's any way to specify what version of the consumer I want to pull the pact for to test. Am I missing it somewhere? Thank you for the help :slightly_smiling_face:

jbecker
2022-05-19 21:02
Is maybe the only way to do it to use the pact-verify CLI like in https://github.com/pact-foundation/pact-python/blob/master/examples/fastapi_provider/verify_pact.sh#L32 and specify the specific URL of the pact you want to verify?

matt.fellows
2022-05-19 23:04
You wouldn't usually specify the consumer version on the provider side - that's going to couple things a little too tightly. This is where branches/tags and other consumer version selectors are used

matt.fellows
2022-05-20 00:38
If it works on the consumer I?d be suprrised it doesn?t work on the provider - the install process is the same as Yousaf said

matt.fellows
2022-05-20 00:39
So you can do that, but it?s not the recommended way

matt.fellows
2022-05-20 00:39
see howtonirvana

2022-05-20 00:39
See this page on the steps to creating an effective contract-testing setup https://docs.pact.io/pact_nirvana. (This workshop demonstrates those principles in action: https://docs.pactflow.io/docs/workshops/ci-cd/)

chantalnitz
2022-05-20 07:22
has joined #pact-python

robert
2022-05-20 08:47
has joined #pact-python

baris.kucuk.atilim
2022-05-20 09:47
has joined #pact-python

rajnavakoti
2022-05-20 12:42
has joined #pact-python

jbecker
2022-05-20 13:12
Not sure I understand. If we want to deploy a new version of the provider to an environment and the version of the consumer which is in that environment is not the latest, would I not want to specify the consumer's branch/tag/environment rather than defaulting to "latest" since "latest" doesn't apply in this case?

jbecker
2022-05-20 13:13
Okay, so this right here, this is what I'm trying to do:

jbecker
2022-05-20 13:14
Forget I used the word "version". I'm trying to verify my provider against a specific tag or environment. I'm not seeing how to do that in these python examples. Can it be done?

jbecker
2022-05-20 13:15
This "Gold diagram" is actually literally exactly what I'm trying to do right now

mlund
2022-05-20 21:04
has joined #pact-python

pavi.dealwis
2022-05-21 03:28
has joined #pact-python

endika2
2022-05-21 10:52
has joined #pact-python

matt.fellows
2022-05-21 10:58
Yes, you should definitely be able to do that

matt.fellows
2022-05-21 11:00
Consumer version selectors or consumer version tags

matt.fellows
2022-05-21 11:01
Yes exactly. Sorry you mentioned `version` which would require to much information about the consumer, but certainly a tag or environment would be recommended

6eo2ge
2022-05-22 13:17
has joined #pact-python

eugene.baranovsky
2022-05-22 23:25
has joined #pact-python

harris
2022-05-23 03:04
has joined #pact-python

abhiattipra
2022-05-23 06:04
has joined #pact-python

max.bruns
2022-05-23 07:13
has joined #pact-python

hello560
2022-05-23 12:23
has joined #pact-python

venky.hodigere
2022-05-23 14:54
has joined #pact-python

prerit.jain
2022-05-23 16:27
has joined #pact-python

evan
2022-05-23 16:48
has joined #pact-python

manuel.porto
2022-05-23 17:56
has joined #pact-python

abhishek.lamba
2022-05-24 09:25
has joined #pact-python

stefan.friese
2022-05-24 09:32
has joined #pact-python

bharath.shetty
2022-05-24 09:33
has joined #pact-python

rivanitskiy
2022-05-24 14:23
has joined #pact-python

marti92
2022-05-24 21:40
has joined #pact-python

yasarenver
2022-05-25 05:22
has joined #pact-python

brian.quinn
2022-05-25 08:53
has joined #pact-python

jarekrzdbk
2022-05-25 12:45
has joined #pact-python

shaun.mendham
2022-05-25 16:32
has joined #pact-python

plourded
2022-05-25 19:43
has joined #pact-python

emirhan.emmez
2022-05-26 06:31
has joined #pact-python

yasir27uk
2022-05-26 17:56
has joined #pact-python

lcs2019022
2022-05-27 05:27
has joined #pact-python

wieslaw.bondyra
2022-05-27 08:09
has joined #pact-python

rafaelcebulla
2022-05-27 15:20
has joined #pact-python

orbit.mjs
2022-05-27 17:45
has joined #pact-python

msparks
2022-05-27 19:56
has joined #pact-python

falvarez
2022-05-30 14:17
has joined #pact-python

ruslan.ponomarev
2022-05-31 06:28
has joined #pact-python

alexander.maiburg
2022-05-31 07:31
has joined #pact-python

drakulavich
2022-05-31 08:01
@drakulavich has left the channel

edouard.lopez
2022-05-31 14:28
@edouard.lopez has left the channel

aherbst
2022-05-31 17:31
has joined #pact-python

poojakunder1997
2022-06-01 02:53
Hi Team, I am completely new to PACT and started working on already available framework in my current company but I am getting error below when we import ,as its saying that cant find reference verifier in spite of having PACTMAN installed *from pactman.verifier.broker_pact import BrokerPacts, pact_id, BrokerPact* Could you please help me to get rid of this error ?

matt.fellows
2022-06-01 04:50
Just an FYI that Pactman is not an officially supported Pact client library. I think a few people use it in here :stuck_out_tongue:

poojakunder1997
2022-06-01 05:04
I tried with PACT and PACT python as well but that also dint work ,Is there any other way to get rid of this error :slightly_smiling_face:

matt.fellows
2022-06-01 05:38
> PACT python as well but that also dint work what didn?t work about it?

poojakunder1997
2022-06-01 05:59
I installed PACT PYTHON and was trying to import *verifier.broker_pact import BrokerPacts, pact_id, BrokerPact*

poojakunder1997
2022-06-01 05:59
which wasnt working for me

matt.fellows
2022-06-01 07:16
Are you following some guide or something? They are two completely different packages, so I?m not surprised it wouldn?t work in both. Perhaps if you can go back a step and share what you?re doing that would help

vipul.pachauri
2022-06-01 08:02
has joined #pact-python

komal.sharma1
2022-06-01 08:02
has joined #pact-python

poojakunder1997
2022-06-01 08:13
Yeah I will check with senior the one who is familiar with that framework and get back, Thanks Matt :slightly_smiling_face:

matt.fellows
2022-06-01 08:15
There are a few example projects about, including the one in the pact-python project itself - i?d start there

matt.fellows
2022-06-01 08:15
P.S. it?s ?Pact? not ?PACT? :slightly_smiling_face:

poojakunder1997
2022-06-01 08:17
Can I get any link I can refer where we are using pact-python for example projects ?


poojakunder1997
2022-06-01 08:19
Thank you so much :slightly_smiling_face:

matt.fellows
2022-06-01 08:19
You're welcome

chris169
2022-06-01 11:53
has joined #pact-python

m.shi
2022-06-01 19:07
has joined #pact-python

asa.anudeep4
2022-06-02 04:33
has joined #pact-python

diede
2022-06-02 10:01
has joined #pact-python

mateusz.zaborowski
2022-06-02 17:54
has joined #pact-python

rchord23
2022-06-05 19:30
has joined #pact-python

divya.parameswaran
2022-06-05 20:16
has joined #pact-python

alexey.shchukin
2022-06-06 11:46
has joined #pact-python

afang
2022-06-06 22:17
has joined #pact-python

pratish.mp
2022-06-07 00:58
has joined #pact-python

poojakunder1997
2022-06-07 08:04
Hey Matt !! Needed your help in getting confirmation on is Pact python is the library which is replacing Pactman ?

matt.fellows
2022-06-07 10:07
No, pact-python has always been the official lib

matt.fellows
2022-06-07 10:08
Pactman is not, and has not been an official lib

matt.fellows
2022-06-07 10:08
(that?s not to say it wasn?t a good library or anything!)

poojakunder1997
2022-06-07 10:23
So can we use Pactman still ?

poojakunder1997
2022-06-07 10:24
or should we replace it with official libraries ?

matt.fellows
2022-06-07 10:24
I would suggest you don?t. It?s not supported by Pact and it?s not supported by its previous author/maintainer

poojakunder1997
2022-06-07 10:26
okay...So now if I wanna use the packages I was importing earlier from Pactman for eg like below, How can I get the same from pact python ?

matt.fellows
2022-06-07 10:27
You can?t just convert pactman to pact-python. They are different libraries.

matt.fellows
2022-06-07 10:27
I?d suggest going to the Pact Python project and starting from their examples/docs


poojakunder1997
2022-06-07 10:27
okay will do that !! Thank you !!

dasarih
2022-06-08 00:20
has joined #pact-python

benjamhawk
2022-06-08 02:37
has joined #pact-python

sclaros
2022-06-08 13:07
has joined #pact-python

daniel.tjondro
2022-06-08 15:25
has joined #pact-python

slacksync
2022-06-08 17:21
has joined #pact-python

sandro
2022-06-08 18:26
has joined #pact-python

hazem
2022-06-08 23:14
has joined #pact-python

leonardo.lanni
2022-06-09 14:51
has joined #pact-python

jcamilovasquezm
2022-06-10 02:47
has joined #pact-python

markrkell
2022-06-10 08:13
has joined #pact-python

eva-maria.schaller
2022-06-10 08:24
has joined #pact-python

michel.kaporin
2022-06-10 14:43
has joined #pact-python

pooja.sharma4099
2022-06-11 08:39
has joined #pact-python

srinivas.vaddi
2022-06-11 16:31
has joined #pact-python

igor.sharfman
2022-06-12 11:25
has joined #pact-python

chituru.chinwah
2022-06-13 08:48
has joined #pact-python

cchinwah1
2022-06-13 09:45
has joined #pact-python

julian.alvarezv
2022-06-13 17:10
has joined #pact-python

malukenho.dev
2022-06-14 14:33
has joined #pact-python

vikki.read
2022-06-14 18:58
has joined #pact-python

omer.khalil
2022-06-14 19:33
has joined #pact-python

rxiao
2022-06-15 04:29
has joined #pact-python

james.demaine373
2022-06-15 10:22
has joined #pact-python

dmoll
2022-06-15 21:10
has joined #pact-python

kurt3402
2022-06-16 04:29
has joined #pact-python

kyo.tang
2022-06-16 06:03
has joined #pact-python

prasadsolanki
2022-06-16 10:58
has joined #pact-python

mairtin.conneely
2022-06-16 12:02
has joined #pact-python

laura.kennedy
2022-06-16 14:32
has joined #pact-python

jbecker
2022-06-16 15:01
Hey all! I've been prototyping a process for the pact provider verification for my team's FastAPI service, and my team is pretty excited about it, but our architect is worried that it's a little complicated and introduces too much new stuff and the average developer will have a hard time understanding how it works and how to implement it (which is valid and I pretty much agree with him), so I thought I'd hop on here and see if anyone had any tips or thoughts about best practices for implementing the pact provider verifier in FastAPI. So first of all, the way I have it designed now is that inside the project repository's `./tests` directory I added a `pact_provider` directory to projects which are pact providers and a `pact_consumer` directory to projects that are pact consumers, with the idea being that the pytest tests which generate the contract live inside the `pact_consumer` directory and the start-up logic for running the server in pact-verification mode lives in `pact_provider`. (As best as I can tell, FastAPI needs a separate starting point to run the provider server in "pact-mode" because it has to add an extra router to define the `"/_pact/provider_states"` endpoint, via https://github.com/pact-foundation/pact-python/blob/master/examples/fastapi_provider/tests/pact_provider.py#L29). We use poetry to manage dependencies and run the code, so in our `pyproject.toml` alongside the `start = "<app_name>.run:start"` script, I'm defining `start_pact_verifier = "tests.pact_provider.setup:run"`. So in order to implement this solution, a developer has to add: ? the `start_pact_verifier` script line to their `pyproject.toml` ? the `./tests/pact_provider/setup.py` file with a run method which imports the main application's `FastAPI` instance and adds the pact states router to it ? the new pact states router itself, including https://github.com/pact-foundation/pact-python/blob/master/examples/fastapi_provider/tests/pact_provider.py#L17 ? plus the setup functions themselves It just seems like a lot to ask a developer to understand, and I was wondering if anyone had any tips to simplify it. Is there a way I could maybe utilize an internal poetry library to hide a lot of this boiler-plate away from the developer trying to implement this? Or maybe just a better design pattern I could be taking advantage of? My architect recommended moving the `run` function to the `<app_name>/run.py` module, but that seems like a pretty small step.

mike.geeves064
2022-06-16 20:28
[disclaimer: I have limited usage within teams so relatively light on useful suggestions] re the `/_pact/provider_states"` endpoint, I quite liked that pattern, iirc I did have a conversation about why you have to have this other way of starting it along the lines of "well, alternatively we could have the /_pact/provider_states_ endpoint exposed alongside the other routes, where people could then wipe the database from a single unauthenticated call" -> "ohhhhh! I get it now, this way is better" :slightly_smiling_face: but I agree having to explain it one person at a time is tricky to scale

mike.geeves064
2022-06-16 20:33
there is quite a lot to add in and get your head around, I'm not sure it's much harder than "everything else", once you've got that first example in there and a pattern to follow :thinking_face:

mike.geeves064
2022-06-16 20:44
How were you thinking of "getting" the pacts? I mean if the developers will be involved in the process with the consumers, to come up with the expected behaviour and the different states - I think that all helps with the context of why this things is being added and how it relates

jbecker
2022-06-16 20:47
We are using pact broker to store the pacts, and we have a jenkins job which does the verifications which you can pass either the url of the pact you want to verify (we use this with the pact broker webhook) or you can pass it an environment name and it'll run the verifier CLI against all the pacts in the pact broker tagged with that environment

mike.geeves064
2022-06-16 20:49
I mean the less technical part, if the FastAPI devs are talking with the consumer devs to go through the process of "we would like a new endpoint to do x" vs "there's an updated consumer Pact, we need to implement what they asked for"

mike.geeves064
2022-06-16 20:49
(around the issue of getting a developer to understand)

jbecker
2022-06-16 20:50
Sure, I think initially it's going to be the same developers who own the consumer and the provider, because the intra-team contracts are going to be the easiest to spearhead

jbecker
2022-06-16 20:51
I think the main concern is just that it's a lot of boilerplate to learn, particularly for the pact verifier stuff

jbecker
2022-06-16 20:51
But I'm not sure how to do it more simply

mike.geeves064
2022-06-16 20:54
it probably helps if you have difficulty now :slightly_smiling_face: for us it was a case of yes it's adding in boilerplate, but previously a lot of very similar activities happened but the end result was some half baked json with a few notes in JIRA that invariably didn't actually turn out to be the final result so we were then doing something quite similar, just within a defined structure :thinking_face:

mike.geeves064
2022-06-16 20:56
another of the conversations along the lines of "you know how we have pseudo-json in the jira ticket and then 1 day into the sprint it turns out to be incomplete or just plain wrong? ...what if I told you there was a way to...." :slightly_smiling_face:

mike.geeves064
2022-06-16 20:58
it's an interesting point for the examples/workshops though, i wonder if a series of commits showing the steps of which bits you need to add in would be helpful to refer to :thinking_face: (may already exist somewhere)

jbecker
2022-06-16 20:59
Okay, I have an idea of how I might use a private library to handle a lot of the boilerplate code so developers just have to pass a FastAPI instance and their state function map

mike.geeves064
2022-06-16 21:02
cookiecutter is still on my list to check out, i wonder if that would work for ongoing adding in additional changes beyond the first cutting :thinking_face:

gaurav.bajpai
2022-06-17 03:41
has joined #pact-python

salmanjamali
2022-06-17 06:49
has joined #pact-python

alansimonalie
2022-06-17 12:57
has joined #pact-python

ben.a.hubbard
2022-06-17 13:47
has joined #pact-python

mike.geeves064
2022-06-18 10:50
Looking at the message examples, but had some blockers of getting a dev environment going again :slightly_smiling_face: I had this previously but worked around by just putting the .tar.gz file where it expected to be - the logic had download_bin_path always being set so the route to go get could never happen

mike.geeves064
2022-06-18 10:58
eugh. which is doing the...build failed first time on my repo, but worked with a retry :disappointed:

mike.geeves064
2022-06-18 10:58
[when running some of the e2e tests, no perms to hit retry]

lafriakh.rachid
2022-06-18 14:24
has joined #pact-python

elliottmurray
2022-06-18 20:46
Want to check now? So this deals with both the case of the binaries being specified and not. I?ve only quickly glanced at the code

mike.geeves064
2022-06-18 20:59
I couldn't actually see how you're able to provide a specific path to it :thinking_face: The logic was definitely broken before as it had straight away if None then replace with where it goes, which is fine if you have the file already I should add in a before and after for reference in the PR This is one of those, I was trying to look at the message examples but ended up with a tangent while trying to get it working at all :grinning:

elliottmurray
2022-06-19 08:00
Let me have a look this morning. We'll try and pull out the old pr

elliottmurray
2022-06-19 08:28
Ok seems to make sense - never understood that code and looking at comments on the closed PR I think it was called out and I shouldn?t have merged it apologies. It ran locally for me (and could do a develop install without specifying the binaries) I?ll consider doing a release later

mike.geeves064
2022-06-19 08:30
:+1: Probably not worth a user release yet, I don't think anything else has changed from that pov so should be fine if anyone is pulling the repo down as is

mike.geeves064
2022-06-19 08:32
Trying to make sense of some message examples but having discussions where to put them with @yousafn so may or may not end up here :thinking_face:

matt.fellows
2022-06-20 03:08
FYI after several years of trying different approaches, my recommendation is to simply download and embed the standalone (or FFI libs) all into the distribution. It might make it a bit bigger, but space is cheaper than dealing with corporate proxies!

matt.fellows
2022-06-20 03:09
The issue is that downloading at install time introduces more places a failure can happen - the download, the zip etc. And allowing users to specify a pre-defined location makes drift possible, upgrades harder for users and introduces more checks needed to determine the source of the problem for maintainers

courtney.lum
2022-06-20 04:02
has joined #pact-python

mike.geeves064
2022-06-20 08:07
This was for a maintainer rather than for users but yes agree it probably confuses things [having as an option at all] :slightly_smiling_face: Packaging up in general... a problem for another day! Assuming it's some effectively dead code paths, I'm not sure how you would specify the one you did want to use :thinking_face: I got this error, unless pact/bin already existed with the .tar.gz file ```mgeeves@bearly:~/dev/GitHub/mikegeeves/pact-foundation/pact-python$ git status HEAD detached at c17ac70 Untracked files: (use "git add <file>..." to include in what will be committed) .venv/ nothing added to commit but untracked files present (use "git add" to track) mgeeves@bearly:~/dev/GitHub/mikegeeves/pact-foundation/pact-python$ make deps pip install -r requirements_dev.txt -e . Obtaining file:///home/mgeeves/dev/GitHub/mikegeeves/pact-foundation/pact-python Preparing metadata (setup.py) ... done Requirement already satisfied: Click>=2.0.0 in /home/mgeeves/dev/GitHub/mikegeeves/pact-examples/.venv/lib/python3.9/site-packages (from -r requirements_dev.txt (line 1)) (7.1.2) <snip> Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/mgeeves/dev/GitHub/mikegeeves/pact-examples/.venv/lib/python3.9/site-packages (from pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2->fastapi>=0.67.0->pact-python==1.5.2) (4.2.0) Installing collected packages: tox-travis, pact-python Running setup.py develop for pact-python error: subprocess-exited-with-error × python setup.py develop did not run successfully. ? exit code: 1 ??> [38 lines of output] running develop running egg_info writing pact_python.egg-info/PKG-INFO writing dependency_links to pact_python.egg-info/dependency_links.txt writing entry points to pact_python.egg-info/entry_points.txt writing requirements to pact_python.egg-info/requires.txt writing top-level names to pact_python.egg-info/top_level.txt adding license file 'LICENSE' (matched pattern 'LICEN[CS]E*') reading manifest file 'pact_python.egg-info/SOURCES.txt' reading manifest template 'http://MANIFEST.in' warning: no files found matching 'pact/bin/*' no previously-included directories found matching 'pact/test' no previously-included directories found matching 'e2e' writing manifest file 'pact_python.egg-info/SOURCES.txt' running build_ext Creating /home/mgeeves/dev/GitHub/mikegeeves/pact-examples/.venv/lib/python3.9/site-packages/pact-python.egg-link (link to .) Adding pact-python 1.5.2 to easy-install.pth file Installing pact-verifier script to /home/mgeeves/dev/GitHub/mikegeeves/pact-examples/.venv/bin Installed /home/mgeeves/dev/GitHub/mikegeeves/pact-foundation/pact-python Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/home/mgeeves/dev/GitHub/mikegeeves/pact-foundation/pact-python/setup.py", line 212, in <module> setup( File "/home/mgeeves/dev/GitHub/mikegeeves/pact-examples/.venv/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/home/mgeeves/.pyenv/versions/3.9.6/lib/python3.9/distutils/core.py", line 148, in setup dist.run_commands() File "/home/mgeeves/.pyenv/versions/3.9.6/lib/python3.9/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/home/mgeeves/.pyenv/versions/3.9.6/lib/python3.9/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/mgeeves/dev/GitHub/mikegeeves/pact-foundation/pact-python/setup.py", line 64, in run install_ruby_app(package_bin_path, download_bin_path=None) File "/home/mgeeves/dev/GitHub/mikegeeves/pact-foundation/pact-python/setup.py", line 118, in install_ruby_app raise RuntimeError('Could not find {} binary.'.format(path)) RuntimeError: Could not find /home/mgeeves/dev/GitHub/mikegeeves/pact-foundation/pact-python/pact/bin/pact-1.88.83-linux-x86_64.tar.gz binary. [end of output]```

mike.geeves064
2022-06-20 08:11
[rewording because I'm incoherent before my coffee kicks in]

woojos
2022-06-20 09:58
has joined #pact-python

abdou.ahzab
2022-06-20 10:08
has joined #pact-python

matt.fellows
2022-06-20 11:05
> This is one of those, I was trying to look at the message examples but ended up with a tangent while trying to get it working at all A first for everything Mike!

matt.fellows
2022-06-20 11:05
So I don?t fully understand the above thread, I suspect I?m missing some context - how can I help (if at all)?

mike.geeves064
2022-06-20 11:57
All good thanks, it's merged in, hopefully slightly nicer DX for now, hopefully nothing broken

dstekanov.tech
2022-06-20 15:28
has joined #pact-python

rohit.thadhani
2022-06-21 04:39
has joined #pact-python

jvieira
2022-06-21 22:28
has joined #pact-python

john
2022-06-22 10:08
I wrote a consumer test in Python, but when i run it in pytest nothing happens? Do i need to have the broker running locally? Actually Im gettting this error trying to get it to run: ```Hint: make sure your test modules/packages have valid Python names. Traceback: /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) consumer.py:9: in <module> from web.api.api import cancel_order E ModuleNotFoundError: No module named 'web'``` Im not too familiar with python

john
2022-06-22 11:05
when I run my test it seems to have created a local. db?: But i cant seem to create the table in that db

john
2022-06-22 12:40
If someone can help me out my test is looking like this: ```import atexit import logging import os import requests import pytest import subprocess from pact import Consumer, Like, Provider, Term, Format from orders_service.orders import Order log = logging.getLogger(__name__) logging.basicConfig(level=http://logging.INFO) # If publishing the Pact(s), they will be submitted to the Pact Broker here. # For the purposes of this example, the broker is started up as a fixture defined # in conftest.py. For normal usage this would be self-hosted or using Pactflow. PACT_BROKER_URL = "https://johnwilliams.pactflow.io/" PACT_BROKER_USERNAME = "johnwilliams" PACT_BROKER_PASSWORD = "secure123" # Define where to run the mock server, for the consumer to connect to. These # are the defaults so may be omitted PACT_MOCK_HOST = "localhost" PACT_MOCK_PORT = 1234 # Where to output the JSON Pact files created by any tests PACT_DIR = os.path.dirname(os.path.realpath(__file__)) @pytest.fixture def consumer() -> Order.cancel: return Order.cancel("http://{host}:{port}".format(host=PACT_MOCK_HOST, port=PACT_MOCK_PORT)) @pytest.fixture(scope="session") def pact(request): """Setup a Pact Consumer, which provides the Provider mock service. This will generate and optionally publish Pacts to the Pact Broker""" # When publishing a Pact to the Pact Broker, a version number of the Consumer # is required, to be able to construct the compatability matrix between the # Consumer versions and Provider versions # version = request.config.getoption("--publish-pact") # publish = True if version else False pact = Consumer("UserServiceClient", version=1).has_pact_with( Provider("UserService"), host_name=PACT_MOCK_HOST, port=PACT_MOCK_PORT, pact_dir=PACT_DIR, publish_to_broker=True, broker_base_url=PACT_BROKER_URL, broker_username=PACT_BROKER_USERNAME, broker_password=PACT_BROKER_PASSWORD, ) pact.start_service() # Make sure the Pact mocked provider is stopped when we finish, otherwise # port 1234 may become blocked atexit.register(pact.stop_service) yield pact # This will stop the Pact mock server, and if publish is True, submit Pacts # to the Pact Broker pact.stop_service() # Given we have cleanly stopped the service, we do not want to re-submit the # Pacts to the Pact Broker again atexit, since the Broker may no longer be # available if it has been started using the --run-broker option, as it will # have been torn down at that point pact.publish_to_broker = False def test_cancel_scheduled_order(pact, consumer): expected = \ { "id": "1e54e244-d0ab-46ed-a88a-b9e6037655ef", "order": [ { "product": "coffee", "quantity": 1, "size": "small" } ], "scheduled": "Wed, 22 Jun 2022 09:21:26 GMT", "status": "cancelled" } (pact .given('A scheduled order exists and it is not cancelled already') .upon_receiving('a request for cancellation') .with_request('get', f'http://localhost:3001/kitchen/schedule/{Like(12343)}/cancel') .will_respond_with(200, body=Like(expected))) with pact: response = consumer.cancel() assert response['status'] == "cancelled" pact.verify()```

john
2022-06-22 12:41
Im not sure about the fixture part and the following: ```with pact: response = consumer.cancel() assert response['status'] == "cancelled"```

john
2022-06-22 12:41
Im trying to write a test for the cancel function : ```class Order: def __init__(self, id, created, items, status, schedule_id=None, delivery_id=None, order_=None): self._order = order_ self._id = id self._created = created self.items = [OrderItem(**item) for item in items] self._status = status self.schedule_id = schedule_id self.delivery_id = delivery_id @property def id(self): return self._id or self._order.id @property def created(self): return self._created or self._order.created @property def status(self): return self._status or self._order.status def cancel(self): if self.status == 'progress': response = requests.get( f'http://localhost:3001/kitchen/schedule/{self.schedule_id}/cancel', data={'order': self.items} ) if response.status_code == 200: return raise APIIntegrationError( f'Could not cancel order with id {self.id}' ) if self.status == 'delivery': raise InvalidActionError(f'Cannot cancel order with id {self.id}')```

john
2022-06-22 12:42
and the error i get is: ```self = 'http://localhost:1234' def cancel(self): > if self.status == 'progress': E AttributeError: 'str' object has no attribute 'status' ../orders_service/orders.py:48: AttributeError```

mike.geeves064
2022-06-22 13:55
so for that one, you're setting `self.__status` in init rather than `self.status` that's being used here - you'll need the attributes to match, so should be `self.__status` here as well

marcus.james
2022-06-22 15:28
has joined #pact-python

jonas.pena
2022-06-22 15:50
has joined #pact-python

abudi.hijazi.01
2022-06-22 16:44
has joined #pact-python

vaddisrinivas170497
2022-06-22 18:57
has joined #pact-python

john
2022-06-22 23:25
Thanks for pointing that out Mike. I updated that but i still get the same error. Do I need to do anything additional like pass in an object into the OrderClass or something? In this : ```with pact: response = consumer.cancel()``` or something?

john
2022-06-23 03:02
any ideas why I would be getting an error like this:

john
2022-06-23 03:02
```ERROR consumer.py::test_cancel_scheduled_order - requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=3001): Max retries exceeded w...```

john
2022-06-23 03:08
oh i fixed hte above issue

john
2022-06-23 03:18
I get this error now: ```pact = <pact.pact.Pact object at 0x103b5d3d0>, consumer = None def test_cancel_scheduled_order(pact, consumer): expected = \ { "id": "1e54e244-d0ab-46ed-a88a-b9e6037655ef", "order": [ { "product": "coffee", "quantity": 1, "size": "small" } ], "scheduled": "Wed, 22 Jun 2022 09:21:26 GMT", "status": "cancelled" } (pact .given('A scheduled order exists and it is not cancelled already') .upon_receiving('a request for cancellation') .with_request('get', f'http://localhost:3001/kitchen/schedule/{Like(12343)}/cancel') .will_respond_with(200, body=Like(expected))) with pact: order = [{"id":1, "product":"coffee", "size":"small", "quantity":1}] payload = Order(id="76ac3eb5-a656-49e3-b973-17e7c992cc5e", created="2022-06-23T03:11:19.415574", items=order, status="created") # return Order.cancel(payload) # payload = Order(UUID, datetime.now, {"product":"coffee", "size":"large", "quantity":1}, "progress") print(payload) > response = consumer.cancel(payload) E AttributeError: 'NoneType' object has no attribute 'cancel' consumer.py:110: AttributeError``` hmmm im not sure what im doijng wrong can someone help?

adam.anderson
2022-06-23 03:46
has joined #pact-python

yegorisa
2022-06-23 03:47
has joined #pact-python

swapnil.jagdale
2022-06-23 05:19
has joined #pact-python

john
2022-06-23 06:15
any idea what the issue is with this: ```I, [2022-06-23T16:14:14.635384 #84978] INFO -- : Cleared interactions I, [2022-06-23T16:14:14.663371 #84978] INFO -- : Registered expected interaction GET http://127.0.0.1:5000/kitchen/schedule/<pact.matchers.Like object at 0x104e7b220>/cancel D, [2022-06-23T16:14:14.663741 #84978] DEBUG -- : { "description": "a request for cancellation", "providerState": "A scheduled order exists and it is not cancelled already", "request": { "method": "get", "path": "http://127.0.0.1:5000/kitchen/schedule/<pact.matchers.Like object at 0x104e7b220>/cancel" }, "response": { "status": 200, "headers": { }, "body": { "json_class": "Pact::SomethingLike", "contents": { "id": "1e54e244-d0ab-46ed-a88a-b9e6037655ef", "order": [ { "product": "coffee", "quantity": 1, "size": "small" } ], "scheduled": "Wed, 22 Jun 2022 09:21:26 GMT", "status": "cancelled" } } }, "metadata": null } W, [2022-06-23T16:14:14.721886 #84978] WARN -- : Verifying - actual interactions do not match expected interactions. Missing requests: GET http://127.0.0.1:5000/kitchen/schedule/<pact.matchers.Like object at 0x104e7b220>/cancel W, [2022-06-23T16:14:14.721961 #84978] WARN -- : Missing requests: GET http://127.0.0.1:5000/kitchen/schedule/<pact.matchers.Like object at 0x104e7b220>/cancel```

matt.fellows
2022-06-23 06:27
> > ```http://127.0.0.1:5000/kitchen/schedule/<pact.matchers.Like object at 0x104e7b220>/cancel``` That should give you a hint.

matt.fellows
2022-06-23 06:28
I?m no Python expert, but that is a function call embedded in a string. So what you?re getting, is the output of a matcher (an object) being stringified.

mike.geeves064
2022-06-23 06:29
At the top you have `consumer = None` that's why it doesn't have an attribute cancel, or any attributes

matt.fellows
2022-06-23 06:30
Rather than ```with_request('get', f'http://localhost:3001/kitchen/schedule/{Like(12343)}/cancel')``` You probably need to do something like this: ```with_request('get', Regex('http://localhost:3001/kitchen/schedule/([0-9+])/cancel')``` (that?s not a real regex and I?m not sure that?s the right function to do a regex, but hopefully that gives you an idea)

mike.geeves064
2022-06-23 06:30
Or is that not a line of code as you have pact = an object above?

mike.geeves064
2022-06-23 06:32
I would suggest spending some time learning about python in general, and testing in python, fixtures if you are using pytest.. and so on

john
2022-06-23 07:38
ah well spotted thanks

mark.mcmurray
2022-06-23 08:33
has joined #pact-python

john
2022-06-23 08:46
I managed to resolve that issue

john
2022-06-23 08:47
as to python yes im not really an expert on that.

john
2022-06-23 08:55
Mike, I'm actually under considerable pressure to get contract testing done so unfortunately i don't have a lot of time to learn python properly. I just need to get to the state of getting contract testing working and demonstratable. So any help you can offer is greatly appreciated

jacek.maciag
2022-06-23 09:15
has joined #pact-python

john
2022-06-23 09:20
Hey Matt I tried something similar but it didnt work. I looked at the readme in the python-pact and they just add paths to this : ```pact.with_request( method='POST', path='/api/v1/my-resources/123', body={'user_ids': [1, 2, 3]}, headers={'Content-Type': 'application/json'}, )``` In the pact log, where is the actal request and which is the expected it isn't very clear? I tried just adding hte path instead of the whole url.

john
2022-06-23 09:22
this is what i see: ```I, [2022-06-23T19:21:41.781641 #92156] INFO -- : Cleared interactions I, [2022-06-23T19:21:41.798136 #92156] INFO -- : Registered expected interaction GET /kitchen/schedule/bc72e917-4af1-4e39-b897-1eda6d006b18/cancel D, [2022-06-23T19:21:41.798505 #92156] DEBUG -- : { "description": "a request for cancellation", "providerState": "A scheduled order exists and it is not cancelled already", "request": { "method": "GET", "path": "/kitchen/schedule/bc72e917-4af1-4e39-b897-1eda6d006b18/cancel" }, "response": { "status": 200, "headers": { }, "body": { "json_class": "Pact::SomethingLike", "contents": { "id": "1e54e244-d0ab-46ed-a88a-b9e6037655ef", "order": [ { "product": "coffee", "quantity": 1, "size": "small" } ], "scheduled": "Wed, 22 Jun 2022 09:21:26 GMT", "status": "cancelled" } } }, "metadata": null } W, [2022-06-23T19:21:41.848351 #92156] WARN -- : Verifying - actual interactions do not match expected interactions. Missing requests: GET /kitchen/schedule/bc72e917-4af1-4e39-b897-1eda6d006b18/cancel W, [2022-06-23T19:21:41.848412 #92156] WARN -- : Missing requests: GET /kitchen/schedule/bc72e917-4af1-4e39-b897-1eda6d006b18/cancel```

mike.geeves064
2022-06-23 10:39
Try to follow the patterns in the examples - the "UserConsumer" is effectively a service which provides methods you can call. This is your consumer, rather than one of the methods being called as part of declaring it (cancel, which is something you would call in the 'with pact' part) Since you haven't created an Order there's no state to check against, so none of the matches will apply Above about the status issue, you're trying to call cancel giving it the argument of the string, rather than the order I would again suggest try and get some help from someone in your company, or go and learn more about the python side, general coding etc. It will help you understand the Pact side much more. The Pact side is plenty confusing by itself without the barrier of using the language :smile:

john
2022-06-23 10:41
Hey Mike, If i run the test it cancels the order in the other service

john
2022-06-23 10:44
So i basically created 2 microservices this orders Microservice and this Kitchen service. I just created the order in the kitchen service via swagger and when I run the test it successfully calls the order service cancel function and canceled the order int he kitchen service can you explain this again: Above about the status issue, you're trying to call cancel giving it the argument of the string, rather than the order

mike.geeves064
2022-06-23 10:46
you have ```@pytest.fixture def consumer() -> Order.cancel: return Order.cancel("http://{host}:{port}".format(host=PACT_MOCK_HOST, port=PACT_MOCK_PORT))``` so you are trying to call Order.cancel with the argument of the url, you aren't creating Order anywhere I can see

john
2022-06-23 10:47
```import atexit from datetime import datetime import logging import os from uuid import UUID import requests import pytest import subprocess import re from pact import Consumer, Like, Provider, Term, Format, EachLike from orders_service.orders import Order, OrderItem log = logging.getLogger(__name__) logging.basicConfig(level=http://logging.INFO) # If publishing the Pact(s), they will be submitted to the Pact Broker here. # For the purposes of this example, the broker is started up as a fixture defined # in conftest.py. For normal usage this would be self-hosted or using Pactflow. PACT_BROKER_URL = "https://xxx.pactflow.io/" PACT_BROKER_USERNAME = "xxx" PACT_BROKER_PASSWORD = "xxx" # Define where to run the mock server, for the consumer to connect to. These # are the defaults so may be omitted PACT_MOCK_HOST = "localhost" PACT_MOCK_PORT = 1234 # Where to output the JSON Pact files created by any tests PACT_DIR = os.path.dirname(os.path.realpath(__file__)) @pytest.fixture def consumer() -> Order.cancel: # return Order("http://{host}:{port}".format(host=PACT_MOCK_HOST, port=PACT_MOCK_PORT)) order = [{"id":"43b2ee86-9c06-45a0-a281-6c136e3bdd7b", "product":"coffee", "size":"big", "quantity":1}] # payload = Order(id="76ac3eb5-a656-49e3-b973-17e7c992cc5e", created="2022-06-23T03:11:19.415574", items=order, status="created").dict() # print("first payload: ",payload) # return Order(payload) return Order(id="43b2ee86-9c06-45a0-a281-6c136e3bdd7b", created="2022-06-23T05:59:02.948144", items=order, status="cancelled") @pytest.fixture(scope="session") def pact(request): """Setup a Pact Consumer, which provides the Provider mock service. This will generate and optionally publish Pacts to the Pact Broker""" # When publishing a Pact to the Pact Broker, a version number of the Consumer # is required, to be able to construct the compatability matrix between the # Consumer versions and Provider versions # version = request.config.getoption("--publish-pact") # publish = True if version else False pact = Consumer("UserServiceClient", version=1).has_pact_with( Provider("UserService"), host_name=PACT_MOCK_HOST, port=PACT_MOCK_PORT, pact_dir=PACT_DIR, publish_to_broker=True, broker_base_url=PACT_BROKER_URL, broker_username=PACT_BROKER_USERNAME, broker_password=PACT_BROKER_PASSWORD, ) pact.start_service() # Make sure the Pact mocked provider is stopped when we finish, otherwise # port 1234 may become blocked atexit.register(pact.stop_service) yield pact # This will stop the Pact mock server, and if publish is True, submit Pacts # to the Pact Broker pact.stop_service() # Given we have cleanly stopped the service, we do not want to re-submit the # Pacts to the Pact Broker again atexit, since the Broker may no longer be # available if it has been started using the --run-broker option, as it will # have been torn down at that point pact.publish_to_broker = False def test_cancel_scheduled_order(pact, consumer): expected = { "id": Format().uuid(), "order": [ { "product": "coffee", "quantity": 1, "size": "big" } ], "scheduled": Format().date(), "status": "cancelled" } (pact .given('A scheduled order exists and it is not cancelled already') .upon_receiving('a request for cancellation') .with_request(method='GET', path='http://127.0.0.1:5000/kitchen/schedule/bc72e917-4af1-4e39-b897-1eda6d006b18/cancel', headers={'Content-Type': 'application/json'},) .will_respond_with(200, body=Like(expected))) with pact: # order = [{"id":"43b2ee86-9c06-45a0-a281-6c136e3bdd7b", "product":"coffee", "size":"big", "quantity":1}] # payload = Order(id="43b2ee86-9c06-45a0-a281-6c136e3bdd7b", created="2022-06-23T06:00:24.667545", items=order, status="pending").dict() # return Order.cancel(payload) # payload = Order(UUID, datetime.now, {"product":"coffee", "size":"large", "quantity":1}, "progress") # print("payload is: ",payload) response = consumer.cancel() # resp = response.json() # print("resp: ", response.json()) # assert resp['status'] == "cancelled" # assert response['status'] == "cancelled" pact.verify()```

john
2022-06-23 10:47
so i create the order hewre: ``` return Order(id="43b2ee86-9c06-45a0-a281-6c136e3bdd7b", created="2022-06-23T05:59:02.948144", items=order, status="cancelled")```

john
2022-06-23 10:50
sorry i realised you must been looking at my old code

mike.geeves064
2022-06-23 11:48
If you're creating it with status cancelled, then it won't match your "if"s in cancel

john
2022-06-23 12:15
sorry Mike what do you mean?

john
2022-06-23 12:16
I just hacked it a bit so that shouldnt be an issue

john
2022-06-23 12:17
i editted the line: if self.status == 'progress'

john
2022-06-23 12:17
so it also considers cancelled orders

john
2022-06-23 12:18
this api is just a sandbox to test out contract testing

mike.geeves064
2022-06-23 12:18
> so i create the order hewre: ``` return Order(id="43b2ee86-9c06-45a0-a281-6c136e3bdd7b", created="2022-06-23T05:59:02.948144", items=order, status="cancelled")``` you're creating it as cancelled

john
2022-06-23 12:20
so even if i create it as pending it is the same

john
2022-06-23 12:20
one thing that isnt yet working. Is when i create an order it doenst yet created the order int he kitchen api

john
2022-06-23 12:21
i can only cancle the orders that are in the other service

matt.fellows
2022-06-23 22:18
> In the pact log, where is the actal request and which is the expected it isn?t very clear? It should say ?Registered expected interaction? for the expected when, and the ?Received? when it receives a call. In your log above, it never received a call - so that would indicate your code is not sending the request to the mock service (which I think you know now, but writing for posterity)

matt.fellows
2022-06-23 22:18
> .with_request(method=?GET?, path=?http://127.0.0.1:5000/kitchen/schedule/bc72e917-4af1-4e39-b897-1eda6d006b18/cancel?, headers={?Content-Type?: ?application/json?},) You?re right btw, you should only have the *path* here, not the full URI

matt.fellows
2022-06-23 22:21
I can?t see in the code above where it calls the actual mock service. I?ve removed the comented things for readability: ``` (pact .given('A scheduled order exists and it is not cancelled already') .upon_receiving('a request for cancellation') .with_request(method='GET', path='/kitchen/schedule/bc72e917-4af1-4e39-b897-1eda6d006b18/cancel', headers={'Content-Type': 'application/json'},) .will_respond_with(200, body=Like(expected))) with pact: // this needs to be sending a request to // http://localhost:1234/kitchen/schedule/bc72e917-4af1-4e39-b897-1eda6d006b18/cancel response = consumer.cancel() pact.verify()```

matt.fellows
2022-06-23 22:23
This method, seems to just be returning a canned object: ```@pytest.fixture def consumer() -> Order.cancel: # return Order("http://{host}:{port}".format(host=PACT_MOCK_HOST, port=PACT_MOCK_PORT)) order = [{"id":"43b2ee86-9c06-45a0-a281-6c136e3bdd7b", "product":"coffee", "size":"big", "quantity":1}] # payload = Order(id="76ac3eb5-a656-49e3-b973-17e7c992cc5e", created="2022-06-23T03:11:19.415574", items=order, status="created").dict() # print("first payload: ",payload) # return Order(payload) return Order(id="43b2ee86-9c06-45a0-a281-6c136e3bdd7b", created="2022-06-23T05:59:02.948144", items=order, status="cancelled")``` Assuming the `consumer.cancel()` calls this code, this would explain why the mock service isn?t seeing any requests, because it?s not making any requests

john
2022-06-23 23:01
thanks Matt Ill have a oplay with it, makes more sense now

john
2022-06-24 06:05
Hey Matt! It seems to work now that i added this: ``` with pact: requests.get( f'http://localhost:1234/kitchen/schedule/43b2ee86-9c06-45a0-a281-6c136e3bdd7b/cancel', data={'order': [{"id":"43b2ee86-9c06-45a0-a281-6c136e3bdd7b", "product":"coffee", "size":"big", "quantity":1}]}) response = consumer.cancel() response = response.json() assert response ['status'] == "cancelled" pact.verify()``` I though that: response = consumer.cancel() would make the call to the mock server as i defined the Object which the cancel method is a apart of in the python fixture. I didnt realise that I need to make the request to the mock server basically. I just need to sort out my api bearer token and i should be able to publish that>

john
2022-06-24 06:06
I wont be giving up my. day job to be writing these tests fulltime thats for sure. But Ill no doubt have many more questions so thanks so much for your patience. It really is appreciated as even my own questions give myself a headache too LOL

matt.fellows
2022-06-24 06:31
So I assume this is just for testing purposes, but: ```# 1 requests.get( f'http://localhost:1234/kitchen/schedule/43b2ee86-9c06-45a0-a281-6c136e3bdd7b/cancel', data={'order': [{"id":"43b2ee86-9c06-45a0-a281-6c136e3bdd7b", "product":"coffee", "size":"big", "quantity":1}]}) # 2 response = consumer.cancel() # 3 response = response.json()``` 1. should really be done as part of 2. 2. You should obviously also add assertions to 3 The whole idea here is that you?re unit testing an API client. Presumably, `consumer` is supposed to be an API client?

mike.geeves064
2022-06-24 07:57
From earlier in the thread, consumer.cancel() would be able to make the GET but the consumer ('Order') being created is 'intentionally' created with status 'cancelled' so it doesn't go through that logic block

john
2022-06-24 08:30
Im not sure how to make #1 part of the #2. That Order class has a method called function in it which makes the request to the kitchen service

matt.fellows
2022-06-24 08:51
If you can't do that then we're testing the wrong thing and we should instead be testing the `function` call, which is the thing that calls the API. It needs to be configurable to talk to the mock service during the unit test

john
2022-06-24 09:09
yeahs thats why I orginally called that consumer.cancel()

john
2022-06-24 09:10
Im going to have to investigate how to configure that for unit testing - this is an area i dont know too much about

john
2022-06-24 09:12
so just so im clear Matt. Presently the consumer.cancel() is calling the real endpoint and not the mock. So I somehow need to configure this Order.cancel to point to the mock server? Does that mean for this contract test it isnt necessary to call the real endpoint?

matt.fellows
2022-06-24 09:12
Bingo

john
2022-06-24 09:13
and it isnt needed at all in the test to call the real endpoint?

john
2022-06-24 09:17
i guess that the provider test will make that request

sandor.arpa
2022-06-24 09:30
has joined #pact-python

matt.fellows
2022-06-24 10:32
> and it isnt needed at all in the test to call the real endpoint? (edited) correct. You usually would dynamically configure the API client to talk to the Pact mock server instead of the real thing. This way it?s close to being deterministic, much more reliable, and you don?t need to stand up the real test environment to run it (isolation).

matt.fellows
2022-06-24 10:32
> i guess that the provider test will make that request Yes. The provider test will re-issue what you put in your consumer test, against the locally running provider in a unit test like environment for the provider side (again, aiming for isolation for deterministic/reliable tests)

mwilso29
2022-06-24 11:19
has joined #pact-python

john
2022-06-24 11:26
ok thanks for all your help. Im going to do some investigating about how to set up that pact mock server with this fastapi.

renaud.meurisse
2022-06-24 12:47
has joined #pact-python

john
2022-06-25 13:59
Hey all just a quick question. I have the following code: ```"""pact test for OrderService provider""" import logging import pytest import os from pact import Verifier from dotenv import load_dotenv load_dotenv() log = logging.getLogger(__name__) logging.basicConfig(level=http://logging.INFO) # For the purposes of this example, the broker is started up as a fixture defined # in conftest.py. For normal usage this would be self-hosted or using Pactflow. PACT_BROKER_BASE_URL=os.getenv('PACT_USER') PACT_BROKER_TOKEN=os.getenv('PACT_BROKER_TOKEN') # For the purposes of this example, the Flask provider will be started up as part # of run_pytest.sh when running the tests. Alternatives could be, for example # running a Docker container with a database of test data configured. # This is the "real" provider to verify against. PROVIDER_HOST = "localhost" PROVIDER_PORT = 5000 PROVIDER_URL = f"http://{PROVIDER_HOST}:{PROVIDER_PORT}" @pytest.fixture def broker_opts(): return { # "broker_username": PACT_BROKER_USERNAME, # "broker_password": PACT_BROKER_PASSWORD, "broker_url": PACT_BROKER_BASE_URL, "publish_version": "1", "publish_verification_results": True, "broker_base_url":PACT_BROKER_BASE_URL, "broker_token":PACT_BROKER_TOKEN } def test_user_service_provider_against_broker(broker_opts): verifier = Verifier(provider="KitchenService", provider_base_url=PROVIDER_URL) # Request all Pact(s) from the Pact Broker to verify this Provider against. # In the Pact Broker logs, this corresponds to the following entry: # PactBroker::Api::Resources::ProviderPactsForVerification -- Fetching pacts for verification by UserService -- {:provider_name=>"UserService", :params=>{}} success, logs = verifier.verify_with_broker( **broker_opts, verbose=True, provider_states_setup_url=f"{PROVIDER_URL}/_pact/provider_states", enable_pending=False, ) # If publish_verification_results is set to True, the results will be # published to the Pact Broker. # In the Pact Broker logs, this corresponds to the following entry: # PactBroker::Verifications::Service -- Creating verification 200 for \ # pact_version_sha=c8568cbb30d2e3933b2df4d6e1248b3d37f3be34 -- \ # {"success"=>true, "providerApplicationVersion"=>"3", "wip"=>false, \ # "pending"=>"true"} # Note: # If "successful", then the return code here will be 0 # This can still be 0 and so PASS if a Pact verification FAILS, as long as # it has not resulted in a REGRESSION of an already verified interaction. # See https://docs.pact.io/pact_broker/advanced_topics/pending_pacts/ for # more details. assert success == 0 def test_KitchenService_provider_against_pact(): verifier = Verifier(provider="KitchenService", provider_base_url=PROVIDER_URL) # Rather than requesting the Pact interactions from the Pact Broker, this # will perform the verification based on the Pact file locally. # # Because there is no way of knowing the previous state of an interaction, # if it has been successful in the past (since this is what the Pact Broker # is for), if the verification of an interaction fails then the success # result will be != 0, and so the test will FAIL. output, _ = verifier.verify_pacts( "../pacts/OrderService-KitchenService.json", verbose=False, provider_states_setup_url="{}/_pact/provider_states".format(PROVIDER_URL), ) assert output == 0``` but I get the error: I did create a new endpoint that posts the data to the KitchenService on the endpoint: So im not quite sure what the error means?

mike.geeves064
2022-06-25 14:24
Take a look at the examples, where provider states are setup

mike.geeves064
2022-06-25 14:25
If you're specifying provider states, you need the endpoint to support it

john
2022-06-26 01:06
is that not what i did set up the providerstate endpoint: /_pact/provider_state?

john
2022-06-26 07:11
i have the following provider code: ```@blueprint.response(200) @blueprint.route('/_pact/provider_states', methods=['POST']) def provider_states(): data = setup_scheduled_order_for_cancellation() mapping = { "A scheduled order exists and it is not cancelled already": data, } mapping[request.json["state"]]() # return {"state":mapping} return jsonify({"result": request.json['state']}) # return mapping def setup_scheduled_order_for_cancellation(): print('inside creat teest data function') payload = {} payload['id'] = '273429e2-e513-4df7-95bc-eeaad7e0e5aa' payload['scheduled'] = datetime.utcnow() payload['status'] = 'pending' payload['order'] = [ { "product": "coffee", "quantity": 1, "size": "big" } ] schedules.append(payload) validate_schedule(payload) return payload``` im not sure what the following lines are supposed to do: ``` mapping[request.json["state"]]() return jsonify({"result": request.json['state']})```

rk8085858
2022-06-26 08:12
has joined #pact-python

matt.fellows
2022-06-26 09:58
You just need to be able to return a 2xx status for the provider states, the main thing is that you are setting up the interaction for a successful test run. It looks like your code probably does that from context

matt.fellows
2022-06-26 10:02
As per https://pact-foundation.slack.com/archives/C9VECUP6E/p1656165624813059, it looks like the pact verifier is getting a `403` when attempting to communicate to your endpoint. Is there auth on it?

john
2022-06-26 11:02
thre isnt any auth on the endpoint

matt.fellows
2022-06-26 11:05
The verifier can also emit a log file, which shows you what it?s doing/seeing

john
2022-06-26 11:06
i see a log file

john
2022-06-26 11:06
but it doesnt show much

john
2022-06-26 11:08
I get a log like this:

john
2022-06-26 11:08
```Failed interactions: PACT_DESCRIPTION='a request for cancellation' PACT_PROVIDER_STATE='A scheduled order exists and it is not cancelled already' /Users/johnwilliams/.local/share/virtualenvs/kitchen-75vucmml/bin/pytest provider_test.py # A request for cancellation given A scheduled order exists and it is not cancelled already opening connection to http://reallyusefulengine.pactflow.io:443... opened starting SSL for http://reallyusefulengine.pactflow.io:443... SSL established <- "POST /pacts/provider/KitchenService/consumer/OrdersService/pact-version/151338713becd543895163268e6e1043cd4d772f/metadata/c1tdW2xdPXRydWUmc1tdW2N2XT0xNg/verification-results HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: application/hal+json, */*\r\nUser-Agent: Ruby\r\nContent-Type: application/json\r\nAuthorization: [redacted]\r\n" <- "{\"success\":false,\"providerApplicationVersion\":\"1\",\"testResults\":{\"tests\":[{\"testDescription\":\"has status code 200\",\"testFullDescription\":\"Verifying a pact between OrdersService and KitchenService Given A scheduled order exists and it is not cancelled already a request for cancellation with GET /kitchen/schedule/273429e2-e513-4df7-95bc-eeaad7e0e5aa/cancel returns a response which has status code 200\",\"status\":\"failed\",\"interactionProviderState\":\"A scheduled order exists and it is not cancelled already\",\"interactionDescription\":\"a request for cancellation\",\"exception\":{\"class\":\"Pact::ProviderVerifier::SetUpProviderStateError\",\"message\":\"Error setting up provider state 'A scheduled order exists and it is not cancelled already' for consumer 'OrdersService' at http://localhost:5000/_pact/provider_states. response status=403 response body=\"}},{\"testDescription\":\"has a matching body\",\"testFullDescription\":\"Verifying a pact between OrdersService and KitchenService Given A scheduled order exists and it is not cancelled already a request for cancellation with GET /kitchen/schedule/273429e2-e513-4df7-95bc-eeaad7e0e5aa/cancel returns a response which has a matching body\",\"status\":\"failed\",\"interactionProviderState\":\"A scheduled order exists and it is not cancelled already\",\"interactionDescription\":\"a request for cancellation\",\"exception\":{\"class\":\"Pact::ProviderVerifier::SetUpProviderStateError\",\"message\":\"Error setting up provider state 'A scheduled order exists and it is not cancelled already' for consumer 'OrdersService' at http://localhost:5000/_pact/provider_states. response status=403 response body=\"}}],\"summary\":{\"testCount\":2,\"failureCount\":2},\"metadata\":{\"warning\":\"These test results use a beta format. Do not rely on it, as it will definitely change.\",\"pactVerificationResultsSpecification\":{\"version\":\"1.0.0-beta.1\"}}}}" -> "HTTP/1.1 201 Created\r\n" -> "Date: Sun, 26 Jun 2022 11:06:16 GMT\r\n" -> "Content-Type: application/hal+json;charset=utf-8\r\n" -> "Content-Length: 2830\r\n" -> "Connection: keep-alive\r\n" -> "Vary: Accept\r\n" -> "Location: https://reallyusefulengine.pactflow.io/pacts/provider/KitchenService/consumer/OrdersService/pact-version/151338713becd543895163268e6e1043cd4d772f/verification-results/246\r\n" -> "Server: Webmachine-Ruby/1.6.0 Rack/1.3\r\n" -> "X-Pact-Broker-Version: 2.100.0\r\n" -> "X-Content-Type-Options: nosniff\r\n" -> "Strict-Transport-Security: max-age=63072000; includeSubDomains; preload\r\n" -> "X-Pact-Broker-Git-Sha: eb163ede\r\n" -> "X-Pactflow-Git-Sha: 20b84cf0a\r\n" -> "X-Request-Id: 1d1c887ae363993d23c5ba48cc86741d\r\n" -> "\r\n" reading 2830 bytes... -> "{\"providerName\":\"KitchenService\",\"providerApplicationVersion\":\"1\",\"success\":false,\"verificationDate\":\"2022-06-26T11:06:16.390+00:00\",\"testResults\":{\"tests\":[{\"testDescription\":\"has status code 200\",\"testFullDescription\":\"Verifying a pact between OrdersService and KitchenService Given A scheduled order exists and it is not cancelled already a request for cancellation with GET /kitchen/schedule/273429e2-e513-4df7-95bc-eeaad7e0e5aa/cancel returns a response which has status code 200\",\"status\":\"failed\",\"interactionProviderState\":\"A scheduled order exists and it is not cancelled already\",\"interactionDescription\":\"a request for cancellation\",\"exception\":{\"class\":\"Pact::ProviderVerifier::SetUpProviderStateError\",\"message\":\"Error setting up provider state 'A scheduled order exists and it is not cancelled already' for consumer 'OrdersService' at http://localhost:5000/_pact/provider_states. response status=403 response body=\"}},{\"testDescription\":\"has a matching body\",\"testFullDescription\":\"Verifying a pact between OrdersService and KitchenService Given A scheduled order exists and it is not cancelled already a request for cancellation with GET /kitchen/schedule/273429e2-e513-4df7-95bc-eeaad7e0e5aa/cancel returns a response which has a matching body\",\"status\":\"failed\",\"interactionProviderState\":\"A scheduled order exists and it is not cancelled already\",\"interactionDescription\":\"a request for cancellation\",\"exception\":{\"class\":\"Pact::ProviderVerifier::SetUpProviderStateError\",\"message\":\"Error setting up provider state 'A scheduled order exists and it is not cancelled already' for consumer 'OrdersService' at http://localhost:5000/_pact/provider_states. response status=403 response body=\"}}],\"summary\":{\"testCount\":2,\"failureCount\":2},\"metadata\":{\"warning\":\"These test results use a beta format. Do not rely on it, as it will definitely change.\",\"pactVerificationResultsSpecification\":{\"version\":\"1.0.0-beta.1\"}}},\"verifiedBy\":{},\"_links\":{\"self\":{\"title\":\"Verification result\",\"name\":\"Verification result 246 for Pact between OrdersService (1) and KitchenService\",\"href\":\"https://reallyusefulengine.pactflow.io/pacts/provider/KitchenService/consumer/OrdersService/pact-version/151338713becd543895163268e6e1043cd4d772f/verification-results/246\"},\"pb:pact-version\":{\"title\":\"Pact\",\"name\":\"Pact between OrdersService (1) and KitchenService\",\"href\":\"https://reallyusefulengine.pactflow.io/pacts/provider/KitchenService/consumer/OrdersService/pact-version/151338713becd543895163268e6e1043cd4d772f/metadata/Y3ZuPTE\"},\"pb:triggered-webhooks\":{\"title\":\"Webhooks triggered by the publication of this verification result\",\"href\":\"https://reallyusefulengine.pactflow.io/pacts/provider/KitchenService/consumer/OrdersService/pact-version/151338713becd543895163268e6e1043cd4d772f/verification-results/246/triggered-webhooks\"}}}" read 2830 bytes Conn keep-alive INFO: Verification results published to https://reallyusefulengine.pactflow.io/pacts/provider/KitchenService/consumer/OrdersService/pact-version/151338713becd543895163268e6e1043cd4d772f/verification-results/246```

matt.fellows
2022-06-26 11:08
I don?t know the python interface very well, but looks like you can make it go to debug level: https://github.com/pact-foundation/pact-python/blob/8085be0d6f8bbed1adeaa0aad0837d7d84c3ab82/pact/verify_wrapper.py#L155

matt.fellows
2022-06-26 11:09
I think also setting the `VERBOSE=true` environment variable might land you with better logs

matt.fellows
2022-06-26 11:09
(that would just bypass the Python API)

john
2022-06-26 11:16
``` 2) Verifying a pact between OrdersService and KitchenService Given A scheduled order exists and it is not cancelled already a request for cancellation with GET /kitchen/schedule/273429e2-e513-4df7-95bc-eeaad7e0e5aa/cancel returns a response which has a matching body Failure/Error: set_up_provider_states interaction.provider_states, options[:consumer] Pact::ProviderVerifier::SetUpProviderStateError: Error setting up provider state 'A scheduled order exists and it is not cancelled already' for consumer 'OrdersService' at http://localhost:5000/kitchen/_pact/provider_states. response status=403 response body=```

matt.fellows
2022-06-26 11:18
hmm thanks. > ``` http://localhost:5000/kitchen/_pact/provider_states``` That doesn?t seem to line up with the code I see above. Specifically, I can?t see where `/kitchen` is set on the states endpoint?

john
2022-06-26 11:18
ah yeah sorry i just changed that

john
2022-06-26 11:19
so the provide has

john
2022-06-26 11:19
provider_states_setup_url="{}/kitchen/_pact/provider_states".format(PROVIDER_URL)

john
2022-06-26 11:19
@blueprint.route('/kitchen/_pact/provider_states', methods=['POST']) def provider_states():

john
2022-06-26 11:20
one thing Matt if I use swagger to manually post to that _pact/provider_states endpoint i get an error

matt.fellows
2022-06-26 11:23
> one thing Matt if I use swagger to manually post to that _pact/provider_states endpoint i get an error This is your code right? So perhaps you have validation to ensure you have a valid JSON object sent to that endpoint

matt.fellows
2022-06-26 11:24
As a starting point, i?d suggest adding logging to your `kitchen/_pact/provider_states` endpoint to a) ensure it?s actually called b) see what the shape of the payload from Pact is c) ensure it?s not failing mid way

matt.fellows
2022-06-26 11:26
(I have to run sorry - but I?d be inclined to assume the verifier is not lying to you, and is receiving a `403` from some endpoint - you just need to figure out which one!)

john
2022-06-26 11:26
no worries Matt, enjoy the rest of your evening

john
2022-06-26 13:06
the error seems to be because of this: ``` mapping[request.json["state"]]() TypeError: 'dict' object is not callable``` but im not sure how to fix that. Anyhow pretty late so ill go to bed

john
2022-06-26 13:08
ahh man

john
2022-06-26 13:09
i fixed it buy doing this: ```@blueprint.response(200) @blueprint.route('/kitchen/_pact/provider_states', methods=['Post']) def provider_state(): print(request) data = setup_scheduled_order_for_cancellation() mapping = { "A scheduled order exists and it is not cancelled already": data, } # mapping[request.json["state"]]() return {"state":mapping}``` at least it is one step forward

matt.fellows
2022-06-26 23:28
nice work! Also if I read the above, you are execute the state for the cancellation there on every call to that endpoint - probably not what you want? Really, you only want to seed the cancellation info when the ?A scheduled order exists and it is not cancelled already? state is fired. In the current handler, the data is always setup even if the cancellation state isn?t intended to be setup ``` mapping = { "A scheduled order exists and it is not cancelled already": setup_scheduled_order_for_cancellation(), } mapping[request.json["state"]]() # <- this now only fires the function if found. You should properly guard this to avoid errors for states that aren't mapped```

john
2022-06-26 23:37
Im glad it is kind of working now. I added Like(expected to my assertion and it doesn't seem to complain about differences in the date now, so that is cool. The reason why it didn't seem to work before was in the provider test I was pointing to localhost but the expectation was 127.0.0.1. Also when I tried to use the code for that only runnning state data setup (from the example) I got the error: ```mapping[request.json["state"]]() TypeError: 'dict' object is not callable```

matt.fellows
2022-06-26 23:45
Yes, it?s because you didn?t pass a function to that mapping dict, you executed the function and so you were trying to call a function that was not a function

matt.fellows
2022-06-26 23:46
i.e. ```@blueprint.response(200) @blueprint.route('/_pact/provider_states', methods=['POST']) def provider_states(): data = setup_scheduled_order_for_cancellation() # -< You already called the function here mapping = { "A scheduled order exists and it is not cancelled already": data, # <- data is not a function now, it's the data. You should just pass the function here } mapping[request.json["state"]]() # <- can't call this, because it's just data not a function. # return {"state":mapping} return jsonify({"result": request.json['state']}) # return mapping```

john
2022-06-26 23:49
Let me try that again

john
2022-06-26 23:50
ill try to get that working

matt.fellows
2022-06-26 23:52
Also last one. You have used a like matcher for a string date. A like matcher just looks at the underlying json type and only fails if the type is different. So any string would make that test pass. You probably want a regex on a particular string format

john
2022-06-27 00:16
yes good point, is something im going to investigate next

john
2022-06-27 00:26
as the point of the test is to make sure orders can be canclled

alex.savage
2022-06-27 08:26
has joined #pact-python

simon.selvadurai
2022-06-27 08:28
has joined #pact-python

yasir.khan
2022-06-27 11:21
has joined #pact-python

willem.basson
2022-06-27 11:25
has joined #pact-python

edward.francis
2022-06-27 11:32
has joined #pact-python

laura.cabantous
2022-06-27 11:35
has joined #pact-python

ruslan.charuh
2022-06-27 12:18
has joined #pact-python

pramod-arjun.bhalerao
2022-06-27 12:54
has joined #pact-python

ssomepalli
2022-06-27 14:30
has joined #pact-python

owen.oclee.old
2022-06-27 16:13
has joined #pact-python

oherescu
2022-06-27 19:21
has joined #pact-python

nathan.tejuco
2022-06-28 03:50
has joined #pact-python

jun.ito
2022-06-28 07:47
has joined #pact-python

daniel.shamaeli
2022-06-28 09:01
has joined #pact-python

michael.oloyede
2022-06-28 09:55
has joined #pact-python

lucas.azzola
2022-06-29 04:18
has joined #pact-python

jens.suhr
2022-06-29 09:25
has joined #pact-python

jens.suhr
2022-06-29 09:26
@jens.suhr has left the channel

thammarith.likittheer
2022-06-29 10:46
has joined #pact-python

andrevpuc
2022-06-29 14:24
has joined #pact-python

mylesjj
2022-06-29 16:26
has joined #pact-python

oliviawalsh1
2022-06-30 09:49
has joined #pact-python

john
2022-07-01 02:53
Is provider-state-injected something which is available with Python?

hiepluong2205
2022-07-01 06:40
has joined #pact-python

saleh.elnagar
2022-07-01 13:20
has joined #pact-python

animesh.kumar
2022-07-03 16:54
has joined #pact-python

omri.benyair
2022-07-04 03:14
has joined #pact-python

chriswilliamsef
2022-07-04 13:11
has joined #pact-python

rioka68
2022-07-04 13:32
has joined #pact-python

heinenm
2022-07-04 14:01
has joined #pact-python

omri.eyal
2022-07-05 06:22
has joined #pact-python

shen-yu
2022-07-05 15:35
has joined #pact-python

ben.foster
2022-07-05 15:42
has joined #pact-python

maarten.gryp
2022-07-05 16:20
has joined #pact-python

megha.t
2022-07-06 06:56
has joined #pact-python

ravindra.dhaka
2022-07-06 07:08
has joined #pact-python

mrigendra.ranjan
2022-07-06 07:08
has joined #pact-python

deepak.bhoria
2022-07-06 07:11
has joined #pact-python

cjenkins
2022-07-06 07:17
has joined #pact-python

megha.t
2022-07-06 07:18
Hi All, I am completely new to pact so decided to start with the examples given in _pact-python_ repo.I cloned the repo and am running the _pact broker via docker compose_ as mentioned in the readme. I intermittently get the error `container for service "broker_app" is unhealthy` What can be the issue with the container? Also, on running `./run_pytest.sh`, with a healthy broker, I get the following error:- ``` docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))``` What can be causing the issue? Any insights will be greatly appreciated. TIA

elliottmurray
2022-07-06 07:23
This is a docker issue by the looks of it. Are there some log messages around the broker app start up?

megha.t
2022-07-06 07:29
Thanks for replying @elliottmurray Here are the log messages for the broker when I do a `docker-compose up` :-

elliottmurray
2022-07-06 07:38
Pact broker clearly didn't start and it looks like that you have an issue with the postgres connection. There are a few ways to investigate this but at it's heart when you do ```docker-compose up``` you should be able to log into the broker which IIRC is localhost:8080. I suspect postgres instance didn't start so work back from that (assume you don't have something on port 5432 already?)

elliottmurray
2022-07-06 07:38
It's really a docker question not a pact question so if you have someone on your team who knows that ask them to help you debug it

megha.t
2022-07-06 07:45
Okay. When I do a docker ps on a successful `docker-compose up`I get the following response(attached) but the docker connection exception persists on running the pytests for consumer.

elliottmurray
2022-07-06 07:54
Why is postgres up for 12 minutes but your broker for 24 seconds?

gustavo.chain
2022-07-06 08:04
has joined #pact-python

megha.t
2022-07-06 08:12
I am not sure. Postgres was healthy in the first attempt itself. Does it matter?

tobias.friedrich
2022-07-06 08:31
has joined #pact-python

ganesh.panchagnula-no
2022-07-06 11:50
has joined #pact-python

morten.gejl
2022-07-06 13:02
has joined #pact-python

varunthaper
2022-07-06 15:17
has joined #pact-python

jwheatley
2022-07-06 17:12
has joined #pact-python

noor.hashem
2022-07-06 20:23
has joined #pact-python

dormeiri
2022-07-07 09:41
has joined #pact-python

andreaschung1
2022-07-07 12:28
has joined #pact-python

parvatshiva
2022-07-07 22:05
has joined #pact-python

adam.anderson
2022-07-08 01:19
Hello, is there any support right now for BDCT in Pactflow using pact-python?

matt.fellows
2022-07-08 06:58
Pactflow just needs a consumer contract in pact format - so yes python supports it. On the provider it's not used, you need to BYO provider testing tool and publish an OAS

jonathan.dowling
2022-07-08 11:37
has joined #pact-python

alex423
2022-07-08 13:59
has joined #pact-python

francis.williams
2022-07-08 19:52
has joined #pact-python

dmitry.sarkisov
2022-07-08 20:07
has joined #pact-python

neokree
2022-07-09 10:50
has joined #pact-python

lynn.alhaimy
2022-07-10 18:20
has joined #pact-python

eirikval
2022-07-11 15:08
has joined #pact-python

sahil.jain
2022-07-12 10:21
has joined #pact-python

kyriacos.elia
2022-07-12 15:43
has joined #pact-python

fabricio.mendes.ti
2022-07-12 16:33
has joined #pact-python

cameron.allan853
2022-07-12 23:18
has joined #pact-python

jeroen.lamain
2022-07-13 08:49
has joined #pact-python

programmingwithbangal
2022-07-13 12:48
has joined #pact-python

rohitkeshwani07
2022-07-13 13:28
has joined #pact-python

gjvengelen
2022-07-13 18:18
has joined #pact-python

lorenz.ammon
2022-07-14 08:52
has joined #pact-python

remigijus.mazulis
2022-07-14 08:53
has joined #pact-python

seanruffatti
2022-07-14 14:40
has joined #pact-python

oury.diallo
2022-07-14 17:05
@matt.fellows any example on how to publish the openapi spec to pactflow in a python project cc @adam.anderson in case you have done this.

matt.fellows
2022-07-14 17:07
Just use the CLI tools to publish, it is language agnostic

oury.diallo
2022-07-14 17:08
Thanks!

nico.neirinck
2022-07-15 06:10
has joined #pact-python

k.bangarusamy
2022-07-15 14:36
has joined #pact-python

harinder.kaur
2022-07-15 17:19
has joined #pact-python

mahidasp
2022-07-16 17:30
has joined #pact-python

juan.aa.espiritu
2022-07-17 08:39
has joined #pact-python

thomas.loudon
2022-07-18 11:05
has joined #pact-python

david.hayden
2022-07-18 11:12
has joined #pact-python

hakan.b.jansson
2022-07-18 14:04
has joined #pact-python

mike.geeves064
2022-07-18 15:08
One of those, I can see how to fix, but not without potentially causing issues for people elsewhere, and best to try and fix in a way that is consistent with other languages, and who knows how they work :smile:

jakehowden
2022-07-18 15:54
has joined #pact-python

remigijus.mazulis
2022-07-19 09:18
@remigijus.mazulis has left the channel

chrstnklb
2022-07-19 10:58
has joined #pact-python

andrew.favaloro
2022-07-19 19:36
has joined #pact-python

tarun.gulati1988
2022-07-19 19:41
has joined #pact-python

boweixu
2022-07-19 20:39
has joined #pact-python

juanalvarezarquillos
2022-07-20 05:46
has joined #pact-python

jkaur
2022-07-20 06:32
has joined #pact-python

steve.heasman
2022-07-20 09:08
has joined #pact-python

je.alvinez
2022-07-20 11:17
has joined #pact-python

jbecker
2022-07-20 14:14
Is there a good way to mock a pact provider service's dependencies during the verification run? I want to seed my fake db with test data when I run my setup functions, but because of the way our service is designed, it is reaching out to other services to get auth data and other such things tangentially related to the contract I'm trying to verify, so even with the fake data the contract is expecting, I'm not accessing that data when the pact verifier runs because the user that it's using can't be retrieved because the pact provider service can't reach the auth service. The traditional methods of mocking that I'm familiar with are all for running unit tests though (like the pytest_mock's MockerFixture.patch, for example) and while I could overwrite the config that contains the base url of the auth service and run another mock server to return the expected user data whenever it's called, that seems like it'll wind up being a lot of extra work and it seems like there's got to be another better solution.

jbecker
2022-07-20 14:19
The issue I think is that the pact verifier process is in a weird half-way point between the production app and the unit test app. We have a very unit-testable extension of our app already built out for the purpose of our pytest suite which mocks out all the external dependencies, but for the pact verification we want to run the actual instance of the provider service. On the other end of the spectrum though is the production-ready provider service, which is what the provider verification process is running (plus the additional route for posting states obviously). But this service doesn't have any mocks built out or any special testing logic because it's assumed it runs in a live environment with other external services which it can actually call.

mike.geeves064
2022-07-20 14:47
Thinking of the config with the url, would it work without too much extra to add in endpoints to the service when verifying? I'm thinking similar to how in the examples it adds a route for the state endpoint and behaviour there - you could add another auth endpoint so something can get called and just do nothing, then at least it's all in one place together :thinking_face:

mike.geeves064
2022-07-20 14:49
Alternatively, maybe in the state handler, you could just monkey patch out the actual methods that go and do the auth No clue how nice it would be as a pattern

mike.geeves064
2022-07-20 14:49
:smile:

jbecker
2022-07-20 14:51
I'm not exactly a python expert. Can you monkey-patch a function that's being imported into a class? So it's not an attribute on the class itself...

mike.geeves064
2022-07-20 14:53
It gets quite messy and is easy to end up with it not working but yes you should be able to, I'd need to dig out some examples to explain better [it's easy to import from somewhere, but then not mock correctly if you import differently where you're doing the mocking]

matkruse
2022-07-20 14:53
has joined #pact-python

jbecker
2022-07-20 14:54
Like I may have: ```from function_lib import helper_function class ThingDoer: def do_thing(self): value = helper_function() # < snip out lots of logic on the value > return value```

jbecker
2022-07-20 14:55
I get how one might monkey patch `do_thing()` function, but not how to monkey patch over the `helper_function()` call, which is ultimately the bit I want to overwrite

mike.geeves064
2022-07-20 14:56
I will dig out some examples and get back to you in a bit, just on a call now :slightly_smiling_face:

jbecker
2022-07-20 14:57
Cool, thank you

mike.geeves064
2022-07-20 15:26
Right, so: I have some code which for the "get_auth" goes and uses boto to talk to AWS and get credentials, this is in `bearly_utils/ig.py` in a completely separate package in my test code I can then do: ```from bearly_utils import ig``` and later: ```class MockIgAuth(NamedTuple): identifier: str password: str key: str environment: str = "demo" @pytest.fixture def patch_bearly_utils(monkeypatch): def get_auth(account): account_json = json.loads(account) mock_account = account_json["account"]["mock"] return MockIgAuth( identifier=mock_account["identifier"], password=mock_account["password"], key=mock_account["key"] ) monkeypatch.setattr(ig, "get_auth", get_auth)``` The key bit with the monkeypatch is you are importing something as `ig`, and where you're using it for real, you have the same import line.... I mean here if I had just `import bearly_utils` and then tried to do `bearly_utils.ig.get_auth` it wouldn't match up with the monkeypatched one. I hope that makes sense :smile: When it's used in the actual non-test code it's called like: ```auth = ig.get_auth(account=account)```

jbecker
2022-07-20 16:00
How do you use pytest fixtures in your provider verification?

mike.geeves064
2022-07-20 16:12
Hmm, that one's separate from Pact usage, there isn't actually Pact in where that mocking is happening

mike.geeves064
2022-07-20 16:13
I'm not quite sure what you mean by "how" though?

mike.geeves064
2022-07-20 16:14
Where I'm currently using Pact is message rather than "normal" http, and it was less effort to use requests-mock in multiple places to mock out the calls than monkeypatch them, so I haven't followed that approach here

jbecker
2022-07-20 16:15
Maybe I didn't make my original question clear then. I'm trying to mock out the auth package which my provider service consumes when I'm verifying a pact for this provider. Since the pact verifier script does not use pytest, I don't know how to mock dependencies without it, so I'm stuck

mike.geeves064
2022-07-20 16:16
ohhh ok, I thought as you mentioned pytest that you were using it

jbecker
2022-07-20 16:16
I wish, that would solve a lot of problems

jbecker
2022-07-20 16:16
I assumed it wasn't possible to use pytest for provider verification though

mike.geeves064
2022-07-20 16:16
it's been a while since using unittest, if you mean you're using that instead?

jbecker
2022-07-20 16:17
For my provider verification? How would that work?

mike.geeves064
2022-07-20 16:18
pact-python/examples/fastapi_provider is using pytest

mike.geeves064
2022-07-20 16:19
I may be completely misunderstanding or missing something, apologies if so :sweat_smile: How are you currently verifying then?

jbecker
2022-07-20 16:19
I run my provider service, then I run the "verify provider" cli and point it at this provider's host/port and provide the pactfile (etiher as a url or as a file path)

jbecker
2022-07-20 16:23
I see, you're not using the verifier cli

jbecker
2022-07-20 16:23
you're doing everything in pytest and starting the server as a fixture :thinking_face:

mike.geeves064
2022-07-20 16:24
yeah, the run_pytest rather than verify_pact route

jbecker
2022-07-20 16:25
shoot, I'd have to re-write a lot to do it this way now...

mike.geeves064
2022-07-20 16:25
Huge disclaimer around I'm not in any way saying it's the best or even better way :slightly_smiling_face:

mike.geeves064
2022-07-20 16:26
I think that could still work going back to the original suggestion around doing something in the provider state

jbecker
2022-07-20 16:26
I thought it would be easier from the perspective of our CI/CD pipeline if the provider logic was the same, so I based it on the verifier cli

mike.geeves064
2022-07-20 16:33
> if the provider logic was the same same as? in principle i like the idea of a nice and consistent calling a cli if that's what you meant, but I've gone for wrapping it up everywhere so my ci/cd does a "make test" regardless of what it is where possible (again, it's an approach, rather than necessarily being the best route)

jbecker
2022-07-20 16:34
Same as our Java services and our Node services

mike.geeves064
2022-07-20 16:35
using cli verifier you mean? makes sense

2billy
2022-07-20 16:56
has joined #pact-python

mike.geeves064
2022-07-20 17:05
I can maybe try and play with some code later, but I think you should be able to just monkey patch like that from the provider state handler in exactly the same way :thinking_face: Ignore that it's in a fixture, you just have an alternative method call that returns something which you're patching in

oury.diallo
2022-07-21 03:03
Hey guys, I am new to PACT/Pactflow, I am currently building a bi-directional contract testing POC. Our consumer is in typescript and the provider is a python based service. So far, I was able to publish my consumer contract to pactflow and I also used the pact standalone cli to publish the openapi spec to pactflow from the provider: ```./pact/bin/pactflow publish-provider-contract \ "openapi/v0/openapi.yaml" \ --broker-token=<token> \ --broker-base-url=https://adae.pactflow.io \ --specification=oas \ --provider "messaging-api" \ --provider-app-version 12345\ --branch cdc \``` After I ran the above, it published the openapi spec and also validated the consumer contract but I also noticed the provider contract (self verification) was not done. That's the piece I am a bit confused about. Our openapi spec is manually generated and we use pytest to validate it. How can I get the provider contract (openapi) to be validated in pactflow as well? I saw the below args for the CLI but I am not quite sure how to use them. --verification-exit-code=EXIT_CODE \ --verification-results REPORT_PATH \ --verification-results-content-type REPORT_CONTENT_TYPE \ --verifier VERIFIER Is it even necessary to do the provider contract self validation in pactflow if we already have tests that validate the openapi spec? I am also contemplating using dredd maybe to validate our openapi spec. I am looking for a bit of guidance, best practice etc. Any help is greatly appreciated.

matt.fellows
2022-07-21 08:36
> Is it even necessary to do the provider contract self validation in pactflow if we already have tests that validate the openapi spec? Pactflow doesn?t do the verification, you just need to tell Pactflow that it was / was not verified successfully.

matt.fellows
2022-07-21 08:36
We allow the situation for you to publish the work in progress OAS, even if the implementation is not yet done.

matt.fellows
2022-07-21 08:38
In the case of pytest, if you have at output file you can upload as the report path, that should suffice. Otherwise an empty string I think will work for that value

matt.fellows
2022-07-21 08:38
An exit code of `0` would indicate success

christopher.forbes
2022-07-21 09:27
has joined #pact-python

megha.t
2022-07-21 10:14
Hi I am new to pact and was checking out the examples folder for pact-python to test out publishing pacts. I was able to generate a pact for the example consumer earlier but now I am seeing the following error:- ```docker.errors.ContainerError: Command 'publish /pacts --consumer-app-version 1' in image 'pactfoundation/pact-cli:latest' returned non-zero exit status 1: b"bundler: failed to load command: /pact/bin/pact (/pact/bin/pact)\n/usr/lib/ruby/2.7.0/net/http.rb:960:in `initialize': Failed to open TCP connection to broker_app:9292 (getaddrinfo: Name does not resolve)``` I did not change anything in the _sharedfixtures.py_ file. The pact-broker app is up and running on 9292 but I am still getting this error. Any help would be greatly appreciated!

oury.diallo
2022-07-21 14:11
Thanks a lot Matt! This helped.

sandy.oberoi
2022-07-21 18:57
has joined #pact-python

adelamarre
2022-07-21 19:37
has joined #pact-python

adam.anderson
2022-07-21 23:24
@matt.fellows we have graphql endpoints, any recommendation there for uploading? Is there a way to upload a set of example provider responses instead of a spec?

matt.fellows
2022-07-21 23:28
At this moment in time we don?t support GraphQL for the BDCT flow. You could still use the standard Pact workflow of course

matt.fellows
2022-07-21 23:29
The idea of uploading something that is not actually the provider spec (e.g. OAS/GraphQL) but a series of tests is something we are considering, but haven?t yet got an official position on

adam.anderson
2022-07-21 23:35
Thanks Matt, we have the standard verification flow up and running but excited to try BDCT.

husamhindustani
2022-07-22 06:52
has joined #pact-python

harley
2022-07-23 02:15
has joined #pact-python

japlavaren
2022-07-25 09:21
has joined #pact-python

alasdair.ryan
2022-07-25 10:45
has joined #pact-python

hui.supat
2022-07-25 13:22
has joined #pact-python

balaramvineethvenugop
2022-07-25 17:06
has joined #pact-python

alan.still
2022-07-25 18:18
has joined #pact-python

yshkedi
2022-07-25 21:16
has joined #pact-python

apapia
2022-07-26 02:27
has joined #pact-python

mike.geeves064
2022-07-26 08:53
how was that almost a week ago :open_mouth: did you manage to get anywhere in the end?

rziembicki
2022-07-26 10:47
has joined #pact-python

dpal
2022-07-26 10:58
has joined #pact-python

dgrace
2022-07-26 11:02
has joined #pact-python

dgowdappa
2022-07-26 11:02
has joined #pact-python

jbecker
2022-07-26 13:23
I got something working. I didn't want to have to rewrite everything to utilize pytest, so I just wrote a handful of mocks manually and managed to get them to work so :thumbsup:

sascha_pactflow
2022-07-26 20:29
has joined #pact-python

hunsolitude
2022-07-26 22:34
has joined #pact-python

maksym_odanets
2022-07-27 08:07
has joined #pact-python

andrew.january
2022-07-27 09:03
has joined #pact-python

davidf
2022-07-27 09:17
has joined #pact-python

ankit.mittal
2022-07-28 10:00
has joined #pact-python

vishal.kukreja
2022-07-28 10:22
has joined #pact-python

robert.henzel
2022-07-28 19:50
has joined #pact-python

adrianminnock123
2022-07-29 08:53
has joined #pact-python

adam.witko
2022-07-29 09:39
@adam.witko has left the channel

massimiliano.devivo
2022-07-29 12:12
has joined #pact-python

hareesh.dj
2022-07-30 12:01
has joined #pact-python

heera
2022-07-31 08:00
has joined #pact-python

adam.redlisiak
2022-08-01 10:18
has joined #pact-python

altan.demirkiran846
2022-08-01 14:38
has joined #pact-python

nick080
2022-08-01 14:44
has joined #pact-python

ali.ustek
2022-08-01 15:09
has joined #pact-python

elliottmurray
2022-08-01 16:35
Sorry been away from this for a while but have noticed the same issues locally. Did you resolve it? I?ll have a look next week otherwise

momarquez
2022-08-01 19:37
has joined #pact-python

rubemfsv15
2022-08-02 20:13
has joined #pact-python

rene.klatt
2022-08-03 06:13
has joined #pact-python

imayat
2022-08-03 09:42
has joined #pact-python

mark.shand
2022-08-03 10:15
has joined #pact-python

gunjan.titiya
2022-08-03 11:51
has joined #pact-python

chaitanya.guttula
2022-08-03 12:43
has joined #pact-python

deb.kimnach
2022-08-03 12:48
has joined #pact-python

adam.anderson
2022-08-03 23:46
Hi, is there a pattern with the Python pact Verifier to route the requests to a python function instead of `localhost:<port>` ?

kaiquan.shi
2022-08-04 03:38
has joined #pact-python

mike.geeves064
2022-08-04 07:28
You could maybe try the pact-message approach, the provider is mapped to a handler, essentially the function to call to perform the "request", rather than running a service normally. I don't think the examples currently show much around how to handle arguments etc. What's the scenario, where the normal http endpoint approach doesn't work for you?

aalexandrumihai
2022-08-04 10:15
has joined #pact-python

alex.makdessi
2022-08-04 13:03
has joined #pact-python

ynechaieva
2022-08-04 14:11
has joined #pact-python

adam.anderson
2022-08-04 21:25
Our microservices run GraphQL (graphene) through AWS lambda. So running on localhost would rely on using `sam local` which has slow build / run / hot reload times. The routing could be direct to: ```schema = graphene.Schema(...) return schema.execute(query, variables)```

dineshh.wot2021
2022-08-05 10:17
has joined #pact-python

fernandapontual5
2022-08-05 11:34
has joined #pact-python

sridhar140895
2022-08-05 11:58
has joined #pact-python

glenn
2022-08-06 18:13
has joined #pact-python

sandy.mechie
2022-08-07 21:46
has joined #pact-python

prapurna.manda3
2022-08-08 07:38
has joined #pact-python

jaroslavburi
2022-08-08 14:44
has joined #pact-python

manumahendran
2022-08-08 16:14
has joined #pact-python

lmendonca
2022-08-08 22:18
has joined #pact-python

jbrauchler
2022-08-08 22:44
has joined #pact-python

cristideacc
2022-08-09 09:05
has joined #pact-python

thanuxxxx
2022-08-09 15:16
@thanuxxxx has left the channel

alison.stuart.contrac
2022-08-09 20:41
has joined #pact-python

tischnerd
2022-08-11 06:49
has joined #pact-python

joel.wochele
2022-08-11 12:53
has joined #pact-python

evert.vanloo
2022-08-12 12:16
has joined #pact-python

jors.matthys
2022-08-12 13:27
has joined #pact-python

ricardo.maury
2022-08-12 18:34
has joined #pact-python

prateekm33
2022-08-15 00:46
has joined #pact-python

ahmed.fahmy
2022-08-15 09:10
has joined #pact-python

tpaktopsp
2022-08-15 18:47
has joined #pact-python

julian.schmidt
2022-08-16 09:03
has joined #pact-python

jack340
2022-08-16 09:11
has joined #pact-python

g.varga
2022-08-16 11:55
has joined #pact-python

lnthai2002
2022-08-16 15:02
has joined #pact-python

sarunas.kavaliauskas
2022-08-16 19:15
has joined #pact-python

tbansal
2022-08-17 10:30
has joined #pact-python

andrevdrodrigues
2022-08-17 14:24
Hello there! In python is possible to test the contract between fields as multipart/form-data? I searched for some examples, but Im found nothing :confused:

dekkofilms
2022-08-17 21:14
has joined #pact-python

nirajlalr
2022-08-18 09:46
has joined #pact-python

jon669
2022-08-18 11:14
has joined #pact-python

michael.birchmeier
2022-08-18 19:27
has joined #pact-python

ben.crinion
2022-08-18 19:42
@ben.crinion has left the channel

jwang
2022-08-18 21:07
has joined #pact-python

msiyaj1
2022-08-18 22:03
has joined #pact-python

ben.hansen
2022-08-19 00:44
has joined #pact-python

lottie.kett
2022-08-19 12:08
has joined #pact-python

paul.lynn
2022-08-19 14:18
has joined #pact-python

duynguyenptithcm
2022-08-20 07:22
has joined #pact-python

gaudenz.halter
2022-08-22 07:52
has joined #pact-python

harold.robson
2022-08-22 13:07
has joined #pact-python

bentzion.schochet
2022-08-22 13:27
has joined #pact-python

mat.delong
2022-08-22 14:03
has joined #pact-python

mat.delong
2022-08-23 09:27
@mat.delong has left the channel

jaswanth.ooty
2022-08-23 09:35
@jaswanth.ooty has left the channel

volker.wengert
2022-08-23 10:59
has joined #pact-python

sathish.sundararajan
2022-08-23 19:32
has joined #pact-python

patrick.lu
2022-08-24 02:12
has joined #pact-python

krishna.cv
2022-08-24 04:38
has joined #pact-python

ravishankar.emc
2022-08-24 06:00
has joined #pact-python

alan.zhu
2022-08-24 08:54
has joined #pact-python

nabil.bourenane
2022-08-24 14:19
has joined #pact-python

ami.ta
2022-08-25 06:05
has joined #pact-python

me1001
2022-08-25 07:24
has joined #pact-python

nidzgorskiadrian
2022-08-25 08:05
has joined #pact-python

dealandi
2022-08-25 11:50
has joined #pact-python

jreynolds
2022-08-25 12:44
has joined #pact-python

josh.steffensmeier
2022-08-25 13:18
has joined #pact-python

mhtkandpal10
2022-08-26 11:29
has joined #pact-python

dwalleck
2022-08-26 20:51
has joined #pact-python

lijinze01
2022-08-26 22:20
has joined #pact-python

mhaller
2022-08-27 00:19
has joined #pact-python

mvliannoi
2022-08-29 03:41
has joined #pact-python

haobei.ma
2022-08-29 06:06
has joined #pact-python

maram.elsayed
2022-08-29 08:52
has joined #pact-python

helloitsdave
2022-08-29 14:51
has joined #pact-python

mberkowitz
2022-08-29 16:16
has joined #pact-python

matt.bremer
2022-08-29 20:10
has joined #pact-python

lennart.querter
2022-08-30 09:24
has joined #pact-python

lennart.querter
2022-08-30 09:27
@lennart.querter has left the channel

mhtkandpal10
2022-08-30 11:10
Hey Guys ! started pact-python ,so curious where i can start from scratch with good understanding .

matt.fellows
2022-08-30 11:17
have you looked at http://docs.pact.io and the example projects?

matt.fellows
2022-08-30 11:17
(see howtoexamples :point_down: )


matt.fellows
2022-08-30 11:17
Pactflow also has some good workshops/tutorials (howtolearn)

2022-08-30 11:18
Here are a number of useful hands-on labs that teach all of the key concepts: https://docs.pactflow.io/docs/workshops and https://docs.pact.io/implementation_guides/workshops

mhtkandpal10
2022-08-30 11:21
can i get tutorials in python, however , i am just curious about specific in python language,thank you:raised_hands:

matt.fellows
2022-08-30 11:32
I don?t think we have a python specific workshop sorry, but the concepts are the same

mhtkandpal10
2022-08-30 13:18
okay ! can you make one so that we can have good grasp over it

matt.fellows
2022-08-30 14:02
I?d like to see one also (as I?m sure others would), but the reality is creating workshops is a non-trivial exercise. It would be great for somebody in the community to pick this up, but (transparently) we don?t have any capacity to pick this up any time soon

veaceslav.gaidarji
2022-08-30 15:29
has joined #pact-python

sharonw
2022-08-30 15:29
has joined #pact-python

grace.quek
2022-08-30 15:32
has joined #pact-python

s.kadium1
2022-08-30 16:12
has joined #pact-python

sumanta.roy
2022-08-31 01:33
has joined #pact-python

shuying.lin
2022-08-31 05:45
has joined #pact-python

victor.lopez
2022-08-31 10:08
has joined #pact-python

nfinley
2022-08-31 15:52
has joined #pact-python

hartror
2022-09-01 06:26
has joined #pact-python

uralsmh
2022-09-01 10:37
has joined #pact-python

krystof.sykora
2022-09-01 12:34
has joined #pact-python

lesa
2022-09-01 14:34
has joined #pact-python

gunesmes
2022-09-01 15:31
has joined #pact-python

alanwallaceross
2022-09-02 16:27
has joined #pact-python

wdridi1
2022-09-02 18:59
has joined #pact-python

daviseago
2022-09-03 02:16
has joined #pact-python

hsanghavi538
2022-09-06 02:33
has joined #pact-python

thibaut.bodart
2022-09-06 10:41
has joined #pact-python

bastien.decroix
2022-09-06 11:45
has joined #pact-python

pabcagi
2022-09-06 12:28
has joined #pact-python

patrickbadley
2022-09-06 13:25
has joined #pact-python

james.grubb
2022-09-06 19:19
has joined #pact-python

snehasingh291506
2022-09-06 19:42
has joined #pact-python

patrickbadley
2022-09-06 19:55
@patrickbadley has left the channel

senchu.pampoorickal
2022-09-06 20:15
has joined #pact-python

nagasrinivas.thota
2022-09-07 06:56
has joined #pact-python

mahinsyeda99
2022-09-07 09:40
has joined #pact-python

lisnychyis
2022-09-07 14:00
has joined #pact-python

marek.czerwinski
2022-09-07 16:07
has joined #pact-python

glenn
2022-09-07 16:39
@glenn has left the channel

xiaofeng02111
2022-09-08 03:20
has joined #pact-python

jayvdb
2022-09-08 06:22
has joined #pact-python

david342
2022-09-08 12:00
Good afternoon, I have just started using Pact and have a problem, our API response returns an array of objects which can have child objects , if the parent object has children they are in an array , if the parent has no children the array is empty. From looking at the Docs, the EachLike matcher dictates the array has at least one child object , so that is not useable in my case. Is there any other way to have a matcher for this situation. This is a bit of a deal breaker for us and I'm not sure why you cannot have a situation for, if array contains objects then objects should have this shape , else object is empty ? Something like Either {} or [{...}, {...} , ...]

david342
2022-09-08 12:06
It is a shame Python seems like a bit of a second class citizen , when I am more familiar with Pact then I'd like to pick that up. In the meantime , there are some good blog type introductions with Python here are some links https://www.dilatoit.com/2021/02/24/how-to-write-a-consumer-pact-test-in-python.html and https://qxf2.com/blog/writing-contract-test-using-pact/

vvarunbajpai1988
2022-09-08 12:13
has joined #pact-python

zakir
2022-09-08 12:55
has joined #pact-python

gregory.hanson
2022-09-08 12:56
has joined #pact-python


matt.fellows
2022-09-08 13:17
you need to use provider states to have two different scenarios: one where the array is empty, and another where it has objects in it

matt.fellows
2022-09-08 13:19
(see also https://github.com/pact-foundation/pact-support/pull/11 where @bethskurrie schooled my on my first Ruby PR to the project :laughing: )

ashishmerani
2022-09-08 21:54
has joined #pact-python

ramesh.ambastha
2022-09-09 11:06
has joined #pact-python

matt.fellows
2022-09-11 10:52
:tada:

matt.fellows
2022-09-11 10:53
Thanks @elliottmurray @yousafn and most of all @shuying.lin for have a crack at this :clap:

elliottmurray
2022-09-11 10:54
I just did the admin. The credit goes to @yousafn for testing and clean up and @shuying.lin for actually doing the work!

elliottmurray
2022-09-11 10:55
Publish pact and verify on branch now supported for everyone else.

oak155online
2022-09-11 19:25
@oak155online has left the channel

nickm
2022-09-12 17:15
has joined #pact-python

uzma_khan
2022-09-12 18:13
has joined #pact-python

stefan.tertan
2022-09-13 15:28
has joined #pact-python

konitzert
2022-09-14 07:11
has joined #pact-python

daniel.puiu
2022-09-14 13:43
has joined #pact-python

l.heluszko
2022-09-15 13:12
has joined #pact-python

alecat88
2022-09-16 10:25
has joined #pact-python

chris.armbrester
2022-09-16 11:45
has joined #pact-python

zohaibse011
2022-09-16 13:28
has joined #pact-python

nvenkataraman
2022-09-16 17:17
has joined #pact-python

zach.davis
2022-09-16 20:18
has joined #pact-python

jorbraken
2022-09-16 20:29
has joined #pact-python

paul.ologeh
2022-09-16 23:25
has joined #pact-python

purushothamv02
2022-09-19 14:19
has joined #pact-python

lcruz
2022-09-19 23:05
has joined #pact-python

sweiba
2022-09-20 07:26
has joined #pact-python

adam910
2022-09-20 12:32
has joined #pact-python

p.pommerencke
2022-09-20 14:00
has joined #pact-python

anhtvuong
2022-09-21 01:39
has joined #pact-python

timothee.ville
2022-09-21 08:09
has joined #pact-python

tymoschuk.jane
2022-09-21 12:38
has joined #pact-python

tony.nguyen
2022-09-21 13:41
has joined #pact-python

sashi.kandru
2022-09-21 13:45
has joined #pact-python

khaled.bali
2022-09-21 18:01
has joined #pact-python

m.mertens
2022-09-21 18:41
has joined #pact-python

m.mertens
2022-09-21 18:49
Hi, I am trying pact out for the first time and we are mainly message based. That is where my problem lies. I want to use the matchers in my consumer tests but using them is kinda weird. The way that I would expect them to work according to docs is: ``` event = { "event": "delivery:created", "delivery_type": matchers.Term("express|standard", "standard"), } ( pact_no_publish.given("Delivery has standard shipping") .expects_to_receive("delivery:created") .with_content(event) .with_metadata({"Content-Type": "application/json"}) )``` What this does is to pass the Term object into the message. What I have to do in this case is this: ``` event = { "event": "delivery:created", "delivery_type": matchers.Term("express|standard", "standard").generate()["data"]["generate"], }``` Is this the intended way or should it be done im some other way?

mforsman
2022-09-22 09:13
has joined #pact-python

shivendra.singh1
2022-09-22 10:04
has joined #pact-python

vaibhav.tiwari
2022-09-22 10:04
has joined #pact-python

akshaythakur2905
2022-09-22 10:06
has joined #pact-python

sukriti.kumari
2022-09-22 10:07
has joined #pact-python

p.kowalska
2022-09-22 10:35
has joined #pact-python

mazin.inaad
2022-09-22 13:21
has joined #pact-python

mastahfreak
2022-09-23 09:47
has joined #pact-python

kellie.persson
2022-09-23 17:50
has joined #pact-python

kbon
2022-09-26 13:58
has joined #pact-python

tanyaryzhova93
2022-09-26 18:53
has joined #pact-python

anand.krishnan
2022-09-27 10:45
has joined #pact-python

estelle.margoutin
2022-09-27 12:00
has joined #pact-python

criss.trifan
2022-09-28 05:36
has joined #pact-python

vipatel
2022-09-28 15:29
has joined #pact-python

olaoluphilip
2022-09-28 15:51
has joined #pact-python

vieira.jluiz
2022-09-28 17:20
has joined #pact-python

shuo.yang.2006
2022-09-28 19:48
has joined #pact-python

nirmalcbaral
2022-09-29 15:27
has joined #pact-python

ruppel.julian
2022-09-29 20:03
has joined #pact-python

alipala.ist
2022-09-29 20:28
has joined #pact-python

educationextended
2022-09-30 05:00
has joined #pact-python

ross.butler
2022-09-30 11:22
has joined #pact-python

koen.jans
2022-09-30 15:06
has joined #pact-python

ksawery.karwacki
2022-10-01 13:12
has joined #pact-python

jesper.nilsson
2022-10-01 13:59
has joined #pact-python

mansillamarcelo90
2022-10-02 22:06
has joined #pact-python

yulia.tekin.86
2022-10-02 22:55
has joined #pact-python

rachel.anderson
2022-10-02 23:39
has joined #pact-python

jason.stahl
2022-10-03 22:19
has joined #pact-python

sreeragsa
2022-10-04 03:03
has joined #pact-python

tara.costin
2022-10-04 14:45
has joined #pact-python

tanyaryzhova93
2022-10-04 17:25
Hi All! I am trying to understand how pact states work and how it can be implemented. Input data: ? My provider uses Python 3.10 and FastAPI ? I have two consumer tests, one to get one specific event, another one to get all events. And pact is generated. I have to ensure that at least one event exists in my local database, so I need to use pact states. I would like to insert just one event to my DB. So, I am doing the following: I?m trying to implement post endpoint as it?s shown https://github.com/pact-foundation/pact-python/blob/master/examples/fastapi_provider/tests/pact_provider.py. I am mapping just one state for my getting a specific endpoint (exactly for this endpoint I need a specific event existed in the DB). My code looks like: ```from fastapi import APIRouter from pydantic import BaseModel from eventhub.core.events.types import EventLifecycle, EventStatus from tests.e2e.conftest import team_factory, event_factory pact_router = APIRouter() STARTED_EVENT_ID = "ba5ec002-6fac-4285-bbbb-46c8801fb283" TEAM_ID = "dummy_tid" class ProviderState(BaseModel): state: str # noqa: E999 @pact_router.post("/_pact/provider_states") async def provider_states(provider_state: ProviderState): mapping = { "I can get a specific event": setup_started_event } mapping[provider_state.state]() return {"result": mapping[provider_state.state]} async def setup_started_event(db_session): await team_factory(db_session, team_id=TEAM_ID) await event_factory( db_session, STARTED_EVENT_ID, team_id=TEAM_ID, life_cycle=EventLifecycle.STARTED, status=EventStatus.PUBLISHED )``` The application is running and I am trying to verify my pact by running: ```pact-verifier --provider-base-url=http://localhost:8000 --pact-url=./pacts/mousedeer-events-consumer-eventhub-provider.json --provider-states-setup-url=http://localhost:8000/_pact/provider_states``` But I am getting the errors: ```Failures: 1) Verifying a pact between mousedeer-events-consumer and eventhub-provider Given I can get a specific event a request to get a specific event with GET /events/ba5ec002-6fac-4285-bbbb-46c8801fb283 returns a response which has status code 200 Failure/Error: set_up_provider_states interaction.provider_states, options[:consumer] Pact::ProviderVerifier::SetUpProviderStateError: Error setting up provider state 'I can get a specific event' for consumer 'mousedeer-events-consumer' at http://localhost:8000/_pact/provider_states. response status=404 response body={"detail":"Not Found"} ... ... ... 6) Verifying a pact between mousedeer-events-consumer and eventhub-provider Given I can get all events a request to get all events with GET /events?limit=10&name=&offset=0 returns a response which includes headers "Content-Type" which equals "application/json" Failure/Error: set_up_provider_states interaction.provider_states, options[:consumer] Pact::ProviderVerifier::SetUpProviderStateError: Error setting up provider state 'I can get all events' for consumer 'mousedeer-events-consumer' at http://localhost:8000/_pact/provider_states. response status=404 response body={"detail":"Not Found"}``` First, I am wondering why it tries to setup a state for my all two endpoints if I provided state just for one? Second, does this setup looks fine or something is wrong? Unfortunately, I don?t fully understand how post request should be implemented for pact states (as I can see it should be done according to https://docs.pact.io/implementation_guides/ruby/provider_states#provider-codebase), so I just tried to use your example. Third, do I understand correctly that in my case I should seed my local DB (the app and DB is running against localhost in my case)? or I can use fakedb as https://github.com/pact-foundation/pact-python/blob/master/examples/fastapi_provider/tests/pact_provider.py?

matt.fellows
2022-10-04 22:37
The states are defined in the pact file. It will always try to setup the states, even if you haven?t defined them in your test.

matt.fellows
2022-10-04 22:38
Your state mapping function should be able to deal with unknown states, because consumers may add new ones without the provider knowing about them

matt.fellows
2022-10-04 22:40
> Third, do I understand correctly that in my case I should seed my local DB (the app and DB is running against localhost in my case)? or I can use fakedb as https://github.com/pact-foundation/pact-python/blob/master/examples/fastapi_provider/tests/pact_provider.py? (edited) Pact is agnostic to how you setup the state - stubs, mocks, database seeding etc. The provider should get to choose the method that is most convenient for it, rather than have the consumer specify how the provider does that (like in e2e tests).

matt.fellows
2022-10-04 22:40
I tend to stub/mock the repository layer, personally.

oscar.barbamanzano
2022-10-05 14:18
has joined #pact-python

yanov.alexander
2022-10-06 08:39
has joined #pact-python

bxbivc
2022-10-06 10:05
has joined #pact-python

curtis.scott
2022-10-06 11:27
has joined #pact-python

riley.lee
2022-10-06 11:30
has joined #pact-python

oliver.smyth
2022-10-06 11:34
has joined #pact-python

kevin.campos
2022-10-06 11:35
has joined #pact-python

pstrnad
2022-10-06 12:04
has joined #pact-python

rachelxelizabethh
2022-10-06 13:20
has joined #pact-python

pratish
2022-10-06 21:08
has joined #pact-python

ilia
2022-10-06 22:18
has joined #pact-python

edudelta
2022-10-07 15:57
has joined #pact-python

olsen.lee.r
2022-10-07 18:29
has joined #pact-python

johndunning
2022-10-08 18:05
has joined #pact-python

kentooooo.1230
2022-10-09 17:49
has joined #pact-python

gpapadakis84
2022-10-10 12:32
has joined #pact-python

daftpunkapi
2022-10-11 09:22
has joined #pact-python

matteo.demasi
2022-10-11 12:08
has joined #pact-python

raul.romitan.ext
2022-10-11 12:17
has joined #pact-python

dominikdieter.krichba
2022-10-11 13:23
has joined #pact-python

ulrich.keil
2022-10-11 13:26
has joined #pact-python

mitchell.l.cooper
2022-10-11 13:45
has joined #pact-python

torsten.wiederkehr
2022-10-11 14:24
has joined #pact-python

mikey214
2022-10-11 22:32
has joined #pact-python

xi.luo
2022-10-12 05:11
has joined #pact-python

kim.crowe
2022-10-12 10:15
has joined #pact-python

suganyamuthukumar03
2022-10-13 11:01
has joined #pact-python

francis.bonneau
2022-10-13 18:30
has joined #pact-python

naf
2022-10-14 10:55
has joined #pact-python

werner.lauterfeld
2022-10-14 11:09
has joined #pact-python

jharms
2022-10-14 15:04
has joined #pact-python

daniel.cronin
2022-10-14 16:15
has joined #pact-python

txomin.sirera
2022-10-14 18:57
has joined #pact-python

jayeshguru81
2022-10-14 19:56
Hello Pact Python Team, I am trying to write Provider Test as below, it is able to communicate with pactbroker but not able to get the request body from pact so getting 400 error, Am I missing anything? ```from pact import Verifier PACT_BROKER_URL = "http://pactbroker.service.xxx.xxx.xxx.com/" # I am spinning up our provider service(my-service) in docker-compose on 5002 port PROVIDER_HOST = "my-service" PROVIDER_PORT = 5002 PROVIDER_URL = f"http://{PROVIDER_HOST}:{PROVIDER_PORT}" @pytest.fixture def broker_opts(): return { "broker_url": PACT_BROKER_URL, "publish_version": "3", "publish_verification_results": False, } def test_service_provider_against_broker(broker_opts): headers=["Authorization: Bearer my_jwt_token"] headers.append("Content-Type:application/json") verifier = Verifier(provider="my_provider_python_service", provider_base_url=PROVIDER_URL) success, logs = verifier.verify_with_broker( **broker_opts, verbose=True, provider_states_setup_url=f"{PROVIDER_URL}/my_path", enable_pending=False, headers=headers ) assert success == 0```

jr
2022-10-15 20:48
has joined #pact-python

sasankdts
2022-10-16 08:48
has joined #pact-python

wil.pannell
2022-10-16 16:56
has joined #pact-python

sirisha.kunaparaju
2022-10-17 11:01
has joined #pact-python

gardeepti
2022-10-17 11:02
has joined #pact-python

vedant3620
2022-10-17 11:08
has joined #pact-python

priyanka.bbit
2022-10-17 11:11
has joined #pact-python

nvourlakis
2022-10-17 11:21
has joined #pact-python

jayeshguru81
2022-10-17 12:54
@matt.fellows I know you are vacationing but your quick feedback on this would really help to unblock me

oliwia.koch
2022-10-17 13:51
has joined #pact-python

bluediamondpc
2022-10-17 14:18
has joined #pact-python

nicholas.difelice
2022-10-17 15:16
has joined #pact-python

remington.otoole
2022-10-17 15:20
has joined #pact-python

matt.lucido
2022-10-17 15:23
has joined #pact-python

molly.mccarthy
2022-10-17 15:28
has joined #pact-python

jayeshguru81
2022-10-17 22:08
@matt.fellows Does this mean we don?t need to create `@pact_router.post("/_pact/provider_states")` in our provider side of tests? > The states are defined in the pact file. It will always try to setup the states, even if you haven?t defined them in your test.

matt.fellows
2022-10-18 01:27
In the case of Python, you probably still will need these routes for your tests, to be able to receive the state setup messages and respond accordingly

matt.fellows
2022-10-18 01:29
Going to need a lot more info to be able to diagnose this. > but not able to get the request body from pact what do you mean by this? The request body comes from your provider, not Pact. Pact checks the response from your provider is correct

matt.fellows
2022-10-18 01:29
I can?t see where your provider is starting there, and why it might be failing.

matt.fellows
2022-10-18 01:29
the log output would be helpful here, ideally at debug level

jayeshguru81
2022-10-18 01:29
I am running my provider service in a docker container where my provider verification tests are, not sure from the examples what do I need to return?

matt.fellows
2022-10-18 01:29
I believe there should be an option to specify the provider log info

matt.fellows
2022-10-18 01:31
a `200` ok is all you need. The point of the provider states endpoint is to setup mocks/data to be able to respond to a scenario-

matt.fellows
2022-10-18 01:31
e.g. if the state is `User A exists` when the state handler is executed, you should ensure that User A exists. This could be injecting data into a database, setting up a mock etc.

jayeshguru81
2022-10-18 01:33
taking this conversation to the message thread I posted

jayeshguru81
2022-10-18 01:36
```Given metadata, upon receiving return created metadata object id from myconsumer-service, with { "method": "post", "path": "/metadata/", "headers": { "Authorization": "Bearer token", "content-type": "application/json" }, "body": { "datasource_id": 11111, "metadata": { "schema_id": 3, "schema_tags": [ { "schema_tag_id": 2, "schema_tag_values": [ "1" ] } ] } } } myprovider-service will respond with: { "status": 200, "body": { "metadata_object_id": 222222222, "version_id": 1, "validation_errors": { "hard": { }, "soft": { } } } }```

jayeshguru81
2022-10-18 01:36
This is my pact

jayeshguru81
2022-10-18 01:36
I don?t have provider states defined in my provider service

matt.fellows
2022-10-18 01:39
what?s the actual issue though?

jayeshguru81
2022-10-18 01:39
``` 4) Verifying a pact between myconsumer-service and myprovider-service Given metadata return created metadata object id with POST /metadata/ returns a response which has a matching body Failure/Error: set_up_provider_states interaction.provider_states, options[:consumer] Pact::ProviderVerifier::SetUpProviderStateError: Error setting up provider state 'metadata' for consumer 'myconsumer-service' at http://mats-service:5002/metadata/. response status=400 response body={"title":"Client Input Validation Error","message":[{"loc":["body","datasource_id"],"msg":"field required","type":"value_error.missing"},{"loc":["body","metadata"],"msg":"field required","type":"value_error.missing"},{"loc":["body","consumer"],"msg":"extra fields not permitted","type":"value_error.extra"},{"loc":["body","params"],"msg":"extra fields not permitted","type":"value_error.extra"},{"loc":["body","state"],"msg":"extra fields not permitted","type":"value_error.extra"},{"loc":["body","states"],"msg":"extra fields not permitted","type":"value_error.extra"}],"mats_error_code":2000} 2 interactions, 2 failures```

jayeshguru81
2022-10-18 01:39
here is the error

jayeshguru81
2022-10-18 01:40
there is big stacktrace of ruby below this

jayeshguru81
2022-10-18 01:40
which I can send if needed

matt.fellows
2022-10-18 01:57
right. So you need the provider state endpoint to be there, and it needs to respond with a `200`

matt.fellows
2022-10-18 01:57
whether or not you actually setup a state is a whole other thing

matt.fellows
2022-10-18 01:57
(an important thing, but a different thing)

slack1211
2022-10-18 07:24
has joined #pact-python

mekala.kalyan
2022-10-18 12:49
has joined #pact-python

jayeshguru81
2022-10-18 14:18
thats awesome I tried with this and it worked but still want to check if this looks good? ```@pact_router.post("/_pact/provider_states") async def provider_states(provider_state: ProviderState): mapping = { "metadata": {}, "get schema tag enums": {}, } return {"result": mapping[provider_state.state]}```

jpullifrone
2022-10-18 17:05
has joined #pact-python

jorge.bo
2022-10-18 18:42
has joined #pact-python

orhun
2022-10-18 19:42
has joined #pact-python

orhun
2022-10-18 19:51
Hello everyone, I am currently trying to create contract tests between 2 applications that communicate through message queue using pact broker. The producer is written by python and the consumer is kotlin. I have created consumer contracts on kotlin using `pact-jvm-consumer-java8_2.12` , and the python one using pact-foundation package. I can see the pacts published on my broker, and when I want to verify my producer contract in python, I get an error called "no matched handler". I saw some github discussions about message queue contracts being v3 and python having ruby implementation which supports v2, could this error be about that? I'm also sharing my logs, can provide more info if needed. Many thanks ```I, [2022-10-18T22:10:20.628161 #97499] INFO -- : Running example 'Verifying a pact between sms-consumer and sms-provider Given a user was created a create event has matching content' I, [2022-10-18T22:10:20.629846 #97499] INFO -- : Sending POST request to path: "/" with headers: {"CONTENT_TYPE"=>"application/json", "HTTP_X_PACT_ORIGINAL_HEADER_NAMES"=>"Content-Type", "X_PACT_PROVIDER_STATES"=>[{"name"=>"a user was created"}]}, see debug logs for body D, [2022-10-18T22:10:20.629899 #97499] DEBUG -- : body :{"description":"a create event","providerStates":[{"name":"a user was created","params":{}}],"metadata":{"Content-Type":"application/json; charset=UTF-8"}} I, [2022-10-18T22:10:20.646374 #97499] INFO -- : Received response with status: 500, headers: {"Date"=>"Tue, 18 Oct 2022 19:10:20 GMT", "Server"=>"uvicorn", "Content-Length"=>"32", "Content-Type"=>"application/json"}, see debug logs for body D, [2022-10-18T22:10:20.646463 #97499] DEBUG -- : body: {"detail":"No matched handler."}```

matt.fellows
2022-10-18 23:05
Well, that doesn?t actually do anything. It doesn?t need a body, it just needs a 200

matt.fellows
2022-10-18 23:06
if you?re not actually doing anything with the states, my guess is you could just have an empty methed

matt.fellows
2022-10-18 23:06
but at some point, you will need to do something with the states

matt.fellows
2022-10-18 23:09
Python supports messages

matt.fellows
2022-10-18 23:10
can you please share your code setup? The log file indicates you haven?t properly mapped the handlers and it couldn?t find the responsible handler for an interaction

orhun
2022-10-19 05:57
Sure, I create my contracts on kotlin using this code ```import au.com.dius.pact.consumer.MessagePactBuilder import au.com.dius.pact.consumer.MessagePactProviderRule import au.com.dius.pact.consumer.Pact import au.com.dius.pact.consumer.PactVerification import au.com.dius.pact.model.v3.messaging.MessagePact import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.intenseye.notificationapi.model.EmailRequest import com.intenseye.notificationapi.model.SmsRequest import io.pactfoundation.consumer.dsl.LambdaDsl.newJsonBody import org.junit.Rule import org.junit.Test class NotificationContractTest { @get:Rule val pactSmsRule = MessagePactProviderRule("sms-provider", this) @get:Rule val pactEmailRule = MessagePactProviderRule("email-provider", this) @Pact(provider = "sms-provider", consumer = "sms-consumer") fun createSmsEvent(builder: MessagePactBuilder): MessagePact { val body = newJsonBody { body -> body.stringType("to", "") body.stringValue("body", "Alert") }.build() return builder.given("a user was created") .expectsToReceive("a create event") .withContent(body) .toPact() } @Pact(provider = "email-provider", consumer = "email-consumer") fun createEmailEvent(builder: MessagePactBuilder): MessagePact { val body = newJsonBody { body -> body.array("to") { it.stringValue("") } body.stringValue("from", "Alert") body.stringValue("senderName", "Alert") body.stringValue("subject", "Alert") body.stringValue("body", "Alert") body.stringValue("templateName", "Alert") body.`object`("templateParams") { it.stringType("param1", "value1") it.stringType("param2", "value2") } body.array("cc") { it.stringValue("") } body.array("bcc") { it.stringValue("") } }.build() return builder.given("a user was created") .expectsToReceive("a create event") .withContent(body) .toPact() } @Test @PactVerification("sms-provider", fragment = "createSmsEvent") fun canParseCreateSmsEvent() { jacksonObjectMapper().readValue(pactSmsRule.message, SmsRequest::class.java) } @Test @PactVerification("email-provider", fragment = "createEmailEvent") fun canParseCreateEmailEvent() { jacksonObjectMapper().readValue(pactEmailRule.message, EmailRequest::class.java) } }``` and publish them with mvn verify:pact publish

orhun
2022-10-19 05:59
and this is the python code ```def sms_notification_handler(): return { "to": "", "body": "Alert" } def test_verify_success(): provider = MessageProvider( message_providers={ 'a create event': sms_notification_handler }, provider='sms-provider', consumer='sms-consumer', ) with provider: provider.verify_with_broker(broker_url='http://10.102.127.5:80', log_level='DEBUG', publish_version='0.0.1', publish_verification_results=True)```

orhun
2022-10-19 07:03
this is the contract generated by kotlin ```{ "consumer": { "name": "sms-consumer" }, "provider": { "name": "sms-provider" }, "messages": [ { "_id": "3a837aa529513ced39204e2ab42f06dd3dc63022", "description": "a create event", "metaData": { "Content-Type": "application/json; charset=UTF-8" }, "contents": { "body": "Alert", "to": "" }, "providerStates": [ { "name": "a user was created" } ], "matchingRules": { "body": { "$.to": { "matchers": [ { "match": "type" } ], "combine": "AND" } } } } ], "metadata": { "pactSpecification": { "version": "3.0.0" }, "pact-jvm": { "version": "3.5.21" } } }```

orhun
2022-10-19 08:08
since python is the message provider for my kotlin consumer, I just need it to compare the in memory content( ``` { "to": "", "body": "Alert" }``` ) to the one it receives from pact broker, am I thinking wrong? Btw I haven't observed a pact directory generation in my python project, but it might be normal behaviour since I don't need mocking in provider, I just want to verify that my provider model fits the consumer requirement in broker

kwo.ding
2022-10-19 08:24
has joined #pact-python

ankit.jain
2022-10-19 10:41
has joined #pact-python

edeandre
2022-10-19 12:09
has joined #pact-python

matt.fellows
2022-10-19 12:11
Looks like you?re missing the provider state handler too for the `a user was created` state

stanlisaus
2022-10-19 12:11
has joined #pact-python

orhun
2022-10-19 12:12
in consumer contract?

matt.fellows
2022-10-19 12:33
in the provider. You have defined states in your consumer test, you need to implement the provider state handler in the provider test

matt.fellows
2022-10-19 12:33
the provider state handler receives a message that says ?please get your system into state X? so that scenario Y will work

matt.fellows
2022-10-19 12:34
How you do that is up to to you (seed database, stub code etc.)

orhun
2022-10-19 12:34
doesn't this part in the logger mean that I am sending the provider states ```D, [2022-10-18T22:10:20.629899 #97499] DEBUG -- : body :{"description":"a create event","providerStates":[{"name":"a user was created","params":{}}],"metadata":{"Content-Type":"application/json; charset=UTF-8"}}```

matt.fellows
2022-10-19 12:37
I believe that is the request being sent from the core framework into Pact Python framework.

matt.fellows
2022-10-19 12:38
Looking at https://github.com/pact-foundation/pact-python/blob/610173491b4cb0030e4e91a600dfd58d03249f26/pact/message_provider.py#L16 it does appear that there _is_ no option to set the provider state handlers though. Is that actually causing issue? Is the logs you shared previously don?t seem to have the rest of the detail

orhun
2022-10-19 12:40
yes I had no option to set provider state, I thought the framework would somehow generate them through the first param 'message _provider' 's value ```message_providers={ 'a create event': sms_notification_handler }```

orhun
2022-10-19 12:47
these are all the unique log lines that I have in the pact.log, I also have pact-mock-service logs but may be irrelevant

orhun
2022-10-19 14:11
Matt, apparently the key in message providers map ('`a create event`') was supposed to be my provider state, `a user was created`. I found it after debugging `def _match_states(payload):` method in `http_proxy.py` .

orhun
2022-10-19 14:12
now my provider can verify consumer pact successfully

nikolaasrondon
2022-10-19 17:29
has joined #pact-python

fquijada
2022-10-19 21:25
has joined #pact-python

matt.fellows
2022-10-19 21:47
That sounds like a bug to me!

kkalan
2022-10-20 03:52
has joined #pact-python

dyptorden
2022-10-20 10:24
has joined #pact-python

olawale.akande
2022-10-20 11:52
has joined #pact-python

olawale92.tech
2022-10-20 11:56
has joined #pact-python

calen.pennington
2022-10-20 13:43
has joined #pact-python

muhammud.naseeruddin
2022-10-20 16:04
has joined #pact-python

xuw
2022-10-20 16:38
has joined #pact-python

matt.johnson
2022-10-20 17:25
has joined #pact-python

bhavyashree.r
2022-10-22 06:10
has joined #pact-python

mosesgwenne
2022-10-24 06:10
has joined #pact-python

j.watkins12
2022-10-24 21:13
has joined #pact-python

tony.odonnell
2022-10-25 07:56
has joined #pact-python

martin.schlegel
2022-10-25 11:24
has joined #pact-python

stefan.zivkovic
2022-10-25 12:35
has joined #pact-python

alexander.friesen
2022-10-25 14:07
has joined #pact-python

mspector
2022-10-25 14:45
has joined #pact-python

thomas.peyregne
2022-10-25 14:53
has joined #pact-python

jsirju
2022-10-25 20:22
has joined #pact-python

a.emmanuelmendoza
2022-10-25 23:42
has joined #pact-python

emma.colleran
2022-10-26 13:05
has joined #pact-python

aaron.swerlein
2022-10-26 15:10
has joined #pact-python

jeronimo
2022-10-26 17:50
has joined #pact-python

matthew.beattie
2022-10-26 20:14
has joined #pact-python

harrison.le
2022-10-26 21:47
has joined #pact-python

amandasstecz
2022-10-26 21:57
has joined #pact-python

christianoliver.table
2022-10-27 06:15
has joined #pact-python

zehra.lichtenberg
2022-10-27 08:08
has joined #pact-python

vzviaruha
2022-10-27 11:29
has joined #pact-python

michael.laird
2022-10-27 13:38
has joined #pact-python

jayeshguru81
2022-10-27 18:10
I might get back to you on understanding what needs to be done with the provider states

jayeshguru81
2022-10-27 18:16
But I have another question on Provider tests - I think I saw you mentioning that all DB,KAFKA and Aerospike dependencies should be mocked for contract tests which sounds reasonable but as I am spinning up the service in another docker container than contract tests, I am unable to mock those dependencies as service is running in separate container. Is it advisable to spin up MSSQL, Aerospike and Kafka in their own containers and let service talk to them?

jayeshguru81
2022-10-27 18:17
I am not sure if I am clear but let me know I can explain more specific usecase for my needs

pedropho18
2022-10-27 21:33
has joined #pact-python

juancesarvillalba
2022-10-27 21:43
has joined #pact-python

matt.fellows
2022-10-28 02:01
So yeah, this is why running them in a docker container isn?t ideal

matt.fellows
2022-10-28 02:01
as much as possible, try to think of these as a unit test

angad.singh
2022-10-28 11:07
has joined #pact-python

oroceo.ian
2022-10-28 20:04
has joined #pact-python

benjamin
2022-10-28 21:09
has joined #pact-python

emailpankaj.agarwal
2022-10-29 13:26
has joined #pact-python

jayeshguru81
2022-10-30 15:44
we have buildkite pipelines for test, lint, build and deploy, so all our unit tests, contract tests, integration tests run in pipeline. That?s why we run it in docker container

jayeshguru81
2022-10-30 15:47
we have base python images which serve as basic image for services, we pull it from dockerfile and then install all dependencies

jayeshguru81
2022-10-30 15:47
easy to manage this with docker

krishnakanth219
2022-10-30 22:59
has joined #pact-python

joshua.mclatchie
2022-10-31 02:21
has joined #pact-python

jason.taylor2
2022-10-31 13:55
has joined #pact-python

kedar.ghate
2022-10-31 14:02
has joined #pact-python

usama.mumtaz
2022-11-02 09:45
has joined #pact-python

gsouza
2022-11-02 14:29
has joined #pact-python

zhangjingqiang
2022-11-02 23:49
has joined #pact-python

bmorton
2022-11-02 23:58
has joined #pact-python

andrew.brindle
2022-11-03 10:44
has joined #pact-python

vladislav.ledniov
2022-11-03 14:13
has joined #pact-python

jonathan
2022-11-03 16:43
has joined #pact-python

ldicesaro.scvsoft
2022-11-03 20:55
has joined #pact-python

jayeshguru81
2022-11-04 01:37
Also @matt.fellows for unit tests we use Python TestClient `from fastapi.testclient import TestClient` , but pact verifier needs a provider base url which we cannot pass if we are using Test Client

matt.fellows
2022-11-04 02:07
> we have buildkite pipelines for test, lint, build and deploy, so all our unit tests, contract tests, integration tests run in pipeline. That?s why we run it in docker container (edited) I?m not saying don?t run them _in_ a docker container, I?m suggesting you don?t run the provider tests _against_ a docker container (that doesn?t have stubbed dependencies).

matt.fellows
2022-11-04 02:08
> for unit tests we use Python TestClient `from fastapi.testclient import TestClient` , but pact verifier needs a provider base url which we cannot pass if we are using Test Client I understand. The verification isn?t a unit test, but you try your best to think of it as one - this includes being able to stub dependencies in a granular fashion, so that your pact tests are easy to manage and run.

carlosmarange
2022-11-04 06:09
has joined #pact-python

stevet
2022-11-04 06:31
has joined #pact-python

seikyo.cho
2022-11-04 08:58
has joined #pact-python

poornimakrishnarajan
2022-11-04 13:56
has joined #pact-python

michalkras
2022-11-05 01:05
has joined #pact-python

nuno.frias
2022-11-07 10:15
Hi all, I would like to use matchers with messages, but all the examples I see have exact values https://github.com/pact-foundation/pact-python/tree/master/examples/message . Do matchers work with messages ? If so where can I find an example / documentation ?

nuno.frias
2022-11-07 10:15
Thank you

mike.geeves064
2022-11-07 11:07
You can, the examples and docs aren't great. I was looking at adding to them but some areas are a little confusing!

mike.geeves064
2022-11-07 11:10
I'm just looking at some tests I have in a code base, but I think copy pasting chunks might also be quite confusing. There's a PR to change the current behaviour for this I believe, but something that was missing/unclear is you need to do this: ``` with pact: mock_slack(kwargs) result = consumer(matchers.get_generated_values(event)).get_result()```

mike.geeves064
2022-11-07 11:10
Where the event has your matchers in, so something like ```TERM_ANY_EPIC = Term("^(audusd|eurcad|eurgbp|eurusd|gbpcad|gbpeur|gbpusd|usdcad|usdjpy)$", "audusd") TERM_BUY_SELL = Term("^(BUY|SELL)$", "BUY") event = { "detail-type": "placeTrade", "source": "ig-tracker", "detail": { "message": { "epic": TERM_ANY_EPIC, "trade_type": TERM_TRADE_TYPE, "buysell": TERM_BUY_SELL, } }, }```

mike.geeves064
2022-11-07 11:11
The key bit being you need to make that `matchers.get_generated_values(event)` call to handle the Term properly

mike.geeves064
2022-11-07 11:12
:thinking_face: hopefully that makes sense / helps a little!

nuno.frias
2022-11-07 11:55
Brilliant. Thank you very much

mike.geeves064
2022-11-07 11:58
You're welcome :slightly_smiling_face:

maria.botnari
2022-11-07 12:07
has joined #pact-python

tomasz.sosnowski
2022-11-07 13:52
has joined #pact-python

bpadhalni
2022-11-07 15:26
has joined #pact-python

ajay.chinnam
2022-11-08 10:08
has joined #pact-python

sprengo
2022-11-08 10:57
has joined #pact-python

nuno.frias
2022-11-08 11:17
Hi again In Pact-go for asynchronous interactions there are 2 concepts: state handlers (which set the provider state), and message handlers (which I use to serialize the message into a JSON format). In Pact-python I can only see the equivalent to state handlers. *Is there a way for me to have a message handler function?* In my case my provider tests is a component wide test (not a unit test) and I need to be able to grab the published message to feed it into pact.

matt.fellows
2022-11-08 12:30
It should have. Albeit after this thread: https://pact-foundation.slack.com/archives/C9VECUP6E/p1666216028101009?thread_ts=1666122705.799749&cid=C9VECUP6E I suspect maybe there is a misunderstanding in that API

james.ferguson
2022-11-08 12:33
has joined #pact-python

gururaghavendrar98
2022-11-08 13:04
has joined #pact-python

nuno.frias
2022-11-08 13:47
Thank you very much :+1:

steven
2022-11-08 23:09
has joined #pact-python

alan.barr
2022-11-09 03:14
has joined #pact-python

wojciech.bachur
2022-11-09 13:55
has joined #pact-python

arek92
2022-11-09 13:58
has joined #pact-python

dariusz.duleba
2022-11-09 14:00
has joined #pact-python

gururaghavendrar98
2022-11-09 14:29
Hi Team, Can someone help me how to mock AWS lambda function using python? I didn't find any example for Lambda contract testing between 2 services. Any information will be really helpful to start with for me. Thank you

matt.fellows
2022-11-09 21:59
I?m not sure Pact Python supports _synchronous_ messaging

gururaghavendrar98
2022-11-10 07:41
Okay, can you suggest me any alternative for contract testing on _synchronous calls_

cgodsey
2022-11-10 19:45
has joined #pact-python

saweniger
2022-11-14 17:29
has joined #pact-python

miguel.roldan
2022-11-15 11:06
has joined #pact-python

robin.lungwitz
2022-11-15 13:32
has joined #pact-python

laith
2022-11-15 16:15
has joined #pact-python

elluru.kri.mohan
2022-11-15 18:14
has joined #pact-python

rmartine
2022-11-15 20:35
has joined #pact-python

sameena9010
2022-11-16 06:49
has joined #pact-python

ryanthomas840310
2022-11-16 20:52
has joined #pact-python

mike.hideaki
2022-11-16 21:48
has joined #pact-python

vwaters
2022-11-16 22:31
has joined #pact-python

jayeshguru81
2022-11-17 00:31
Hello Team, I am using Pact Matchers to match either integer or None but could not find any matcher to match 2 data types (int or Nonetype) ```.will_respond_with( status=200, body={ "id": Like(1|None) } )```

jayeshguru81
2022-11-17 00:50
@matt.fellows is it possible to have Optional matches?

matt.fellows
2022-11-17 03:16
howtooptional


matt.fellows
2022-11-17 03:17
You need to create two test cases - one for when the value is present and another for when it is not

jayeshguru81
2022-11-17 13:38
we are returning around 100 templates in an array, if there are certain fields which are not present in DB those are returned null but others have value. So we don?t have like 2 test cases, data comes with mix and match of null or values

juergen.unfried
2022-11-17 20:43
has joined #pact-python

matt.fellows
2022-11-18 03:39
> if there are certain fields which are not present in DB those are returned null but others have value https://docs.pact.io/provider#verify-your-pacts-against-a-locally-running-instance-of-the-provider This is why we have provider states - so that _you_ can control these different states

jose.anastacio
2022-11-18 13:34
has joined #pact-python

shawn305
2022-11-18 13:42
has joined #pact-python

tronghuy
2022-11-19 01:38
has joined #pact-python

glauco.carvalho
2022-11-21 15:47
has joined #pact-python

soner.ay
2022-11-21 16:57
has joined #pact-python

flafla.mattos
2022-11-22 19:10
has joined #pact-python

chrisjburnscg
2022-11-22 22:11
has joined #pact-python

alan.zhu
2022-11-23 02:34
Hey, team I raise an https://github.com/pact-foundation/pact-python/issues/315 for pact-python because the pact binaries(version 1.88.83) combined in pact-python is incompatible with dev env and CI pipeline. I always got the same error response when I try to verify my pact. But when I use the latest binaries version(1.91.0). The issue won't exist. So are we going to upgrade the version combined in pact-python or is there a suitable way I can config the version that pact-python will call? That's will be much helpful for my implementation. Thanks!

bethskurrie
2022-11-23 02:43
I?ve just opened a PR to update the standalone to 1.91.0


bethskurrie
2022-11-23 02:43
I don?t know why all the builds are failing though.


alan.zhu
2022-11-23 07:11
I think `sdist` tried to download a linux-x86.tar.gz binary package and at the https://github.com/pact-foundation/pact-ruby-standalone/releases?page=1 we don't own this type of binary package at all which failed the build https://github.com/pact-foundation/pact-python/blob/d87d54bce2ed2f74b0a2bb46314b18541bdb598a/setup.py#L21


matt.fellows
2022-11-23 10:52
It?s a bit weird that it downloads all operating systems instead of checking what is needed for the current one?

alan.zhu
2022-11-24 06:32
I think pact-python have packaged all the operating systems binaries and choose the suitable one during the test run. So checking all operating systems during the build seems persuasive. But I don't know why the 3.10 test failed(seems ruby issue) and I don't have much background why later version binary abandoned the linux-x86.tar.gz type:melting_face:

bethskurrie
2022-11-24 06:33
support was dropped for one of the old linuxes, but I don?t know why python would care about that. it should be agnostic to the name of the package.

imer.muhovic
2022-11-24 08:57
has joined #pact-python

mohitsoni
2022-11-24 10:19
has joined #pact-python

mohitsoni
2022-11-24 10:27
Hello, I am trying to add a simple test case using pact python, but I am getting error "ImportError while importing test module" (Python version - 3.7.13). Can anyone please help me.

mohitsoni
2022-11-24 10:28
> Error Log:

mohitsoni
2022-11-24 10:28
> Traceback: > ../../../.pyenv/versions/3.7.13/lib/python3.7/importlib/__init__.py:127: in import_module > return _bootstrap._gcd_import(name[level:], package, level) > tests/pactflow_contract_testing/pact_consumer_api_token.py:4: in <module> > from pact import Consumer, Provider > .venv/lib/python3.7/site-packages/pact/__init__.py:3: in <module> > from .consumer import Consumer > .venv/lib/python3.7/site-packages/pact/consumer.py:2: in <module> > from .pact import Pact > .venv/lib/python3.7/site-packages/pact/pact.py:8: in <module> > import psutil > .venv/lib/python3.7/site-packages/psutil/__init__.py:123: in <module> > from . import _psosx as _psplatform > .venv/lib/python3.7/site-packages/psutil/_psosx.py:13: in <module> > from . import _psposix > .venv/lib/python3.7/site-packages/psutil/_psposix.py:28: in <module> > from . import _psutil_osx > E ImportError: dlopen(/<PATH>.venv/lib/python3.7/site-packages/psutil/_psutil_osx.cpython-37m-darwin.so, 0x0002): tried: '/.venv/lib/python3.7/site-packages/psutil/_psutil_osx.cpython-37m-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))


matt.fellows
2022-11-24 12:55
Looks like an M1 issue. Have you tried running in Rosetta mode?

mohitsoni
2022-11-24 12:58
Let me try Rosetta mode. Thanks

mohitsoni
2022-11-24 13:08
Hi Matt, Due to IT policy I can't check in rosetta mode. Do you have any other ways to resolve this issue.

matt.fellows
2022-11-24 14:04
If you remove Pact from the project do you still have an issue? The error seems unrelated but I'm pretty sure it will need to run under Rosetta with Pact

matt.fellows
2022-11-24 14:05
It might be that Pact needs an os specific package

celia
2022-11-24 14:32
has joined #pact-python

matt.fellows
2022-11-25 00:52
It cares about it because it pulls the package down during the build/install step

matt.fellows
2022-11-25 00:52
(It currently pulls all OS/architectures down at install time, and then only uses the one it needs at runtime - a bit wasteful)

matt.fellows
2022-11-25 00:52
I think my PR needs to be mergede

bethskurrie
2022-11-25 00:53
ah, right, I think that distribution needs to be removed from the code

matt.fellows
2022-11-25 00:55
yep

matt.fellows
2022-11-25 01:04
Tried to see if there was any data in GA to inform architecture.

matt.fellows
2022-11-25 01:04
will check Python / pip


harald.bittermann
2022-11-25 10:01
has joined #pact-python

ad
2022-11-25 13:23
has joined #pact-python

sree
2022-11-25 14:22
has joined #pact-python

yousafn
2022-11-25 16:14
Hello hello, Calling all Pact Pythonista's. Have you been itching for ? Proper messaging support in Pact-Python ? Support for up to V4 of the Pact specification ? Pact Plugin support You can check out some of the updates in this tracking issue https://github.com/pact-foundation/pact-python/issues/88#issuecomment-1327645996 We would love your help, guidance and assistance in unlocking these capabilities to the masses but also being able to take the time to address some of the things about Pact-Python that you may have wanted to improve during your time using it!

soumya.aithal
2022-11-27 17:15
has joined #pact-python

nathan.pine
2022-11-28 09:19
has joined #pact-python

sanmicad
2022-11-28 12:20
has joined #pact-python

marcin.nawrocki
2022-11-29 09:25
has joined #pact-python

sergewar
2022-11-30 08:54
has joined #pact-python

diego
2022-11-30 09:50
has joined #pact-python

surya.sidharthan
2022-11-30 11:13
has joined #pact-python

nicolas.chara
2022-11-30 13:16
has joined #pact-python

daniel
2022-11-30 18:30
has joined #pact-python

denis
2022-11-30 22:07
has joined #pact-python

dbarne24
2022-12-01 11:35
has joined #pact-python

min.zaw.mra
2022-12-01 11:36
has joined #pact-python

kevin.lau
2022-12-01 11:41
has joined #pact-python

bojanmarjanovic1980
2022-12-01 13:09
has joined #pact-python

ivona.sovic
2022-12-01 13:13
has joined #pact-python

orbit
2022-12-01 15:45
has joined #pact-python

david.dudley
2022-12-01 19:55
has joined #pact-python

brian.coan
2022-12-01 20:22
has joined #pact-python

manishmitraba
2022-12-02 02:16
has joined #pact-python

lepdiana01
2022-12-02 03:53
has joined #pact-python

arpan.agr
2022-12-02 08:06
has joined #pact-python

goksel00
2022-12-02 17:41
has joined #pact-python

aibosun900614
2022-12-04 02:18
has joined #pact-python

mayank.mahajan04
2022-12-05 10:51
has joined #pact-python

tony.nguyen
2022-12-05 19:58
Hi team, similar to adding verbose and disable ssl for the standalone in Python, how do we add proxy setting to the standalone Ruby? Example of the os env for verbose and ssl: ```os.environ['PACT_DISABLE_SSL_VERIFICATION'] = 'true' os.environ['VERBOSE'] = 'true'```

matt.fellows
2022-12-05 22:07
The Ruby app should respect the standard proxy environment variables (`http_proxy`, `https_proxy` and `no_proxy`)

mailtoshinu
2022-12-06 07:42
has joined #pact-python

youri.thielen
2022-12-07 07:52
has joined #pact-python

cpopovici
2022-12-07 09:02
has joined #pact-python

hendrik916
2022-12-07 12:07
has joined #pact-python

matcheckep
2022-12-07 13:55
has joined #pact-python

jayeshguru81
2022-12-07 18:07
I have a use case to write contract test for file upload endpoint where we use MultiPartEncoder to upload a file but it looks pact does not accept Multipart Encoder request body, Do we have alternative solution in pact-python

wesley.nutley
2022-12-07 19:48
has joined #pact-python

github2
2022-12-07 20:21
The GitHub user https://github.com/bethesque has signed out. Use the following command/s to recreate subscriptions /github subscribe pact-foundation/pact-python

matt.fellows
2022-12-07 23:39
what error are you seeing? Pact should definitely support multippart headers etc., but Python may not support matching the bodies (assuming they are binary or something)

bethskurrie
2022-12-08 00:34
/github subscribe pact-foundation/pact-python

2022-12-08 00:34
:white_check_mark: Subscribed to https://github.com/pact-foundation/pact-python. This channel will receive notifications for `issues`, `pulls`, `commits`, `releases`, `deployments`

dagmara.krent
2022-12-08 10:19
has joined #pact-python

komathypriya
2022-12-08 11:35
has joined #pact-python

neethu.santhosh
2022-12-08 14:22
has joined #pact-python

jayeshguru81
2022-12-08 15:44
yeah exactly the same error, Multipart encoder is not supported in request body

jayeshguru81
2022-12-08 15:46
we need to still handle this as provider will replay the request on their side so we need a real request to be part of the pact

nuno.frias
2022-12-08 16:43
Hi all, Any chance some higher power could review and if happy, merge https://github.com/pact-foundation/pact-python/pull/322

janga.nagamallika
2022-12-08 17:49
has joined #pact-python

jampala_1988
2022-12-08 23:47
has joined #pact-python

krishnaraj.pk
2022-12-09 05:35
has joined #pact-python

matt.fellows
2022-12-09 06:32
Sorry I?m still unclear of the problem. Can you please share a code snippet of what you?re trying? You should be able to match on the path, headers etc.

matt.fellows
2022-12-09 06:33
I?ll ping the maintainer

rajavadootha04
2022-12-09 07:56
has joined #pact-python

nuno.frias
2022-12-09 09:17
Thank you very much

tomaszrdzak
2022-12-09 11:54
has joined #pact-python

tomaszrdzak
2022-12-09 12:02
:wave: Hello, team! I?ve been trying hard to find an example of how to set up a *Mock Service Provider* to run pacts verification process without running a server in Python. I?m currently using Pactman in Consumer side, but open to change. Please point me to a good resource on how to verify pacts in unit tests. Thanks!

matt.fellows
2022-12-09 12:11
Hi Tomasz, Pact Python requires you start your provider locally (ideally with stubbed dependencies). There?s no way around that currently that I?m aware of

tomaszrdzak
2022-12-09 12:12
Thank you. That is very sad.

matt.fellows
2022-12-11 23:50
Is starting the provider troublesome?

maxime.raverdy
2022-12-12 09:22
has joined #pact-python

sambhavi.chinnu
2022-12-13 04:11
has joined #pact-python

david.turner
2022-12-13 09:01
has joined #pact-python

mateusz.dudek03
2022-12-13 14:10
has joined #pact-python

mateusz.dudek
2022-12-13 14:22
has joined #pact-python

dmitrij.bogomyakov
2022-12-13 16:09
has joined #pact-python

victor.lau841
2022-12-13 16:30
has joined #pact-python

roblesjm
2022-12-14 11:40
has joined #pact-python

ahmidat
2022-12-14 12:44
has joined #pact-python

sergey.ledniov
2022-12-14 16:46
has joined #pact-python

abhimanu.sehgal
2022-12-14 20:40
has joined #pact-python

enrique.decoss
2022-12-15 02:25
has joined #pact-python

kirankishore4
2022-12-15 06:12
has joined #pact-python

maxime.raverdy
2022-12-15 09:58
@maxime.raverdy has left the channel

alvaro.navarroiborra
2022-12-15 10:47
has joined #pact-python

leelavathi.sundaram
2022-12-15 10:55
has joined #pact-python

paula.muldoon
2022-12-15 11:40
has joined #pact-python

james.sun
2022-12-15 22:42
has joined #pact-python

dominic.matabilas
2022-12-15 22:42
has joined #pact-python

tlemmonds
2022-12-16 19:55
has joined #pact-python

vejeta
2022-12-18 02:27
@vejeta has left the channel

samuel.woodbridge
2022-12-19 09:44
has joined #pact-python

paula.muldoon
2022-12-19 12:19
@paula.muldoon has left the channel

mwojcik
2022-12-19 13:43
has joined #pact-python

robinsmit
2022-12-19 15:08
has joined #pact-python

jungjae.lim
2022-12-19 16:24
has joined #pact-python

tomaszrdzak
2022-12-21 11:06
Yes. First it?s way slower in general and more involved, but in this situation, it?s a bunch of lambda functions.

saurwein
2022-12-21 14:48
has joined #pact-python

ssharma
2022-12-21 15:17
has joined #pact-python

alejandro.depablos
2022-12-21 18:56
has joined #pact-python

tomas.cerkasas
2022-12-21 23:14
has joined #pact-python

priyanka.soni
2022-12-22 08:24
has joined #pact-python

zijian.wang1
2022-12-22 10:51
has joined #pact-python

anyi.huang
2022-12-22 11:02
has joined #pact-python

matt.fellows
2022-12-23 00:43
Are these lambda functions exposed via an HTTP interface or are they more of a req/res style invocation? _(also, I assume when you say lambda, you mean AWS lambda?)_

stepik02
2022-12-23 10:36
has joined #pact-python

prajwalg
2022-12-25 14:28
has joined #pact-python

raksha.baskaran
2022-12-27 06:01
has joined #pact-python

venkatesh.madas
2022-12-27 06:36
has joined #pact-python

anthony.bennett
2022-12-27 20:15
has joined #pact-python

livinglogic.nl
2022-12-28 10:50
has joined #pact-python

pawel.szczerbicki
2022-12-29 13:22
has joined #pact-python

anandhiemail
2022-12-29 17:37
has joined #pact-python

anandhiemail
2022-12-29 18:24
@anandhiemail has left the channel

arika.goyal
2022-12-30 12:18
has joined #pact-python

m.marquez
2022-12-31 16:05
has joined #pact-python

guoxin.rick33
2023-01-03 08:45
has joined #pact-python

will
2023-01-03 09:59
has joined #pact-python

mario.pires
2023-01-03 11:42
has joined #pact-python

vtft1988
2023-01-03 16:38
has joined #pact-python

matt.thompson
2023-01-04 10:54
has joined #pact-python

tomaszrdzak
2023-01-04 10:58
They are aws lambdas. Invoking them locally via real HTTP interface is a bit of a pain in the neck. The handlers themselves can be invoked but the HTTP interface is no longer there, as they accept specific input (event), normally created by AWS gateway from HTTP call contents, similar to what any web framework does when converting pure raw bits conforming to HTTP protocol into objects such as ?req?. This part is what is missing. But also, it?s not strictly needed to interact via this interface.

rytis.lisauskas
2023-01-04 14:20
has joined #pact-python

morin.td
2023-01-04 16:54
has joined #pact-python

afernandez
2023-01-04 22:22
has joined #pact-python

vkaramoff
2023-01-05 10:00
has joined #pact-python

morin.td
2023-01-05 10:18
@morin.td has left the channel

vika.karman
2023-01-05 10:32
has joined #pact-python

nickzakirov
2023-01-05 15:01
has joined #pact-python

nam.nguyen
2023-01-07 04:00
has joined #pact-python

dale.wells
2023-01-08 15:18
has joined #pact-python

manohar.adepu
2023-01-09 02:58
has joined #pact-python

hsyogesh12
2023-01-09 05:54
has joined #pact-python

sowmya.bhg
2023-01-09 10:32
has joined #pact-python

matt.fellows
2023-01-09 11:05
I understand. I don?t know Python all that well, but with NodeJS and Golang it was trivial to use SAM/Serverless to start an HTTP service with a gateway simulation for this purpose. You don?t need to start the HTTP service in this way, however it?s convenient because you know it will mimic the behaviour of the API gateway and invoke your lambda with the correct additional context (I?ve also previously created a separate HTTP interface to invoke the underlying lambda for testing purposes, which can be useful in certain situations also).

matt.fellows
2023-01-09 11:05
In any case, at the moment it?s a moot point because the Python library does require an HTTP target to hit.

matt.fellows
2023-01-09 11:06
Another option in the future could be a plugin (see http://docs.pact.io/plugins) which abstracts this stuff out. We have yet to roll out the rust core to Python, which is a pre-requisite for that support also. So sadly, that option is out too. We are looking for some additional maintainer support for Python, so if you?re interested in improving this situation we?d love to chat!

ivan.mikhalka
2023-01-09 13:21
has joined #pact-python

klaudijus.rulys
2023-01-09 13:32
has joined #pact-python

aaron.swerlein
2023-01-09 14:44
Hey team. I am trying to create provider side validations in a separate python repo (consumer written in Ruby framework). I am trying to find good documentation on provider states in python, but I am not having much luck. I found the pact-python repo on Github, but am not having luck with creating a port to send the requests to. Whenever I run the `pact-verifier` command, it says connection refused on the port

boer.k
2023-01-09 15:10
has joined #pact-python

chris.aguirre11
2023-01-09 16:45
has joined #pact-python

tomaszrdzak
2023-01-09 16:46
Thanks @matt.fellows We have wrapped the handler code in separate Flask instance, which is indeed handy anyway which is faster to spin up - still on this :slightly_smiling_face:

nicolas.barbey
2023-01-09 17:06
has joined #pact-python

simon.petty
2023-01-09 21:11
has joined #pact-python

edisonjen13
2023-01-09 22:25
has joined #pact-python

jeroen.vandijk
2023-01-10 09:07
@jeroen.vandijk has left the channel

boer.k
2023-01-10 10:18
@boer.k has left the channel

nuno.frias
2023-01-10 11:15
Hi Matt My team would really like this fix to be pushed is there something I can do to expedite this.

matt.fellows
2023-01-11 11:46
Hi Nuno. It looks like Mike has given some feedback, apologies for your delay (and thanks to @mike.geeves064 for stepping in to look at it).

nuno.frias
2023-01-11 12:06
Hi Matt. I have seen it last night. I will try to address them today.

nuno.frias
2023-01-11 12:06
Thank you very much @mike.geeves064

artem.z
2023-01-11 13:18
has joined #pact-python

jrede
2023-01-11 17:57
has joined #pact-python

vanitha.annamalai
2023-01-12 05:27
has joined #pact-python

jessy.li
2023-01-12 17:29
has joined #pact-python

aronlmin
2023-01-13 02:13
has joined #pact-python

buckley
2023-01-13 20:01
has joined #pact-python

sashizen
2023-01-16 09:09
has joined #pact-python

richardmccann
2023-01-16 15:37
has joined #pact-python

eugene.malihins
2023-01-17 11:08
has joined #pact-python

yusufjamalazam
2023-01-17 12:24
has joined #pact-python

jbosca
2023-01-17 13:10
has joined #pact-python

hehecx
2023-01-17 22:16
has joined #pact-python

jawaharsurapaneni
2023-01-18 00:36
has joined #pact-python

kerrypmckeever
2023-01-18 02:12
has joined #pact-python

paul
2023-01-18 16:56
has joined #pact-python

basma.eldesouky
2023-01-19 10:24
has joined #pact-python

alex.strizhak
2023-01-19 13:12
has joined #pact-python

laura.porpiglia
2023-01-19 13:56
has joined #pact-python

chimein.1234
2023-01-19 16:13
has joined #pact-python

john295
2023-01-19 23:12
has joined #pact-python

dominik.lukac.96
2023-01-20 10:33
has joined #pact-python

luca.narbone
2023-01-20 16:39
has joined #pact-python

bram.hautekiet
2023-01-22 22:32
has joined #pact-python

bram.hautekiet
2023-01-22 23:00
Hi folks, we're experimenting with a Pact POC for our python microservices. More specifically we are trying to run the verification for the provider against a flask test_client instead of against a live server, but this seems not possible (yet)? The flask test client makes requests to the application without running a live server. You can test the client programmatically by calling `response = test_client.get()`, `response = http://test_client.post()`, ... Using this test client has some advantages compared to running a local server: it's faster, it makes it easier to mock dependent services (like databases), it makes it very easy to deal with authentication etc... But as far as I can see the only way of verifying a provider contract is with the standalone _pact-verifier_ tool (or a wrapper around the tool), where you need to pass a _provider-base-url_ which points to a live server?

matt.fellows
2023-01-23 00:52
That?s right, at the moment, the verifier must be able to connect to the HTTP server to do the verification. It is possible to do, albeit `pact-python` would need to start an HTTP server and route traffic to the flask test client (so it will always need an HTTP endpoint, just whether or not `pact-python` provides it, or the user)

benjamin.hess
2023-01-23 23:55
has joined #pact-python

steve.jefferies
2023-01-24 09:47
has joined #pact-python

nuno.frias
2023-01-24 10:37
Hi Matt, The change has been approved, any other step required before the merge can happen ?

aoife.drury
2023-01-24 14:36
has joined #pact-python

perger1984
2023-01-24 21:04
has joined #pact-python

matt.fellows
2023-01-25 05:00
Looks like it went out overnight?

ajaytaneja
2023-01-25 13:18
has joined #pact-python

petr.sebek
2023-01-25 14:20
has joined #pact-python

petr.sebek
2023-01-25 14:36
Hello, I have a question about enums in contract tests. My use-case is that I'd like to tests messages being sent in event-driven system (messaging) between publisher and subscriber. Imagine that I'm sending these enums as a part of message ```class TestEnumV1(str, Enum): OPTION_1 = "option_1" OPTION_2 = "option_2" OPTION_3 = "option_3" class TestEnumV2(str, Enum): OPTION_1 = "option_1" OPTION_2 = "option_2" OPTION_3 = "option_3" OPTION_4 = "option_4"``` Note that `TestEnumV2` has extra `OPTION_4`. I'm sending these messages as JSONs so it will be serialized as "option_4" string. Now `TestEnumV1` and `TestEnumV2` are not compatible because if publisher sends `"option_4"` to a subscriber understanding only `TestEnumV1` it will fail because subscriber will not know that value in `TestEnumV1`. However, if I write consumer matcher as `pact.Like(TestEnumV1.OPTION_1)` it will happily accept any string. I can write a regex for it `pact.Term(r"^option_1|option_2|option_3$", "option_1")` which would resolve it on consumer side. But what should I do on provider side? Should I generate and test message with every enum value possible? Is this (consumer and provider parts) how it should be done?

jayeshguru81
2023-01-25 15:15
Hey Folks I am getting below error while using EachLike in my expected response Body ```self = <pact.pact.Pact object at 0x7f5a847b4a90> def verify(self): """ Have the mock service verify all interactions occurred. Calls the mock service to verify that all interactions occurred as expected, and has it write out the contracts to disk. :raises AssertionError: When not all interactions are found. """ self._interactions = [] resp = requests.get( self.uri + "/interactions/verification", headers=self.HEADERS, verify=False ) assert resp.status_code == 200, resp.text resp = http://requests.post(self.uri + "/pact", headers=self.HEADERS, verify=False) > assert resp.status_code == 200, resp.text E AssertionError: {"message":"Error ocurred in mock service: Filelock::ExecTimeout - Didn't finish executing Filelock block within the timeout specified.","backtrace":["/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/reification.rb:31:in `from_term'","/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/array_like.rb:44:in `block in generate'","/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/array_like.rb:44:in `times'","/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/array_like.rb:44:in `each'","/pyenv/versions/3.8.10/envs/cmedia-adf-management-api/lib/python3.8/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.17.0/lib/pact/array_like.rb:44:in `collect'","/pyenv/versions/3.8.10/envs/cmedia-adf-management- Truncated /pyenv/versions/cmedia-adf-management-api/lib/python3.8/site-packages/pact/pact.py:281: AssertionError```

sean.mccann
2023-01-25 15:25
has joined #pact-python

nirob726
2023-01-26 12:25
has joined #pact-python

giuseppe.aina
2023-01-26 17:45
has joined #pact-python

boris.pogrebitskiy
2023-01-26 23:00
has joined #pact-python

rafael.luiz-cavalcant
2023-01-27 00:00
has joined #pact-python

zkocsihorvath
2023-01-27 13:47
has joined #pact-python

jorgen.x.andersson
2023-01-27 14:56
has joined #pact-python

mlapis
2023-01-29 10:56
has joined #pact-python

tim.malseed
2023-01-30 04:52
has joined #pact-python

matt.corby-eaglen
2023-01-30 11:47
has joined #pact-python

ulises.cervino
2023-01-30 12:38
has joined #pact-python

m.gruehn
2023-01-30 13:04
has joined #pact-python

martin.ineichen
2023-01-30 15:07
has joined #pact-python

ch.pascucci
2023-01-30 15:22
has joined #pact-python

grace.tree
2023-01-30 16:03
has joined #pact-python

pryan
2023-01-30 21:25
has joined #pact-python

andy.jenness
2023-01-30 21:29
has joined #pact-python

jcarlos.anast
2023-01-31 12:24
has joined #pact-python

leonardo.saragiotto
2023-01-31 12:32
has joined #pact-python

barry.irvine
2023-02-01 15:52
has joined #pact-python

marcin.slowiak.007
2023-02-01 18:28
has joined #pact-python

hoon.jung
2023-02-01 23:53
has joined #pact-python

andhika.hasiholan06
2023-02-02 03:51
has joined #pact-python

jhordies
2023-02-02 09:59
has joined #pact-python

amanda.santos
2023-02-02 14:19
has joined #pact-python

keith.w
2023-02-02 15:57
has joined #pact-python

gazal.gafoor
2023-02-03 00:13
has joined #pact-python

eschroeder
2023-02-03 17:15
has joined #pact-python

marunachalam1
2023-02-04 02:16
has joined #pact-python

loc.daot
2023-02-06 07:37
has joined #pact-python

ivan.mikhalka
2023-02-06 08:44
Hello, could someone provide some examples how to work with Graphql API via `pact-python` ?

ondrej.hajek
2023-02-06 09:45
has joined #pact-python

shravan.baira
2023-02-06 11:16
has joined #pact-python

cameron.doyle
2023-02-06 11:17
has joined #pact-python

ckarlborg45
2023-02-06 11:29
has joined #pact-python

itzhak
2023-02-06 11:56
has joined #pact-python

prashant.singh
2023-02-06 14:05
has joined #pact-python

georgina.sallery
2023-02-06 15:18
has joined #pact-python

guptadaksh56
2023-02-06 20:40
has joined #pact-python

brendanmbliss
2023-02-06 23:14
has joined #pact-python

helloyuanyuan
2023-02-07 02:25
has joined #pact-python

matt.fellows
2023-02-07 02:50
I don?t think we have a GraphQL example, but it should be trivial to copy another language.

matt.fellows
2023-02-07 02:50
Golang and JS are just simple wrappers over the HTTP interface



matt.fellows
2023-02-07 02:51
It?s just the request side you need to care about, the response side is just standard HTTP

ivan.mikhalka
2023-02-07 06:33
yes, I need similar like we have in JS, ApolloGraphQLInteraction

ivan.mikhalka
2023-02-07 06:37
I?ve created feature request.

ivan.mikhalka
2023-02-07 06:46
I am not Python developer myself, it should be based on this class, I guess: https://github.com/pact-foundation/pact-python/blob/master/pact/pact.py

ivan.mikhalka
2023-02-07 06:49
There is a class Request inside, which is used by Pact class

geetika.joshi
2023-02-07 10:25
has joined #pact-python

erik.haartmans
2023-02-07 10:31
has joined #pact-python

rawisankarn
2023-02-07 12:59
has joined #pact-python

hiep.duong
2023-02-07 13:10
has joined #pact-python

michael.branders484
2023-02-07 14:08
has joined #pact-python

anda.rozenfelde
2023-02-07 14:33
has joined #pact-python

vietanhtran.dev
2023-02-08 04:44
has joined #pact-python

goyal.himanshu
2023-02-08 08:23
has joined #pact-python

jeroenlamain
2023-02-08 11:57
has joined #pact-python

pallavi.bose
2023-02-08 13:19
has joined #pact-python

adi.d
2023-02-08 16:25
has joined #pact-python

oriane.rodriguez
2023-02-08 16:59
has joined #pact-python

tdickman
2023-02-08 21:36
has joined #pact-python

george.croucamp
2023-02-09 05:14
has joined #pact-python

gcroucamp
2023-02-09 05:15
has joined #pact-python

tonis.ojandu
2023-02-09 09:46
has joined #pact-python

justyna
2023-02-09 10:03
has joined #pact-python

tomer.ghelber
2023-02-09 12:24
has joined #pact-python

tommy.chen
2023-02-10 00:39
has joined #pact-python

sayler.b
2023-02-11 03:46
has joined #pact-python

rm.bozhko
2023-02-12 16:27
has joined #pact-python

moid.abdul
2023-02-13 00:16
has joined #pact-python

sugi
2023-02-13 09:59
has joined #pact-python

sgeethu21
2023-02-13 11:01
has joined #pact-python

kp1289
2023-02-13 11:59
has joined #pact-python

rahul.jalagadugu
2023-02-13 15:37
has joined #pact-python

omatuzenko.hse
2023-02-13 18:14
has joined #pact-python

sathish.sundararajan
2023-02-13 21:21
Does pact-python support gRPC contract tests? Pact-go has created a separate branch for adding gRPC support. Looking to see if there is similar traction on pact-python. Appreciate your guidance on this

tyler.fleurant
2023-02-13 21:56
has joined #pact-python

matt.fellows
2023-02-13 23:03
It does not yet support gRPC as it is not on the Rust Core just yet, which is needed to use the plugin framework

sathish.sundararajan
2023-02-13 23:07
Thanks @matt.fellows Are there any plans to add it in the near future ?

matt.fellows
2023-02-13 23:35
There are no concrete plans (as in who/when and how long) but we are currently looking at how we resource the project to get it done. Python is not currently a language PactFlow has a maintainer for, so it?s up to the community maintainer/contributors. We would like to take the project on board.

sathish.sundararajan
2023-02-13 23:45
Oh thanks @matt.fellows :+1:

swilkinson
2023-02-14 09:59
has joined #pact-python

brooks
2023-02-14 18:41
has joined #pact-python

carlos.lopez
2023-02-14 19:20
has joined #pact-python

sam.mirzaee
2023-02-15 02:35
has joined #pact-python

kam.sobon
2023-02-15 11:26
has joined #pact-python

nuno.frias
2023-02-15 13:21
Hi all, Any chance a new build release of pact-python could be made available please? The last one (1.6.0) is almost 6 months old and I have been installing directly from the repo which takes forever. BTW the reason I do this is because I need a change that was recently merged into master.

elliottmurray
2023-02-15 14:34
Sorry I forgot to do this after the last couple of merges. Will do at the weekend. IIRC a few larger changes so will probably be a minor bump

mail391
2023-02-15 14:59
has joined #pact-python

nuno.frias
2023-02-15 15:59
Brilliant thank you very much

jmoreno
2023-02-15 21:27
has joined #pact-python

marcio.duarte
2023-02-16 03:38
has joined #pact-python

bryen.vieira
2023-02-16 16:34
has joined #pact-python

mike.geeves064
2023-02-16 17:06
Should have some capacity at the weekend if it would be helpful to go through? We didn't quite get a call scheduled in :thinking_face:

yousafn
2023-02-16 17:17
Yeah I wouldn?t mind piggy backing off this, I am out Sat eve at a gig but other than that super flexible for you guys. We can help document the process and lighten the load from you in the future Elliott!

ryan319
2023-02-16 22:50
has joined #pact-python

zhig.ivan
2023-02-17 08:56
has joined #pact-python

yerken.tussupbekov
2023-02-17 11:40
has joined #pact-python

iamchughmayank
2023-02-17 18:30
has joined #pact-python

jake.kline
2023-02-18 04:11
has joined #pact-python

elliottmurray
2023-02-19 12:02
Hey released - let me know if any issues. I didn?t do my usual testing locally as people were using it. Can do a quick patch if a problem. For @mike.geeves064 and @yousafn I?ve created https://github.com/pact-foundation/pact-python/pull/327

elliottmurray
2023-02-19 12:03
Has the steps mostly documented now

culudamar
2023-02-20 08:12
has joined #pact-python

swilkinson
2023-02-20 12:00
Hi all, I want to use `pact-python` to verify messages between a consumer and provider on an AWS SQS queue. What's the best way of using matchers in the consumer test? The problem is that if my expected message has matchers in it, my system under test can't parse the message as it doesn't understand the matchers. My workaround is to pass the message into the SUT as a serialized JSON string, using a custom serializer that converts the matcher objects into actual values. I'm new to Pact and I suspect I'm doing something wrong, is there a better way of doing this? Example expected message: ```expected_msg = { "timestamp": Term( matcher=Format.Regexes.timestamp.value, generate=datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ"), ), "cat": { "name": "Saffy", "breed": "DomesticShorthair", }, }```

yousafn
2023-02-20 16:15
Fantastic, thanks for the release and the PR with the updated release docs. Will give it a spin shortly

gawaine.ogilvie
2023-02-20 17:01
has joined #pact-python

nuno.frias
2023-02-21 10:10
Hi Steve Have you tried something like this: ```from pact import MessageConsumer MY_PACT_DIR = f"{os.path.dirname(os.path.realpath(__file__))}/pacts" def example_test(): async_consumer = MessageConsumer( "my consumer", version=1.0, tag_with_git_branch=True, branch="test/ticket-123", auto_detect_version_properties=True ) pact = async_consumer.has_pact_with( Provider("my_provider"), publish_to_broker=False, pact_dir=MY_PACT_DIR, ) expected_msg = { "timestamp": Term(Format.Regexes.timestamp.value. datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")), "cat": { "name": Like("Saffy"), "breed": Like("DomesticShorthair"), }, } (pact. given("Some provider state"). expects_to_receive("Retry message"). with_content(expected_msg) ) with pact: raw_msg_data = matchers.get_generated_values(expected_msg) output = method_that_ingests_the_sqs_message(raw_msg_data) # run your assertions against the output```

nuno.frias
2023-02-21 10:31
The key bit is: ```from pact import matchers matchers.get_generated_values(expected_msg)```

nuno.frias
2023-02-21 10:34
Btw the example above is obviously incomplete, just to give an idea of the overall structure.

swilkinson
2023-02-21 11:05
Thanks @nuno.frias, perfect answer! My test now works without my ugly workaround.

swilkinson
2023-02-21 14:11
Hi everyone, I'm using pact-python version 1.7.0. I've run into a problem when trying to publish a pact from my consumer test. It works if I pass a semantic version as the version number, but fails if I use a git commit hash. I'm getting this error: ```Received request message: {"resource": "cats", "method": "POST", "timeReceived": "2023-02-21T13:39:16Z", "cat": {"name": "Saffy", "breed": "DomesticShorthair"}} resource = cats, method = POST, time_received = 2023-02-21 13:39:16+00:00, cat = name='Saffy' breed=<CatBreed.DOMESTIC_SHORTHAIR: 'DomesticShorthair'> ----------------------------------------------------------------------- Captured stderr call ----------------------------------------------------------------------- /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /mnt/c in PATH, mode 040777 /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/rubygems/version.rb:206:in `initialize': Malformed version number string d3ba3948430b8a34ca5def0991648290010bf021 (ArgumentError) from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/rubygems/version.rb:196:in `new' from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/2.2.0/rubygems/version.rb:196:in `new' from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-message-0.11.1/lib/pact/message/cli.rb:26:in `update' from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run' from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command' from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch' from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start' from /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/app/pact-message.rb:28:in `<main>' /home/swilkinson/repos/pact-poc-consumer-catsdb/.venv/lib/python3.9/site-packages/pact/bin/pact/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /mnt/c in PATH, mode 040777 No value provided for required pact_files``` Is it trying to validate the version number as a semantic version? If so is there a way to turn this off? This is the code I use to initialize the message consumer pact object: ```@pytest.fixture(scope="session") def consumer_pact(request): version = request.config.getoption("--publish-pact", None) publish = True if version else False branch = request.config.getoption("--branch-name", None) pact: MessagePact = MessageConsumer(CONSUMER_NAME, branch=branch).has_pact_with( provider=Provider(PROVIDER_NAME), publish_to_broker=publish, broker_base_url=PACT_BROKER_BASE, broker_token=PACT_BROKER_TOKEN, pact_dir=PACT_DIR, version=version, ) yield pact```


yousafn
2023-02-21 14:29
Hey, I don't think it would validate it to a semver (as we use commit hashes as the most common versioning schema), it is the same with the previous version `1.6.0` The error is stating `No value provided for required pact_files` which doesn't look to be passed in your args, (its using `pact_dir`) - is there definitely pacts in that folder? I haven't had a chance to test out the new release `1.7.0` yet but will give it a check over now in a pact message project https://github.com/YOU54F/pact-logical-replication/blob/main/message_pact_python/message_consumer_test.py

yousafn
2023-02-21 14:53
Hmm, I think there is the param version, which is being used for both the pact specification version of `3.0.0` and the version of the consumer when publishing. https://github.com/pact-foundation/pact-python/blob/48b7f3705d927b558e5aa4a95f1a1f6aac332309/pact/message_pact.py#L76 https://github.com/pact-foundation/pact-python/blob/master/pact/message_consumer.py#L47

swilkinson
2023-02-21 14:53
Ha I just realized what I'm doing wrong, I'm passing the version argument into the `has_pact_with` method, rather than into the constructor of the `MessageConsumer`. Sorry!

yousafn
2023-02-21 14:54
It's ok dude! The docs could be clearer, I've had to dig into the code to look at the two methods!

yousafn
2023-02-21 14:54
Got me spinning up pact-python and testing out the new release so nice one :slightly_smiling_face:

james414
2023-02-22 10:00
has joined #pact-python

nbolam
2023-02-22 20:26
has joined #pact-python

lambent21
2023-02-23 13:35
has joined #pact-python

pach
2023-02-23 17:34
has joined #pact-python

richard.ruiter
2023-02-24 06:43
has joined #pact-python

spalle
2023-02-24 10:54
has joined #pact-python

alex637
2023-02-24 14:32
has joined #pact-python

egrep
2023-02-25 17:32
has joined #pact-python

ykamali
2023-02-26 05:10
has joined #pact-python

kripa.kurian
2023-02-27 04:35
has joined #pact-python

jordan.brooks
2023-02-27 09:46
has joined #pact-python

courtel.yann
2023-02-27 10:47
has joined #pact-python

nathan.hickson
2023-02-27 13:07
has joined #pact-python

mark.simpson
2023-02-27 13:08
has joined #pact-python

masykur.sn
2023-02-27 15:21
has joined #pact-python

makifkus
2023-02-28 03:51
has joined #pact-python

jacob.waller
2023-02-28 21:08
has joined #pact-python

dipak8959
2023-02-28 21:18
has joined #pact-python

sanketh.shanbhag
2023-03-01 03:57
has joined #pact-python

adam.cox
2023-03-01 12:34
has joined #pact-python

gazal.gafoor
2023-03-01 13:30
@gazal.gafoor has left the channel

steve.short
2023-03-01 15:14
has joined #pact-python

kgrady
2023-03-01 18:58
has joined #pact-python

egrep
2023-03-02 08:58
@matt.fellows Could you please take a look

pratima.patil
2023-03-02 11:13
has joined #pact-python

matt.fellows
2023-03-02 11:55
Thanks! I?m not a Pact Python maintainer though, so best to wait for them to see the PR and comment on it.

shilpa199350
2023-03-02 12:40
has joined #pact-python

syamphaneendrak
2023-03-02 16:21
has joined #pact-python

neeraj.sharma
2023-03-02 16:33
has joined #pact-python

dominik.chmielarz
2023-03-02 16:55
has joined #pact-python

xchen
2023-03-02 18:59
has joined #pact-python

fdawson
2023-03-03 08:15
has joined #pact-python

elliottmurray
2023-03-03 10:25
Done - I'll merge at some point

elliottmurray
2023-03-03 10:25
Thanks!

egrep
2023-03-03 10:59
You?re welcome :slightly_smiling_face:

tom.meldrum
2023-03-03 13:02
has joined #pact-python

dragos.neagu
2023-03-03 16:44
has joined #pact-python

swilkinson
2023-03-03 17:38
Hi folks, I'm trying to use the `pact_url` kwarg in my call to `MessageProvider.verify_with_broker` in order to verify against a specific pact, but it seems to be ignored. I always get this error: "pact.verify_wrapper.PactException: Pact urls or Pact broker required". What's the correct way to verify against a specific pact using pact-python?

egrep
2023-03-05 01:00
I think this has not been implemented yet. https://github.com/pact-foundation/pact-python/issues? I?ll try to fix it.

egrep
2023-03-05 01:00
@elliottmurray Could you please take a look :slightly_smiling_face:

egrep
2023-03-05 08:50
@elliottmurray Take a look please

egrep
2023-03-05 08:50
@elliottmurray This one needs your review :)

mike.geeves064
2023-03-05 23:01
:tada:


facundo.g
2023-03-06 12:13
has joined #pact-python

michael.bryson
2023-03-06 14:59
has joined #pact-python

kingsley
2023-03-06 22:47
has joined #pact-python

marckpuiu
2023-03-07 15:58
has joined #pact-python

facundo.g
2023-03-08 09:31
@facundo.g has left the channel

duncan3142
2023-03-08 19:42
has joined #pact-python

william.stewart
2023-03-08 20:25
has joined #pact-python

trc229
2023-03-09 01:34
has joined #pact-python

zaira.zafar
2023-03-09 10:41
has joined #pact-python

dominik.goltermann
2023-03-09 15:31
has joined #pact-python

sharathkonda
2023-03-09 15:37
has joined #pact-python

allen.ayala
2023-03-09 16:33
has joined #pact-python

slawomir.pawluk
2023-03-09 18:22
has joined #pact-python

casavelha
2023-03-09 19:49
has joined #pact-python

nikita.gupta
2023-03-09 22:21
has joined #pact-python

pjayakumar
2023-03-10 02:21
has joined #pact-python

egrep
2023-03-10 09:57
I?m sorry for my annoyance, but I?m just curious about the SDLC of pact-python. My questions may seem naive, I apologize in advance. This is due to my lack of understanding of current workflow. Does anyone do full-time development of pact-python? Who is the official maintainer? How often are pull requests/issues considered/merged (monthly, quarterly, yearly, etc)? Where can I see the current roadmap? Is this project in a state of stagnation? I probably jumped the gun https://pact-foundation.slack.com/archives/C9VECUP6E/p1677978017816369?thread_ts=1677865097.455139&cid=C9VECUP6E @swilkinson I?d take care of it. Now, having analyzed the activity of the project, I am more inclined to think that my contribution may be considered a bit (too) late, when it will no longer be relevant at all. Frankly, I don?t have a lot of free time, and I?d like to use it where my help really needed. I hope my doubts are clear.

yousafn
2023-03-10 13:15
Hey > Does anyone do full-time development of pact-python? no-one works full time on Pact, it is an open-source project. Development work is conducted by contributors in their free time, or normally during their employers time as it is a need for work. > Who is the official maintainer? Maintainers are listed on https://docs.pact.io/contributing/contributors > How often are pull requests/issues considered/merged (monthly, quarterly, yearly, etc)? It varies by maintainer capacity, we appreciate community support in raising issues, providing fixes, and reviews. Where can I see the current roadmap? https://github.com/pact-foundation/pact-python/projects/1 https://pact.canny.io/ > Is this project in a state of stagnation? That is a matter of perspective, it is usable for many but doesn't contain all the latest and greatest Pact features. It is an open-source library so can be improved and extended by anyone. We are always on the lookout for more contributors and maintainers, our current maintainer has very little bandwidth (the project has been going for many years and priorities shift especially for work people do as volunteering)

yousafn
2023-03-10 13:18
If it were I, and I wanted to get a feature into Pact-python, I would fork the repo, make the change, add tests, package it up, test it out e2e and consume it in my own projects, so I'm confident it works.

egrep
2023-03-10 14:53
Frankly, that?s what I do for my organization. But we are now considering a more significant use of pact ecosystem projects. The fact is that we have about 350 microservices (about 1000 employees) and we would like to have some certainty of stability, more than just forks. Although it certainly works for us too

egrep
2023-03-10 14:54
Anyway thank you for your answers!

josh.marlow
2023-03-10 15:10
has joined #pact-python

patilb
2023-03-11 17:02
has joined #pact-python

renan.santos
2023-03-11 18:46
has joined #pact-python

elliottmurray
2023-03-11 20:12
I would strongly recommend finding way to contribute to what we have. I?ve personally struggled with time to contribute to new features such as v3. But there is strength in numbers and we're an open bunch. Corporate sponsorship has a lot of benefits and can be done in a multitude of ways. Time oftentimes the most valuable resource.

keren.eckshtein
2023-03-12 08:57
has joined #pact-python

sr
2023-03-12 11:58
has joined #pact-python

gokuldot
2023-03-12 17:30
has joined #pact-python

egrep
2023-03-12 22:28
cc @swilkinson

egrep
2023-03-12 22:30
Although I certainly doubt you?ll get it anytime soon, let?s see

ldgaribello
2023-03-13 06:23
has joined #pact-python

lidan.liu
2023-03-13 10:45
has joined #pact-python

vipin.kumar
2023-03-13 12:29
has joined #pact-python

yousafn
2023-03-13 14:08
for corporate stability for your organisation, as eluded to by Elliot, time is one of the most valuable things that can be provided, raising issues, providing fixes as you have done. it can be useful especially if you are around other python engineers for them to offer reviews on your pr?s as well, this greatly aids maintainers who are time limited in getting changes across the line. we are only a small maintainer team and are happy to provide to assistance. I personally as part of looking after the open source project want to help provide more visibility on what?s required for a v2-v3 upgrade ( migration to the rust core ) and beyond to being in features such as pact plugins to python.

egrep
2023-03-13 15:01
I will tell my own opinion, which may not coincide with the collective opinion and certainly has nothing to do with my employer. How it usually happens in every company?. Usually companies are concerned with making money. Companies as a whole is a little out of touch with technology and tools to explore. Usually in every company there is a pioneer (or a group). These are some researchers who first explore and study the technology at a good enough level, understand it, fall in love with it, and only after that they become evangelists - bringing it to companies and promoting its use. A lot depends on this first step. If the pioneer can?t convince himself that it?s really very useful, he can?t be an advocate for it, and of course in this case there will be no ?traf?c of engineers,? collective intelligence, etc. So in my opinion, it is very important for Pact ecosystem to attract such pioneers, increasing their retention, than to work to get a big client at once.

bknapik
2023-03-13 17:13
has joined #pact-python

ravi0894
2023-03-13 17:38
has joined #pact-python

anji.boddupally
2023-03-13 20:37
has joined #pact-python

voon.wong
2023-03-14 01:34
has joined #pact-python

matt.fellows
2023-03-14 06:21
Hi folks, coming in very late to this party (it was a long weekend in Melbourne, and longer for some - aka me!) Both Elliot (current maintainer) and Yousaf (DevRel) have done a great job of answering the current state - and we are always on the lookout for more contributors and maintainers. If you or anyone in the team are interested, we will absolutely support you. What I can say from a SmartBear corporate sponsorship perspective (my employer, along with Yousaf and a number of other core maintainers), we are looking to invest further into the Pact ecosystem - especially ensuring the core projects remain active, healthy and feature rich. We are currently in the planning stages of a new initiative called ?https://docs.pact.io/help/smartbear?. Whilst I can?t tell you exactly what that means just yet (because it?s still in progress), one element that will definitely be a part of it is ensuring a number of the ?key assets? are maintained at a level you would expect of any paid product. This would incorporate Pact Python and ensuring it gets to the latest spec version (v4), plugin support etc. It?s officially on our https://github.com/pactflow/roadmap/projects/1 for Q3 this year, however there are multiple pathways to getting there and we obviously need to work with the community to drive the initiative, so do stay tuned and follow the item?s progress.

matt.fellows
2023-03-14 06:23
I hope that helps give you some further perspective?

matt.fellows
2023-03-14 06:38
I?ve just taken a quick look - thank you! Will need the maintainer (who actually knows Python and the code base) to review

egrep
2023-03-14 07:32
Yeah, thank you :pray:

matt.fellows
2023-03-14 07:48
You're welcome. Btw thank you for all of the issue reports/PRs!

gigamac
2023-03-14 08:09
has joined #pact-python

ivstam
2023-03-14 08:43
has joined #pact-python

melikesezin
2023-03-14 14:17
has joined #pact-python

gopishankar.haridas
2023-03-14 16:42
has joined #pact-python

rajasekaran.parthiban
2023-03-14 20:13
has joined #pact-python

sbanerjee
2023-03-15 02:46
has joined #pact-python

kurt_schriefer
2023-03-15 13:21
has joined #pact-python

yousafn
2023-03-15 13:31
Totally appreciate the PR's and issue raising, I saw you had one resolved by the team and you tested it today, nice one for that! Also saw you have a pretty cool set of repos https://github.com/sergeyklay/consumer-pact-example + https://github.com/sergeyklay/provider-pact-example I'd love to see it added to our list of community projects if you would be up for another PR? https://docs.pact.io/community_repos#full-workflows > So in my opinion, it is very important for Pact ecosystem to attract such pioneers, increasing their retention, than to work to get a big client at once. agreed, we've seen community members advocate for Pact off their own backs for many years, I was one of them and was brought into the fold under PactFlow to help the open source project. Always open to ideas on how we can do so! I wouldn't say any of us in the open source are working to get a big client, to drive the project. How many people want to take on the onus of _maintaining_ an open source project, which is depended on by many real world projects, as the potential to break things is great. I know we could take the time to build up regression test suites to improve the situation and reduce the risk with change, but it's not a small effort, as with an already large estate to look after just keeping the lights on for users and helping them understand what is already there can easily soak up any available time. I think we will see greater support and time being spent on those roadmap style efforts for the open-source with https://docs.pact.io/help/smartbearwho purchased PactFlow under acquisition, and enhanced community outreach programs to support those advocating for Pact (through courses, examples), and improving Pact (though issues/prs/discussions/maintenance) I started using Pact as a tool for a job, but then realised I could both learn programming skills as a polyglot, with a tool I could use in the real world (rather than learning by building some hello world apps) - I think that is how we end up seeing lots of contributions come in. Would love to round table at some point with a few of the python folk, @mike.geeves064 / @elliottmurray and others, take into consideration all the blockers you are coming under and @matt.fellows and I can help tackle them. There is a Python conf running this month and @dawoud.sheraz is doing a talk there, so we hope we might get some extra eyes on Python this year. https://pact-foundation.slack.com/archives/C5F4KFKR8/p1677859156212079

egrep
2023-03-15 14:23
> I?d love to see it added to our list of community projects if you would be up for another PR? Done :sunglasses:

andreas530
2023-03-15 22:32
has joined #pact-python

santiago.rendong
2023-03-15 23:21
has joined #pact-python

christine.awofeso
2023-03-16 09:58
has joined #pact-python

konstantin.manna
2023-03-16 15:04
has joined #pact-python

emgarcia
2023-03-16 15:44
has joined #pact-python

john.goodwin
2023-03-16 15:51
has joined #pact-python

tomasz.kowalczyk
2023-03-16 15:51
has joined #pact-python

christine.awofeso
2023-03-16 16:16
Hi we would like to do verification for v4 contracts via python, however at the moment the pact-python does not support v4. I can see there is on the project board that this is something you are wanting to implement. Is there any updates on this, is there any way one can easily contribute to speed things up? thanks :slightly_smiling_face:

yousafn
2023-03-16 16:23
Hi @christine.awofeso Thanks for getting in touch, I am sure a not insignificant amount of people would also appreciate this functionality. We've had a few attempts so far https://github.com/pact-foundation/pact-python/issues/88#issuecomment-1327645996 So some eyes across those existing pull requests might be a good start. We are currently in discussions with @egrep about helping with Pact-python maintenance, with others in the pact-python team @elliottmurray / @mike.geeves064. You'll note several pull requests in pact-python that could also do with some love https://github.com/pact-foundation/pact-python/pulls

yousafn
2023-03-16 16:27
It would be good to map out the work required in order to make a staged approach, and work out the technical approaches along with the benenfits/drawbacks on any approach. As an interim you can use the rust verifier via the CLI, which might also help for providing a regression suite to test for comparable behaviour as the verifier side of Pact-python gets built out. As to easily contribute, I would probably say its not as clear as I would like for newbies but it seems with a few refreshed eyes on it, I am sure we can come to a general consensus, carve up and create reasonably well groomed cards which can be picked up by (ideally) anyone with some python/pact experience - but that shouldn't be a _huge pre-_requisite, wannabe polyglot programmers are welcome

samir.ferreira
2023-03-16 16:27
has joined #pact-python

yousafn
2023-03-16 16:28
recommended workaround at the moment (apologies it isn't ideal) https://github.com/pact-foundation/pact-python/issues/312#issuecomment-1278807182

christine.awofeso
2023-03-16 16:30
Thanks @yousafn

kripa.kurian
2023-03-16 19:31
@kripa.kurian has left the channel

raess.simon
2023-03-16 23:02
has joined #pact-python

anshu.ranjan1002
2023-03-17 21:59
has joined #pact-python

mptinternational
2023-03-18 18:12
has joined #pact-python

16728365
2023-03-19 14:30
has joined #pact-python

brick777
2023-03-19 21:47
has joined #pact-python

mark.ingram
2023-03-20 11:31
has joined #pact-python

jo.laing
2023-03-20 17:06
has joined #pact-python

erich.buri
2023-03-20 22:07
has joined #pact-python

xiaorong.ruby
2023-03-21 09:34
has joined #pact-python

markcox20
2023-03-21 10:08
has joined #pact-python

oloruntobi.ayilara
2023-03-21 14:01
has joined #pact-python

pankaj_kumar39
2023-03-21 14:18
has joined #pact-python

ravi_shankar_lakkims
2023-03-21 14:18
has joined #pact-python

sathish.nilla
2023-03-21 14:19
has joined #pact-python

sikandar_kumar.singh
2023-03-21 14:19
has joined #pact-python

benjamin.earle
2023-03-21 19:23
has joined #pact-python

sanjaysingh99in
2023-03-22 00:57
has joined #pact-python

rafalmaciak
2023-03-22 08:03
has joined #pact-python

jyothy18
2023-03-22 09:23
has joined #pact-python

haiyang.huang
2023-03-22 10:30
has joined #pact-python

denispegan4
2023-03-22 13:14
has joined #pact-python

ulises.cervino
2023-03-22 21:01
@ulises.cervino has left the channel

tranghetti
2023-03-22 21:15
has joined #pact-python

amruta_mandavilli
2023-03-23 06:23
has joined #pact-python

shubhamshriram.shinde
2023-03-23 06:34
has joined #pact-python

juliemarierosok
2023-03-23 08:20
has joined #pact-python

colin.aygalinc
2023-03-23 09:23
has joined #pact-python

me1685
2023-03-23 10:53
has joined #pact-python

gregpovorozniuk
2023-03-23 11:32
has joined #pact-python

mpalla553
2023-03-23 14:51
has joined #pact-python

sumit.singh
2023-03-23 18:03
has joined #pact-python

quinton.miller
2023-03-23 19:18
has joined #pact-python

quinton.miller
2023-03-23 19:21
Hello, I am trying to verify my pact contracts in my Python project and am having some trouble. In the docstrings in `verifiers.py` it says that the verify_with_broker function is supposed to return true if there are no issues. However, the readme shows that the function should return `0`. Which one is correct?

matt.fellows
2023-03-24 06:01
I think the CLI would return an exit code of `0` which this wraps. Looking at https://github.com/pact-foundation/pact-python/blob/master/pact/verify_wrapper.py#LL199C31-L199C31, I think it would be 0. It doesn?t look like (to my eyes) it gets converted to a boolean

hurdledatrade
2023-03-24 11:24
has joined #pact-python

srijan.c
2023-03-24 15:26
has joined #pact-python

praveen.gangasani
2023-03-26 13:19
has joined #pact-python

yzxu
2023-03-27 07:27
has joined #pact-python

1248124408
2023-03-27 08:59
has joined #pact-python

daniel.redelberger
2023-03-27 09:07
has joined #pact-python

mohammed.a.ezzedine
2023-03-27 15:25
has joined #pact-python

kiran.malsetty
2023-03-27 17:20
has joined #pact-python

rchild
2023-03-27 18:46
has joined #pact-python

asoni
2023-03-27 20:23
has joined #pact-python

yu.xie
2023-03-28 00:08
has joined #pact-python

gamer.fikri
2023-03-28 04:46
has joined #pact-python

shaun.carmody
2023-03-28 13:23
has joined #pact-python

christianschiepe
2023-03-28 13:50
has joined #pact-python

melikesezin
2023-03-28 14:02
Hello, I'm trying to understand how Matcher works for pact-python. Apparently I cannot use Like, SomethingLike, Term etc. for matching keys in json responses. In below example, I'll have at least 1 node in response, where the node id can have any value (in the example there are 3 nodes with ids 1, 2, 3). Is there a way to make this work? expected = { "nodes": { "1": { "description": SomethingLike("description"), "classification": SomethingLike("classification") }, "2": { "description": SomethingLike("description"), "classification": SomethingLike("classification") }, "3": { "description": SomethingLike("description"), "classification": SomethingLike("classification") } } }

aberman
2023-03-28 19:24
has joined #pact-python

egrep
2023-03-28 21:21
Hi Melike, Could you please explain a bit more what the exact problem is? I?m not sure I understand what you want to achieve.

matt.fellows
2023-03-29 01:42
I think Melike wants the equivalent of `eachLike` (which matches on values of an array) but for unknown keys in a hash

matt.fellows
2023-03-29 01:43
This is currently not supported in Python, which only supports up to the V2 Pact Specification.


0xoscario
2023-03-29 03:38
has joined #pact-python

melikesezin
2023-03-29 06:59
Thanks a lot for your help. Indeed, I want to have the equivalent of eachLike for unknown keys. If it's not supported in Python (yet), any idea on a workaround?

egrep
2023-03-29 12:01
@melikesezin could you please open a new feature request at pact-python project? I?ll to sort out

matt.fellows
2023-03-30 02:14
Is the verification also via Pact Python? One dodgey workaround I can think of, is to simply update the `pact` file afterwards to inject the matching rules you need. Then if a library that _can_ understand that matcher verifies it, it will work.

matt.fellows
2023-03-30 02:15
But as @egrep said, a good starting point is an issue.

melikesezin
2023-03-30 09:19
@egrep I have just created a feature request. Thanks!

melikesezin
2023-03-30 09:20
@matt.fellows Indeed the verification is also via pact-python. I'll try to inject additional matcher rules within provider-tests, after downloading the pacts. Thanks!

egrep
2023-03-30 09:22
@melikesezin Is it pact-python repo? I don?t see a new issue




melikesezin
2023-03-30 09:25
oh sorry I just created the feature request, thanks for creating the issue!

paddyhendy94
2023-03-30 12:48
has joined #pact-python

haroldrobson11
2023-03-30 13:16
has joined #pact-python

jfbosca
2023-03-30 15:26
has joined #pact-python

gokuldot
2023-03-31 17:25
Hi All, I am new to this topic. Planning to implement in my micro service project. I am seeing consumer verification using mock server in pact python. Can we continue the same for provider verification with pact file? Is there any GitHub location to understand on it? Interested to learn more on contract test using http://pact.io with python. Kindly help.

egrep
2023-03-31 20:33
Hi! I?m glad to see you?re interested in contract testing using Pact for your microservices project. I?m more than happy to help you get started with this topic. First and foremost, I recommend you go through the 5-minute introduction at https://docs.pact.io/. It won?t take much time, but it will help you grasp the basic principles. Don?t worry if the guide is not specific to Python, as it will still be beneficial. As for working with Python, a great starting point would be the following page: https://docs.pact.io/implementation_guides/python. It may not be exhaustive, but it will definitely help you get started. Regarding contract verification, I suggest you check out this page: https://docs.pact.io/provider. Additionally, I?d like to offer you two Python example projects that I created for learning purposes: 1. https://github.com/sergeyklay/consumer-pact-example 2. https://github.com/sergeyklay/provider-pact-example Please feel free to ask questions and experiment. We?re here to help you and anyone else who seeks assistance. Good luck with your journey in contract testing using Pact!

daominhdam
2023-04-01 10:04
has joined #pact-python

gokuldot
2023-04-02 02:59
Thank you very much for your reply and encouragement. Will go through the materials.

matt.fellows
2023-04-03 00:13
Awesome work @egrep, @mike.geeves064 and @elliottmurray !

mike.geeves064
2023-04-03 08:07
Still getting the hang of multiple GitHub accounts :smile:

joseph.gately
2023-04-03 14:14
has joined #pact-python

bram.harmsen
2023-04-04 07:20
has joined #pact-python

sarah.al-hawi
2023-04-04 10:55
has joined #pact-python

andrei.enache
2023-04-04 10:55
has joined #pact-python

sohaib.zahid
2023-04-04 10:55
has joined #pact-python

behrouz.pooladrak
2023-04-04 10:55
has joined #pact-python

amarpal.amrith
2023-04-04 10:57
has joined #pact-python

laszlo.bogardi
2023-04-04 10:57
has joined #pact-python

caroline.thom
2023-04-04 13:20
has joined #pact-python

jeremy.chao
2023-04-04 14:49
has joined #pact-python

bmdk83
2023-04-04 15:51
has joined #pact-python

maithree.uppunda
2023-04-05 07:50
has joined #pact-python

sivamkumar80
2023-04-05 13:34
has joined #pact-python

vanja.ilic
2023-04-05 14:24
has joined #pact-python

proydimonoff
2023-04-05 14:30
has joined #pact-python

proy
2023-04-05 14:33
has joined #pact-python

kevin.moylan
2023-04-05 16:13
has joined #pact-python

vijaykumar.patel
2023-04-06 06:36
has joined #pact-python

ankit.kumar
2023-04-06 10:55
has joined #pact-python

joye.arbuckle
2023-04-06 14:24
has joined #pact-python

allison.stone
2023-04-06 19:36
has joined #pact-python

mayank
2023-04-06 22:11
has joined #pact-python

ganesh.walunj
2023-04-07 06:05
has joined #pact-python

jan.krolikowski
2023-04-07 14:39
has joined #pact-python

mragni.majhwar
2023-04-07 17:51
has joined #pact-python

gonzalo.granizo
2023-04-11 10:13
has joined #pact-python

theburningmonk
2023-04-11 11:29
has joined #pact-python

helenarodcal
2023-04-11 11:31
has joined #pact-python

enver.yasar
2023-04-11 13:39
has joined #pact-python

christian.ledgard
2023-04-11 13:49
has joined #pact-python

ddongre
2023-04-11 15:09
has joined #pact-python

prajapati.pravesh
2023-04-12 02:56
has joined #pact-python

edwin.raju
2023-04-12 08:13
has joined #pact-python

john.hennigan
2023-04-12 08:16
has joined #pact-python

donald.robertson
2023-04-12 10:42
has joined #pact-python

tam.norris
2023-04-12 10:46
has joined #pact-python

gopijaganathan7
2023-04-13 07:27
has joined #pact-python

lukaszmalek90
2023-04-13 11:40
has joined #pact-python

omri.eyal
2023-04-13 13:23
@omri.eyal has left the channel

nickwilliamsqa
2023-04-13 16:15
has joined #pact-python

guozhangliew
2023-04-14 02:03
has joined #pact-python

praboo.p
2023-04-14 07:17
has joined #pact-python

florenciaaldana.rodri
2023-04-14 08:10
has joined #pact-python

taher.kapasi
2023-04-14 15:53
has joined #pact-python

michael385
2023-04-14 16:40
has joined #pact-python

darrenoc3
2023-04-15 03:46
has joined #pact-python

ones.ardo
2023-04-17 07:58
has joined #pact-python

deeptiagrawal
2023-04-17 23:31
has joined #pact-python

madhukar.koratagere
2023-04-18 06:24
has joined #pact-python

mahesh.damavarapu
2023-04-18 06:26
has joined #pact-python

sagupta
2023-04-18 13:52
has joined #pact-python

paul.caplan
2023-04-18 14:52
has joined #pact-python

squarism
2023-04-18 22:42
has joined #pact-python

squarism
2023-04-18 22:58
I can't figure out how to use the pact context or data in the contract in pact-python when doing non-HTTP. ```pact.given({"name": "Test provider"}).with_content("foo") # assume this usage is correct, I see JSON saved to pacts/ and it is correct # now, I want to use the value "foo" with pact: # invoke my function with foo but I need to get foo from the contract, I don't know how to do this do_foo(foo) # I might guess something like # - get the contract agreement between "Test consumer" and "Test provider" for "this scenario" and then get the content for that situation. # This is what I remember anyway.``` I debugged this with ipdb and other things for hours, looking at the objects within but I can't find anything interesting.

yousafn
2023-04-18 23:12
one of our community contributors made an sns example it might help https://github.com/pactflow/example-consumer-python-sns/blob/main/tests/unit/product_service_pact_test.py i assume are we talking about fully on the consumer side here? are you trying to do something with the response from your event handler so after it?s processed the message? or trying to get data into the pact?

cars2991
2023-04-19 02:42
has joined #pact-python

vaidas.sieber
2023-04-19 06:42
has joined #pact-python

jonathandelaros
2023-04-19 07:40
has joined #pact-python

priyaranjanmudliar
2023-04-19 09:05
has joined #pact-python

ajaydiwakar.ka
2023-04-19 10:11
has joined #pact-python

meghaagr
2023-04-19 10:13
has joined #pact-python

hcummins
2023-04-19 12:58
has joined #pact-python

michael.dasilva
2023-04-19 13:13
has joined #pact-python

ivana.lazic
2023-04-19 14:04
has joined #pact-python

vakong13
2023-04-19 16:15
has joined #pact-python

squarism
2023-04-19 20:27
Yes, thank you. This was helpful even though I had seen similar examples. I used a variable. :face-palm: This is what I was missing I guess. Welcome to _sleep on it_ :bed: Consumer works. Now, I'm trying to figure out how to do the Producer. The pydocs seem wrong. This https://github.com/pact-foundation/pact-python/blob/master/pact/message_provider.py#L20 Does not match the init signature. `consumer` is required. So I'm trying `MessagePact`. Also, the `MessageProvider` seems to send a `/ping` message to `:1234` when `pact.verify()` runs. I can see it by running a python web server (the `-m http.server` trick). This is why I'm trying to use `MessagePact`. ```::1 - - [19/Apr/2023 13:13:12] code 404, message File not found ::1 - - [19/Apr/2023 13:13:12] "GET /ping HTTP/1.1" 404 -``` Of course I don't have `/ping` but also I don't want it. I'm doing non-HTTP. Actually it seems to fire with any `with pact:` statement.


squarism
2023-04-19 20:34
I don't understand what context is doing here or where it comes from https://github.com/pact-foundation/pact-python/blob/master/pact/message_pact.py#L27

ravinder.kadiyan
2023-04-20 09:56
has joined #pact-python

alfredo.castro
2023-04-20 13:27
has joined #pact-python

lluis.casals
2023-04-20 17:07
has joined #pact-python

squarism
2023-04-20 18:02
I think my issue and hangup is that this Ruby gem https://github.com/reevoo/pact-messages is doing a lot of nice convenience work to look up the data from the Provider/Producer side and then passing it to the test. Not only is this gem very old but there's no equivalent in python that I know of. ```# pseudo-ish ruby code for the provider contract test (e.g. provider_spec.rb) context "When an image recognition system is given a picture" do let(:contract_message) { Pact::Messages.get_message_sample("A Provider", "A Consumer", "Dog picture given") } it "sends a dog picture" do # sends "dog.jpg" (from the contract that was created by the consumer) and returns "dog" result = subject.analyze_image(contract_message) expect(result).to eq("dog") end end```

squarism
2023-04-20 18:11
This would align with the nirvana guide for non-http

squarism
2023-04-20 18:11
Green to gray steps are what I have done. Now I need to `read`. I'll have to write a python JSON reader myself I guess.

squarism
2023-04-20 18:12
I'm curious why the pact-messages gem is old

squarism
2023-04-20 22:07
Solved for now. The consumer test is done using `MessageConsumer` which there are examples online (the async message queue examples). Here's my workaround for the provider.

dprawatya
2023-04-21 01:11
has joined #pact-python

mbutt
2023-04-21 01:11
has joined #pact-python

matt.fellows
2023-04-21 01:33
BTW the correct Ruby message project is https://github.com/pact-foundation/pact-message-ruby. The other one is some 3rd party project (which was the only option prior to the official Ruby supported one)

marcia.meira
2023-04-21 12:43
has joined #pact-python

raubreysmith
2023-04-21 12:46
has joined #pact-python

ksenia.vasileva
2023-04-21 15:03
has joined #pact-python

yousafn
2023-04-21 15:18
Hey hey, Got an arm64 machine? Might want to check this out https://github.com/pact-foundation/pact-python/pull/342 Testing would be most welcome

jack.amico
2023-04-21 15:48
has joined #pact-python

squarism
2023-04-21 22:09
Perfect! This gem wasn't available years ago. It's working fine already and this will definitely help me with the python version.

cheng.ngai
2023-04-22 00:55
has joined #pact-python

matt.fellows
2023-04-22 13:40
Excellent!

aditya.kashyap
2023-04-24 05:13
has joined #pact-python

iustina.gavrila
2023-04-24 09:15
has joined #pact-python

vandana.aveva
2023-04-24 18:24
has joined #pact-python

lucas
2023-04-25 00:01
has joined #pact-python

lucas
2023-04-25 00:06
Hi everyone! I?m Lucas, new to this channel. I?ve been trying to setup Contract Testing in a React based consumer with a Django REST Provider. I?ve been able to run the the test in the consumer following the pact-js docs but I wasn?t able to follow the pact-python guide to setup the checks in the provider. I was able to install pact locally and run the checks with the pact-verifier CLI. But I need to do add Auth to the requests so I wanted to add it as a middleware somewhere. Is there any guide on how to setup the tests locally in a Django based app?

szydlakus
2023-04-25 11:19
has joined #pact-python

sarah.hutchins
2023-04-25 12:48
has joined #pact-python

kristoffer
2023-04-25 13:31
has joined #pact-python

jack.drake
2023-04-25 15:40
has joined #pact-python

mathivanan.kailasam
2023-04-25 16:15
has joined #pact-python

hornc
2023-04-25 18:00
has joined #pact-python

hulia.suliman
2023-04-25 18:07
has joined #pact-python

markus.nakhlah
2023-04-26 13:44
has joined #pact-python

jean-francois.renaud
2023-04-26 21:09
has joined #pact-python

lucas
2023-04-26 22:22
Okay so I was able to use Django REST unittest methods for running the pact tests and adding a header to the Verifier class. The problem is that by using Django built in testing tools I need to use the test DB that Django spins up when running tests and Pact tests run against a running server (so it?s a different DB). As a workaround (and also to avoid running the server locally to run the contracts) I?m using the django.test.LiveServerTestCase class to create the contract test in the provider. This allows me to automatically run the server when running that test and use the DB I set up locally (I think). I?m still trying things out but maybe this helps someone.

jakazzy
2023-04-27 06:16
has joined #pact-python

srinivas.nali
2023-04-28 14:27
has joined #pact-python

andrew.favaloro
2023-04-28 15:59
I?ve noticed a strange behavior, and I think it?s a bug in the python library, but wanted to check in here. It seems like after a test runs, and `pact.verify()` has been called, an interaction will stick around on the pact mock server, which can lead to some unexpected behaviors (:thread:)

dmitriy.tarasevich
2023-04-28 16:00
has joined #pact-python

andrew.favaloro
2023-04-28 16:00
Let?s say I have the following four tests: ```def test_1(): with ( pact.upon_receiving("Get description") .given("provider state") .with_request(method="POST", path="/") .will_respond_with(status=200) ): assert http://requests.post(f"{BASE_URL}/").status_code == 200 def test_2(): with ( pact.upon_receiving("Post description") .given("provider state") .with_request(method="GET", path="/") .will_respond_with(status=200) ): assert requests.get(f"{BASE_URL}/").status_code == 200 def test_3(): assert http://requests.post(f"{BASE_URL}/").status_code == 200 def test_4(): assert requests.get(f"{BASE_URL}/").status_code == 200```

andrew.favaloro
2023-04-28 16:00
Test 1 will pass, because we defined the interaction before making the request. Test 2 will pass, because we defined the interaction before making the request. Test 3 will fail, because there is no interaction defined for a POST request. Test 4 passes.

jigish.mehta
2023-04-28 16:00
has joined #pact-python

andrew.favaloro
2023-04-28 16:00
I would expect test 4 to fail, because there is no interaction set. However, it seems that interactions are cleared when we enter into the context manager of `with pact...`, (https://github.com/pact-foundation/pact-python/blob/master/pact/pact.py#L362-L368, https://github.com/pact-foundation/pact-python/blob/master/pact/pact.py#L166-L178) as opposed to when we exit. This means that whatever the last interaction that was defined sticks around, and can be unwittingly used, leading to unexpected results. Namely, it suddenly makes the order that tests are run in a factor in whether or not they pass. In the example above, if I ran the tests in the order `test_2, test_1, test_3, test_4`, then test 3 would pass and test 4 would fail.

andrew.favaloro
2023-04-28 16:00
Just want to confirm that this is a bug, as opposed to expected behavior for some reason.

juan.felix
2023-04-28 16:01
has joined #pact-python

himesj
2023-04-28 17:25
has joined #pact-python

matt.fellows
2023-04-28 22:30
Thanks for sharing!

itsforbabu
2023-04-29 14:25
has joined #pact-python

tea.trader168
2023-04-30 02:04
has joined #pact-python

matt.fellows
2023-04-30 23:30
It?s probably a lifecycle thing. Behind the scenes, between tests the interactions should be cleared. I?m guessing that verify is only called after all of these tests, and so the clearing of interactions isn?t happening

matt.fellows
2023-04-30 23:30
I?m not super familiar with the Python DSL, but it?s plausible that?s what is happening

andrew.favaloro
2023-04-30 23:56
Yeah, it looks like interactions get cleared in the setup phase, not the verify phase, which feels odd. To you knowledge, there's no good reason to do it that way? Or do you know if in other libraries the interactions are cleared before tests as opposed to after?

matt.fellows
2023-05-01 01:34
In Pact JS/Go, they are cleaned in between each test. In the older versions, a lifecycle method was exposed to users to call (`finalize`) but in the latest version, it does it automatically. that is, you can?t get into that state

lori.maurais
2023-05-01 15:27
has joined #pact-python

damola.thompson
2023-05-02 07:26
has joined #pact-python

ivan.v.kurlovich
2023-05-02 13:01
has joined #pact-python

ckulkarni
2023-05-02 14:22
has joined #pact-python

aurel.pintea
2023-05-02 14:55
has joined #pact-python

ariveros142
2023-05-02 20:03
has joined #pact-python

cody.jenkins
2023-05-03 04:48
has joined #pact-python

ashish.tilara
2023-05-03 06:08
has joined #pact-python

alfred.brose00
2023-05-03 08:17
has joined #pact-python

alfred.brose00
2023-05-03 08:37
Hello all! I'm a total beginner in the area of contract based testing. In my current project our teams are developing a microservices system for AI based marketing tools. We are exclusively on AWS and our microservices are mainly AWS Lambda Functions. Due to some constraints in the past we don't use API Gateways for the "internal" service-to-service communication. Most communication is message based - Event Bridge and SQS, but in some cases we're doing direct calls via lambda invocation using boto3 (we're using python for all our lambda services). So, for example service A needs to call an endpoint in service B, so service A invokes the right lambda function (by name) from the service B which represents/handles this endpoint. I'm trying to wrap my head around how to test service A (consumer) and service B (Provider) using pact. The recipes page https://docs.pact.io/recipes/lambdahttp which should cover this topic is empty and I couldn't find anything related on the internet. How do I tackle this? I know that the best practice approach would be to "hide" the lambdas behind a Rest Endpoint (Api GW or VPC Lattice) but we're not there yet. Alfred

yousafn
2023-05-03 08:47
Hey hey Alfred, Does this help at all https://github.com/pactflow/example-consumer-python-sns It was written by one of our maintainers It's based on the sns e2e example in javascript I thought I had pulled it into the site, but it seems not (will add to my list of yaks to be shaved) This page should help explain the concept of message pact https://docs.pact.io/getting_started/how_pact_works#non-http-testing-message-pact there is some limitations, as we only focus on the message, not the protocol, as a necessary abstraction The framework has since been extended to allow for plugins https://docs.pact.io/plugins/quick_start to allow for catering of the transport layer too

yousafn
2023-05-03 08:48
Although the example is for PactFlow, you can easily switch it out for an open source broker, by changing the token params to username/password :+1:

alfred.brose00
2023-05-03 08:51
Thanks Yousaf, I'll take a look into these. Right now I don't bother integrating a pact broker - I want to just get a simple example working :slightly_smiling_face: For this POC I don't mind copying the pact file over to the producer validation manually

yousafn
2023-05-03 08:52
Yeah no worries , that is what we recommend when starting out anyway :+1: best of luck

dibya.dhar
2023-05-03 09:04
has joined #pact-python

ronnie.kilsbo
2023-05-03 09:28
has joined #pact-python

caitriona.gallagher
2023-05-03 15:18
has joined #pact-python

yousafn
2023-05-03 17:01
:rocket: nice one @egrep There is something up with the pipeline for ubuntu-latest, with regards to this test tests/consumer/test_user_consumer.py::test_get_user_non_admin I wonder if the docker containers aren't ready yet?

majhwar.mragni
2023-05-03 17:03
has joined #pact-python


michael.fenstermaker
2023-05-03 20:56
has joined #pact-python

man.tse
2023-05-03 20:58
has joined #pact-python

tristan
2023-05-04 03:27
has joined #pact-python

michal.kopriva
2023-05-04 11:03
has joined #pact-python

james.jenks
2023-05-04 19:09
has joined #pact-python

abdurrahman.muratt
2023-05-04 20:50
has joined #pact-python

svetoldo444ka
2023-05-05 15:35
has joined #pact-python

arjun.gowda
2023-05-08 17:07
has joined #pact-python

valencianaad
2023-05-09 15:05
has joined #pact-python

marlon.jimenez
2023-05-09 17:53
has joined #pact-python

erollins
2023-05-09 18:49
has joined #pact-python

marcos.aruj
2023-05-09 23:39
has joined #pact-python

meritxell.rodriguez
2023-05-10 06:33
has joined #pact-python

yana.kliuch
2023-05-10 08:58
has joined #pact-python

james.brown
2023-05-10 14:01
has joined #pact-python

mark.bursnall
2023-05-10 14:01
has joined #pact-python

alexandru.simion
2023-05-10 14:01
has joined #pact-python

giulio.giovannini
2023-05-10 14:01
has joined #pact-python

razvan.grigorescu
2023-05-10 14:04
has joined #pact-python

henry.rutman
2023-05-10 18:28
has joined #pact-python

simondemartini
2023-05-10 19:53
has joined #pact-python

stefan.kemp
2023-05-11 07:42
has joined #pact-python

supersmile2009
2023-05-11 12:06
has joined #pact-python

lknaresh2
2023-05-11 18:20
has joined #pact-python

siddharth12345
2023-05-12 09:47
has joined #pact-python

siddharth.shetty
2023-05-12 09:51
has joined #pact-python

lukemstorey
2023-05-12 13:52
has joined #pact-python

rana
2023-05-13 20:56
has joined #pact-python

anatoliy.ganzyuk
2023-05-14 20:15
has joined #pact-python

minhajsid
2023-05-15 10:18
has joined #pact-python

artur.ashyrov984
2023-05-15 16:01
has joined #pact-python

jerson.zuniga
2023-05-15 20:25
has joined #pact-python

sekumar
2023-05-15 21:05
has joined #pact-python

jzunigacoayla
2023-05-15 21:41
has joined #pact-python

matthieu.saleta
2023-05-16 09:31
has joined #pact-python

carls.stfleur
2023-05-16 12:20
has joined #pact-python

dale
2023-05-16 16:01
has joined #pact-python

curb1968
2023-05-17 03:41
has joined #pact-python

robert.turner
2023-05-17 12:26
has joined #pact-python

nickwilliamsqa
2023-05-17 14:36
Hi, is it possible to for Pact to identify a breaking change to the contract locally, prior to publishing to a Pact Broker? Use case is local developer feedback that they haven't unintentionally made a breaking change to a contract, before opening a PR etc. For example, using Pact in a BDCT consumer, we've written the consumer test for a function which hits the desired endpoint, and maps the response to a model class. The response is mocked through Pact, and aligning changes to the class/mock response would not cause the consumer tests to fail - but would break the contract. My initial thoughts are no - as how does your consumer/provider know what the contract contains without communicating with the broker? But have had guidance that this is possible, so perhaps I am missing something (or misunderstood the guidance).

matt.fellows
2023-05-17 23:26
At the moment, with BDCT that is not the case, but do have on our backlog a ?can-i-deploy local? type command, that would accept local (i.e. in development) version of the consumer/provider contract, and compare it to the target environment. See https://github.com/pactflow/roadmap/issues/73 (and please vote/comment as necessary)

nickwilliamsqa
2023-05-18 08:49
Thanks Matt - have left a comment as would very much appreciate that feature! > with BDCT that is not the case Does this mean it is possible with a CD approach? We're planning on going with BDCT in the first instance but be able to do this immediately may sway us towards consumer-driven instead. In lieu of this feature we had considered comparing the hash of the generated pact-file locally to see if it had changed - is there anything pre-existing we could hook into here?

jsanthakumar
2023-05-18 09:47
has joined #pact-python

rmodrego
2023-05-18 09:47
has joined #pact-python

clm.whyte
2023-05-18 09:48
has joined #pact-python

fdonald
2023-05-18 09:52
has joined #pact-python

mgarcia
2023-05-18 09:53
has joined #pact-python

lsantarelli
2023-05-18 10:26
has joined #pact-python

bdocherty
2023-05-18 11:56
has joined #pact-python

srikanth_vemuri
2023-05-18 12:08
has joined #pact-python

perera.x.roshni
2023-05-18 12:16
has joined #pact-python

mohitkrishna.s.s12
2023-05-18 13:23
has joined #pact-python

dwayne.sykes
2023-05-18 16:23
has joined #pact-python

kancharla.g
2023-05-19 03:31
has joined #pact-python

matt.fellows
2023-05-19 05:13
> Does this mean it is possible with a CD approach Not really, the consumer pact still has to be published for the `can-i-deploy` check to run. So the local version really needs to apply to both patterns

matt.fellows
2023-05-19 05:13
> In lieu of this feature we had considered comparing the hash of the generated pact-file locally to see if it had changed - is there anything pre-existing we could hook into here? That?s probably not a terrible proxy, but obviously if the provider side changes/deploys you?ll lose that bit of tracking.

clm.whyte
2023-05-19 16:34
@clm.whyte has left the channel

joseantonionmfilho
2023-05-19 17:46
has joined #pact-python

anenada
2023-05-20 08:06
has joined #pact-python

rabrosimov
2023-05-20 20:11
has joined #pact-python

arm.arturpetrosyan
2023-05-22 10:37
has joined #pact-python

adra_verma
2023-05-22 12:11
has joined #pact-python

p.keshav.chainani
2023-05-22 12:13
has joined #pact-python

divya.s.parappanavar
2023-05-22 12:13
has joined #pact-python

n.duran
2023-05-22 14:38
has joined #pact-python

garry.wilson
2023-05-23 12:28
has joined #pact-python

verevad
2023-05-23 13:04
has joined #pact-python

jon.arambarri
2023-05-24 07:34
has joined #pact-python

jon.arambarri
2023-05-24 07:47
Hello, I'm having troubles installing pact-python on my project, I´m using Python 3.8.10, is it supported for this version? This is the error I'm getting: ERROR: Could not find a version that satisfies the requirement pact-python (from versions: none) ERROR: No matching distribution found for pact-python

yonatany
2023-05-24 08:14
has joined #pact-python

yousafn
2023-05-24 09:25
can you provide more details about your machine? it?s tested in CI against 3.8 ( and other versions ) cross platform in github actions, you can check this yourself

jon.arambarri
2023-05-24 09:37
Thanks for your answer Yousaf, I have sorted the issue out (it was a problem with my IP)

yousafn
2023-05-24 09:37
result! :raised_hands:

jon.arambarri
2023-05-24 10:47
Sorry Yousaf, I´m having a new issue. After installing the pact-python library I'm still getting a "Import "pact" could not be resolved" error. Any idea what the issue might be?

scoplin
2023-05-24 20:02
has joined #pact-python

aemanuelson
2023-05-25 23:41
has joined #pact-python

sreenivas.chaitanya
2023-05-26 08:29
has joined #pact-python

tigrandza
2023-05-26 08:46
has joined #pact-python

tle
2023-05-26 09:56
has joined #pact-python

adam699
2023-05-26 13:35
has joined #pact-python

mariusz.kapczynski
2023-05-29 12:10
has joined #pact-python

kazimierz.zarychta
2023-05-29 12:10
has joined #pact-python

pierre.zeidan
2023-05-30 13:10
has joined #pact-python

shkothari
2023-05-30 14:55
has joined #pact-python

bwang
2023-05-30 16:55
has joined #pact-python

dev.talha.akbar
2023-05-31 09:45
has joined #pact-python

msiles
2023-05-31 13:50
has joined #pact-python

eli.thorkelson
2023-05-31 18:14
has joined #pact-python

jegadeesan.ponnusamy8
2023-06-02 16:19
has joined #pact-python

siyuanshen1993
2023-06-03 10:36
has joined #pact-python

pawar.s
2023-06-05 05:15
has joined #pact-python

rohitkrishnan
2023-06-05 20:37
has joined #pact-python

payal.chainani
2023-06-06 06:32
has joined #pact-python

divya.parappanavar
2023-06-06 07:23
has joined #pact-python

mrudula.patil
2023-06-06 08:19
has joined #pact-python

asjad.baig.ind
2023-06-06 11:12
has joined #pact-python

rajat.chouhan
2023-06-06 12:16
has joined #pact-python

david.stothers
2023-06-07 07:25
has joined #pact-python

rafaela.azevedosouza
2023-06-07 08:52
has joined #pact-python

newmolti
2023-06-07 10:14
has joined #pact-python

danut.turta
2023-06-07 11:35
has joined #pact-python

dev664
2023-06-07 11:53
has joined #pact-python

david.blanco
2023-06-07 18:08
has joined #pact-python

jonathan.fisher
2023-06-07 19:30
has joined #pact-python

dev.pactslack
2023-06-07 20:17
has joined #pact-python

dan.nichols52
2023-06-08 04:30
has joined #pact-python

s.lohmeier
2023-06-08 08:08
has joined #pact-python

radek.stolarczyk
2023-06-08 13:32
has joined #pact-python

zeeshankhan0330
2023-06-08 16:36
has joined #pact-python

marek
2023-06-09 07:57
has joined #pact-python

michael.lawrence
2023-06-09 09:57
has joined #pact-python

mssachin
2023-06-12 08:06
has joined #pact-python

andy.frith
2023-06-12 12:31
has joined #pact-python

sandy.mechie
2023-06-12 15:08
Hello, When will pact-python be supported with GRPC plugin?

yousafn
2023-06-12 15:11
We are still on the hunt for active maintainers and contributors to help move this along https://github.com/pact-foundation/pact-python/issues/88#issuecomment-1327645996 There has been lots of appetite from the community for support, but very few hands willing to help get us there :slightly_smiling_face:

yousafn
2023-06-12 15:14
There are examples of how you can use the pact ffi library directly in python in the pact-reference repo https://github.com/pact-foundation/pact-reference/tree/master/python and I built out a poc here https://github.com/YOU54F/pact-python-ffi to give python users access to the underlying lib, but without any of the niceties of a consumer facing DSL that pact-python offers

sandy.mechie
2023-06-12 15:14
Thanks @yousafn: I'll check within my team and see if we can contribute to the great tooling

yousafn
2023-06-12 15:18
That would be amazing, and we would certainly support you and others, no pressure either way though :slightly_smiling_face:

ajay_886
2023-06-12 22:38
has joined #pact-python

steven.wang06
2023-06-13 05:06
has joined #pact-python

navanesyan
2023-06-13 07:05
has joined #pact-python

ran.tao
2023-06-13 21:46
has joined #pact-python

prakhar.roy371
2023-06-14 05:21
has joined #pact-python

john.joel.thetla
2023-06-14 10:16
has joined #pact-python

drew.bowman
2023-06-14 18:05
has joined #pact-python

devwenzel
2023-06-15 08:26
has joined #pact-python

ronen.yurik
2023-06-15 13:34
has joined #pact-python

matthew.finbury
2023-06-15 13:39
has joined #pact-python

anthony.sharp
2023-06-15 13:43
has joined #pact-python

mariane.leite
2023-06-15 15:25
has joined #pact-python

wvkehoe
2023-06-16 10:27
has joined #pact-python

rost.khanyukov
2023-06-16 22:59
has joined #pact-python

mich.krzyzanowski
2023-06-17 15:22
has joined #pact-python

f.barril
2023-06-18 16:58
has joined #pact-python

delboy1978uk
2023-06-20 07:46
has joined #pact-python

hammid.funsho
2023-06-20 22:18
has joined #pact-python

benjamine.nidhin
2023-06-21 12:15
has joined #pact-python

kuksa.vladyslav
2023-06-22 12:47
has joined #pact-python

suryasaharan
2023-06-22 15:41
has joined #pact-python

gabriel
2023-06-22 21:22
has joined #pact-python

bgrgincic
2023-06-26 11:00
has joined #pact-python

svilen.popov
2023-06-27 09:44
has joined #pact-python

matt982
2023-06-27 16:02
has joined #pact-python

allen.ayala
2023-06-28 16:20
What?s the follow up on this https://pact-foundation.slack.com/archives/C9VECUP6E/p1683135454656619? I?m trying to write contract tests for Amazon SQS, and when I was generating sample contract tests using the https://github.com/pact-foundation/pact-python I saw that the pact specification is version 3. Why is this the case? I thought only version 2 was supported for Python?

eltonlinconl07
2023-06-28 17:30
has joined #pact-python

matt.fellows
2023-06-28 23:25
Apologies for the confusion. Pact Message (the feature you?re wanting) is part of the V3 specification, however just this part of the spec was added to Python to support messaging, and thus you can do asynchronous message testing with Python

matt.fellows
2023-06-28 23:25
As for the top-level issue, we are still in need of a contributor on this front

carlosmmelo
2023-06-29 07:00
has joined #pact-python

prerit.jain849
2023-06-29 09:40
has joined #pact-python

sssona09
2023-06-29 11:12
has joined #pact-python

allen.ayala
2023-06-29 16:13
Great, thanks for the clarification!

antonio.blandon
2023-06-29 20:40
has joined #pact-python

arjun
2023-07-02 04:23
has joined #pact-python

adwait.damle
2023-07-03 06:39
has joined #pact-python

christian.ledgard
2023-07-03 09:44
Hello! I'm experiencing issues while running tests on my CI Jenkins Pipeline on my consumer repository. When I run the tests locally, the library generates the contract with no problem. However, when the tests run on a docker instance, part of a Jenkins Pipeline, I get the following error: ```urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=1234): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f94edd6b610>: Failed to establish a new connection: [Errno 111] Connection refused'))``` The docker seems unable to access the mockup service created by the library. Have you ever experienced something like this? Any possible solution? I found https://github.com/pact-foundation/pact-python/issues/244 with this problem, but no clear answer was provided _(they only mention an alternative library)_. Thanks for the help!

priyaranjanmudliar
2023-07-03 10:41
i faced a very similar issue, where locally i was able to generate the pact, but in the CI, it used to fail with the exact same error. I tried replacing localhost with ?127.0.0.1? in the host part, and it got resolved.

christian.ledgard
2023-07-03 10:57
Thanks for the suggestion! However, the issue persists when changing the host from `localhost` to `127.0.0.1` . Still experiencing `Connection refused`.

matt.fellows
2023-07-03 12:11
are there any logs to suggest the mock service started up correctly?

matt.fellows
2023-07-03 12:11
you can try and start it yourself by shelling into the docker container and seeing if you can get it to start

matt.fellows
2023-07-03 12:11
somewhere in the installation, a hidden `pact-mock-service` should be hiding away. You should be able to just execute it

matt.fellows
2023-07-03 12:12
Also, are the tests fully contained in docker, or are you attempting to start the mock service in docker, but run the tests from the outside? (unusual setup, but I?ve seen people try)

stan.amsellem
2023-07-03 14:00
has joined #pact-python

cobookman
2023-07-03 21:14
has joined #pact-python

anshu.behera.02
2023-07-04 07:01
has joined #pact-python

adam.strawson
2023-07-04 13:24
has joined #pact-python

mathewsa
2023-07-04 15:20
has joined #pact-python

olopezs
2023-07-04 16:03
has joined #pact-python

christian.ledgard
2023-07-05 07:32
Thanks, @matt.fellows. The mock service seems to have not started correctly since there is also an exception on `pact.start_service()` _(see image below)._ Also, the tests are fully contained in the docker (not tests from the outside).

nithesh
2023-07-05 08:14
has joined #pact-python

andre.tartarelli
2023-07-05 11:26
has joined #pact-python

matt.fellows
2023-07-05 11:56
Did you try running the binary manually to check as suggested?

laura.huysamen
2023-07-05 12:38
has joined #pact-python

goatleyj11
2023-07-05 12:43
has joined #pact-python

christian.ledgard
2023-07-05 14:35
I am coordinating with the teams because shelling the docker is not trivial in our CI/CD environment. Also, I am trying to reproduce it within a docker locally. Will get to you soon :)

lily.oconnell
2023-07-05 15:32
has joined #pact-python

mohanraj.r
2023-07-05 19:53
has joined #pact-python

ianlutz
2023-07-06 01:34
has joined #pact-python

rohit.m.patil27
2023-07-06 03:51
has joined #pact-python

timo.schwarzer
2023-07-06 06:18
has joined #pact-python

kuntol.banerjee
2023-07-06 06:54
has joined #pact-python

adwait.damle
2023-07-06 06:54
Hello guys, Is there a step-by-step tutorial on how to create a consumer test in python for Kafka?

matt.fellows
2023-07-06 07:22
I don?t think a step-by-step guide in Python (or actually, any language) exists. But there are examples in other languages

matt.fellows
2023-07-06 07:22
see :point_down: (howtoexamples)


adebakre
2023-07-06 11:28
has joined #pact-python

rajkumarbapuvrs
2023-07-06 17:35
has joined #pact-python

allen.ayala
2023-07-06 20:00
I?m attempting to run the provider verification using MessageProvider but when I run `verify_with_broker()` (with my custom https://github.com/pact-foundation/pact-python/tree/master/examples/message) I get a connection refused error for the `proxy_host` and `proxy_port` https://github.com/pact-foundation/pact-python/blob/master/pact/message_provider.py. Is the SDK supposed to automatically start https://github.com/pact-foundation/pact-python/blob/master/pact/http_proxy.py or do I have to invoke it? The verification is able to retrieve the contents of the pact stored in my online broker, but fails to connect to the mentioned proxy server

matt.fellows
2023-07-06 23:19
The proxy should start automatically.

matt.fellows
2023-07-06 23:20
Might be worth checking if `localhost` resolves to an ipv4 or v6 address. Or even just try updating it to `127.0.0.1` .

jorge.carneiro
2023-07-07 09:43
has joined #pact-python

carlleferink
2023-07-07 12:01
has joined #pact-python

allen.ayala
2023-07-07 14:07
I tried setting the proxy_host to `127.0.0.1` and tried various ports, but I still ran into the same issue. Are there any other potential causes for a connection refused error? Maybe something with my configuration?

allen.ayala
2023-07-07 14:10
For context, I?ve been referencing this https://github.com/pactflow/example-provider-js-sns to make a python SQS provider. I mainly care about getting the `make test` to work since this is what accomplishes the provider verification (to my understanding)

anju.ashk
2023-07-10 07:39
has joined #pact-python

rmahadeorathod
2023-07-10 09:48
has joined #pact-python

ekaterina.essina
2023-07-10 09:59
has joined #pact-python

arca.artem
2023-07-10 10:00
has joined #pact-python

connor.stevens
2023-07-10 11:35
has joined #pact-python

christian.ledgard
2023-07-10 14:12
I was able to identify the root cause of the issue. When I run the `Dockerfile` from `python:3.11,` everything is OK, but the tests fail when I run it from `python:3.11-alpine`. _(our company's Python image is based on python alpine image)_ Can you share with me if there is a missing library or some other incompatibility that?s stopping Pact from working on the Alpine-based image? CC. @matt.fellows


matt.fellows
2023-07-10 23:49
In general, I?d avoid Alpine for Pact but it should work in your case with the instructions above

pgeurtsen
2023-07-11 07:30
has joined #pact-python

rjurca
2023-07-11 08:22
has joined #pact-python

yousafn
2023-07-11 11:03
^ Will be cutting a new release to PyPi very shortly :slightly_smiling_face:

christian.ledgard
2023-07-11 11:34
Thanks for sharing, Matt. Installing the dependencies solved the issue. :+1:

yousafn
2023-07-11 12:54
:python: ista?s - A present for Tuesday. ? ARM64 for both Linux & MacOS is now natively supported by Pact Python ? Linux Support for x86 platforms (32-bit) has been dropped ? The ruby standalone now runs the latest ruby 3.2.2 (big bump from a deprecated Ruby 2.4) ? Plus a few other fixes and enhancements from the community and maintainers. https://pypi.org/project/pact-python/2.0.0/

frederic.vaugeois
2023-07-11 14:12
has joined #pact-python

marko.lamberg
2023-07-11 15:27
has joined #pact-python

lshilling
2023-07-12 09:31
has joined #pact-python

rudydc
2023-07-12 17:53
has joined #pact-python

bas
2023-07-13 15:44
@bas has left the channel

wesley.newcomb
2023-07-13 15:54
has joined #pact-python

joris.vaneijden
2023-07-14 10:56
has joined #pact-python

joris.vaneijden
2023-07-14 10:58
@joris.vaneijden has left the channel

tushar.adsul223
2023-07-14 15:29
has joined #pact-python

francisco.almeida
2023-07-17 11:35
has joined #pact-python

mike.lovely
2023-07-17 12:12
has joined #pact-python

kyam.harris_pact
2023-07-17 12:51
has joined #pact-python

drettie
2023-07-17 13:23
has joined #pact-python

mburns
2023-07-17 13:24
has joined #pact-python

amit.jadhav
2023-07-18 06:19
has joined #pact-python

aljaz.klanecek
2023-07-18 08:58
has joined #pact-python

amitw
2023-07-18 15:15
has joined #pact-python

amitw
2023-07-18 15:43
Hello people. I'm rather new to pact and I came across a roadblock - my python client is working with GRPC, and I understood that while pact can deal with such traffic, the python consumer is in dire need of help to go migrate to pact V4 that will enable this sort of integration. So, my question is - where to start? I've seen the repositories referenced here: https://github.com/pact-foundation/pact-python/issues/88 and I couldn't understand what should I do to help promote this. I'm trying to understand the scope of the project, and whether I can convince my employer to allocate time for that. Who should I talk with?

yousafn
2023-07-18 15:54
I got a bit further with pact verifier side here using the pact ffi based on some earlier work done by maintainers/contributors https://github.com/pact-foundation/pact-python/pull/357 the consumer side needs implementing but the libraries are loaded so it shouldn?t be a huge leap versus starting from scratch. Using the existing consumer tests as a base to check for progress and ensuring a neat interface that is either backwards compatible or you can build up a migration guide. I?ve added https://github.com/pact-foundation/pact-reference/blob/master/python/pact_plugin_grpc_v4.py of a grpc test using the pact protobuf plugin, in the pact-reference repo for inspiration and packaged it into a pretty rough example repo here - https://github.com/YOU54F/pact-python-ffi

fkelly
2023-07-18 17:28
has joined #pact-python

phananhdung104
2023-07-18 18:28
has joined #pact-python

amitw
2023-07-18 19:14
Thanks - I did look on those things, and I'm a bit confused - it seems like all of the code in the example is running on import, am I reading it correctly? I think I'm missing the starting point - What steps should I do in order to be able to write a consumer test that will look somewhat like this (not keeping the syntax, just writing of the top of my head): ```def test_grpc(): pact=Consumer(my_consumer).has_pact_with(GrpcProvider(<protobuf definitions>)) pact.given("db is",params={'person', Person}) .upon_recieving(<object before being encoded with relevant protobuf>) .will_respond_with(<object after protobuf parsing> ```

amitw
2023-07-18 19:15
first step seems like mocking would be the first thing to do, then add validations and then outputting a proper pact file

gurubabu.jampala
2023-07-19 01:02
has joined #pact-python

yousafn
2023-07-19 08:14
i don?t understand the first question about running on import, and i provided several links to its not clear which you are referring to. if you just want to run a grpc test in python i?ve provided you some code that doesn?t use pact-python if you want to get pact plug-in functionality in pact python the starting point would be looking at pact-pythons consumer class for the ruby implementation and a single http test that has already been written. write a consumer class which uses the ffi library and call the relevant functions. the pact python lifecycle handlers may need looking at, as we will invoke it via the ffi rather than the ruby cli as current. once you?ve covered that, you could extend to add in the method to call the pactffi plug-in method. you?ll find some inspiration of these calls wrapped in client libraries in that latest pact-js/pact-js-core/pact-net implementations. but there are many ways to skin a cat, whatever works for you

amitw
2023-07-19 10:03
sorry for not being clear, I'm at a bit of a loss. I started by looking at the https://github.com/YOU54F/pact-python-ffi/blob/main/pact_plugin_grpc_v4.py example, and wondered how to connect it to pact - it seems that there's no "main" function or other obvious entry point, so I'm not sure when and how it runs (this is the "runs on import" question). Should I be able to connect it to pact somehow? I started by cloning python-pact project and trying to understand how are the current stuff connected. If I got it right, it seems that the flow is: 1. pact.start_service() starts the http proxy by running a commandline (if I read correctly, it's something in Ruby?) 2. when calling "given", a state is added to "interactions" 3. same is true for calling upon_recieving and "will_respond_with" 4. When entering the context manager, setup is being called. 5. During setup, the field "interactions" is communicated to the server (first deleting whatever was there, then adding our own) 6. functions called within the context, client is verified. 7. Upon exiting the context manager, pact.verify() is called, sending a verification request to the server. 8. Somewhere later, the pact file is being produced, I'm not sure where and when. Is this the proper flow? If this is the case, are the following steps the correct thing to do? 1. run a different server in start_service (any recommendations on which?) 2. Adjust the format of the interactions to support the appropriate protocol version 3. all should work I'm not sure about where ffi becomes relevant

yousafn
2023-07-19 10:05
so pact-python is a wrapper around a pact core implementation written in ruby, it?s a standalone process, run as a CLI, so pact-python collects various options as passes them to the pact ruby core. the core functionality has been replaced by rust which is available as a shared library loadable with ffi, which supports up to v4 pacts and plugins (which you require) therefore in order to migrate the pact-python project to benefit from the rust core functionality, the calls which are made to the ruby cli, need to be replicated to call the pact ffi functions

yousafn
2023-07-19 10:07
> I started by looking at the https://github.com/YOU54F/pact-python-ffi/blob/main/pact_plugin_grpc_v4.py example, and wondered how to connect it to pact It is a standalone example, not related to the main `pact-python` project, you could build that python package and utilise that, but it is pretty raw and doesn?t use a nice python consumer dsl

yousafn
2023-07-19 10:08
I?m aware this isn?t hugely clear/straightforward for someone to jump in without alot of assumed knowledge, its on our current roadmap to document this migration to and utilisation of the ffi exposed functionality in the pact-rust core

amitw
2023-07-19 10:15
Ok, I'll try playing with it and seeing if I can have something running. Should I be looking into this : https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_mock_server ?

a.kravchenko357
2023-07-19 11:03
has joined #pact-python

matt.fellows
2023-07-19 12:03
What Yousaf said (we?re https://github.com/pact-foundation/docs.pact.io/pull/270 that would help answer such questions)

matt.fellows
2023-07-19 12:08
But in the meantime and to add to Yousaf?s points: 1. Most client languages wrap or embed a reference implementation (Pact is complex, and plugin support - which gRPC needs - is all wrapped up in the https://github.com/pact-foundation/pact-reference, distributed as a shared library) 2. Python is currently on our ?old? embedded Ruby implementation, but needs to be ported to the rust shared core before the latest and greatest features can be supported 3. If you want to shortcut this, Yousaf has showed how you might hack directly into the shared core and do what you need. As you note, this side steps the Python Pact implementation - so you would need to build your own wrappers/utilities to make it workable in a unit test environment a. You could then use 4. Alternatively, we would of course love any help to migrate Python to the latest shared core so that others may benefit from that work. 5. There are a few languages now that have done it (Pact JS, Pact .NET and Pact Go) and Pact PHP is https://github.com/pact-foundation/pact-php/pull/323 6. The #libpact_ffi-users is a good place for questions relating to implementation, and there are now several maintainers that could probably assist you, in lieu of a nice maintainer guide.

ivan.mikhalka
2023-07-19 12:21
Hello, guys, I have a question about verifying contract files. Currently I am using such row: ```success, logs = verifier.verify_pacts("{}".format(os.environ["CONTRACT_PATH"]))``` I have ability to check only one contract file per run such way. When I am trying to specify CONTRACT_PATH as directory, I am getting: ``` missing_files = [path for path in pacts if not path_exists(path)] if missing_files: > raise Exception("Missing pact files {}".format(missing_files)) E Exception: Missing pact files ['/my/path/to/contracts/'] ../venv/lib/python3.10/site-packages/pact/verifier.py:48: Exception =============================================== short test summary info ================================================ FAILED provider_test.py::TestProvider::test_execute_provider_checks - Exception: Missing pact files ['/my/path/to/contracts/'] ================================================== 1 failed in 0.97s ===================================================``` Can I specify many contract files at once? Or choose some files amongst others?

yousafn
2023-07-19 12:45
I don?t believe looking at the code that it supports a directory, it expects a file, or list of files. https://github.com/pact-foundation/pact-python/blob/00dcacd8ea49e8e90df3005d8883356286d061ae/tests/test_verifier.py#L55-L56 so you will probably need to read the files in the directory, and then pass them in https://github.com/pact-foundation/pact-python/blob/00dcacd8ea49e8e90df3005d8883356286d061ae/pact/verifier.py#L44-L53

ivan.mikhalka
2023-07-19 15:24
I am confused too

ivan.mikhalka
2023-07-19 15:26
as I?ve read source code for `verify_pacts` (though I am not Python developer), seems, it should be able to parse path as directory

yousafn
2023-07-19 15:27
There is nothing in the documentation nor tests to suggest that that function reads a pact dir and from your error its clear that it doesn?t

ivan.mikhalka
2023-07-19 15:28
still, it is

yousafn
2023-07-19 15:28
well its saying you are missing pact files if you pass a directory

ivan.mikhalka
2023-07-19 15:29
Wait: it not supposed to receive directories?

yousafn
2023-07-19 15:33
> There is nothing in the documentation nor tests to suggest that that function reads a pact dir unless you can find something that suggests otherwise, it would be a PR enhancement to the project.

yousafn
2023-07-19 15:33
or as said, and as documented in the test suite, you can parse the directory yourself, pull out the file paths and pass them to to the function :+1:

ivan.mikhalka
2023-07-19 15:35
ok

ivan.mikhalka
2023-07-19 15:35
I need to analyze this

yousafn
2023-07-19 16:24
you might be able to use `os.listdir('/path/to/pacts')`

thiagotrinta
2023-07-19 20:00
has joined #pact-python

ivan.mikhalka
2023-07-19 21:39
Probably, I need to specify it via env var. Like, one time I want to run one consumer: `export CONSUMER_1_CONTRACT=<path/to/contract1> && pytest provider_test.py` , next time the second: ```export CONSUMER_2_CONTRACT=<path/to/contract2> && pytest provider_test.py``` last time all of them: ```export CONSUMER_1_CONTRACT=<path/to/contract1> && export CONSUMER_2_CONTRACT=<path/to/contract2> && pytest provider_test.py```

ivan.mikhalka
2023-07-19 22:28
Currently solved like this: ``` pact_files = [] if not os.environ.get("CONSUMER_1_CONTRACT_PATH") is None: pact_files.append("{}".format(os.environ["CONSUMER_1_CONTRACT_PATH"])) if not os.environ.get("CONSUMER_2_CONTRACT_PATH") is None: pact_files.append("{}".format(os.environ["CONSUMER_2_CONTRACT_PATH"])) success, logs = verifier.verify_pacts(*pact_files)```

lotem.dagan
2023-07-20 10:48
has joined #pact-python

cmesyngi
2023-07-20 20:56
has joined #pact-python

alan.barker
2023-07-21 09:47
has joined #pact-python

vijaya.balla.external
2023-07-21 15:06
has joined #pact-python

dennis1125dennis
2023-07-22 02:30
has joined #pact-python

muhammedalimutlu
2023-07-23 18:40
has joined #pact-python

doug.hanke
2023-07-24 17:53
has joined #pact-python

sameswar.khuntia
2023-07-25 10:17
has joined #pact-python

michal.mirecki
2023-07-25 10:28
has joined #pact-python

yousafn
2023-07-25 14:17
Hey dude, just to note I added your solution, along with the one I proposed here https://github.com/pact-foundation/pact-python/issues/362 :+1:

jeremyjpark
2023-07-25 15:30
has joined #pact-python

chetana.mahangare
2023-07-25 15:58
has joined #pact-python

kwan
2023-07-25 18:49
has joined #pact-python

yousafn
2023-07-26 14:21
Nice smöl releases, release smöl, release early.

venkatesh.civic
2023-07-26 16:49
has joined #pact-python

bartlomiej
2023-07-26 18:06
has joined #pact-python

wongkoonwai
2023-07-27 03:14
has joined #pact-python

conrad.john
2023-07-27 08:37
has joined #pact-python

ajit.kumar
2023-07-27 11:37
has joined #pact-python

marekurbanowicz
2023-07-27 12:40
has joined #pact-python

maciej.krakowiak
2023-07-27 13:28
has joined #pact-python

mateusz.luty
2023-07-27 13:29
has joined #pact-python

amitw
2023-07-27 14:46
So, I've been trying to use ffi, looking at the example provided by @yousafn (that for some reason I can't get to run on my pc) I'm stuck at the first step - where should I be getting the .so\.dll to run? where should I get the header files from?


amitw
2023-07-27 14:57
thanks

pact259
2023-07-27 23:19
has joined #pact-python

ivan.mikhalka
2023-07-28 09:40
cool

hetal.patel
2023-07-28 14:04
has joined #pact-python

thatrandybrown
2023-07-28 16:49
has joined #pact-python

michael072
2023-07-29 03:08
has joined #pact-python

selniumtrainer
2023-07-29 08:10
has joined #pact-python

raylincontact
2023-07-31 01:51
has joined #pact-python

ext-damian.rudzinski
2023-07-31 10:01
has joined #pact-python

rostas.laszlo.dev
2023-07-31 11:27
has joined #pact-python

anubhuti.shrivastava
2023-08-01 07:35
has joined #pact-python

pavikrish
2023-08-01 07:45
has joined #pact-python

arnoldsi
2023-08-01 15:09
has joined #pact-python

stefan.waldhauser
2023-08-02 13:45
has joined #pact-python

shadman.equebal140
2023-08-02 19:20
has joined #pact-python

aravind.pai
2023-08-03 07:06
has joined #pact-python

ganeshacse01
2023-08-03 08:10
has joined #pact-python

yousafn
2023-08-03 11:13
After some Pact V3 goodness in Pact :python: ? Feast your eyes on https://github.com/pact-foundation/pact-python/pull/367

yousafn
2023-08-03 13:50
:broom:

br.holanda15
2023-08-03 14:35
has joined #pact-python

elliottmurray
2023-08-03 14:53
Amazing! Will catch up on this so at some point

abarkha1
2023-08-03 22:34
has joined #pact-python

boreyuk
2023-08-04 07:22
has joined #pact-python

evan196
2023-08-04 14:33
has joined #pact-python

marek.fexa
2023-08-06 08:36
has joined #pact-python

acemilyalcin
2023-08-06 16:55
has joined #pact-python

aniket.rane
2023-08-07 02:55
has joined #pact-python

aravind.pai
2023-08-07 06:55
*How to write a matcher for JSON object with properties?* I receive an API response like the following: ```{ "status": 200, "data": { "service1": { "type": "ONE", "moreinfo": "More Info about service1" }, "service2": { "type": "ONE", "moreinfo": "More Info about service2" }, "service3": { "type": "ONE", "moreinfo": "More Info about service3" }, "service4": { "type": "TWO", "moreinfo": "More Info about service4" } } }``` Using `EachLike` like the following doesn't work here because it matches against an array, not properties as in my example above. ``` expected = { "data": EachLike({ "service1": { "type": Like("ONE"), "moreinfo": Like("More Info about service1") } }, minimum=4) }``` How should I properly write a matcher for this? Also, I couldn't figure out a way to match the type of the key. (In the above example, I cannot use `Like("service1")` though my intention is to match against a `str` type, not the exact value of `"service1"`.) Is there another approach I could try with?

matt.fellows
2023-08-07 07:00
You could wrap the whole of `data` with a `Like`. i.e., pass the dictionary to it

matt.fellows
2023-08-07 07:01
this would ensure there are (in your example) 4 children present `service1` ? `serviceN` each with `type` and `moreinfo` properties that must be strings (the same as the type in the example given)

aravind.pai
2023-08-07 07:13
@matt.fellows Thank you for the quick response. I had intuitively started out that way, but it gave me errors, so I thought that wasn't allowed. I tried the following two approaches again, but neither works. :disappointed: ```expected = { Like("data": { "service1": { "type": Like("ONE"), "moreinfo": Like("More Info about service1") } }) }``` ```expected = { Like({ "data": { "service1": { "type": Like("ONE"), "moreinfo": Like("More Info about service1") } } }) }``` Perhaps there's something wrong with my syntax? This also doesn't make it clear that the expectation is for multiple properties. I could, of course, copy-paste the "service1" multiple times, but I'm not sure if the contract verification will look for exactly that many properties, in that order, with exactly those names? PS: I think some example codes in the documentation would help. I will gladly help out with a pull request to the documentation, once I can figure out myself how this works.

matt.fellows
2023-08-07 07:19
What is the signature of the `Like()` method?

matt.fellows
2023-08-07 07:19
It should be something like this: ```expected = { data: Like({ "service1": { "type": Like("ONE"), "moreinfo": Like("More Info about service1") } }) }```

aravind.pai
2023-08-07 07:57
Sure, that works syntax-wise, but it fails on the verification side. Because that sets the expectations for an array, while the response doesn't have an array, it has a number of properties.

matt.fellows
2023-08-07 08:01
No, `EachLike` does that. `Like` just says ?match this structure, using a `Like` matcher all the way through?

antony
2023-08-07 08:12
has joined #pact-python

aravind.pai
2023-08-07 08:12
Yes, but that contract gets verified if there's at least one property matching that specification, even if the other properties don't match that structure. That was why I wanted to use `EachLike` to start with. Also, I cannot "hardcode" the names like `"service1"` into the contract, I only want to check that the name is a string, but using `Like` in the "key" of the dictionary is not allowed. I'm ok with using a different approach to this including "write your own matcher". But I want to be sure there's no current solution and also that "write your own matcher" has some chance of success.

matt.fellows
2023-08-07 08:13
> Yes, but that contract gets verified if there?s at least one property matching that specification, even if the other properties don?t match that structure what do you mean?

aravind.pai
2023-08-07 08:16
For example: By using `Like ... "service1"`, the below response verifies the contract. But `"service2"` structure is different, and so the verification should fail. ```{ "status": 200, "data": { "service1": { "type": "ONE", "moreinfo": "More Info about service1" }, "service2": { "different": "ONE", "noinfo": "No Info about service2" } } }```

matt.fellows
2023-08-07 08:19
Pact would definitely catch the situation where you expected the above, but the provider did not return the same structure (at a minimum, extra fields in the provider response are of course allowed)

aravind.pai
2023-08-07 08:27
If you write the expectation like this: ```expected = { data: Like({ "service1": { "type": Like("ONE"), "moreinfo": Like("More Info about service1") } }) }``` then it won't catch the error in structure of `"service2"` . That is why I wanted to use `EachLike`. My requirement is only that the properties follow that structure, the provider need not return them in exactly the same order, for example. So I don't want to impose a condition stricter than what is necessary. Long story short, the structure returned is: ```"data": one or more of {...}``` But the `EachLike` matcher writes into the contract file: ```"data": [ one or more of {...} ]``` and I'm trying to figure out if there's a way to tell pact the difference between the two. Whereas with `Like`, I would get: ```"data": at least one of {...}``` But that's not what I want to check.

matt.fellows
2023-08-07 08:28
Yes, that?s correct, because it?s not included in your expectation.

matt.fellows
2023-08-07 08:28
There is a matcher, but it?s not yet in Python, which is called ?EachValueLike? (or similar), that just matches on values

matt.fellows
2023-08-07 08:29
> Whereas with `Like`, I would get: ```"data": at least one of {...}``` > But that?s not what I want to check. No, it?s ?the response has to have exactly this structure at a minimum, any additional properties I don?t care about? It?s not about numbers of items, it?s just because you?ve only provided 1 top level key. Add as many as you like. But I think your problem is that you have an unknown number of keys? If so, could you use provider states to help clarify the use case when verificatin happens? e.g. `given services A, B and C exist`

matt.fellows
2023-08-07 08:29
The `Each` type matchers are designated for Arrays

aravind.pai
2023-08-07 08:47
My problem is not so much the unknown number of keys, it is about how to write the contract test in a way that is readable and understood, even by someone who doesn't know about Pact. With matchers like `Like` and `EachLike`, the test is reasonably well-understood. But if I have, for example, 50 keys, and I need to enumerate each of them in the test, then the test becomes unreadable soon. Moreover, the contract verification becomes almost like string comparison, and then I imagine, when the test fails, figuring out what has mismatched won't be so obvious. But I would like to see that verification compare the contract with the actual response on a "higher level", and so the error response would say, "your expected `key object` did not match for the following keys ..." Essentially, what I was looking for is the following: For an Array of similar objects in the JSON response -> use `EachLike`. For multiple properties (key, object pairs) in the JSON response -> use ???. From this discussion, I understand that such a matcher isn't currently available. So I will take this back to my team at work, and we will figure out what we want to do next with it. If this usecase is important enough for us, we might explore developing our own matcher to fill the above "???". Thank you very much for patiently answering my questions and explaining this to me, Matt.

matt.fellows
2023-08-07 09:46
You?re welcome.

matt.fellows
2023-08-07 09:48
> But if I have, for example, 50 keys, and I need to enumerate each of them in the test, then the test becomes unreadable soon. Does the consumer know about the specific keys, or is it a generic format where the keys are always `serviceXYZ` and the consumer will just accept the arbitrary number of them? i.e. the consumer is not expecting `service1` and `service2` ? `serviceN`, it just expects there to be a key, and the shape of each of them is always consistent?

matt.fellows
2023-08-07 09:50
If it?s the latter, it?s the `EachValue` matcher you need (introduced in https://github.com/pact-foundation/pact-specification/tree/version-4#supported-matching-rules). Python currently only supports up to 2, but active development on 4 is https://github.com/pact-foundation/pact-python/issues/88


yousafn
2023-08-07 12:07
`EachLike` is for arrays as pointed out. Does this work, or does this fail expecting the known key `service1` or doesn't fail if another key say `service2` is present but with diff keys. ```expected = { Like({ "status": 200, "data": Like({ "service1": { "type": "ONE", "moreinfo": More Info about service1" } }) }) }``` if you want to add a test, even if its failing in the pact-python repo, it would be good to huddle on, and demostrate your issue

andreas.marcec.extern
2023-08-07 14:35
has joined #pact-python

jeffreykey
2023-08-07 17:44
has joined #pact-python

aravind.pai
2023-08-08 11:31
Hey guys, thanks for those questions. It helps me better understand what I actually want to do here. :slightly_smiling_face: I had hoped that I would have collected enough information to respond by now, but that has not happened unfortunately, so I will come back with more information in a few days. Some background here is I am a developer in the "provider team". We are doing an exploration of contract testing, and specifically the pact framework. We have already had discussions on a concept level with the "consumer teams" about the use of contract testing. Once we have a reasonably stable and functional prototype, we plan to approach them again to have more detailed technical discussions. So at the moment, I'm not entirely sure how the "consumer teams" would (or should) write their tests. But I'm collecting as much information as I can for now.

vaishali.rastogi
2023-08-08 12:29
has joined #pact-python

michael.knoll
2023-08-08 14:02
has joined #pact-python

michelle.he
2023-08-08 19:02
has joined #pact-python

matt.fellows
2023-08-08 22:26
Got it!

matt.fellows
2023-08-09 01:01
If it helps, one of the key things your consumers should be doing is writing a good set of tests that cover _their_ needs of your API, and not simply enumerating all of the things the API can do. This is what gives you visibility into how consumers are actually using your API, and importantly, information that allows you to remove or change things that won?t impact them (or if it does, you?ll know who it impacts and can have the discussion)

mohammed.a.ezzedin501
2023-08-09 11:17
has joined #pact-python

jacopo
2023-08-09 15:34
has joined #pact-python

enrique519
2023-08-09 23:57
has joined #pact-python

sheyanr
2023-08-10 02:55
has joined #pact-python

rcalvo
2023-08-10 08:28
has joined #pact-python

endikaposadas
2023-08-10 08:40
has joined #pact-python

chinmaya.mishra
2023-08-10 10:05
has joined #pact-python

anderson.aeb
2023-08-10 12:37
has joined #pact-python

poojarylatika1
2023-08-10 14:17
has joined #pact-python

sebastianmsandri
2023-08-10 16:01
has joined #pact-python

biancoc
2023-08-11 14:27
has joined #pact-python

svarakantham
2023-08-14 00:19
has joined #pact-python

carrm
2023-08-14 13:22
has joined #pact-python

jd.courtoy
2023-08-14 16:25
has joined #pact-python

elenadoty
2023-08-14 20:01
has joined #pact-python

a.adeyeye.gr
2023-08-15 08:49
has joined #pact-python

bas.plijnaer
2023-08-15 12:32
has joined #pact-python

liam.butler
2023-08-15 15:20
has joined #pact-python

marcocbarbieri
2023-08-15 22:47
has joined #pact-python

juandiegopalacio
2023-08-16 09:00
has joined #pact-python

t.vandenberk
2023-08-17 09:12
has joined #pact-python

jianbin.lin
2023-08-17 15:07
has joined #pact-python

artur.suhaniaka
2023-08-17 20:34
has joined #pact-python

aniruddhasingh.kushwa
2023-08-18 01:40
has joined #pact-python

parthiban.rajasekaran
2023-08-18 08:32
has joined #pact-python

gowthamgopal24
2023-08-18 09:52
has joined #pact-python

sandy.mechie
2023-08-18 13:02
Hi Yousuf, sorry for coming back late on this. As a team we are interested in contributing back but we are figuring out what is the best process to do this considering the security context. I'll reach out to you in the next couple of weeks once I have clarity .

yousafn
2023-08-18 13:04
no worries, not sure what the security context is, maybe you could elaborate? i?ve been working on this PR here https://github.com/pact-foundation/pact-python/pull/367 and there is a grpc example in there, just needs dressing up in a nice python dsl

yousafn
2023-08-18 13:04
and no worries on the delay! thanks for getting back to us!

sandy.mechie
2023-08-18 13:11
Cool. To contribute back we would need approvals in place making sure we comply with firm security standards and controls that have been put in place..

naimun.siraj
2023-08-18 16:50
has joined #pact-python

eugeniosaulo
2023-08-18 21:28
has joined #pact-python

pere.villega
2023-08-20 17:49
has joined #pact-python

navin.dhanaraj
2023-08-21 00:10
has joined #pact-python

eduardo.rodrigues
2023-08-22 08:05
has joined #pact-python

nickkeers
2023-08-22 08:35
has joined #pact-python

stan.amsellem
2023-08-22 09:36
@stan.amsellem has left the channel

christophe.laranjo
2023-08-22 17:34
has joined #pact-python

huthayfa
2023-08-23 08:10
has joined #pact-python

dsherwin
2023-08-23 09:20
has joined #pact-python

marcel.novak
2023-08-23 13:53
has joined #pact-python

davidm
2023-08-23 15:57
has joined #pact-python

svmanikantakumar
2023-08-24 08:50
has joined #pact-python

eomeroff
2023-08-24 13:49
has joined #pact-python

riley.marzka
2023-08-24 17:47
has joined #pact-python

jared.anderson
2023-08-24 18:15
has joined #pact-python

timofeev1valeriy
2023-08-25 08:32
has joined #pact-python

kastala.nirosha
2023-08-25 09:17
has joined #pact-python

kkanova
2023-08-25 12:55
has joined #pact-python

theteea
2023-08-25 13:18
has joined #pact-python

theteea
2023-08-25 13:26
@theteea has left the channel

charlan.bettiol
2023-08-25 16:32
has joined #pact-python

david.tu
2023-08-25 17:51
has joined #pact-python

viktor.stephanyk
2023-08-28 12:46
has joined #pact-python

arpit.gawande
2023-08-28 12:58
has joined #pact-python

alexander.doppelbauer
2023-08-28 17:52
has joined #pact-python

jayapriya.m
2023-08-29 00:22
has joined #pact-python

grnmeadow7
2023-08-29 03:27
has joined #pact-python

sayantini.basak
2023-08-29 10:02
has joined #pact-python

shayanadc
2023-08-29 18:19
has joined #pact-python

jack.jones9512
2023-08-30 15:49
has joined #pact-python

craftyqa
2023-08-30 16:54
has joined #pact-python

jean-baptiste.bronisz
2023-08-31 15:48
has joined #pact-python

razorangel
2023-08-31 18:41
has joined #pact-python

dsharma
2023-08-31 19:11
has joined #pact-python

eytan.hanig
2023-08-31 22:10
has joined #pact-python

eytan.hanig
2023-09-01 03:15
For each of our providers we use https://github.com/openapi-generators/openapi-python-client to generate clients that our Consumers can use. *How do you recommend generating the contracts for these Consumers* given that they rely on the generated clients that abstract away the endpoints used in the normal `pact....with_request('GET', '/product/10')...` approach?


matt.fellows
2023-09-01 03:18
One of the reasons you can?t auto generate them, is that you won?t know what response fields the consumer needs, as well as which subset of endpoints the client uses

eytan.hanig
2023-09-01 03:19
I 100% agree with the need to base the contract on more than just schema, however I'm wondering if there's a way to create this contract while being able to interface with the clients like developers are used to doing.

eytan.hanig
2023-09-01 03:25
Example of usage: ```from producer_service_api_client import Client from producer_service_api_client.api.my_tag import get_my_data_model from producer_service_api_client.models import MyDataModel from producer_service_api_client.types import Response client = Client(base_url="https://api.example.com") my_data: MyDataModel = get_my_data_model.sync(client=client) # or if you need more info (e.g. status_code) response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)```

eytan.hanig
2023-09-01 03:33
More details on this here: https://github.com/openapi-generators/openapi-python-client/blob/a719c87b7d278135c475d8123aa144651fa55523/integration-tests/README.md At the end of the day this boils down to "I'm going to make this call and expect this response, so how can I use that to create a contract"?

matt.fellows
2023-09-01 04:46
> At the end of the day this boils down to ?I?m going to make this call and expect this response? do you mean Pact, or the OpenAPI document, boils down to this?

matt.fellows
2023-09-01 04:48
I like to think of the OpenAPI document as ?this is what my provider API can do? You can then think of the Pact tests as ?this is what my consumer needs / does? I don?t see why you couldn?t continue to write Pact tests as you would now, and you would just use those API clients in the tests?

munitheja91
2023-09-01 13:14
has joined #pact-python

eytan.hanig
2023-09-01 16:26
> you would just use those API clients in the tests This is exactly what I'm hoping for! There are great examples of https://docs.pact.io/implementation_guides/python/readme, but I'm not sure where to start writing tests that both use the generated clients and also create the desired contract/pact. Any advice?

eytan.hanig
2023-09-01 19:22
And, in particular, to do so in a way such that the test author doesn't need to know the actual endpoint that the client abstracts away from them.

alvarado.kelvin
2023-09-02 12:48
has joined #pact-python

sautade
2023-09-04 01:23
has joined #pact-python

joshua.ellis
2023-09-04 04:51
has joined #pact-python

bbodoque.atsistemas
2023-09-04 10:21
has joined #pact-python

avanlent
2023-09-05 05:56
has joined #pact-python

callum.atkinson
2023-09-05 17:00
has joined #pact-python

emilie.bline
2023-09-05 22:27
has joined #pact-python

me1414
2023-09-06 12:37
has joined #pact-python

juantamosaitis2015
2023-09-06 13:24
has joined #pact-python

ali.tariq
2023-09-06 14:51
has joined #pact-python

anas.zakarneh
2023-09-06 15:04
has joined #pact-python

anas.zakarneh
2023-09-06 15:44
Hello We?re currently experimenting Pactflow to test our system, our system consists of interconnected MSs that communicate with each other, both synchronously and asynchronously. In our experiment, we have one Provider and one Consumer: 1. the consumer makes requests to a Consume an API in one scenario. 2. the consumer consumes a message from the same Provider in another scenario. *On the Consumer side, we have two tests:* ? The first test creates an API interaction contract ```@pytest.fixture def pact(): pact = (Consumer('ConsumerName') .has_pact_with(Provider('ProviderName'), host_name=settings.TESTING_SERVICES_HOST_NAME, port=settings.TESTING_SERVICES_PORT, pact_dir="./pacts", log_dir="./logs")) try: pact.start_service() yield pact finally: pact.stop_service() @pytest.fixture def define_test_api_contract(test_case, pact): pact.given('Test Request')\ .upon_receiving('a test request')\ .with_request('GET', f'/api/test')\ .will_respond_with(200, body=Like({"message": "success"}))``` ? The second test creates a message contract ```@pytest.fixture def pact(): pact = MessageConsumer('ConsumerName').has_pact_with(Provider('ProviderName'), pact_dir="./pacts") yield pact @pytest.fixture def generate_example_event_contract(test_case, pact): pact.given("Example Event")\ .expects_to_receive(f'Example Event')\ .with_content({ "code": 'Example', "data": { "message": "TEST" } }).with_metadata({"Content-Type": "application/json", 'topic': 'provider'})``` when we executed the tests with this implementation, we got an issue during generating the pacts, and we was able to fix it by changing consumer name used in the `MessageConsumer` Questions on consumer side ? is that expected or we are doing something wrong here? ? why we couldn?t use the same consumer name for both message and api interactions? *On the Provider side, we also have two tests:* ? The first test verifies that the messages sent by the Provider meet the rules defined in the message contract. ? The second test verifies that the api return the same value defined in the interaction contract. ```def test_verify_test_api_contracts(server, pact_provider_default_opts, provider_url): verifier = Verifier(provider="Provider", provider_base_url=provider_url) success, _ = verifier.verify_with_broker( **pact_provider_default_opts, enable_pending=True, ) assert success == 0 def test_verify_example_event_contract(pact_provider_default_opts, server, provider_url): provider = MessageProvider( message_providers={ 'Example Event': { "code": 'Example', "data": { "message": "TEST" } }, }, provider='Provider', consumer='', ) with provider: provider.verify_with_broker( provider_base_url=provider_url, **pact_provider_default_opts )``` when we run the `test_verify_test_api_contracts`, it successfully verifies the API interaction contract, but it also causes the message pact to fail. On the other hand, when we execute `test_verify_example_event_contract`, the opposite happens: the API interaction test fails, but the message verification is successful. Questions on provider side ? is this behavior expected? ? how we can fix the issue?

yousafn
2023-09-06 16:10
hey currently pact python uses the ruby core and v2 spec pacts for http and v3 pacts for message. up to and include v3 pact specifications cannot include message pacts and http pact in the same verification cycle, even with the newer rust core. solution is to rename the providers, so you have a message provider and http provider named equivalent of your provider service. pact v4 spec will allow mixing of interaction types, and will be introduced into pact python as part of a continuation of some in progress prs to intoduce the rust core and a v4 pact interface.

yousafn
2023-09-06 16:10
thx for the excellent code snippets

anas.zakarneh
2023-09-06 16:11
thank you :pray:

jvillars
2023-09-06 17:53
has joined #pact-python

kwongs
2023-09-08 01:45
has joined #pact-python

joshua.ellis
2023-09-08 03:59
Hi everyone! I have recently onboarded with SmartBear, and my focus to begin with will be the Python code. I'm looking forward to working with you all, and improving the Python code! In particular, I will be building upon the amazing work done in https://github.com/pact-foundation/pact-python/pull/367 to get `pact-python` working with the Rust core. As a bit of ground work, I have created two issues above to get my feet wet, before tackling the much larger task of supporting V4 fully. I was also looking at some of the existing PRs and wanted to understand what the status for each of them is. In particular, I see there's 4 open PRs dating to 2021 (or earlier) and I wanted to check whether these can be closed as stale, or if there's any of them that should be kept open and finalised. @mike.geeves064 and @yousafn perhaps you know? I also see 3 more recent PRs ready by @yousafn dating to July, and wanted to check if they can be merged :slightly_smiling_face: In any case, please feel free to message me with any ideas, or just to say hi :blobwave:

matt.fellows
2023-09-08 05:02
Also cc @elliottmurray if you have any thoughts

alicankarayelli
2023-09-08 10:43
has joined #pact-python

sgregory875
2023-09-08 12:23
has joined #pact-python

yousafn
2023-09-08 12:30
YAY! Welcome @joshua.ellis! Comments on state of some of the PR's ? no longer required I think, most changes already applied ? https://github.com/pact-foundation/pact-python/pull/162 ? following PR's possibly superceded by this https://github.com/pact-foundation/pact-python/pull/367 ? https://github.com/pact-foundation/pact-python/pull/245 ? https://github.com/pact-foundation/pact-python/pull/265 ? this chain of services PR example, is still worth investigation/thought ? https://github.com/pact-foundation/pact-python/pull/276 ? Following are good for review ? https://github.com/pact-foundation/pact-python/pull/363 ? https://github.com/pact-foundation/pact-python/pull/364 ? https://github.com/pact-foundation/pact-python/pull/365

yousafn
2023-09-08 12:31
It's a bit old now, but @uglyog did some initial work back with Maturin back in the day at the first V3 implementation. https://github.com/pact-foundation/pact-python/blob/feat/V3/pact-python-v3/pyproject.toml

amagana
2023-09-08 22:40
has joined #pact-python

heverson.amorim
2023-09-09 10:43
has joined #pact-python

vdlre1994
2023-09-11 05:55
has joined #pact-python

rware4
2023-09-11 10:16
has joined #pact-python

hdjikine
2023-09-11 13:55
has joined #pact-python

andrea.paschal
2023-09-11 16:48
has joined #pact-python

tigrandza
2023-09-12 03:14
@tigrandza has left the channel

olof.stalnacke
2023-09-12 05:31
has joined #pact-python

nvangari
2023-09-12 05:39
has joined #pact-python

mike.geeves064
2023-09-12 09:47
Hello and welcome! :slightly_smiling_face: I?ve not got onto going through yet :disappointed: Summer chaos :runner: (and forgot to finish the message here :smile:) ? Agreed about 162, there's still the issue of the message implementation being not-quite-right in python ? I think 245 was pretty early steps so very likely 367 does that and more ? Good with my FFI one (265) being superceded. I see some of the dark magic I was looking at for CLI introspection / arg generation is in there but don't remember from when we talked if that was intentional and good thing or come back to it later? :smile: (the generate_verifier_args.py script - it was PoC/up for discussion so I think would need a little but hopefully not much more work before being "ready" anyway

rksekar5
2023-09-12 12:30
has joined #pact-python

ying.li
2023-09-13 02:54
has joined #pact-python

mike.geeves064
2023-09-14 09:22
Ohh, hadn?t come across hatch, I?ll take a look :slightly_smiling_face:

joshua.ellis
2023-09-14 09:36
Yeah it's a bit newer, and got enough traction to be incorporated into the pypa working group! I'm hoping that it will extend quite straightforwardly to the Rust backend eventually (and if not, switching out build backends won't be difficult, even if we keep the hatch frontend). I do understand it's a big change though, so I'm keen to get feedback!

mike.geeves064
2023-09-14 09:38
they have black, pydantic and fastapi on the list of users which adds a big chunk of credibility for me as well :smile:

david.hodnett
2023-09-14 18:06
has joined #pact-python

jonatan.bjork
2023-09-15 13:30
has joined #pact-python

jonatan.bjork_test1
2023-09-15 13:41
has joined #pact-python

you1
2023-09-15 13:41
has joined #pact-python

jonatan.bjork_test2
2023-09-15 13:42
has joined #pact-python

you1634
2023-09-15 13:43
has joined #pact-python


m_testnewinvite
2023-09-17 22:43
has joined #pact-python

georg.duemlein
2023-09-18 04:09
has joined #pact-python

sam647
2023-09-18 14:37
has joined #pact-python

tanyaryzhova93
2023-09-18 15:28
Hi, I have a question regarding event-based contract tests. Should we still create provider states when we test event-based contracts?

matt.fellows
2023-09-19 00:35
The answer is ?it depends?, but I would usually leave them in because I think it helps explain the intent of the tests

tanyaryzhova93
2023-09-19 00:52
ok, thank you

edward
2023-09-19 07:24
has joined #pact-python

dbc216
2023-09-19 14:17
has joined #pact-python

tan.k.h.usa
2023-09-20 00:31
has joined #pact-python

joshua.ellis
2023-09-20 06:40
@joshua.ellis has left the channel

joshua.ellis
2023-09-20 06:40
has joined #pact-python

daniel.hyun.chae
2023-09-20 13:19
has joined #pact-python

werner.lauterfeld
2023-09-21 08:47
Hi, we tried to install the pact-python 2.0.1 package with Python 3.11.5/3.10.10 and Windows 10 and got the following error: ```Building wheels for collected packages: pact-python Building wheel for pact-python (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for pact-python (pyproject.toml) did not run successfully. ? exit code: 1 ??> [73 lines of output] running bdist_wheel running build running build_py creating build creating build\lib creating build\lib\pact copying pact\broker.py -> build\lib\pact copying pact\constants.py -> build\lib\pact copying pact\consumer.py -> build\lib\pact copying pact\http_proxy.py -> build\lib\pact copying pact\matchers.py -> build\lib\pact copying pact\message_consumer.py -> build\lib\pact copying pact\message_pact.py -> build\lib\pact copying pact\message_provider.py -> build\lib\pact copying pact\pact.py -> build\lib\pact copying pact\provider.py -> build\lib\pact copying pact\verifier.py -> build\lib\pact copying pact\verify_wrapper.py -> build\lib\pact copying pact\__init__.py -> build\lib\pact copying pact\__version__.py -> build\lib\pact creating build\lib\pact\cli copying pact\cli\verify.py -> build\lib\pact\cli copying pact\cli\__init__.py -> build\lib\pact\cli creating build\lib\pact\bin copying pact\bin\pact-2.0.3-linux-arm64.tar.gz -> build\lib\pact\bin copying pact\bin\pact-2.0.3-linux-x86_64.tar.gz -> build\lib\pact\bin copying pact\bin\pact-2.0.3-osx-arm64.tar.gz -> build\lib\pact\bin copying pact\bin\pact-2.0.3-osx-x86_64.tar.gz -> build\lib\pact\bin copying pact\bin\pact-2.0.3-windows-x86.zip -> build\lib\pact\bin copying pact\bin\pact-2.0.3-windows-x86_64.zip -> build\lib\pact\bin installing to build\bdist.win-amd64\wheel running install running install_lib creating build\bdist.win-amd64 creating build\bdist.win-amd64\wheel creating build\bdist.win-amd64\wheel\pact creating build\bdist.win-amd64\wheel\pact\bin copying build\lib\pact\bin\pact-2.0.3-linux-arm64.tar.gz -> build\bdist.win-amd64\wheel\.\pact\bin copying build\lib\pact\bin\pact-2.0.3-linux-x86_64.tar.gz -> build\bdist.win-amd64\wheel\.\pact\bin copying build\lib\pact\bin\pact-2.0.3-osx-arm64.tar.gz -> build\bdist.win-amd64\wheel\.\pact\bin copying build\lib\pact\bin\pact-2.0.3-osx-x86_64.tar.gz -> build\bdist.win-amd64\wheel\.\pact\bin copying build\lib\pact\bin\pact-2.0.3-windows-x86.zip -> build\bdist.win-amd64\wheel\.\pact\bin copying build\lib\pact\bin\pact-2.0.3-windows-x86_64.zip -> build\bdist.win-amd64\wheel\.\pact\bin copying build\lib\pact\broker.py -> build\bdist.win-amd64\wheel\.\pact creating build\bdist.win-amd64\wheel\pact\cli copying build\lib\pact\cli\verify.py -> build\bdist.win-amd64\wheel\.\pact\cli copying build\lib\pact\cli\__init__.py -> build\bdist.win-amd64\wheel\.\pact\cli copying build\lib\pact\constants.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\consumer.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\http_proxy.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\matchers.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\message_consumer.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\message_pact.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\message_provider.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\pact.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\provider.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\verifier.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\verify_wrapper.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\__init__.py -> build\bdist.win-amd64\wheel\.\pact copying build\lib\pact\__version__.py -> build\bdist.win-amd64\wheel\.\pact running install_egg_info running egg_info writing pact_python.egg-info\PKG-INFO writing dependency_links to pact_python.egg-info\dependency_links.txt writing entry points to pact_python.egg-info\entry_points.txt writing requirements to pact_python.egg-info\requires.txt writing top-level names to pact_python.egg-info\top_level.txt reading manifest file 'pact_python.egg-info\SOURCES.txt' adding license file 'LICENSE' writing manifest file 'pact_python.egg-info\SOURCES.txt' Copying pact_python.egg-info to build\bdist.win-amd64\wheel\.\pact_python-2.0.1-py3.10.egg-info running install_scripts error: [Errno 2] No such file or directory: 'build\\bdist.win-amd64\\wheel\\pact\\bin\\pact\\lib\\vendor\\ruby\\3.2.0\\gems\\pact-mock_service-3.11.2\\lib\\pact\\mock_service\\request_handlers\\missing_interactions_get.rb' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pact-python Failed to build pact-python ERROR: Could not build wheels for pact-python, which is required to install pyproject.toml-based projects [notice] A new release of pip is available: 23.1.2 -> 23.2.1 [notice] To update, run: python.exe -m pip install --upgrade pip``` Any idea on what we can try to get it working?

werner.lauterfeld
2023-09-21 08:57
Maybe to add we are using a virtual environment we created with python3 -m venv venv and install this requirements.txt: ```pact-python==2.0.1 pytest==7.4.0```

joshua.ellis
2023-09-21 09:02
We just recently merged a PR that changes the build system. Could you try inserting an explicit dependency on the `master` branch, at least until we publish the next version? ```pact-python @ git+https://github.com/pact-foundation-pact-python@093d9b85c0c6bfc81be60e990e6c17ca103977fc``` The above hash is the latest on master as of the time of writing, and the library code is still identical to `2.0.1` :slightly_smiling_face:

werner.lauterfeld
2023-09-21 09:04
Thanks, we will try :slightly_smiling_face:

werner.lauterfeld
2023-09-21 09:42
Thanks @joshua.ellis - it checked out :slightly_smiling_face:

jake.corn
2023-09-21 14:01
has joined #pact-python

jake.corn
2023-09-21 14:18
Hey all, I'm currently trying to contract test an endpoint like this (redacted and modified) ```GET /people?org_id=1``` (Organization Id is a PK on the org table) ```( pact.given("an organization is configured but no people exist in it") .upon_receiving("a request to list people") .with_request( method="get", path="/people", query={ "org_id": Like("1") } ) .will_respond_with(status=200, body=Like({ people: [] })) )``` _*The Problem*_ During provider verification, I cannot guarantee the org_id and yet, the verification tool is making the request using only the org_id i've supplied. ******* Is there a way to modify the request in a middleware? Ideally I'd like to receive the following in a middleware... which would then allow for me to say "Which provider state is it?" and set up my db accordingly, AND swap the org_id passed from pact for one that I know exists ```{ "state": "an organization is configured but no people exist in it", "query" { "org_id": 1 } }``` Any ideas?

jake.corn
2023-09-21 14:25
IE, without both the "state" and the request being received in a middleware, I can't know if it is for the case I want to handle. I should be able to ```1 - receive the provider state string with request details 2 - modify the db so that there are no people for that org (can't just truncate all people) 3 - alter the request so that the org_id is the one that has been created by the setup```

karl980
2023-09-21 16:44
has joined #pact-python

matt.fellows
2023-09-21 23:46
In V3 pact, there is a concept of provider state generators, where a provider can inject the right value dynamically. Again, this is coming in the next version of Pact Python but not yet is available. If you need middleware, for now you'll need to add it yourself (e.g. attach to the API during test)

yousafn
2023-09-22 12:28
Nice work @joshua.ellis

doctormiguel
2023-09-22 14:31
has joined #pact-python

felipe.simoes702
2023-09-22 17:37
has joined #pact-python

jake.corn
2023-09-22 19:07
awesome, thanks so much

jake.corn
2023-09-22 21:10
Hi! Is there a way to compare a pact interaction against an example json response? I realize that there are benefits of pact beyond "schema", but am i mistaken in thinking that testing the schema is partially what pact does? IE, contract testing can include schema testing. So for a given pact file, I would like to type up an example json response body to see if it is a match. I think the consumer.verify step does this on some level, but what I'd like to be able to do is quickly compare the pactfile generated to json body payloads that our provider endpoints are already producing. I mean, before going through the flow -> "Consumer Publishes Pacts, Provider pulls pacts, provider tries to verify them..." all to find that the consumer pact had a small mistake in its structure and has to go through that cycle again. I mention this because we have a lot of endpoints to cover, and the more churn there is in the process, the harder it will be to get what we need.

jake.corn
2023-09-22 21:12
and really, just looking for a way to go ```pact compare-example --source-pact-file=./consumer-provider.json --interaction-index=0 --example-response-file=./example-response-body1.json```

jake.corn
2023-09-22 21:12
and get back something that tell us.. _*Are we on the right track with this pact?*_

jake.corn
2023-09-22 21:13
IE, the case where the existing endpoint is the source of truth

suat.kose
2023-09-22 22:13
has joined #pact-python

marius.grigoriu
2023-09-23 15:33
has joined #pact-python

noahmcivor
2023-09-24 06:54
has joined #pact-python

matt.fellows
2023-09-24 23:30
That?s an interesting idea. To my knowledge, this doesn?t exist, but obviously the infrastructure should be there to support it. @uglyog what do you think of such an idea? I wonder if we could support it via exposing some CLI commands cc: @yousafn @joshua.ellis

matt.fellows
2023-09-24 23:31
I wonder if we could generalise more commands out of it, so rather than one single specific command, we could have additional utilities that could be combined together (e.g. via bash `|` ) `extract-interaction /path/to/pact --index 0` | `compare-interaction` ?

rholshausen
2023-09-25 00:52
has joined #pact-python

rholshausen
2023-09-25 01:29
Do-able, and a CLI makes sense

matt.fellows
2023-09-25 01:57
@jake.corn if you?re up for a contribution, it would involve understand some of the internals here: https://github.com/pact-foundation/pact-reference/tree/master/rust

marek19922209
2023-09-25 08:09
has joined #pact-python

jake.corn
2023-09-25 12:50
wow, thank you so much. I think I would be up for a contrib. The challenge will be finding time, but I hope I'm able to as it would be helpful and fun.

jake.corn
2023-09-25 12:50
Thanks for the prompt replies and discussion here @matt.fellows and @rholshausen

matt.fellows
2023-09-25 13:16
No worries!

corey_maynard
2023-09-25 20:07
has joined #pact-python

rammohan_mididoddi
2023-09-25 20:12
has joined #pact-python

kevin
2023-09-26 02:31
has joined #pact-python

kevin
2023-09-26 02:38
Hi all, I just joined this group and I am learning how to use python + pactflow :hugging_face: Then, I downloaded https://github.com/pactflow/example-consumer-python and run a contract testing in local. It seems good. But, for the next step, I try to change the config so that I can upload my pacts data to pact flow by running `make test` Any idea how I can make it? Thanks

matt.fellows
2023-09-26 02:39
`make test` just runs the tests

matt.fellows
2023-09-26 02:39
if you want to upload to PactFlow, ensure the correct environment variables are exported into your shell and run `make fake_ci`: https://github.com/pactflow/example-consumer-python#usage

matt.fellows
2023-09-26 02:40
_(of course `make ci` also works, but is designed for github actions - so if you run it there, make sure GH Actions has the appropriate env vars too)_

kevin
2023-09-26 04:05
yes, after I run fack_ci, it works

kevin
2023-09-26 04:05
Thanks @matt.fellows

matt.fellows
2023-09-26 05:56
Awesome! No worries

michael.lemos1
2023-09-26 12:36
has joined #pact-python

sliu
2023-09-27 00:00
has joined #pact-python

sliu
2023-09-27 01:16
Hello, We're wondering that on consumer tests, if there's a way to handle both of the status code 200 and 404?? Seems it's not available using `.will_respond_with(status_code, ...` Any workarounds for this edge case?

matt.fellows
2023-09-27 01:24
You need to create two separate tests, one for each code

matt.fellows
2023-09-27 01:25
what?s the scenario you?re trying to test? Expecting a `200` or `404` in the same scenario definitely seems strange to me

sliu
2023-09-27 01:26
With different provider versions it could be 200 or 404, we're looking for a way to handle both new provider version and the rollback versions from consumer side

sliu
2023-09-27 01:27
If I put them in separate tests, is there a way to make it as long as one of the two tests passed, consider it pass?

matt.fellows
2023-09-27 01:33
Is this due to some mistake in the provider accidentally sending one instead of the other?

matt.fellows
2023-09-27 01:34
Unfortunately it?s not a scenario we support, in the later specification version (v4) you can specify multiple or a range of status codes - just not in the current version of Pact Python

sliu
2023-09-27 01:36
Hi Matt, no not a mistake - more like a corner case that we would like to encourage consumers to have test ready but still got the false tolerance for the rollback provider versions. Setting the range of status code sounds right for this scenario actually

sliu
2023-09-27 01:38
Could we know when the v4 is planning to be out?

joshua.ellis
2023-09-27 01:39
I'm currently working Pact Python v3, which will support the v4 Pact Specification. I am, as we speak, roadmapping the work to transition and I'll share with you a tracking issue on GitHub so you can see the progress :slightly_smiling_face:

sliu
2023-09-27 01:42
Thanks in advanced @joshua.ellis look forward to see the thread

matt.fellows
2023-09-27 01:46
Sorry to keep harping on, but I?m still unsure of the use case. In what scenario could you expect a `200` or a `404` ? e.g. `given that user A exists` a call to `get /users/A` should return a `200` (and a body etc.) e.g. `given that user A does not exist` a call to `get /users/A` should return a `400` Can you describe a scenario where it could be either and you don?t care?

sliu
2023-09-27 01:52
sure Matt, in this case we're considering something like this (assume useraddress as a new api) provider version v2 (gonna release) ```(pact.given('user A exists') .upon_receiving('a get request for user address') .with_request('GET', f"/useraddress/{xxx}") .will_respond_with(200, body=Like(expected_response)) )``` provider version v1 (rollback backup) ```(pact.given('user A exists') .upon_receiving('a get request for user address') .with_request('GET', f"/useraddress/{xxx}") .will_respond_with(404, body=Like(error_msg)) )```

sliu
2023-09-27 01:53
Before the rollback version has been depreciated, in case the consumers would like to add the tests first, we're simulating what could be done for this middle stage

matt.fellows
2023-09-27 01:53
So it?s not just the status code that?s different, but the body as well?

sliu
2023-09-27 01:54
That's true, but for the body, it can be set to be very general, and done in the assertion later

sliu
2023-09-27 01:56
Do you get what I mean?

matt.fellows
2023-09-27 01:57
I think this should be addressed as two separate unit tests, as is above. They are different use cases with different expected responses, i?m not sure why you?d include them in a single unit test. If a new version of a provider is going to be incompatible with old consumers, that is a problem. The way to make changes to a provider is expand and contract (add the new behaviour without removing the old, wait for the consumers to use the new behaviour, and then remove the old). We talk about the expand and contract technique in this https://docs.pact.io/help/amas#apac. I wish we had an article on it, but it should be quite googleable. Pact is _not_ a tool for testing the provider, it?s a tool for making explicit the scenarios a consumer can handle (and then ensuring the provider can handle them).

matt.fellows
2023-09-27 01:57
> That?s true, but for the body, it can be set to be very general, and done in the assertion later I don?t understand this, no. Which assertion later?

sliu
2023-09-27 01:59
The new version of a provider is compatible with old consumers, it's the new consumer pact versions may not compatible with old provider versions

matt.fellows
2023-09-27 02:01
That?s what Pact aims to catch - if a consumer is incompatible with old provider versions, it would catch that problem if you make their needs explicit.

matt.fellows
2023-09-27 02:02
Presumably you don?t want to release a new consumer that is incompatible with existing production versions?

matt.fellows
2023-09-27 02:02
Is this what you mean by ?rollback? version? if you need to rollback what?s in prod?

sliu
2023-09-27 02:03
Rollback version is not existing production versions

sliu
2023-09-27 02:07
Yeah usually if a consumer is incompatible with old provider versions, we expect pact would catch the issue to block the consumer. So this is a corner case that this one consumer test may only be compatible with release version, but not the old provider versions, and if we don't want to block the tests

joshua.ellis
2023-09-27 02:08
As promised, here is the roadmap: https://github.com/pact-foundation/pact-python/issues/396. As you can see, there's a fair bit of work involved, but you'll be able to see the progress as it happens :slightly_smiling_face:

matt.fellows
2023-09-27 02:10
> Yeah usually if a consumer is incompatible with old provider versions, we expect pact would catch the issue to block the consumer. So this is a corner case that this one consumer test may only be compatible with release version, but not the old provider versions, and if we don?t want to block the tests I think recognising you?re in a corner case is the right thing, rather than trying to work around it by a multiple status code/body test. That strikes me as a future hazard

sliu
2023-09-27 02:17
Yes Matt I understand. If the consumer is actively using the api, actually the provider rolling back would definitely break it. But also we don't want to make consumers feeling blocked by the provider progress for 2+ releases. So we're looking for a solution for them with the multiple status code/body for this time period, and we'd need to clarify the risk.

sliu
2023-09-27 02:20
Thank you @joshua.ellis for the information :slightly_smiling_face: Subscribed the thread

ankush.hasani
2023-09-27 10:01
has joined #pact-python

kai
2023-09-27 15:31
has joined #pact-python

sliu
2023-09-28 06:19
Besides the multiple status way, I'd loop back to get some clarification if possible. In pact, usually when there's a new API added on the provider side, how should we handle it when consumer is about to add the testcases for the new api? Assume a scenario like this: ```[provider] v1 - apiA v2 - apiA and apiB [consumer] v1 - testcases for apiA v2 - testcases for apiA and apiB``` consumer v2 * provider v1 would fail because provider v1 doesn't have apiB yet --> What would be suggested handle this part? Remove provider v1 from release??

matt.fellows
2023-09-28 06:24
Ignoring how Pact does it (for the moment), how would you do it otherwise?

sliu
2023-09-28 06:29
Hi Matt, we're discovering what would be options that's why would like to know what would be the suggested way

matt.fellows
2023-09-28 06:34
Well, if I were me, which I am, I would deploy the provider before the consumer, otherwise the consumer won?t work.

sliu
2023-09-28 06:36
hmm so basically on consumer side, only ensure the new pact file (v2) could pass the verification with newly deployed provider (v2)?

sliu
2023-09-28 06:37
not to consider provider v1 anymore once provider v2 is deployed?

matt.fellows
2023-09-28 06:47
> hmm so basically on consumer side, only ensure the new pact file (v2) could pass the verification with newly deployed provider (v2)? I didn?t say that, sorry if I implied it. Usually you would test against the latest version of the main branch (in this case, v2 before it?s deployed) and against what is deployed (in this case, v1). This way, you know a deployment of the consumer won?t break in prod and won?t block the provider when it goes to release the next version). This is all covered in the nirvana guide: https://docs.pact.io/pact_nirvana

matt.fellows
2023-09-28 06:48
See the information about the webhook: https://docs.pact.io/pact_nirvana/step_6


sliu
2023-09-28 07:38
Thank you Matt for the info. I realized that there is actually a hidden assumption that "consumer tests should pass the test against latest main branch (v2) and against what is deployed (v1)". > This way, you know a deployment of the consumer won?t break in prod and won?t block the provider when it goes to release the next version). It make sense to me - let me chat with our team to see if we could apply to it

matt.fellows
2023-09-28 07:41
No worries!

a.monteiro
2023-09-28 09:59
has joined #pact-python

a.monteiro
2023-09-28 10:10
Hello, I need some help I am trying to build a contract test for 2 backend services Here's a high level overview of how it works Main _backend_ interacts with a _specific_data_ service So my _backend_ is the consumer and the _specific_data_service_ is the provider When I send a PUT request to the endpoint `/api/sepecific_data/{specific_uuid}/data` then the backend calls the `update_specific_data()` function The `update_specific_data()` function then sends a PUT request to the external specific_data service which is hosted externally, the base url being something like `https://specific-data-service.run.app/` My question is, *how do I set up my provider url within the consumer test?* --- If I set it like ```pact = Consumer('specific-data-consumer-python').has_pact_with(Provider('specific-data-provider-python'), host_name='http://127.0.0.1', port=1234, pact_dir="./pacts", log_dir="./logs")``` Then when I run ```(pact .given('Data exists') .upon_receiving('a request for updating data') .with_request(method='put', path=f'/api/sepecific_data/{specific_uuid}/data', body=DATA_CHANGED) .will_respond_with(200, body=UPDATED_DATA)) with pact: result = update_specific_data(args) assert result == expected``` the request isn't actualy being intercepted and tries to call the actual external API --- Is there a way to set my provider like? ```pact = Consumer('specific-data-consumer-python').has_pact_with(Provider('specfic-data-provider-python'), host_name='https://specific-data-service.run.app', pact_dir="./pacts", log_dir="./logs")``` :questionmario: Sorry for the super long text I really hope someone can help me :pray:

matt.fellows
2023-09-28 12:17
Ah, I didn?t see the double post. I answered here: https://github.com/pact-foundation/pact-python/discussions/402

jake.corn
2023-09-28 13:44
hey all, hope you're doing well. Is it possible to use bidirectional contract verification for a GQL provider in python?

yousafn
2023-09-28 14:16
Afraid not, its for comparison of a Pact against an OpenAPI document, and as far as I?m aware you can?t document GQL in an OAS? There is possibilities with the Pact plugin framework to build a GraphQL plugin, https://pact.canny.io/feature-requests/p/plugin-graphql This would require Pact V4 spec capabilities to be available in the pact-python library Here is a rough example using the FFI to utilise a Pact plugin - namely the https://github.com/pactflow/pact-protobuf-plugin plugin https://github.com/pact-foundation/pact-reference/blob/master/python/pact_plugin_grpc_v4.py High level detail on the plugin framework https://docs.pact.io/plugins/quick_start

jake.corn
2023-09-28 14:51
oh that's great. Thanks for following up Matt. Gotcha. I'm in a position where we have many services, each with slightly different contracts. I seem to prefer the bi-directional since it seems like a faster, lighter weight approach.

jake.corn
2023-09-28 14:51
but also want the provider verifications for each service to have a similar process and feel

jake.corn
2023-09-28 15:44
hey, sorry for the bomb of questions. Is there a way to verify a single response against an interaction with either pact python or using the cli?

jake.corn
2023-09-28 15:50
one of the reasons I ask is because I'd like to use an in memory host for verification

yousafn
2023-09-28 16:07
you can pass in a description to run just a specific verification for a particular interaction

ml210993
2023-09-29 05:12
has joined #pact-python

prempooon.hc
2023-09-29 11:35
has joined #pact-python

jaishankar.nedunchezh
2023-09-29 17:07
has joined #pact-python

devin.woods
2023-09-29 19:28
has joined #pact-python

vittorio.gue
2023-09-30 10:51
has joined #pact-python

honglu11
2023-10-01 16:47
has joined #pact-python

matt.fellows
2023-10-01 23:35
Makes sense and totally understand

matt.fellows
2023-10-01 23:35
I?ll make a note on our feature request backlog to help with prioritisation

idd90i
2023-10-02 10:37
has joined #pact-python

nathan
2023-10-03 00:43
has joined #pact-python

jonathan.ryding
2023-10-03 12:02
has joined #pact-python

joshua.ellis
2023-10-04 01:05
Made a mistake originally when I reworked the publish script and accidentally forgot to assign the correct environment to the publish step (under the hood, the same `twine upload ...` command is used). As I will need to manually upload the wheels instead, I will coordinate with @elliottmurray and @matthew.balvanz to do this.

gabe.hollombe
2023-10-04 03:17
has joined #pact-python

pratyusha.boyapati
2023-10-04 08:35
has joined #pact-python

yousafn
2023-10-04 09:02
nice work on your first pact release @joshua.ellis

mateusz.socha
2023-10-04 10:41
has joined #pact-python

maja.vitaz
2023-10-05 10:37
has joined #pact-python

martindjk92
2023-10-05 13:05
has joined #pact-python

james814
2023-10-05 20:24
has joined #pact-python

craig.kilpatrick
2023-10-06 00:33
has joined #pact-python

prabakaranplaced
2023-10-06 08:00
has joined #pact-python

likekeys
2023-10-06 14:22
has joined #pact-python

chris.odryna
2023-10-06 16:51
has joined #pact-python

rezaur.rahman
2023-10-06 17:39
has joined #pact-python

julie.laursen
2023-10-06 17:43
has joined #pact-python

pratibha.kachi
2023-10-06 20:02
has joined #pact-python

robert579
2023-10-06 20:22
has joined #pact-python

sbalaranganathan
2023-10-09 12:10
has joined #pact-python

henrik
2023-10-09 18:15
has joined #pact-python

johnkavadias
2023-10-10 09:37
has joined #pact-python

jose-antonio.cano
2023-10-10 16:21
has joined #pact-python

panagiotis.liaros
2023-10-11 10:15
has joined #pact-python

ananya
2023-10-11 10:38
has joined #pact-python

omar.sakka
2023-10-11 14:38
has joined #pact-python

brandon.king
2023-10-11 18:35
has joined #pact-python

sandy.mechie
2023-10-11 20:16
Hello, When I am passing Auth bearer token as part of the header when runing test against the provider, `header = ['Authorization: Bearer ejy.....']` `verifier.verify_pacts(interactions, headers=header, log_dir='/var/tmp/', log_level='DEBUG')` I am getting following error Failure/Error: replay_interaction, options[:request_customizer] EOFError: end of file reached #<venv_path>/pact/lib/ruby/lib/ruby/3.2.0/forwardable.rb:240:in ``custom_request`` Am i missing any setting? This used to work fine when the service was authenticated using SPNEGO

sridhar.nayakwadi
2023-10-11 20:56
has joined #pact-python

saroja.bhogadhi
2023-10-11 20:58
has joined #pact-python

joshua.ellis
2023-10-11 22:20
Do you have additional information as to the version of Pact Python you are using?

bethskurrie
2023-10-11 22:46
The error is coming from the ruby code in the pact-ruby-standalone

joshua.ellis
2023-10-11 22:48
Yeah, I'm just wondering whether there might be a packaging issue. E.g., if a file was incorrectly truncated or omitted entirely.


bethskurrie
2023-10-11 22:50
@sandy.mechie the best way for us to help you is if you can provide a reproducable example in python

bethskurrie
2023-10-11 22:50
with all the same versions

bethskurrie
2023-10-11 22:51
another alternative is to try and reproduce it using the repo I posted above.

bethskurrie
2023-10-11 22:51
you?ll just need to work out what arguments to pass in.

bethskurrie
2023-10-11 22:54
/github subscribe list

bethskurrie
2023-10-11 22:54
/github subscribe list

bethskurrie
2023-10-11 22:55
/github subscribe list

bethskurrie
2023-10-11 22:56
/github unsubscribe pact-foundation/pact-python issues

2023-10-11 22:56
This channel will receive notifications from https://github.com/pact-foundation/pact-python for: `pulls`, `commits`, `releases`, `deployments`

bethskurrie
2023-10-11 22:56
/github unsubscribe pact-foundation/pact-python commits

2023-10-11 22:56
This channel will receive notifications from https://github.com/pact-foundation/pact-python for: `pulls`, `releases`, `deployments`

bethskurrie
2023-10-11 22:56
/github unsubscribe pact-foundation/pact-python pulls

2023-10-11 22:56
This channel will receive notifications from https://github.com/pact-foundation/pact-python for: `releases`, `deployments`

joshua.ellis
2023-10-12 04:15
The `github-pages` environment is new and is part of some preliminary work in https://github.com/pact-foundation/pact-python/pull/414. We probably won't want to have notifications every time there's an update to the GitHub pages...

sandy.mechie
2023-10-12 06:23
Thanks Joshua and Beth. I am currently using Pact 2.0.1. I'll get back on this thread soon

chris.paul
2023-10-12 15:54
has joined #pact-python

ryan.standley
2023-10-12 17:34
has joined #pact-python

joseph
2023-10-12 20:58
has joined #pact-python

laurie.green
2023-10-12 22:46
has joined #pact-python

nikesh1123
2023-10-13 10:32
has joined #pact-python

imthu55
2023-10-13 11:05
has joined #pact-python

dzianis_frydliand
2023-10-13 12:36
has joined #pact-python

john.maynard
2023-10-13 14:35
has joined #pact-python

cmuddam.testing
2023-10-15 06:46
has joined #pact-python

david.vadkerti.toth
2023-10-17 08:29
has joined #pact-python

shirley.houter
2023-10-17 08:52
has joined #pact-python

ruth.kurniawati
2023-10-17 20:02
has joined #pact-python

balaaji196
2023-10-18 10:46
has joined #pact-python

mpokala
2023-10-18 20:37
has joined #pact-python

hiroki.gota
2023-10-18 22:26
has joined #pact-python

mattisrobin
2023-10-18 22:37
has joined #pact-python

silvimasss
2023-10-18 23:43
has joined #pact-python

wanghedi88
2023-10-19 11:16
has joined #pact-python

sandy.mechie
2023-10-19 11:21
Hi, sorry not much progress on this on trying it provide a reproducible example but it needs to go through legal approval But wanted to check if there are any additional cookies sent when the request is fired to the provider because the oidc proxy crashes with segmentation fault as mentioned here https://stack.watch/product/openidc/mod-auth-openidc/ I tried directly with python request and curl both seem to be working fine. The crash happens only when pact python sends out the request

sarah.diendorfer
2023-10-19 12:34
has joined #pact-python

ahmed.elakour
2023-10-19 12:35
has joined #pact-python

parmin.rock
2023-10-19 14:57
has joined #pact-python

victor.yusuf
2023-10-19 14:58
has joined #pact-python

luke.dove
2023-10-19 15:46
has joined #pact-python

lee.andrews
2023-10-19 15:52
has joined #pact-python

mitchellp
2023-10-19 16:06
has joined #pact-python

mickelback00
2023-10-19 22:25
has joined #pact-python

philip.buttinger
2023-10-20 10:36
has joined #pact-python

adrian.kosyra
2023-10-20 11:58
has joined #pact-python

dave.hooson
2023-10-20 15:13
has joined #pact-python

sandy.mechie
2023-10-20 15:30
@joshua.ellis @bethskurrie any pointers on above ?

pavankumar.cse88
2023-10-20 17:58
has joined #pact-python

the.m.bjorklund
2023-10-21 21:06
has joined #pact-python

thepiesaresquared
2023-10-22 09:58
has joined #pact-python

vasile.vetisan
2023-10-22 17:50
has joined #pact-python

sartom1994
2023-10-22 18:52
has joined #pact-python

rebecca.fulton
2023-10-23 09:27
has joined #pact-python

joao.jesus
2023-10-23 10:20
has joined #pact-python

kai.moseley
2023-10-23 10:47
has joined #pact-python

gunarajs
2023-10-23 19:23
has joined #pact-python

ctrando
2023-10-23 21:14
has joined #pact-python

thibault.alix
2023-10-23 22:29
has joined #pact-python

joshua.ellis
2023-10-24 02:56
@bethskurrie Is it possible to configure the notifications to exclude `github-pages` releases? If we do end up going the MkDocs route, this will likely trigger after every merge into `master`, which will be too noisy.

sandy.mechie
2023-10-24 08:36
So I was able to get pact ruby running after approvals. Not much details in the error. It just says Failure/Error: replay_interaction, options[: request_customizer] EOFError: end of file reached As mentioned in previous post the oidc proxy is trying to strip cookies and exiting with segmentation fault. Not sure how much this is helpful

kwapisz.bartosz
2023-10-24 08:38
has joined #pact-python

btacca
2023-10-24 12:02
has joined #pact-python

anton.l.petersson
2023-10-24 13:54
has joined #pact-python

jowhalen13
2023-10-24 16:27
has joined #pact-python

bethskurrie
2023-10-25 02:32
Do you have a reproducible example in a codebase you can share?

tanyagorn.benjaprompa
2023-10-25 08:09
has joined #pact-python

sandy.mechie
2023-10-25 11:33
Unfortunately, I cannot provide a reproducible example as the oidc proxy setup is heavily customized. But some positive news. So we enabled the debug logs mode on oidc proxy to see what headers was being passed. So along with bearer token which I had set an empty cookie key was also being sent due to which oidc strip cookie was coming to into picture and was causing segmentation fault. So just to see what happens if I set some random cookie value and send it as part of the header and strangely it worked after sending a non empty cookie. For ex cookie: abc . I am checking with team why this is happening . But at least I can proceed now. Thanks for checking on this.

benguizat
2023-10-25 14:04
has joined #pact-python

stan196
2023-10-25 23:42
has joined #pact-python

manalikhanna92
2023-10-26 07:09
has joined #pact-python

aaron_carey
2023-10-26 09:26
has joined #pact-python

ms.maheshhwari
2023-10-26 09:54
has joined #pact-python

ohisproperties2
2023-10-26 16:34
has joined #pact-python

anupama_enakula
2023-10-26 21:45
has joined #pact-python

roger.liu
2023-10-27 07:15
has joined #pact-python

senbaga.kumarsigamani
2023-10-27 16:12
has joined #pact-python

alejandro.ignacio
2023-10-27 17:42
has joined #pact-python

devendra.patil
2023-10-27 21:40
has joined #pact-python

shenkesi.shiva
2023-10-30 06:57
has joined #pact-python

guido.lenacota
2023-10-30 09:48
has joined #pact-python

yihong.wang
2023-10-30 10:01
has joined #pact-python

ruth.bassindale
2023-10-30 20:54
has joined #pact-python

ruth.bassindale
2023-10-30 20:57
@ruth.bassindale has left the channel

sgavathe
2023-10-31 22:00
has joined #pact-python

cody.jenkins
2023-11-01 02:39
@cody.jenkins has left the channel

ntthaibk
2023-11-01 04:36
has joined #pact-python

rskilling
2023-11-01 10:23
has joined #pact-python

tien.xuan.vo
2023-11-01 11:04
has joined #pact-python

victor_do_val
2023-11-01 19:08
has joined #pact-python

james.corry
2023-11-01 19:23
has joined #pact-python

nicolas.cote-nolin
2023-11-02 12:30
has joined #pact-python

sivaganesh.sivakumar
2023-11-02 13:18
has joined #pact-python

joshua.ellis
2023-11-03 03:55
It is rather weird that this is still failing. It should definitely have access to the publication secrets. In any case, I will manually publish this release to pypi.

id.akanksha26
2023-11-03 11:38
has joined #pact-python

prasant.iragavarapu
2023-11-03 15:06
has joined #pact-python

yagocre
2023-11-03 22:46
has joined #pact-python

steve.blomeley
2023-11-06 14:50
has joined #pact-python

ndomingues10
2023-11-07 10:14
has joined #pact-python

nswetha.reddy
2023-11-07 19:21
has joined #pact-python

aparnakrishna1115
2023-11-08 14:55
has joined #pact-python

harry.talbot
2023-11-08 15:05
has joined #pact-python

daniel.phillips
2023-11-08 17:18
has joined #pact-python

yuliya.rahalski
2023-11-08 20:15
has joined #pact-python

olivier.picaud
2023-11-08 21:51
has joined #pact-python

joseenrique.garcia
2023-11-09 12:56
has joined #pact-python

ashish.patel5
2023-11-09 15:20
has joined #pact-python

cnguyen
2023-11-10 08:31
has joined #pact-python

nam.nguyen414
2023-11-10 12:35
has joined #pact-python

lewis
2023-11-10 16:33
has joined #pact-python

anna.lorenzi
2023-11-10 17:42
has joined #pact-python

nathan334
2023-11-10 18:34
has joined #pact-python

banghung859
2023-11-15 08:38
has joined #pact-python

ali
2023-11-16 04:50
has joined #pact-python

emmanuel
2023-11-16 09:40
has joined #pact-python

dan.corder
2023-11-16 11:37
has joined #pact-python

vikash.kumar.singh
2023-11-16 22:58
has joined #pact-python

barbara.szczygiel
2023-11-17 14:08
has joined #pact-python

maria.olivero
2023-11-17 16:57
has joined #pact-python

madhawa
2023-11-21 04:59
has joined #pact-python

pascal
2023-11-21 05:25
has joined #pact-python

srinu.innovatus
2023-11-21 08:09
has joined #pact-python

somya.khandelwal
2023-11-21 08:39
has joined #pact-python

radek.stolarczyk
2023-11-21 12:23
Hello, I have written a POC for Java Pactflow. One service is sending a message to another service and I would like to compare the messages. I am trying to do the same in Python. Is that possible in Python? here is my Java code: My Consumer class: ```@ExtendWith(PactConsumerTestExt.class) @PactTestFor(providerName = "ProviderCDCT", providerType = ProviderType.ASYNCH, pactVersion = PactSpecVersion.V3) public class ConsumerContractTest { @Pact(consumer = "ConsumerCDCT") public MessagePact createMyPact(MessagePactBuilder builder) { Map<String, String> metadata = new HashMap<>(); metadata.put("content-type", "application/json"); DslPart sqsBody = new PactDslJsonBody() .stringType("messageId", "1") .stringValue("receiptHandle", "testRadek") .stringType("eventSource", "aws:sqs") .stringType("awsRegion", "us-east-1") .object("messageAttributes") .closeObject(); return builder .expectsToReceive("a message with information") .withMetadata(metadata) .withContent(sqsBody) .toPact(); } //This method is needed to create the pact files. @Test @PactTestFor(pactMethod = "createMyPact") public void testMyMethod(List<Message> messages) { } }``` My Provider Class: ```@PactBroker(scheme = "https", host = "", authentication = @PactBrokerAuth(token = "")) @Provider("ProviderCDCT") @Consumer("ConsumerCDCT") public class ProviderContractTest { private final ObjectMapper objectMapper = new ObjectMapper(); @BeforeEach public void setUp(PactVerificationContext context) { context.setTarget(new MessageTestTarget(List.of("Provider"))); System.setProperty("pact.verifier.publishResults", System.getenv("PACT_BROKER_PUBLISH_VERIFICATION_RESULTS") == null ? "true" : "true"); } @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void testTemplate(PactVerificationContext context) { context.verifyInteraction(); } @PactVerifyProvider("a message with information") public MessageAndMetadata providerMessage() throws Exception { Map<String, String> metadata = new HashMap<>(); metadata.put("content-type", "application/json"); Map<String, Object> mainMessage = new HashMap<>(); mainMessage.put("messageId", ""); mainMessage.put("receiptHandle", "testRadek"); mainMessage.put("eventSource", "aws:sqs"); mainMessage.put("awsRegion", "us-east-1"); mainMessage.put("messageAttributes", new HashMap<>()); return new MessageAndMetadata(objectMapper.writeValueAsBytes(mainMessage), metadata); } }```


matt.fellows
2023-11-21 12:47
Did you check out the links I shared to the python message examples?


radek.stolarczyk
2023-11-21 14:35
My consumer in python :raised_hands:. Thank you @matt.fellows!: ```import pytest from pact import MessageConsumer, MessagePact, Provider, Like from typing import Any, Generator @pytest.fixture(scope="module") def pact() -> Generator[MessagePact, Any, None]: consumer = MessageConsumer("MessageConsumer") pact = consumer.has_pact_with( Provider("MessageProvider"), publish_to_broker=True, broker_base_url=str("urlhere"), broker_token=str("tokenhere") ) with pact: yield pact def test_consumer_message_expectation(pact: MessagePact): expected_message = { "messageId": Like("1"), "receiptHandle": Like("testRadek"), "eventSource": Like("aws:sqs"), "awsRegion": Like("us-east-1") } pact.given('a message with information') \ .expects_to_receive('a message with information') \ .with_content(expected_message) \ .with_metadata({'content-type': 'application/json'})```


ndruzhinina
2023-11-22 14:25
has joined #pact-python

jaspal.puri
2023-11-23 10:05
has joined #pact-python

ogbofjnr
2023-11-23 12:25
has joined #pact-python

patricio.dossantos_sl
2023-11-23 20:08
has joined #pact-python

radek.stolarczyk
2023-11-24 09:53
My Provider is able to Verify if the message is matching the message/contract up in pactflow. However, if I try to publish the results I get errors. ```from pact import MessageProvider def provide_message_with_information(): return { "messageId": "1", "receiptHandle": "testRadek", "eventSource": "aws:sqs", "awsRegion": "us-east-1" } def test_verify() -> None: provider = MessageProvider( provider="MessageProvider", consumer="MessageConsumer", message_providers={ 'a message with information': provide_message_with_information } ) with provider: provider.verify_with_broker( broker_url=str("urlhere"), broker_token=str("tokenhere"), publish_verification_results=True )```

radek.stolarczyk
2023-11-24 09:55
```provider_contract_poc.py:12 (test_verify) def test_verify() -> None: provider = MessageProvider( provider="MessageProvider", consumer="MessageConsumer", message_providers={ 'a message with information': provide_message_with_information } ) with provider: > provider.verify_with_broker( broker_url=str("---------"), broker_token=str("----------"), publish_verification_results=True ) provider_contract_poc.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <pact.message_provider.MessageProvider object at 0x111191210> enable_pending = False, include_wip_pacts_since = None kwargs = {'broker_token': '----------', 'broker_url': '----------', 'publish_verification_results': True} verifier = <pact.verifier.Verifier object at 0x111191250>, return_code = 1 _ = '' def verify_with_broker(self, enable_pending=False, include_wip_pacts_since=None, **kwargs): """Use Broker to verify. Args: broker_username ([String]): broker username broker_password ([String]): broker password broker_url ([String]): url of broker enable_pending ([Boolean]) include_wip_pacts_since ([String]) publish_version ([String]) """ verifier = Verifier(provider=self.provider, provider_base_url=self._proxy_url()) return_code, _ = verifier.verify_with_broker(enable_pending, include_wip_pacts_since, **kwargs) > assert (return_code == 0), f'Expected returned_code = 0, actual = {return_code}' E AssertionError: Expected returned_code = 0, actual = 1 ../venv/lib/python3.11/site-packages/pact/message_provider.py:135: AssertionError```

radek.stolarczyk
2023-11-24 09:58
Hello @matt.fellows, happy Friday, hope you well. I use the read and write token. The provider is able to verify against the contract up in Pactflow but can't publish results. Do you know by any chance, what am I doing wrong :see_no_evil:?

matt.fellows
2023-11-24 10:10
are there any logs you can share? There should be a ?verbose? or option to set log level to debug (or both)

matt.fellows
2023-11-24 10:10
that will help us to see what went wrong

martin.gallauner
2023-11-24 10:40
has joined #pact-python

radek.stolarczyk
2023-11-24 10:58
Fixed it. I was missing the published version. @matt.fellows thank you for you help ! ```from pact import MessageProvider def provide_message_with_information(): return { "messageId": "1", "receiptHandle": "testRadek", "eventSource": "aws:sqs", "awsRegion": "us-east-1" } def test_verify() -> None: provider = MessageProvider( provider="MessageProvider", consumer="MessageConsumer", message_providers={ 'a message with information': provide_message_with_information } ) with provider: provider.verify_with_broker( broker_url=str("urlhere"), broker_token=str("tokenhere"), publish_version="0.0.0", publish_verification_results=True )```

aschaff
2023-11-24 15:27
has joined #pact-python

bruno.petkovic99
2023-11-25 13:55
has joined #pact-python

carlrconn
2023-11-27 02:22
has joined #pact-python

yi.wu
2023-11-27 08:10
has joined #pact-python

brian_worsham
2023-11-27 14:30
has joined #pact-python

jessie.eteng
2023-11-27 15:25
has joined #pact-python

crisciano.botelho
2023-11-27 18:57
has joined #pact-python

ajg.public
2023-11-27 21:44
has joined #pact-python

lukasz.lawicki
2023-11-28 10:06
has joined #pact-python

jawad.sefiani
2023-11-28 14:08
has joined #pact-python

elaine.silva
2023-11-28 17:50
has joined #pact-python

lukasz.lawicki
2023-11-29 06:54
@lukasz.lawicki has left the channel

tomasz.myszka
2023-11-29 14:21
has joined #pact-python

tom.willmott944
2023-11-29 14:44
has joined #pact-python

anna.nava
2023-11-29 20:56
has joined #pact-python

pasc.ther
2023-11-29 22:19
has joined #pact-python

pavankumar.cse88
2023-11-30 11:08
Hi Team I am am getting following error in broker() while running test Attached error screen shot, conftest.py and test Can anyone please suggest how to fix this error

awade
2023-11-30 13:49
has joined #pact-python

vspallas
2023-12-03 10:18
has joined #pact-python

nicholaspatrickshaw
2023-12-04 10:32
has joined #pact-python

malvine.logina
2023-12-04 11:52
has joined #pact-python

vinicius.gabriel
2023-12-05 13:59
has joined #pact-python

stasiekps
2023-12-05 15:13
has joined #pact-python

antal.tettinger
2023-12-05 15:50
has joined #pact-python

archaanaaa8
2023-12-06 07:19
has joined #pact-python

visaliparimi
2023-12-06 10:03
has joined #pact-python

indrani.r
2023-12-06 10:06
has joined #pact-python

frank.weitmann
2023-12-06 10:23
has joined #pact-python

venketeshvenky
2023-12-06 10:40
has joined #pact-python

kyle.r.shrader
2023-12-07 01:33
has joined #pact-python

ajay991610
2023-12-07 05:27
has joined #pact-python

marko.stevanovic
2023-12-07 10:01
has joined #pact-python

danut.turta
2023-12-07 14:10
Hey everyone! Very small question: does pact-python work with django based services? I tried adding it to one of our services and I am getting the following error when I try to import Consumer and Provider from the library. This error suggests to me that FastAPI seems to be required:

yousafn
2023-12-07 14:34
fast api is used in the http proxy which is used in the message tests, it should be included in the pact-python module as a dep. I cant see any reason why it wouldn?t work with djanjo and I have seen examples in the wild using it. just about to have lunch but will try and dig them out

yousafn
2023-12-07 14:36
on mobile so excuse the screenshot. its listed in the pyproject toml in the repo

danut.turta
2023-12-07 15:45
heyy, thanks for replying! after seeing this, I also dug deeper, and there seemed to be a problem with the fastapi version that ends up being installed, because I can see a similar error being mentioned https://github.com/Lightning-AI/pytorch-lightning/issues/17106. After pinning the version to the latest one, the error disappeared.

danut.turta
2023-12-07 15:45
we also have some other packages that have dependencies on fastapi, so I guess an older version was already in the lockfile and it didn't get updated in quite a while

yousafn
2023-12-07 16:14
oh great, thanks for confirming and glad you are able to get past that hump now

mahesh.manglani
2023-12-07 16:49
has joined #pact-python

gerard.molina
2023-12-07 17:01
has joined #pact-python

boyd.social
2023-12-07 17:52
has joined #pact-python

muhd_syamil.dzulkafta
2023-12-08 05:47
has joined #pact-python

omer.sucu
2023-12-08 10:04
has joined #pact-python

hermoine807
2023-12-08 12:04
has joined #pact-python

blake.norrish
2023-12-08 17:05
has joined #pact-python

robert.jelic
2023-12-10 23:02
has joined #pact-python

pragna.reddy
2023-12-11 11:32
has joined #pact-python

oguzhannvarol
2023-12-11 14:13
has joined #pact-python

ryan.quinn
2023-12-11 17:57
has joined #pact-python

arnon
2023-12-12 09:01
has joined #pact-python

lewis.blackwood
2023-12-12 14:04
has joined #pact-python

ilie.cotiuga
2023-12-12 14:26
has joined #pact-python

remyjaume
2023-12-12 15:46
has joined #pact-python

amelie.frappier
2023-12-12 18:55
has joined #pact-python

flament.thom
2023-12-12 20:44
has joined #pact-python

ckbisk
2023-12-12 22:18
has joined #pact-python

sterankin
2023-12-13 10:57
has joined #pact-python

shane.bogdan
2023-12-13 12:06
has joined #pact-python

luis.nuno
2023-12-13 18:08
has joined #pact-python

raleigh.schickel
2023-12-13 23:15
has joined #pact-python

hataipat.sup
2023-12-15 05:26
has joined #pact-python

hakan.dilaver
2023-12-15 13:54
has joined #pact-python

eliranbardavid
2023-12-17 09:06
has joined #pact-python

anthony.trad
2023-12-17 12:30
has joined #pact-python

m.mohammadi.se
2023-12-18 19:31
has joined #pact-python

lewis.foreman
2023-12-18 21:45
has joined #pact-python

eran.bergman560
2023-12-19 18:43
has joined #pact-python

tom.dracz
2023-12-20 09:53
has joined #pact-python

ivan.gutowski-smith
2023-12-20 10:40
has joined #pact-python

nicolas.vaquero
2023-12-20 11:31
has joined #pact-python

emailmvj
2023-12-20 16:18
has joined #pact-python

noelmccrory
2023-12-21 12:31
has joined #pact-python

fajfer.pawel
2023-12-21 13:39
has joined #pact-python

praful.poudel
2023-12-21 13:44
has joined #pact-python

pratyush.jaiswal88
2023-12-23 16:45
has joined #pact-python

grzegorz.v.bobrowski
2023-12-24 02:37
has joined #pact-python

elias.coelho
2023-12-27 17:52
has joined #pact-python

tomer
2023-12-28 21:52
has joined #pact-python

christopher316
2024-01-02 20:10
has joined #pact-python

matt.pichette
2024-01-02 20:26
has joined #pact-python

ocean.razafiarison
2024-01-03 08:57
has joined #pact-python

salmaan60
2024-01-03 20:14
has joined #pact-python

sam.huang1
2024-01-04 03:20
has joined #pact-python

ratnajenisha
2024-01-04 04:04
has joined #pact-python

markkellett
2024-01-04 18:27
has joined #pact-python

varghesevarampi
2024-01-05 02:10
has joined #pact-python

lbrndmrcr
2024-01-05 11:52
has joined #pact-python

mcarballido17
2024-01-05 20:12
has joined #pact-python

yonahlipman
2024-01-07 04:00
has joined #pact-python

x1destory
2024-01-07 19:21
has joined #pact-python

christopher.tonog
2024-01-08 18:53
has joined #pact-python

harshad.rayunipet
2024-01-09 08:06
has joined #pact-python

kumar.vas85
2024-01-09 09:50
has joined #pact-python

shuo.diao
2024-01-09 23:54
has joined #pact-python

chris.speck
2024-01-10 02:52
has joined #pact-python

trevor.cook
2024-01-10 18:33
has joined #pact-python

meetbogireddyhere
2024-01-11 16:20
has joined #pact-python

david.garratt
2024-01-12 10:36
has joined #pact-python

noelmccrory
2024-01-12 13:33
@noelmccrory has left the channel

roger.vanburgh
2024-01-12 16:54
has joined #pact-python

sarah.omalley
2024-01-15 10:03
has joined #pact-python

lauren.flanagan
2024-01-15 13:51
has joined #pact-python

tunga
2024-01-15 23:16
has joined #pact-python

sayan.adak
2024-01-16 12:21
has joined #pact-python

shobhit.agarwal
2024-01-16 12:22
has joined #pact-python

carmen.rietdijk
2024-01-16 12:53
has joined #pact-python

nick116
2024-01-17 09:57
has joined #pact-python

nick116
2024-01-17 10:06
Good morning! I'm trying to create a POC of a message based contract between 2 services. I've setup at local `pact-broker` using docker compose, and created a very simple contract between a producer and consumer. The issue is that i'm not able to get the test to pass due to the following error: ``` 1) Verifying a pact between address_identification and geocoder Given An address was geocoded a geocoded address has matching content Failure/Error: raise "An error was raised while verifying the message. The response body is: #{response.body}" RuntimeError: An error was raised while verifying the message. The response body is: ``` I'll attach the python + docker-compose in the thread. Thanks in advance!

nick116
2024-01-17 10:07
Contract generation: ```def generate_contract(): expected = { 'username': 'UserA', 'id': 123, } contract = MessagePact( MessageConsumer("address_identification"), Provider("geocoder"), pact_dir="contracts", broker_base_url="localhost:9292" ) (contract .given('An address was geocoded') .expects_to_receive('a geocoded address') .with_content(expected) .write_to_pact_file())``` Verify: ```from pact import MessageProvider def test_contract(): provider = MessageProvider( { "An address was geocoded": { 'username': 'UserA', 'id': 123, } }, "geocoder", "address_identification", pact_dir="contracts", proxy_port=9292, ) provider.verify_with_broker( broker_username="pactbroker", broker_password="pactbroker", broker_url="http://localhost:9292", publish_version="0.0.0", publish_verification_results=True )``` Docker: ```version: "3.9" services: postgres: image: postgres ports: - "5432:5432" healthcheck: test: psql postgres -U postgres --command 'SELECT 1' environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: postgres broker: image: pactfoundation/pact-broker:latest-multi depends_on: - postgres ports: - "9292:9292" restart: always environment: # Basic auth credentials for the Broker PACT_BROKER_ALLOW_PUBLIC_READ: "true" PACT_BROKER_BASIC_AUTH_USERNAME: pactbroker PACT_BROKER_BASIC_AUTH_PASSWORD: pactbroker # Database PACT_BROKER_DATABASE_URL: "" # PACT_BROKER_DATABASE_URL: sqlite:////tmp/pact_broker.sqlite # Pending pact-foundation/pact-broker-docker#148 healthcheck: test: [ "CMD", "curl", "--silent", "--show-error", "--fail", "http://pactbroker:pactbroker@localhost:9292/diagnostic/status/heartbeat", ] interval: 1s timeout: 2s retries: 5```


matt.fellows
2024-01-17 11:17
Are there any other logs for this? Wondering if you can enable DEBUG or verbose logging?

nick116
2024-01-17 11:20
This is the full output when running `verify`: ``` ```INFO: Fetching pacts for geocoder from http://localhost:9292 with the selection criteria: pact WARN: Please note: we are tracking events anonymously to gather important usage statistics like Pact-Ruby version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'. INFO: Reading pact at http://pactbroker:*****@localhost:9292/pacts/provider/geocoder/consumer/address_identification/pact-version/0e89ff5398aaabfe27ec66133a3fa8c43f78e242/metadata/c1tdW2xdPXRydWUmc1tdW2N2XT0xNA DEBUG: The pact at http://localhost:9292/pacts/provider/geocoder/consumer/address_identification/pact-version/0e89ff5398aaabfe27ec66133a3fa8c43f78e242 is being verified because the pact content belongs to the consumer version matching the following criterion: * latest version of address_identification that has a pact with geocoder (2.2) Verifying a pact between address_identification and geocoder Given An address was geocoded a geocoded address WARN: Skipping set up for provider state 'An address was geocoded' for consumer 'address_identification' as there is no --provider-states-setup-url specified. has matching content (FAILED - 1) Failures: 1) Verifying a pact between address_identification and geocoder Given An address was geocoded a geocoded address has matching content Failure/Error: raise "An error was raised while verifying the message. The response body is: #{response.body}" RuntimeError: An error was raised while verifying the message. The response body is: 1 interaction, 1 failure Failed interactions: PACT_DESCRIPTION='a geocoded address' PACT_PROVIDER_STATE='An address was geocoded' /Users/_user_/projects/pact/provider.py # A geocoded address given An address was geocoded INFO: Verification results published to http://localhost:9292/pacts/provider/geocoder/consumer/address_identification/pact-version/0e89ff5398aaabfe27ec66133a3fa8c43f78e242/verification-results/209 Traceback (most recent call last): File "/Users/_user_/projects/pact/provider.py", line 26, in <module> test_contract() File "/Users/_user_/projects/pact/provider.py", line 18, in test_contract provider.verify_with_broker( File "/Users/_user_/Library/Caches/pypoetry/virtualenvs/platform-pipeline-5Q5gKWed-py3.11/lib/python3.11/site-packages/pact/message_provider.py", line 135, in verify_with_broker assert (return_code == 0), f'Expected returned_code = 0, actual = {return_code}' ^^^^^^^^^^^^^^^^ AssertionError: Expected returned_code = 0, actual = 1 Process finished with exit code 1```

matt.fellows
2024-01-17 11:24
So it _looks_ like no response was received. There should be a verification log file written, or an option to write one

matt.fellows
2024-01-17 11:25
I think your code should be: ``` "a geocoded address": { 'username': 'UserA', 'id': 123, }``` (the description, not the state `An address was geocoded`)

nick116
2024-01-17 11:37
Are the `proxy` settings required for the `MessageProvider`? If i remove those, i'm getting this: ```Errno::ECONNREFUSED: Failed to open TCP connection to localhost:1234 (Connection refused - connect(2) for "localhost" port 1234) # ------------------ # --- Caused by: --- # Errno::ECONNREFUSED: # Connection refused - connect(2) for "localhost" port 1234 # ``` Do i need to setup a proxy alongside the actual broker?

nick116
2024-01-17 14:46
I managed to get something running, i'll see if i can figure out what i did wrong

nick116
2024-01-18 08:29
Ok, so the only thing i can find that is really different is that i'm now running the test in actual tests, and not just a flat python file. Maybe some magic happens when setting up/tearing down tests that ensure that the cache is cleared etc.

miguel.heitor
2024-01-18 09:03
has joined #pact-python

matt.fellows
2024-01-18 10:35
That I couldn?t tell you, not knowing too much about Python. But glad it?s working?!

nick116
2024-01-18 10:36
Yep! Thanks for looking at this with me :smile:

anshita.tripathi
2024-01-18 11:07
has joined #pact-python

hiroshi.fujii
2024-01-18 14:50
has joined #pact-python

ebernardino
2024-01-19 04:08
has joined #pact-python

hegge.m
2024-01-19 09:40
has joined #pact-python

visser.r
2024-01-19 09:40
has joined #pact-python

arnon
2024-01-19 15:40
Hi all, I have used pact only in node before, but now i'm at a place that also has python services. My consumer is a NodeJS project where i wrote some pact tests, and now i need to run them on the provider which is python, but... how to i set up p`rovider state` in the python codebase?

arnon
2024-01-19 15:57
or is it not yet supported?

matt.fellows
2024-01-19 23:13
It's definitely supported. Do you mean consumer or provider side?

arnon
2024-01-21 12:39
Provider side

arnon
2024-01-21 12:40
On consumer test I added state, and have some vars I'd like to use when on provider


dcrivella
2024-01-21 23:51
has joined #pact-python

dmondejar
2024-01-22 03:39
has joined #pact-python

grzegorzstanek
2024-01-22 10:46
has joined #pact-python

arnon
2024-01-22 11:54
yes, but it's still not clear for me in nodeJS provider tests, i would ad lines like https://docs.pact.io/implementation_guides/javascript/docs/provider#api-with-provider-states, so i could also insert vars from the consumer pact. for example ```stateHandlers: { 'I have business rules with data': async () => { businessRule = await addBusinessRule({ categoryUuid: uuidv4() }) return Promise.resolve({ slug: businessRule.accountSlug, category_uuid: businessRule.categoryUuid, }) }``` how do i do that in python?

matt.fellows
2024-01-22 11:55
You don?t. You need to setup a little web server endpoint on your provider (or just an endpoint that can manipulate the provider) that accepts provider state requests from the verifier

arnon
2024-01-22 12:48
oh... :confused: hmm, i'll need to see how to do this then Thanks

arnon
2024-01-22 13:39
so just to make sure i understand correctly. pact-python _*cannot*_ take this line that i wrote on the consumer side, and change `uuid` to be one i created during the provider-state check on provider side? `path: MatchersV3.fromProviderState('/api/v1/accounts/${uuid}/', '/api/v1/accounts/test/')`

matt.fellows
2024-01-22 21:30
Ah, no. That is a V3 feature, and Pact Python is currently only on v2

matt.fellows
2024-01-22 21:32
Work is underway to migrate to the latest core, which would support all of this



arnon
2024-01-23 11:12
Thanks Matt

francois.larouche1
2024-01-23 14:31
has joined #pact-python

sarah.souza
2024-01-23 15:24
has joined #pact-python

harwin1494
2024-01-23 18:05
Hi team, is there a way to output the payload when we run the provider tests? The problem is that we are getting 422 error, so we want to make sure that the request call is correct.

matt.fellows
2024-01-24 04:45
I believe if you set verbose logging, it should log requests/responses to the verification log file

zachary.romano
2024-01-24 19:16
has joined #pact-python

ken.overgard
2024-01-24 19:32
has joined #pact-python

rama.ganapa
2024-01-24 21:13
has joined #pact-python

justin.gilroy
2024-01-24 21:46
has joined #pact-python

naveenkarkra
2024-01-24 23:36
has joined #pact-python

yangtao.ge
2024-01-25 11:07
has joined #pact-python

salman.bilalshah
2024-01-25 11:34
has joined #pact-python

sridhar.munendramani
2024-01-25 14:32
has joined #pact-python

scott.anderson
2024-01-25 15:05
has joined #pact-python

bala.kurakula
2024-01-25 17:21
has joined #pact-python

sarah.hand
2024-01-25 17:28
has joined #pact-python

corey.jewett
2024-01-25 18:48
has joined #pact-python

eddjlsh94
2024-01-26 09:41
has joined #pact-python

falkowski.b
2024-01-26 10:59
has joined #pact-python

yash.khade
2024-01-26 18:50
has joined #pact-python

joe.allen
2024-01-26 18:50
has joined #pact-python

andrew.voronin
2024-01-26 18:50
has joined #pact-python

richie.schramm
2024-01-26 18:55
has joined #pact-python

dsteinbach77
2024-01-26 23:23
has joined #pact-python

rachida_laghmami
2024-01-28 15:53
has joined #pact-python

hrushikesh.agrawal
2024-01-29 07:13
has joined #pact-python

santos.danallanbray
2024-01-29 10:50
has joined #pact-python

katie.andriacchi
2024-01-29 15:05
has joined #pact-python

darren.grove
2024-01-29 15:11
has joined #pact-python

michael.brandeis
2024-01-29 16:37
has joined #pact-python

niki.mahurin
2024-01-29 17:51
has joined #pact-python

arina
2024-01-29 21:48
has joined #pact-python

tomasz.perek
2024-01-30 12:19
has joined #pact-python

sofia
2024-01-30 17:12
has joined #pact-python

wesley.williams
2024-01-30 18:02
has joined #pact-python

j.sauret
2024-01-31 14:03
has joined #pact-python

harwin1494
2024-01-31 17:16
Hi Team, how to resolve the below error? Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown { "sampleItems": [ ... , - Pact::UnexpectedIndex, - Pact::UnexpectedIndex, - Pact::UnexpectedIndex, - Pact::UnexpectedIndex, - Pact::UnexpectedIndex, - Pact::UnexpectedIndex, - Pact::UnexpectedIndex, + Hash, + Hash, + Hash, + Hash, + Hash, + Hash, + Hash, ] } Description of differences -------------------------------------- * Actual array is too long and should not contain a Hash at $.sampleItems[1] * Actual array is too long and should not contain a Hash at $.sampleItems[2] * Actual array is too long and should not contain a Hash at $.sampleItems[3] * Actual array is too long and should not contain a Hash at $.sampleItems[4] * Actual array is too long and should not contain a Hash at $.sampleItems[5] * Actual array is too long and should not contain a Hash at $.sampleItems[6] * Actual array is too long and should not contain a Hash at $.sampleItems[7]

michelle.ryals
2024-01-31 22:17
has joined #pact-python

jyothi.kaspa
2024-01-31 23:34
has joined #pact-python

patrika.patil
2024-02-01 16:41
has joined #pact-python

tim.willis
2024-02-01 16:44
has joined #pact-python

yogi.patel
2024-02-01 18:38
has joined #pact-python

sebbmoreno
2024-02-01 21:23
has joined #pact-python

cverma28
2024-02-02 10:30
has joined #pact-python

a.g.s.maxwell
2024-02-02 12:54
has joined #pact-python

harwin1494
2024-02-02 14:33
@matt.fellows could you please help out with this?

yousafn
2024-02-02 15:33
Please don?t tag maintainers directly, and please think about the person answering your question. You have provided very little detail for anyone to really help https://docs.pact.io/help/how_to_ask_for_help#4-ask-a-good-question Also in the linked SO article, there was an explanation https://stackoverflow.com/questions/42948214/pact-verify-provider-what-does-pactunexpectedindex-mean > As you can see in this test case https://github.com/bethesque/pact-support/blob/d27def23b778503b7f3104ea87f9eb5a406d4801/spec/lib/pact/matchers/matchers_spec.rb#L233 the Pact::UnexpectedIndex is used to indicate than an array is longer than was expected. Without seeing the Pact file, and the response that comes from your provider, it is impossible for someone else to diagnose what is wrong with your example code.

t.mazelin
2024-02-02 23:33
has joined #pact-python

maeleeuxs
2024-02-03 10:20
has joined #pact-python

swaroopsonline
2024-02-04 02:44
has joined #pact-python

jose.silva
2024-02-04 14:45
has joined #pact-python

sonal3062000
2024-02-05 09:52
has joined #pact-python

lorenz.ammon082
2024-02-05 14:44
has joined #pact-python

patrick.barnes
2024-02-05 19:44
has joined #pact-python

andrew.kostka
2024-02-05 20:24
has joined #pact-python

allie
2024-02-05 20:25
has joined #pact-python

bryan.anderson
2024-02-05 21:18
has joined #pact-python

alec.abdul-rahim
2024-02-05 23:34
has joined #pact-python

filip.olszewski
2024-02-06 12:00
has joined #pact-python

amol.jose
2024-02-06 18:03
has joined #pact-python

ryoshida
2024-02-07 01:47
has joined #pact-python

pallam.sudhasrinivas1
2024-02-07 13:21
has joined #pact-python

michal
2024-02-07 16:36
has joined #pact-python

niels.schuette
2024-02-08 14:18
has joined #pact-python

jeremy.buchmann
2024-02-09 00:11
has joined #pact-python

rachel.green
2024-02-09 00:15
has joined #pact-python

jj.guo
2024-02-09 00:33
has joined #pact-python

dipali.gulhane
2024-02-09 07:01
has joined #pact-python

manoj.chaudhari
2024-02-09 09:13
has joined #pact-python

martha.chambers
2024-02-09 16:15
has joined #pact-python

adonay.berhe
2024-02-09 16:52
has joined #pact-python

camilo.morales
2024-02-09 16:52
has joined #pact-python

jonathan.barker
2024-02-12 08:56
has joined #pact-python

tobiasroland
2024-02-12 10:48
has joined #pact-python

samantha.lam
2024-02-12 12:32
has joined #pact-python

logi.ragnarsson
2024-02-12 15:22
has joined #pact-python

michal.patron
2024-02-13 10:41
has joined #pact-python

tomasz.fiechowski
2024-02-13 11:14
has joined #pact-python

coletaylor017
2024-02-13 19:50
has joined #pact-python

lachlan.austin
2024-02-13 22:44
has joined #pact-python

rejeesh.gangadharan
2024-02-14 00:55
has joined #pact-python

utku.kilincci01
2024-02-14 08:00
has joined #pact-python

ahmadlotfygamersfield
2024-02-14 14:38
has joined #pact-python

evan.hafers
2024-02-14 15:11
has joined #pact-python

wiktor2.karpinski
2024-02-15 09:31
has joined #pact-python

cae.vieira
2024-02-15 11:37
has joined #pact-python

m.barbosa
2024-02-15 13:54
has joined #pact-python

r_connolly
2024-02-15 20:22
has joined #pact-python

wally.yuen
2024-02-16 00:42
has joined #pact-python

david.montero
2024-02-16 10:29
has joined #pact-python

hristian.iliev
2024-02-16 10:37
has joined #pact-python

radek.stolarczyk
2024-02-16 10:45
Hello, I am currently writing a contract tests for our system, which consists of AWS Lambda functions that communicate through message exchanges. I've successfully drafted the consumer contract as shown below, but I'm having difficulties in finding resources or documentation that could guide me in developing the provider side of the contract. Any assistance or pointers in the right direction would be greatly appreciated. :raised_hands: my consumer: ```import pytest from pact import Like, MessageConsumer, MessagePact, Provider, Verifier @pytest.fixture(scope="module") def pact() -> MessagePact: consumer = MessageConsumer("test1-lambda") provider = Provider("test2-lambda") pact = consumer.has_pact_with(provider, pact_dir="./pacts") with pact: yield pact def test_message(pact: MessagePact): expected_withdrawal_structure = { "event_id": Like("String"), "event_type": Like("String"), } (pact.expects_to_receive("a request to do something on data") .with_content(expected_withdrawal_structure).with_metadata({"content-type": "application/json"}))```


v-rybam-gri
2024-02-16 13:49
has joined #pact-python

msarayu1111
2024-02-16 13:49
has joined #pact-python

shivanirajebhosale16
2024-02-17 10:50
has joined #pact-python


radek.stolarczyk
2024-02-19 09:35
Thank you!, I will give that a try.

maciej.harapinski
2024-02-19 09:42
has joined #pact-python

radek.stolarczyk
2024-02-19 13:49
I am trying to do something like this and I am getting the following error. Could you tell me what am I doing wrong?: ```from typing import Dict from pact import MessageProvider def generate_withdrawal_message() -> Dict[str, str]: return { "event_id": "String", "event_type": "String", } def test_verify_withdrawals_provider() -> None: broker_url = "https://radektest.pactflow.io" broker_token = "MYTOKEN" provider = MessageProvider( provider="provider_service", consumer="consumer_service", message_providers={ "a request to fetch and process withdrawals for a user": generate_withdrawal_message, }, ) with provider: provider.verify_with_broker( broker_url=broker_url, broker_token=broker_token, publish_version="0.0.0", publish_verification_results=True, )``` I am getting the following error: ```test_withdrawal_event_contract.py:14 (test_verify_withdrawals_provider) def test_verify_withdrawals_provider() -> None: broker_url = "https://radektest.pactflow.io" broker_token = "MYTOKEN" provider = MessageProvider( provider="provider_service", consumer="consumer_service", message_providers={ "a request to fetch and process withdrawals for a user": generate_withdrawal_message, }, ) > with provider: test_withdrawal_event_contract.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../../python/lib/python3.11/site-packages/pact/message_provider.py:143: in __enter__ self._start_proxy() ../../../python/lib/python3.11/site-packages/pact/message_provider.py:102: in _start_proxy self._wait_for_server_start() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <pact.message_provider.MessageProvider object at 0x10ce4d650> def _wait_for_server_start(self): """ Wait for the Http Proxy to be ready. :rtype: None :raises RuntimeError: If there is a problem starting the Http Proxy. """ s = requests.Session() retries = Retry(total=9, backoff_factor=0.5) http_mount = 'http://' s.mount(http_mount, HTTPAdapter(max_retries=retries)) resp = s.get(f'{self._proxy_url()}/ping', verify=False) if resp.status_code != 200: self._stop_proxy() > raise RuntimeError( 'There was a problem starting the proxy: %s', resp.text ) E RuntimeError: ('There was a problem starting the proxy: %s', '{"message":"No interaction found for GET /ping","interaction_diffs":[]}\n')```

d.madureira
2024-02-19 14:17
has joined #pact-python

matt.fellows
2024-02-19 15:14
Hmm that error message indicates a pact mock server is running somewhere and possibly conflicting with the provider test (somehow!).


matt.fellows
2024-02-19 15:18
Not sure why the port is hard coded instead of automatically assigned, but a pact mock server is still running on your machine bound to the same port

matt.fellows
2024-02-19 15:18
Check running proxy processes and kill any rogue ones

radek.stolarczyk
2024-02-19 15:57
Thank you! Yes it was the port :see_no_evil:. Making some progress: ```test_withdrawal_event_contract.py::test_verify_withdrawals_provider FAILED [100%]WARN: Ignoring unsupported combine AND for path $['event_id'] WARN: Ignoring unsupported combine AND for path $['event_type'] INFO: Fetching pacts for withdrawals-service from https://radektest.pactflow.io with the selection criteria: pact WARN: Please note: we are tracking events anonymously to gather important usage statistics like Pact-Ruby version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'. INFO: Reading pact at https://radektest.pactflow.io/pacts/provider/withdrawals-service/consumer/auto-transition-withdrawals-lambda/pact-version/0919598c8f34255adcd857302e1eaf1ce2bb24b3/metadata/c1tdW2xdPXRydWUmc1tdW2N2XT02Nw DEBUG: The pact at https://radektest.pactflow.io/pacts/provider/withdrawals-service/consumer/auto-transition-withdrawals-lambda/pact-version/0919598c8f34255adcd857302e1eaf1ce2bb24b3 is being verified because the pact content belongs to the consumer version matching the following criterion: * latest version of auto-transition-withdrawals-lambda that has a pact with withdrawals-service (v1) Verifying a pact between auto-transition-withdrawals-lambda and withdrawals-service A request to fetch and process withdrawals for a user has matching content (FAILED - 1) Failures: 1) Verifying a pact between auto-transition-withdrawals-lambda and withdrawals-service A request to fetch and process withdrawals for a user has matching content Failure/Error: raise "An error was raised while verifying the message. The response body is: #{response.body}" RuntimeError: An error was raised while verifying the message. The response body is: {"detail":"No matched handler."} 1 interaction, 1 failure Failed interactions: PACT_DESCRIPTION='a request to fetch and process withdrawals for a user' PACT_PROVIDER_STATE='' /Users/rstolarc/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/232.10227.11/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py /Users/rstolarc/fanduel/withdrawals-service/withdrawals/messaging/tests/test_withdrawal_event_contract.py # A request to fetch and process withdrawals for a user WARN: Ignoring unsupported combine AND for path $['event_id'] WARN: Ignoring unsupported combine AND for path $['event_type'] INFO: Verification results published to https://radektest.pactflow.io/pacts/provider/withdrawals-service/consumer/auto-transition-withdrawals-lambda/pact-version/0919598c8f34255adcd857302e1eaf1ce2bb24b3/verification-results/240 test_withdrawal_event_contract.py:17 (test_verify_withdrawals_provider) def test_verify_withdrawals_provider() -> None: provider = MessageProvider( provider="withdrawals-service", consumer="auto-transition-withdrawals-lambda", message_providers={ "A request to fetch and process withdrawals for a user": generate_withdrawal_message, }, ) with provider: > provider.verify_with_broker( broker_url=broker_url, broker_token=broker_token, publish_version=provider_version, publish_verification_results=True, ) test_withdrawal_event_contract.py:28: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <pact.message_provider.MessageProvider object at 0x10dc630d0> enable_pending = False, include_wip_pacts_since = None kwargs = {'broker_token': 'MYTOKEN', 'broker_url': 'https://radektest.pactflow.io', 'publish_verification_results': True, 'publish_version': '1.0.0'} verifier = <pact.verifier.Verifier object at 0x10dc63190>, return_code = 1 _ = '' def verify_with_broker(self, enable_pending=False, include_wip_pacts_since=None, **kwargs): """Use Broker to verify. Args: broker_username ([String]): broker username broker_password ([String]): broker password broker_url ([String]): url of broker enable_pending ([Boolean]) include_wip_pacts_since ([String]) publish_version ([String]) """ verifier = Verifier(provider=self.provider, provider_base_url=self._proxy_url()) return_code, _ = verifier.verify_with_broker(enable_pending, include_wip_pacts_since, **kwargs) > assert (return_code == 0), f'Expected returned_code = 0, actual = {return_code}' E AssertionError: Expected returned_code = 0, actual = 1```

dpunna
2024-02-19 18:35
has joined #pact-python

radek.stolarczyk
2024-02-20 10:21
My consumer class looks like this: ```@ExtendWith(PactConsumerTestExt.class) @PactTestFor(providerName = "provider1", providerType = ProviderType.ASYNCH, pactVersion = PactSpecVersion.V3) public class ConsumerContractTest { @Pact(consumer = "consumer1") public MessagePact createMyPact(MessagePactBuilder builder) { DslPart sqsBody = new PactDslJsonBody() .stringType("event_id", "String") .stringType("event_type", "String"); return builder .expectsToReceive("a request to fetch and process withdrawals for a user") .withContent(sqsBody) .toPact(); } //This method is needed to create the pact files. @Test @PactTestFor(pactMethod = "createMyPact") public void testMyMethod(List<Message> messages) { } }```


michael.schmidt
2024-02-20 11:01
has joined #pact-python

radek.stolarczyk
2024-02-20 12:06
Hello @matt.fellows, do I get the error because my consumer contract is wrong? Do you know by any chance. Thank you for all your help!

yousafn
2024-02-20 12:19
The error is saying there isn?t a matched handler, what does the interaction look like that you are trying to verify ```RuntimeError: An error was raised while verifying the message. The response body is: {"detail":"No matched handler."}```