bethskurrie
2018-03-28 22:01
has joined #pact-message-ruby

cfmack
2018-03-28 22:01
has joined #pact-message-ruby

matt.fellows
2018-03-28 22:01
has joined #pact-message-ruby

neil
2018-03-28 22:01
has joined #pact-message-ruby

bethskurrie
2018-03-28 22:12
Though I guess this really may as well be in the standalone group

bethskurrie
2018-03-28 22:38
Just an update on where this is at. The code required in the standalone to generate and verify a message pact is out - however, the v3 pact spec is only partially supported. You won't be able to verify any jvm message pacts yet.

bethskurrie
2018-03-28 22:38
At the moment, the parser is expecting one provider state string instead of an array of objects.

matt.fellows
2018-03-29 10:23
:the_horns:

matt.fellows
2018-03-29 10:25
I'm not far off having beta's of both JS and Go to test the waters. I have a few questions about the implementation that we can discuss at that point here

matt.fellows
2018-03-30 03:36
Does it properly support matching yet Beth?

matt.fellows
2018-03-30 03:36
I noticed this when trying matchers: ``` { "consumer": { "name": "MyConsumer" }, "provider": { "name": "MyProvider" }, "messages": [ { "description": "a dog", "providerState": "some state", "content": { "id": { "contents": 1, "json_class": "Pact::SomethingLike" }, "name": { "contents": "rover", "json_class": "Pact::SomethingLike" }, "type": { "data": { "generate": "bulldog", "matcher": { "json_class": "Regexp", "o": 0, "s": "bulldog|sheepdog" } }, "json_class": "Pact::Term" } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } } ```

matt.fellows
2018-03-30 03:36
But, the verifier properly caught the matcher

bethskurrie
2018-03-30 03:36
Should, but just the v 2 ones.

bethskurrie
2018-03-30 03:37
Hm. The spec version isn't right

matt.fellows
2018-03-30 03:37
I figured at least that, but was expecting to see the matching rules in there

matt.fellows
2018-03-30 03:37
ah

bethskurrie
2018-03-30 03:37
Are you passing it in to the command line?

matt.fellows
2018-03-30 03:37
that?s from Pact node. Pretty sure that?s in other stuff too :slightly_smiling_face:

bethskurrie
2018-03-30 03:38
There's a bug then.

bethskurrie
2018-03-30 03:38
It must be missing a connection.

matt.fellows
2018-03-30 03:38
ok will take a look

matt.fellows
2018-03-30 03:38
bug in JS/Node or Ruby?

matt.fellows
2018-03-30 03:38
ah, be back soon?

bethskurrie
2018-03-30 03:39
Ruby I think, because the specification version is 2.0.0 in the file

matt.fellows
2018-03-30 03:50
Ah

bethskurrie
2018-03-30 03:56
Confirmed. I can see where it is.

bethskurrie
2018-03-30 03:56
Will fix when I get a chance

matt.fellows
2018-03-30 04:02
Cool, thanks

matt.fellows
2018-03-30 04:02
No hurries.

bethskurrie
2018-03-30 04:19
It should still verify, yes?

bethskurrie
2018-03-30 04:19
Also, we'll need to pass in 3.0.0 when writing the message pacts.

matt.fellows
2018-03-30 04:21
It does, albeit o need to test the regex matcher as it wasn't quite behaving is I expected. That could he me so I need to confirm a few thibgs

matt.fellows
2018-03-30 04:21
Will do re 3.0.0

matt.fellows
2018-03-30 04:43
Hmm, I was just looking - there is currently no option to pass in a spec version to `pact-message` - where should it be passed in?

bethskurrie
2018-03-30 04:54
There is a command line option

matt.fellows
2018-03-30 04:55
ah, so there is

matt.fellows
2018-03-30 04:55
I was invoking the help command incorrectly

matt.fellows
2018-04-03 22:35
Thanks for that `reify` command Beth, works a charm

bethskurrie
2018-04-03 22:36
Cool

matt.fellows
2018-04-03 22:37
I?ll update Pact JS/Node when I get a moment, but that?s working so won?t prioritise it

matt.fellows
2018-04-03 22:37
There are a couple of things we should discuss, which I?ll summarise in here shortly for the other implementations

matt.fellows
2018-04-03 22:39
For some reason though, the `--pact-dir` argument doesn?t like certain paths. e.g. this fails: ``` pact-message update '{"content":{"access":{"contents":{"role":{"data":{"generate":"admin","matcher":{"json_class":"Regexp","o":0,"s":"admin|controller|user"}},"json_class":"Pact::Term"}},"json_class":"Pact::ArrayLike","min":3},"id":{"contents":127,"json_class":"Pact::SomethingLike"},"name":"Baz"},"providerState":"some state","metadata":{"Content-Type":"application/json; charset=utf-8"},"description":"some test case"}' --consumer billy --provider bobby --pact-dir /Users/mfellows/go/src/github.com/pact-foundation/pact-go/examples/pacts/ /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-message-0.4.0/lib/pact/message/consumer/interaction_decorator.rb:36:in `extract_content': undefined method `content' for #<Pact::Interaction:0x007ff211a27000> (NoMethodError) from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-message-0.4.0/lib/pact/message/consumer/interaction_decorator.rb:18:in `as_json' from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-message-0.4.0/lib/pact/message/consumer/consumer_contract_decorator.rb:14:in `block in as_json' from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-message-0.4.0/lib/pact/message/consumer/consumer_contract_decorator.rb:14:in `collect' from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-message-0.4.0/lib/pact/message/consumer/consumer_contract_decorator.rb:14:in `as_json' from /opt/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.6.4/lib/pact/consumer_contract/consumer_contract_decorator.rb:28:in `to_json' from /opt/pact/lib/vendor/ruby/2.2.0/gems/json-2.1.0/lib/json/common.rb:286:in `generate' from /opt/pact/lib/vendor/ruby/2.2.0/gems/json-2.1.0/lib/json/common.rb:286:in `pretty_generate' ``` but this is totes fine: ``` pact-message update '{"content":{"access":{"contents":{"role":{"data":{"generate":"admin","matcher":{"json_class":"Regexp","o":0,"s":"admin|controller|user"}},"json_class":"Pact::Term"}},"json_class":"Pact::ArrayLike","min":3},"id":{"contents":127,"json_class":"Pact::SomethingLike"},"name":"Baz"},"providerState":"some state","metadata":{"Content-Type":"application/json; charset=utf-8"},"description":"some test case"}' --consumer billy --provider bobby --pact-dir /tmp/pacts ```

matt.fellows
2018-04-03 22:39
ahh

bethskurrie
2018-04-03 22:39
Was there an existing doc there?

matt.fellows
2018-04-03 22:39
ya

bethskurrie
2018-04-03 22:40
It may have been trying to merge

matt.fellows
2018-04-03 22:40
I think it must have been an old format?

bethskurrie
2018-04-03 23:02
Yes, not compatible.

matt.fellows
2018-04-04 22:50
@bethskurrie OK, so my pact-message is failing after the last update: ``` Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown { - "id": 1, - "name": "rover" + "id": 27, + "name": "fido" } Description of differences -------------------------------------- * Expected 1 but got 27 at $.id * Expected "rover" but got "fido" at $.name ``` My pact file seems to have the correct v3 matchers, however: ``` { "consumer": { "name": "MyJSMessageConsumer" }, "provider": { "name": "MyJSMessageProvider" }, "messages": [ { "description": "a request for a dog", "providerStates": [ { "name": "some state" } ], "content": { "id": 1, "name": "rover", "type": "bulldog" }, "matchingRules": { "body": { "$.id": { "matchers": [ { "match": "type" } ] }, "$.name": { "matchers": [ { "match": "type" } ] }, "$.type": { "matchers": [ { "match": "regex", "regex": "^(bulldog|sheepdog)$" } ] } } } } ], "metadata": { "pactSpecification": { "version": "3.0.0" } } } ```

bethskurrie
2018-04-04 22:51
Will have a look now

matt.fellows
2018-04-04 22:51
ah, I know. I?m probably not specifying the version to the verifier, perhaps?

bethskurrie
2018-04-04 22:51
You definitely need that

bethskurrie
2018-04-04 22:52
But it may or may not be the cause

bethskurrie
2018-04-04 22:52
No, the verifier should read the version from the pact

matt.fellows
2018-04-04 22:52
ah nah that doesn?t make sense - there isn?t an option for it. exactly

bethskurrie
2018-04-04 22:52
Let me look. It's probably me.

matt.fellows
2018-04-04 22:52
thanks

bethskurrie
2018-04-04 23:01
I've got the same problem. It's not recognising the matching rules. Will investigate.

matt.fellows
2018-04-04 23:01
kk

matt.fellows
2018-04-04 23:01
good to know not just me!

matt.fellows
2018-04-04 23:09
I was also going to ask Beth, given the format looks very v3 speccy, does this mean we have interoperability with Pact JVM generated messages or do we need to do more work on that front?

bethskurrie
2018-04-05 00:19
The missing part (once I've implemented the metadata) will be the multiple provider states, and the provider state params. It will *read* a v3 file from pact jvm and not blow up, but it will ignore the bits it can't understand.

matt.fellows
2018-04-05 06:40
cool, that?s a great compromise and starting point. Probably worth a `WARN` in the logs so people can see, and we can update client side docu about v3 compatibility

bethskurrie
2018-04-05 06:40
Yup, it's prefixed with WARN

bethskurrie
2018-04-05 06:43
`WARN: Using only the first provider state, "an alligator named Mary exists", as support for multiple provider states is not yet implemented. Ignoring provider states: "another state", "yet another state"`

bethskurrie
2018-04-05 06:43
`WARN: Ignoring params for the following provider states as params support is not yet implemented: "yet another state"`

bethskurrie
2018-04-05 06:44
To the error stream, so it won't screw up JSON parsing.

matt.fellows
2018-04-05 06:52
:thumbsup:

matt.fellows
2018-04-05 06:52
amaze

bethskurrie
2018-04-05 06:53
Hopefully it won't be in there for long, but as you say, all code that is released to production, stays in production!

matt.fellows
2018-04-05 06:53
Rust is dead, long live Ruby :wink:

bethskurrie
2018-04-05 06:53
Ha

bethskurrie
2018-04-05 06:54
The rust impl seems to have lost momentum

matt.fellows
2018-04-05 06:55
I think Ron almost has full v3 spec implemented, but we?ll be fighting inertia and all of the other niceties we have with Ruby

matt.fellows
2018-05-10 04:08
@bethskurrie how far off are we for making the Message Stuff _real_ for Ruby devs? Is it good to go? Does it just need docs? Or does the DSL etc. need a facelift?

bethskurrie
2018-05-10 04:09
It just needs a DSL.

matt.fellows
2018-05-10 04:09
ok cool

bethskurrie
2018-05-10 04:09
I've done the underlying logic, obviously, but there isn't a nice interface for it, esp on the producer side.

matt.fellows
2018-05-10 04:09
got it

bethskurrie
2018-05-10 04:09
Someone was asking about it weren't they?

matt.fellows
2018-05-10 04:10
someone else did too (can?t remember) but the team at Stichfix are mostly Ruby, and they?re _keen as mustard_

bethskurrie
2018-05-10 04:10
Ok, I'll get on to it.

bethskurrie
2018-05-10 04:10
I was mostly not bothering because I didn't think anybody cared

bethskurrie
2018-05-10 04:10
:cry:

matt.fellows
2018-05-10 04:11
People care - have you not seen the almost 2k stars on the repo :smile:

bethskurrie
2018-05-10 04:11
Mm.. mostly for historical purposes though.

bethskurrie
2018-05-10 04:11
It was the original http://docs.pact.io really.

matt.fellows
2018-05-10 04:11
true

bethskurrie
2018-05-10 04:11
The knee high dictators have arisen. I must hearken to their commands.

matt.fellows
2018-05-10 04:12
(there doesn?t appear to be a :salute? but salute)

shekharsp27
2018-05-23 05:20
has joined #pact-message-ruby

matt
2018-06-11 01:40
has joined #pact-message-ruby

cfmack
2018-06-29 14:12
@matt.fellows, I am spending sometime catching up to the JS implementation and the spikes with @bethskurrie on message support. What is the thought on adding properties to the pact message objects like Message.ProviderStates when those are not in the original pact-specification v3 (https://github.com/pact-foundation/pact-specification/blob/version-3/testcases/message/body/matches.json).

cfmack
2018-06-29 15:03
@bethskurrie, is there a /message endpoint on the ruby standalone? When the framework registers the interaction with the ruby standalone, how will it know to turn a pact-v3 with a message node, rather than an interactions node?

cfmack
2018-06-29 15:50
As another thing I am working through, I am on Windows ( :violin: ) with Pact Ruby Standalone for 1.47.1 and submitting the JSON from the demo: https://github.com/pact-foundation/pact-message-demo/blob/master/message-pact.json ... and I get an error:`{ "message": "Error ocurred in mock service: NoMethodError - undefined method `[]' for nil:NilClass", "backtrace": [ "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.2/lib/pact/consumer_contract/interaction.rb:32:in `parse_v2_interaction'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.6.2/lib/pact/consumer_contract/interaction.rb:26:in `from_hash'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.0/lib/pact/mock_service/request_handlers/interaction_post.rb:24:in `respond'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.0/lib/pact/mock_service/request_handlers/base_request_handler.rb:17:in `call'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/rack-2.0.5/lib/rack/cascade.rb:33:in `block in call'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/rack-2.0.5/lib/rack/cascade.rb:24:in `each'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/rack-2.0.5/lib/rack/cascade.rb:24:in `call'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.0/lib/pact/consumer/mock_service/cors_origin_header_middleware.rb:11:in `call'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.0/lib/pact/consumer/mock_service/error_handler.rb:13:in `call'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.0/lib/pact/mock_service/app.rb:33:in `call'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-2.9.0/lib/pact/consumer/mock_service/set_location.rb:14:in `call'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/rack-2.0.5/lib/rack/handler/webrick.rb:86:in `service'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:138:in `service'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:94:in `run'", "C:/Users/me/Downloads/pact-1.47.1-win32/pact/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/server.rb:191:in `block in start_thread'" ] }

bethskurrie
2018-06-30 06:24
There is no mock for message pact.

bethskurrie
2018-06-30 06:28
The developer defines the message (and matchers) then calls a language appropriate thing (eg "yield_message") to tell the pact code to give it the concrete message, and then the test makes sure that the prod code does the right thing with the message.

matt.fellows
2018-07-07 03:07
Sorry I didn?t see this. I think perhaps that just means it?s missing from the spec tests (cc @uglyog) because they are definitely in the implementation


uglyog
2018-07-07 04:23
has joined #pact-message-ruby

uglyog
2018-07-07 04:24
The current test cases only test the matching rules

matt.fellows
2018-07-07 04:26
any reason?

uglyog
2018-07-07 04:28
because that is all we wrote :smile:

matt.fellows
2018-07-07 04:31
I assumed as much

cfmack
2018-07-11 20:05
Thanks, y'all

cfmack
2018-07-11 20:56
I am attempting at understanding the Message Pact Validation on https://github.com/pact-foundation/pact-message-demo and implement in Pact-PHP. Let me see if I can understand the control flow and character Pact Provider Verifier. This is pact-provider-verifier(.bat on Windows) in the ruby stand alone. Correct? This will be called by Pact-JS, http://Pact.Net, and Pact-PHP through a message specific implementation. Producer Proxy HTTP Server. This is created by the writer of the test using the Pact libraries (i.e. Pact-JS, http://Pact.Net, and Pact-PHP). Message Invoker. This is a call to the part of the Producer functions Pact libraries (i.e. Pact-JS, http://Pact.Net, and Pact-PHP) that is likely a call back or reference to the Producer class and function that produces appropriate message. Producer class is the function under test. My question is ... is the Producer Proxy HTTP Server written by the implementer of the test or the Pact-(PHP|JS|Net) creator? It would seem really odd for a implementer of the test to be forced to write an HTTP server if their app. Thus, I assume Producer Proxy HTTP Server is actually built into Pact-PHP (in this case). Am I understanding the ownership correctly?

matt.fellows
2018-07-11 21:00
It's written by the framework authors (i.e. us)

matt.fellows
2018-07-11 21:04
We tell the provider verifier to read a given message pact, and to send the message object to the proxy. All we really use from this is the description field (the provider state flow is similar). The proxy then takes that message name and invokes the specific message producer that inplements that message. The response is extracted and sent back to the verifier who then checks it matches whats in the pact spec.

bethskurrie
2018-07-11 21:04
Sorry @cfmack the proxy http server is written by you

cfmack
2018-07-11 21:18
I thought so (and actually hoped so) as that would be _terrible_ for the library users.

matt.fellows
2018-07-11 21:19
:smile:

matt.fellows
2018-07-11 21:19
yeah, pretty harsh!

matt.fellows
2018-07-11 21:20
We thought of a number of ways we could do this. If you have better ideas we?re open to it

matt.fellows
2018-07-11 21:20
One of the main benefits of this approach is it isn?t message specific, so it means other protocols and transport even can be introduced this way

bethskurrie
2018-07-11 21:23
The http proxy is there to enable a cross language process interop call - it's not ideal, and will be much more elegant when we can do it with the rust bindings.

bethskurrie
2018-07-11 21:23
but, like the whole ruby standalone thing, it will get the job done!

bethskurrie
2018-07-11 21:25
The message invoker is the part that the test writer will need to implement (either via a DSL or just a plain old <insert language here> class)

cfmack
2018-07-11 21:28
I'm there! Thanks, y'all. Got any ideas on the rest of the v3 spec? Are we implementing that soon or should we just call this spec "2.1"?

matt.fellows
2018-07-11 21:39
It's a good point. I've left it at beta for now but if we foresee a long delay perhaps that's best

cfmack
2018-07-11 22:34
To end my day, the implementation of creating the proxy server in a scripting language blows my mind. What does the url and payload look like? We are spinning up a server in a library to dynamically load classes with a dynamic function to accept a dynamic payload that is likely complicated by directory locations of the thing calling the library, which likely has dynamic includes. :exploding_head:. No way simple way to make this secure other than putting a big ol' asterisk on it. I'm going to have to noodle on this one

matt.fellows
2018-07-11 22:46
What's the security angle I'm missing?

bethskurrie
2018-07-12 00:16
> What does the url and payload look like? The URL can be whatever you like, as you're going to be configuring both that and the call to the provider verifier. The payload is ``` { description: "description", providerStates: [{ name: "name", params: {} }] } ```

cfmack
2018-07-13 19:48
Hey @matt.fellows, I have a POC complete where I have a listener setup, spins up a proxy provider server in the background, kicks off the unit test, runs pact-provider-verifier.bat, calls the proxy provider server with a POST per message. I am exploring how to tell the proxy server what class to call (i.e. the call back). It looks like in Pact-JS, we set this up as configuration vs a per request. Do you spin up proxy provider per test? I would love to spin up one proxy server then reuse it based on the call back. However, it does not look like I could get the callback information in there via the pact-provider-verifier.bat call

cfmack
2018-07-13 19:50
NVM, l am going to explore using a customer-provider-header

cfmack
2018-07-13 20:06
That works. Ignore that question. Now for my next reflection ...

cfmack
2018-07-13 20:13
pact-provider-verifier.bat returns the description and providerState of each message. A common simple case across message queues would be: Consumer: I need a message that looks like {id : 1} on the queue/routing_key/message_key called "my_key" Producer: I publish "my_key" Hey, let's write a pact and agree on that! It would seem natural for the Consumer and Producer to put the information about "my_key" in the metadata and {id: N} in the contents. Right? If my throught process plays out, pact-provider-verifier.bat would need to somehow pass over the metadata, not just description and providerState. Neither description or providerState seem natural to put "my_key". I suppose you would argue in some cases that is a providerState but a queue seems to be pretty straightforward. Would a description be "A queue with my_key exists" and providerState is "my_key"? If that holds true, what is metadata for?

cfmack
2018-07-13 20:36
... and the customer-provider-header does not work if a pact has more than one message with different call back functions

bethskurrie
2018-07-14 11:20
What is the customer provider header?

bethskurrie
2018-07-14 11:20
Tbh, I never understood the metadata. I think @uglyog uses it for a content type.

bethskurrie
2018-07-14 11:21
Whats the deal with the queue names Ron?

bethskurrie
2018-07-14 11:21
Is that a part of the contract?

uglyog
2018-07-14 11:21
Some message queues allow for metadata to be applied to the message (ie. routing info)

uglyog
2018-07-14 11:22
and the content type comes from there

uglyog
2018-07-14 11:23
I have people asking for the metadata to be verified as well

bethskurrie
2018-07-14 11:23
I'll have to add that then.

bethskurrie
2018-07-14 11:24
Currently, I'm only verifying the content.

bethskurrie
2018-07-14 11:24
Should queue names be included somewhere?

uglyog
2018-07-14 11:24
it could go into the metadata

uglyog
2018-07-14 11:25
But I don't see the value

bethskurrie
2018-07-14 11:26
@cfmack I tend to see the http proxy as something that lasts the entire length of the pact verification process. Starting and stopping it would slow things unnecessarily I think.

matt.fellows
2018-07-15 00:56
I think _customer_ -> _custom_

matt.fellows
2018-07-15 00:58
The Golang proxy tends to spin up in < 10ms, so it?s not something I?m super concerned with. That being said, I use the same proxy instance throughout the process.

bethskurrie
2018-07-16 11:46
Oh, right. What problem are you trying to solve with the custom provider header @cfmack? Is it something we can provide proper support for?

cfmack
2018-07-16 17:25
Stepping back, queue name parallels the same concept at a URI path. "I expect your API to have an end point at /foo" "I expect to listen to your messages on queue 'foo'"

cfmack
2018-07-16 17:27
I have to find away to pass a call back process to an outside process. I was going to pass in that information via the custom provider header. That falls apart when the callback needs to change. I'll try to establish a better use case.

bethskurrie
2018-07-16 21:12
So if we add matching to the metadata, you can put it there.

bethskurrie
2018-07-16 21:13
If you get a repo that demonstrates the problem, I can probably find a way to support you.

bethskurrie
2018-07-16 21:14
The fact that matt's done the js and go impls without a callback suggests to me that there is a way without it, however.

cfmack
2018-07-16 21:37
That works. My next question is ... how does the provider validate when it is only passed the data description & providerState? Should it need to know about the metadata? Maybe not. Let me think about that one. Should that just be in the description and validated on the metadata? (I like to work these things out as I type)

matt.fellows
2018-07-16 21:54
The only external process should be the verifer itself

matt.fellows
2018-07-16 21:54
The proxy should wrap any test code in process, so no need for dynamic callbacks etc

matt.fellows
2018-07-16 22:17
:smile:

bethskurrie
2018-07-16 22:18
The description and state should tell you what message to return I think.

matt.fellows
2018-07-16 22:18
Right now I took the decision _not_ to validate the metadata, if only because I don?t think it?s well defined in the spec just yet and I couldn?t see a nice way to pass it to the function

bethskurrie
2018-07-16 22:18
The matching is performed by the provider verifier process.

matt.fellows
2018-07-16 22:19
Sorry, on the consumer side this is

bethskurrie
2018-07-16 22:19
Oh, right.

matt.fellows
2018-07-16 22:19
IFF i created protocol specific handlers (e.g. AMQP, gRPC or something) that needed it, I would have to ensure it did the right thing.

matt.fellows
2018-07-16 22:20
Presumably the verifier _would_ match it?

bethskurrie
2018-07-16 22:22
It could, but currently does not.

bethskurrie
2018-07-16 22:22
I didn't really understand it.

bethskurrie
2018-07-16 22:23
I can easily add verification for it. But we'd want it to be in line with @uglyog code

uglyog
2018-07-17 08:01
I have an outstanding feature request to add it to the jvm

cfmack
2018-07-21 00:50
I think I got it y'all. I have a functioning Provider with limitations. I'll say that Go and Js are not the same for async programming as PHP, especially on Windows. That said, I got an initial stab on it and have passing tests. Thanks for your help.

matt.fellows
2018-07-21 00:51
I wonder if we have a maintainers hangout and do a demo of each language so we can all see how each works. This will help us get consistency across experiences for our users. Thoughts?

cfmack
2018-07-21 00:53
Probably easier somehow


cfmack
2018-07-21 00:56
After getting this slowly up to snuff (lots to do still), I was thinking about getting a v2 implementation in R. Why? Because it would be fun. Anyone interested?

bethskurrie
2018-07-21 03:20
Really good idea @matt.fellows

bethskurrie
2018-07-21 03:21
@cfmack imo porting one of the current wrapper impls to the rust impl is a more productive use of time, but if you're doing it for fun, then who am I to object!

bethskurrie
2018-07-21 03:22
I pick fun things over necessary things more then I care to admit.

matt.fellows
2018-07-21 04:04
We all do. What's life without whimsy

mbudde
2018-08-09 08:47
has joined #pact-message-ruby

matt.fellows
2018-09-27 05:18
@neil if you want to do some Pact Message stuff, check out the following two links: * https://gist.github.com/bethesque/c858e5c15649ae525ef0cc5264b8477c * https://github.com/pact-foundation/pact-message-demo

matt.fellows
2018-09-27 05:19
There should be enough context to get an idea of how it works, albeit potentially @cfmack has feedback on the use-fullness of them (as he was the most recent beneficiary of this)

heymega
2018-10-06 13:00
has joined #pact-message-ruby

kurst03
2018-11-18 00:42
has joined #pact-message-ruby

mcon
2018-12-13 15:19
has joined #pact-message-ruby

uglyog
2019-02-03 06:02
@bethskurrie @matt.fellows I have a request to have the message metadata to be able to be verified along with the contents. I have picked this issue up now (https://github.com/DiUS/pact-jvm/issues/479). This will need to be implemented in the Ruby implementation.

matt.fellows
2019-02-03 08:47
Sounds good. Is it just the ability to pass the metadata along to the provider or does the verification do some extra processing?

bethskurrie
2019-02-03 20:38
Can do @uglyog

uglyog
2019-02-03 20:57
Matchers and generators can also be applied to the metadata

matt.fellows
2019-02-03 21:43
How does the verification of the metadata work, though? Can you show some pseudocode of what you?re thinking/doing?

uglyog
2019-02-04 08:37
Umm, yeah, about that. When I get to that part I'll let you know :grin:

bart.schotten
2019-03-25 13:21
has joined #pact-message-ruby

uglyog
2019-04-21 04:33
@matt.fellows just finished the verification of message metadata


uglyog
2019-04-21 04:38
Corresponding pact file JSON

uglyog
2019-04-21 04:38
``` { "description": "a test message", "metaData": { "destination": "X001", "Content-Type": "application/json; charset\u003dUTF-8" }, "contents": { "testParam1": "value1", "testParam2": "value2" }, "providerStates": [ { "name": "SomeProviderState" } ], "matchingRules": { "metadata": { "destination": { "matchers": [ { "match": "regex", "regex": "\\w+\\d+" } ], "combine": "AND" } } } } ```

uglyog
2019-04-21 04:40
The invoked test methods need to now return both the message contents and actual metadata

uglyog
2019-04-21 04:40
For backwards compatibility, if only the contents are returned, the metadata is ignored and not verified



bethskurrie
2019-04-21 05:26
@uglyog noted

murphy.meng
2019-04-23 11:01
has joined #pact-message-ruby

matt.fellows
2019-04-23 11:01
On the pact message stuff, I was just talking to @murphy.meng who was asking about the request/response async pattern

matt.fellows
2019-04-23 11:02
My understanding is that to achieve this currently, you need to write two separate tests - one for the request flow and another for the response flow (where the consumer and provider take turns initiating the request)

matt.fellows
2019-04-23 11:03
See recent comments https://gist.github.com/bethesque/c858e5c15649ae525ef0cc5264b8477c for others sharing this sentiment

murphy.meng
2019-04-23 11:08
yes I did read what Alex commented there, ?it will require two message pacts and four time-separated commits for each request-response pair.? It means what you just said about two separate tests? I don?t quite understand how this work around work at the moment.

murphy.meng
2019-04-23 11:08
I mean, I might want to try out pact and two sepaate tests are fine. Could you explain a bit in detail?

matt.fellows
2019-04-23 11:08
I?m not sure about the ?time-separated commits? bit

matt.fellows
2019-04-23 11:10
you would need to create one test for `message from A` -> `[ queue ] ` -> `received by B`, and then write a separate test for the response pathway `B sends response` -> `[queue]` -> `received by A`

matt.fellows
2019-04-23 11:10
If we had the concept of a request/response message here, you would just need to write one test for this scenario

murphy.meng
2019-04-23 11:19
I am going to ask another dumb question, you said pact-mock_service is not used in message api testing, then for example in `message from A` -> `[ queue ]` -> `received by B` scenario, where is the mocked receiver (to replace real B) and generate the pact for A?

matt.fellows
2019-04-23 11:20
The framework will still perform this action, it just may not use the mock service - does that matter to you?

murphy.meng
2019-04-23 11:23
It does not matter your are right it is just impl detail. I simply want to understand better:wink:, sorry. when you say framework, you mean ruby impl, go, javascript and jms impl? Do they share the same impl and they do their own impl?

matt.fellows
2019-04-23 11:31
haha np

matt.fellows
2019-04-23 11:31
In this case, I mean whatever language bindings you are using. So in the case of Pact JS, the JS library will actually invoke your consumer and then invoke another Ruby process asking it to serialise the Pact file. The mock service is not involved

matt.fellows
2019-04-23 11:32
(`pact-message` binary does the serialisation here)

murphy.meng
2019-04-23 12:06
Cool. I believe if I add message impl to Python I will need know how to invoke pact-message binary but let?s put it aside for now.

murphy.meng
2019-04-23 12:09
My next dumb question is, which ruby binary will be used to verify the pact with messaging api scenario?

matt.fellows
2019-04-23 12:11
right, so are you wanting to contribute? This would have been helpful information!!

matt.fellows
2019-04-23 12:11
@murphy.meng start here

murphy.meng
2019-04-23 12:14
I am very keen to allow Python to support messaging api, I managed to get some bandwidth to do this for testing the messaging api in my company.

matt.fellows
2019-04-23 12:42
that?s great

matt.fellows
2019-04-23 12:42
I didn?t realise that was your intention

matt.fellows
2019-04-23 12:43
See the sequence diagrams at https://github.com/pact-foundation/pact-message-demo for background

murphy.meng
2019-04-23 12:57
Sure will do.

davidmolinero.com
2019-05-15 08:09
has joined #pact-message-ruby

bart.schotten
2019-05-16 05:49
I'm running into a problem when testing messages with pact-net, and the output seems to suggest the problem originates in the ruby core. I've got a test that succeeds when running from Windows but fails when running from Linux because it can't parse json. This is a consumer test so I guess the json is generated during the test and not input *for* the test. Does this sound familiar at all? I don't really know Ruby myself so I'm kind of stuck here. ```/mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/json-2.1.0/lib/json/common.rb:156:in 'parse': 757: unexpected token at ''{id:{json_class:Pact::SomethingLike,contents:2},name:{json_class:Pact::SomethingLike,contents:Terence},type:{json_class:Pact::SomethingLike,contents:Giraffe}}'' (JSON::ParserError) from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/json-2.1.0/lib/json/common.rb:156:in 'parse' from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/json-2.1.0/lib/json/common.rb:335:in 'load' from /mnt/c/Repos/Pact-Net/Samples/MessageZooEvents/ZooEventsConsumer.Tests/bin/Debug/netcoreapp2.2/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-message-0.5.0/lib/pact/message/cli.rb:24:in 'reify'``` https://github.com/pact-foundation/pact-net/pull/175

bethskurrie
2019-05-16 05:53
It looks like it's trying to parse an object that is already parsed.

bethskurrie
2019-05-16 05:53
Why this should happen on Linux and not Windows I don't know!

bethskurrie
2019-05-16 05:55
@bart.schotten can you raise this in the pact-ruby-standalone repo with the full backtrace, and I'll have a look at it.

bart.schotten
2019-05-16 06:22

bethskurrie
2019-05-16 06:23
I'll try and get to it as soon as I can. Things are a bit busy here with the launch of http://pactflow.io so forgive me if it's not immediately.

bart.schotten
2019-05-16 06:25
No problem, I appreciate the work you do :+1:

bethskurrie
2019-05-16 06:30
You're welcome.

matt.fellows
2019-05-16 06:51
I recall having an issue with reify early on in the implementation - i?ll check my notes tonight to see if anything turns up

matt.fellows
2019-05-16 06:52
From memory, I got it when I gave it an invalid JSON payload (I think maybe we were iterating on the property keys)

bethskurrie
2019-05-16 07:11
It looks like it's lost its quotes

matt.fellows
2019-05-16 07:14
yeah, looks to have double

bartek.bulat
2019-07-22 13:38
has joined #pact-message-ruby

kashikar.harsh
2019-08-02 06:59
has joined #pact-message-ruby

mmonson
2019-08-09 18:53
has joined #pact-message-ruby

tkimia
2019-09-23 18:45
has joined #pact-message-ruby

khoatran
2019-12-06 00:33
has joined #pact-message-ruby

khoatran
2019-12-06 00:34
Hi guys/gals, are there examples on how to integrate pact for messages for ruby

bethskurrie
2019-12-06 02:51
@khoatran now I've refreshed my memory, I've remembered the DSL for message pact is not done in Ruby yet. The underlying logic is done though, because it's being used by pact-js. Which side would you be interested in using? Consumer or provider, or both?

khoatran
2019-12-06 05:27
hi Beth, I'm interested in using the provider side

khoatran
2019-12-06 05:28
we have some ruby code that pushes messages to a queue, and some node.js code consuming the messages on the other end

bethskurrie
2019-12-06 06:43
It shouldn't be too much work to hook up the verification code.

bethskurrie
2019-12-06 06:43
I'll try to get on to it in the next week or so.

khoatran
2019-12-06 12:12
Thank you Beth

bethskurrie
2020-01-14 19:43
@khoatran sorry, I've been caught up with other things. I'll have a look at it tomorrow.

bethskurrie
2020-01-16 09:55
@khoatran If you update to the latest pact gem you'll have pact message verification support

khoatran
2020-01-18 01:52
Thanks @bethskurrie



khoatran
2020-02-04 01:06
Sorry @bethskurrie I've been away. Thank you for your help :thumbsup:

me1015
2020-02-10 14:29
has joined #pact-message-ruby

me1015
2020-02-10 14:49
Hey guys, added a small PR to pass through message metadata: https://github.com/pact-foundation/pact-message-ruby/pull/12 - let me know if you have any concerns.

dan.garland
2020-02-25 10:24
has joined #pact-message-ruby

angelos
2020-02-25 13:47
has joined #pact-message-ruby

bethskurrie
2020-02-26 06:25
Hi @dan.garland the code for the consumer side of the message pact is actually done, but not released as I got into naming conundrums.

bethskurrie
2020-02-26 06:26
There ended up being a "message builder" on both consumer and provider sides, but they did different things and I couldn't work out what to call them, so I didn't release the code :joy:

bethskurrie
2020-02-26 06:26
Srsly, naming things is the hardest.

bethskurrie
2020-02-26 06:27
What you can do to help it get out is work with me on the naming!

bethskurrie
2020-02-26 06:27
I'll send you the code when I have a moment.



bethskurrie
2020-02-26 06:42
And I'm really not sure about the syntax for supplying the message pact to the test



dan.garland
2020-02-26 08:09
Thanks I tried making a consumer test that followed this and I'll have a think about the points :point_up: . When I looked at the resulting Pact I noticed that the `providerStates` and `matchingRules` were empty- is this the WIP part?

bethskurrie
2020-02-26 09:32
Hm. It might just be unfinished.

bethskurrie
2020-02-26 09:32
I know the underlying impl works because pact-js uses it - it's just been the ruby DSL that was missing.


dan.garland
2020-02-27 09:02
Interesting I'll take a look

dan.garland
2020-02-27 09:20
In the meantime, I've been thinking more about how Pact would fit in with messaging. It seems that the Pact approach of knowing who your producer/provider and consumers are and naming them in the Pact makes total sense with REST, but perhaps a lesser extent with messages. If you buy into the eventing model, part of the sell is that you can throw messages onto the event bus and not care about other services and how they respond. In this situation the contract is a data contract based on the message content, rather than being between specific providers/consumers. I wondered whether anyone using this feature on other languages had a view on this and whether the Pact approach maps well to messaging in their experience

matt.fellows
2020-02-27 09:30
You raise a good point. The current eventing model misses two key interaction types: req/res style and also the "stream" style you've just described.

matt.fellows
2020-02-27 09:31
I think it's worth revisiting both, but we need to initially get parity with current libraries.

eleftherios
2020-04-29 07:03
has joined #pact-message-ruby

akkoubak
2020-05-13 17:16
has joined #pact-message-ruby

angelos
2020-05-28 11:55
Hello, I am trying to use the `pact-message` gem but it seems I'm hitting a wall, due to a weird `method_missing` error. Any tip would be appreciated. I have created a POC repo to reproduce the issue: https://github.com/ang3lkar/poc-kafka-message-contracts/

bethskurrie
2020-05-28 20:42
Hi @angelos if you read the docs, you'll see that the consumer dsl is not finished


angelos
2020-06-01 13:43
hi @bethskurrie! Thanks for answering! However, I'm a bit confused, there is no consumer-side code in my poc, it's just the provider verification of a static contract file. Essentially, it's the simplest manifestation of the provider example in the pact-message README. (https://github.com/pact-foundation/pact-message-ruby/blob/master/README.md#provider)

angelos
2020-06-01 13:44
Is there something I am missing?

manos
2020-06-02 08:06
has joined #pact-message-ruby

max.forasteiro
2020-06-11 20:49
has joined #pact-message-ruby

max.forasteiro
2020-06-11 20:59
any news about that?

max.forasteiro
2020-06-11 21:23
Hey guys! Awesome job that you guys are doing here! is the idea to move this gem inside `pact-ruby` after finishing it? also: I'm receiving an error while trying to use the message provider: ```undefined method `honours_pact_with' for main:Object```

max.forasteiro
2020-06-12 14:15
work around: define a `service_provider` block with your `honours_pact_with` method and then define a `message_provider` block with the `builder` method. Traced the error back to https://github.com/pact-foundation/pact-ruby/blob/master/lib/pact/provider/configuration/message_provider_dsl.rb#L24

max.forasteiro
2020-06-12 14:19
https://github.com/pact-foundation/pact-ruby/issues/215 issue opened :slightly_smiling_face:

bethskurrie
2020-06-18 10:40
@max.forasteiro I was planning on keeping them separate

bethskurrie
2020-06-18 10:40
Thanks again for your help on the DSL btw.

jlammers
2020-07-08 17:28
has joined #pact-message-ruby

nirupma.rim
2020-07-08 17:30
has joined #pact-message-ruby

nirupma.rim
2020-07-09 07:52
Hi All, I m trying to do consumer message contract testing but it failing with below error: MessageHandler get_message allows a consumer to test that it can handle a message example correctly (FAILED - 1) Failures: 1) MessageHandler get_message allows a consumer to test that it can handle a message example correctly Failure/Error: message_provider_kafka .given("Encrypted Msg") .is_expected_to_send("payload for file download") .with_metadata("retry_count": 0) .with_content(message: {:headers=>{:message_class=>"notification-newfile", :message_type=>"notifications", :account=>{:id=>"dhgdjhgf"}, :object_id=>"a05f3b28-9056-493d-9ae6-eb67d04ed511", :transaction_id=>"a61d0c8f-ee3f-49fd-9371-ba7d9e86c419", :encryption_key=>"HpHNuKx0GFRSLH6i7NGxHbSqKAOCX-sBtP3pmG1eWHE22WhYeEb9HSlc8RpgTvvJkvmjpsad9AHcd6M9BjI_jHsDv3zmTPL807O99S4PodMRBcxxXlh_LQLKzaXCMCZiZ-nmw-dH5BlY8nmtnAE4VqmOHKMnwU_lQhyXBLb4R4aMqBhjrFZchw9YPDvoO1x8wQIGCXhMp0dnZRWnqHoXR1Pzv9OfEwKIMispJ-wblNAUOEq6UYWbhtr-81jvBBlIjIqiLZUWaOns3fK6xIKLXUQ-TqtfALH7zvUrbXqjeAsfXZZs49Swzthg2yyU8cQvXVMj_NJ6i8mVnCkZ62AmT5dkz9bMOEPWVrnENgxc-4cJjgmfRb2-Bf7vVNqLPis5bSNLtwOTehKbJA-UPjm23wI5pWiuNaHVnbG97S46I0eVt3h4m12a5-3BsAsWT9-YB3X57jh5lCkPz8Z8GsvXGCqrIenw0_W0qJFaiAxjUtmiNJi_Y2kjxyLAejL8YesWWY8wLm24FRUC00Vu0sC8DC-PgQEJmHjyNVeIiAVFh2IOq5fTtbr0k_mAnE_BdzMBoYvDIrXLdu1Hq_FDAcbkoQAxRECRWPemi3wFRhry7Cm75pDolKZcv18n210TVfjrlhCXIvySlQv1FqP3PygQ3FHReX58pTMvXrhEyM9p-jI=", :key_version=>1}, :metrics=>{:created=>"2020-07-03T09:47:28.427570739Z", :encoded=>"0001-01-01T00:00:00Z", :decoded=>"0001-01-01T00:00:00Z", :entry=>"2020-07-03T09:47:28.468636405Z", :exit=>"0001-01-01T00:00:00Z"}, :payload=>"NGB4LZ9A76SEeXEPwv--jwtM6421UeR29JZwbTGW9juYSZYsrRkyyxVxzuumZvFpWnSLNLvfMF9ZWhf8ZyOIT2ksc0muPi1AnicJpDez9WM5qvaua2HAs0FRnrGP1ZxmVJq2j7v9NWgtfG9MnaiebTCH7O6CubJSmYnr0y-kO9V1--DVI64tVDIZgrRax8CE-up5CAlOS4yvkX6CKVQPd6BaDdCynFRFbdyO9F6-tiQfJFOakztTLkh_FQQhL-25egtPf9TdByEY"}) NoMethodError: undefined method `contents' for #<Pact::Interaction:0x005640992bfe28> # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/pact-message-0.7.0/lib/pact/message/consumer/interaction_decorator.rb:37:in `extract_contents' # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/pact-message-0.7.0/lib/pact/message/consumer/interaction_decorator.rb:18:in `as_json' # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/pact-message-0.7.0/lib/pact/message/consumer/consumer_contract_decorator.rb:14:in `block in as_json' # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/pact-message-0.7.0/lib/pact/message/consumer/consumer_contract_decorator.rb:14:in `collect' # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/pact-message-0.7.0/lib/pact/message/consumer/consumer_contract_decorator.rb:14:in `as_json' # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/pact-mock_service-3.6.1/lib/pact/consumer_contract/consumer_contract_decorator.rb:28:in `to_json' # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/json-2.3.1/lib/json/common.rb:521:in `generate' # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/json-2.3.1/lib/json/common.rb:521:in `pretty_generate' # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/pact-mock_service-3.6.1/lib/pact/consumer_contract/consumer_contract_writer.rb:76:in `pact_json' # /home/vitthal/.rvm/gems/ruby-2.4.0/gems/pact-mock_service-3.6.1/lib/pact/consumer_contract/consumer_contract_writer.rb:66:in `block in update_pactfile'

bethskurrie
2020-07-09 08:03
Consumer is not implemented yet @nirupma.rim


bethskurrie
2020-07-09 08:05
I had hoped to get it out recently, but this whole virus thing has taken away the dedicated oss day in my usual schedule.

nirupma.rim
2020-07-09 08:05
okay Thank you

bethskurrie
2020-07-09 08:05
How did you get the syntax if you didn't see the notice in the docs?

nirupma.rim
2020-07-09 08:10
I checked the inner implementation

bethskurrie
2020-07-09 08:11
Gosh, not many people ever think to do that!

nirupma.rim
2020-07-09 14:27
@bethskurrie: any ETA on completion or what work needs to be done to finish it

bethskurrie
2020-07-10 11:18
If you poke through the consumer code, you'll find a particular dsl/builder class that has mostly empty methods.

bethskurrie
2020-07-10 11:19
I'm sorry, I had hoped to get it out weeks ago. My OSS contribution time used to be on my train trips to and from work, and now I don't have that time.

bethskurrie
2020-07-10 11:19
The coronavirus has no respect for my productivity!

heytaco
2020-08-25 03:57
has joined #pact-message-ruby

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!

armorsmith42
2020-09-08 21:37
has joined #pact-message-ruby

armorsmith42
2020-09-08 21:41
@bethskurrie@bethskurrie@bethskurrie If an intrepid pair of coworkers wanted to pick up working on the ruby kafka consumer what are some links you might suggest reading first? In particular: anything we should do to ensure we follow your lead stylistically?

bethskurrie
2020-09-14 21:19
Hi @armorsmith42, sorry, I only just saw your message.

bethskurrie
2020-09-14 21:21
I'm trying to remember what's outstanding on this. I was going to rename the builder object on the consumer side to avoid confusion with the builder on the provider side.

bethskurrie
2020-09-14 21:21
I'm sure there was some functionality missing too. But not much. I'd have to look through the code again.

armorsmith42
2020-09-14 21:26
If you were able to sketch that out, I would be grateful.

bethskurrie
2020-09-14 21:34
I'll have a look today

bethskurrie
2020-09-14 21:35
I picked it up recently, but my oss time is 0 at the moment, with the kids at home due to lockdown.

bethskurrie
2020-09-15 07:27
Have not forgotten, but didn't get to it today. On the list for tomorrow

mark.doppelfeld
2021-02-17 19:01
has joined #pact-message-ruby

jon.pascoe
2021-03-14 23:30
has joined #pact-message-ruby

raony
2021-04-15 19:24
has joined #pact-message-ruby

armorsmith42
2021-06-12 02:46
@bethskurrie@bethskurrie@bethskurrie would you be willing to ?pair program? with me to draft the docs for this?

bethskurrie
2021-06-13 10:37
@armorsmith42 yes, thanks!

bethskurrie
2021-06-13 10:39
If you want to open a PR we can work on it together. It should be fairly straightforward to reverse engineer from the example spec.

jeen.broekstra
2021-06-17 06:15
has joined #pact-message-ruby

jeen.broekstra
2021-06-17 06:28
:wave: hi folks, I?m experimenting with the use of pact for contract testing for a kafka consumer and producer. Very stoked to see this gem available, but I am finding it rough going getting things set up (probably me being relatively new to pact in general, and completely new to using it for message-driven systems). Is my understanding correct that in principle it should be possible to write a consumer rspec with a mocked message provider using this gem? Or is it still a work in progress? I found the code example mentioned in the README but I am having a hard time translating it to my situation.

bethskurrie
2021-06-17 06:29
Yeah, sorry, the docs are a bit thin @jeen.broekstra

bethskurrie
2021-06-17 06:29
You don't mock out the message provider, you just write a contract for the message handler


jeen.broekstra
2021-06-17 06:30
ah! Thank you, that sounds very useful - I hadn?t found that particular page yet :slightly_smiling_face: :book:

bethskurrie
2021-06-17 06:31
there are a lot of docs!

bethskurrie
2021-06-17 06:31
most of them are very http focussed, as that's what came first.

jeen.broekstra
2021-06-18 02:08
I?m still struggling a little with this. Sorry to flood your channel but let me share a quick consumer-side pact spec that I?m trying to get working. I?ve tried several varieties but what I currently have is this: ```require "rails_helper" RSpec.describe MyConsumer, pact: true do include Pact::Helpers before(:all) do Pact.message_consumer "My Consumer" do has_pact_with "My Provider" do mock_provider :my_provider do pact_specification_version "2" end end end end let(:projector) { double } subject { MyConsumer.new(projector: projector) } describe "processing message", pact: :message do it "does the thing" do my_provider .given("there is a new employee named John").is_expected_to_send("a new employee message") my_provider.send_message_hash { |message| subject.process(message) } expect(projector).to have_received(:handler_for) end end end``` When I try to run this (with `bundle exec rspec`) it gives me an error on the first line of the `it` body: ``` NameError: undefined local variable or method `my_provider' for #<RSpec::ExampleGroups:MyConsumer::ProcessingMessage:0x00007fbb7e647058>``` I?m probably overlooking something trivial but I could use a pointer :slightly_smiling_face:

bethskurrie
2021-06-18 02:18
Try putting your Pact.message_consumer somewhere else

bethskurrie
2021-06-18 02:18
the convention is to put it in a file called "spec/pact_helper.rb"

bethskurrie
2021-06-18 02:19
or, even just put it at the top of the file (to test it)

jeen.broekstra
2021-06-18 03:46
it doesn?t seem to help unfortunately: ```require "rails_helper" require "pact/consumer/rspec" require "pact/helpers" Pact.message_consumer "My Consumer" do has_pact_with "My Provider" do mock_provider :my_provider do pact_specification_version "2" end end end RSpec.describe MyModule::MyConsumer, pact: true do include Pact::Helpers let(:projector) { double } subject { MyModule::MyConsumer.new(projector: projector) } describe "processing message", pact: :message do it "does the thing" do my_provider .given("there is a new employee named John").is_expected_to_send("a new employee message") my_provider.send_message_hash { |message| subject.process(message) } expect(projector).to have_received(:handler_for) end end end``` gives the same error (also if I put the message consumer in spec/message_providers/pact_helper.rb). Some of the documentation mentioned that I should be working with a builder for the message, rather than a mock provider, but I got a bit confused on how that would work at the consumer side. Am I mixing things up here?

bethskurrie
2021-06-18 03:48
the builder is on the provider side


bethskurrie
2021-06-18 03:48
Looking at this, I can only see that there's a missing require

bethskurrie
2021-06-18 03:48
`require "pact/message/consumer/rspec"`

bethskurrie
2021-06-18 03:49
that might have the pact: :message mixin

jeen.broekstra
2021-06-18 03:50
:facepalm:

jeen.broekstra
2021-06-18 03:50
that was it! thanks so much :blush:

sagupta
2021-07-27 18:35
has joined #pact-message-ruby

edanielsen
2021-09-15 01:01
has joined #pact-message-ruby

gemhar
2021-09-20 15:32
has joined #pact-message-ruby

viveksingh.kiit
2022-01-21 09:43
has joined #pact-message-ruby

charles.kuo
2022-02-10 21:53
has joined #pact-message-ruby

henit.laxmicant
2022-04-08 14:21
has joined #pact-message-ruby

yousafn
2022-04-29 14:38
has joined #pact-message-ruby

orbit
2022-05-09 17:58
has joined #pact-message-ruby

slacksync
2022-06-08 17:21
has joined #pact-message-ruby

andrew.january
2022-07-27 13:57
has joined #pact-message-ruby

duynguyenptithcm
2022-08-20 07:25
has joined #pact-message-ruby

orbit
2022-12-01 15:45
has joined #pact-message-ruby

yousafn
2023-08-09 15:29
:blobwave: Are you using pact-message? Would you like to collab on work to introduce the pact ffi (rust core) into pact-message-ruby and the other Pact gems? I?ve already published a couple of gems with the pact_ffi shared lib being loaded into the namespace with ruby?s `ffi` gem. https://github.com/YOU54F/pact-ruby-ffi I?ve learned Ruby by example from our codebases and happy to pair,

joshua.ellis
2023-09-20 06:41
has joined #pact-message-ruby

clm.whyte
2023-11-30 11:36
has joined #pact-message-ruby