pact-php icon indicating copy to clipboard operation
pact-php copied to clipboard

Pact Version 3 support

Open DerManoMann opened this issue 7 years ago • 35 comments

Just a question if this is planned or already happening?

DerManoMann avatar Nov 30 '17 01:11 DerManoMann

I'll more or less paste my answer I posted on issue #27.

There are lots of plans. Keeping in mind, I original ported the Pact.Net 1.1 solution, which did not call Ruby. I'd say I based my entire knowledge of Pact from that implementation. My expertise tends to follow PHP, .Net, JS, then R in that order. The day I finished Pact.Php 1.0, the .Net solution released Pact 2.0 support. I really needed Matcher support for my organization. Thus, I wrote the base of PHP Pact 2.0 support on two long airplane rides (I got some odd looks as we all do). My main concern at the time is that PHP's external calls are finicky. Sometimes, you need to make exec, sometimes new COM("WScript.Shell"); on different versions of Windows. Let's say I have a history.

Looking back, I should have started PHP Pact 2.0 using Ruby. I also do not want to waste that effort if the Rust implementation is around the corner. Should have happened and will happen. The question is when. Next up, I desperately need AMPQ and/or ZMQ support in both the .Net and PHP versions. I was thinking about making two different libraries that could ideally be merged into Pact-PHP and Pact.Net when they support Pact 3.0 specifications. I'd like to do both of these by the end of the year. This is probably the wrong format for my response but through it all out there.

mattermack avatar Nov 30 '17 03:11 mattermack

@DerManoMann ,

Out of curiosity, is there a feature or feature set you are looking for in 3.0? I'm particularly interested in the Message Bus specification. I could certainly use some help there.

mattermack avatar Nov 30 '17 03:11 mattermack

I'm looking at exposing the v2 pact matching via a CLI - that could be used to give you a leg up on the message queue stuff.

bethesque avatar Nov 30 '17 06:11 bethesque

@mattermack Not really a feature - I am having problems with the providerState which is required by the library. The broker we are using fails on those pact files (empty or null value is fine!!). We use both Java and PHP and the Java projects generate v3 pact files. I was kinda hoping that might perhaps fix the problem....

DerManoMann avatar Nov 30 '17 07:11 DerManoMann

@DerManoMann can you clarify what you mean by "The broker we are using fails on those pact files"? Do you mean the broker fails to render it in HTML? Can you raise an issue in the pact_broker repository then.

bethesque avatar Nov 30 '17 08:11 bethesque

Yeah, I thought about that - I do not know enough about the specs to judge this, but having a behaviour where all values other than non-empty string work does not seem right :)

DerManoMann avatar Nov 30 '17 19:11 DerManoMann

Reopening as this should be the issue when it is supported (comment earlier on has reference on the state)

mattermack avatar Jan 02 '18 18:01 mattermack

Can you answer, please, when pactV3 will approximately supported?

arkonchik avatar May 14 '18 07:05 arkonchik

Unfortunately it is dependent on pact v3 being done in the ruby implementation. I've added the pact message support, but I haven't added any of the new matchers. @arkonchik which feature of v3 are you after?

bethesque avatar May 14 '18 23:05 bethesque

Oh, I've just seen your other post @arkonchik . @mattermack, @mefellows and I can help you out with adding the message support.

bethesque avatar May 14 '18 23:05 bethesque

Thanks. I'll be traveling for a bit. I was originally thinking of implementing something outside of the implementation like https://github.com/Mattersight/pact-net-messages. If the ruby conversion is further along when this starts, the better. @arkonchik , we do not have implementation timeline, other than soon. I personally have a need to get PHP up to V3 with messages like the related .Net implementation but would like to be more inline with the rest of the community. So ... soon :)

mattermack avatar May 15 '18 02:05 mattermack

We've already got a pact message beta out for javascript and go using the ruby standalone. There's really quite a small amount of work that needs doing to integrate it into another language.

bethesque avatar May 15 '18 03:05 bethesque

@bethesque you guessed. I need message queue support. I can try to help with this too.

arkonchik avatar May 15 '18 08:05 arkonchik

@bethesque How can I help with message queue support?

arkonchik avatar May 21 '18 05:05 arkonchik

@arkonchik I've done a bit of a brain dump here: https://github.com/pact-foundation/pact-message-demo

But there is so much to explain, that writing it down would take me ages. Perhaps we could have an online catch up where we could discuss it "in person" with @mattermack and @mefellows?

bethesque avatar May 22 '18 01:05 bethesque

Would love to discuss this in "person" too :)

FWIW I've added some more notes to the original POC gist: https://gist.github.com/bethesque/c858e5c15649ae525ef0cc5264b8477c#gistcomment-2596746

It's far from a guide, but hopefully will be handy.

On Tue, May 22, 2018 at 11:02 AM, Beth Skurrie [email protected] wrote:

@arkonchik https://github.com/arkonchik I've done a bit of a brain dump here: https://github.com/pact-foundation/pact-message-demo

But there is so much to explain, that writing it down would take me ages. Perhaps we could have an online catch up where we could discuss it "in person" with @mattermack https://github.com/mattermack and @mefellows https://github.com/mefellows?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-php/issues/29#issuecomment-390830114, or mute the thread https://github.com/notifications/unsubscribe-auth/AADSjKcycJ5XzSvsX3qRARS1-DjStMsBks5t02OSgaJpZM4Qv6GA .

-- Matt Fellows

  • http://www.onegeek.com.au/

mefellows avatar May 22 '18 07:05 mefellows

Here is the pact message consumer diagram:

  1. Test case sets up the interaction, and accepts a message consumer that should be able to handle the message
  2. Test case invokes Verify on the wrapper language
  3. Wrapper may optionally reach out to pact-message to reify the data structure back into its generated form (i.e. strip out all of the matchers etc.)
  4. Wrapper then invokes the message consumer
  5. If the consumer errors, it fails the test
  6. If the consumer passes, it calls pact-message update to save the pact.

I can add this to your repo if you like Beth?

On Tue, May 22, 2018 at 5:51 PM, Matt Fellows [email protected] wrote:

Would love to discuss this in "person" too :)

FWIW I've added some more notes to the original POC gist: https://gist.github.com/bethesque/c858e5c15649ae525ef0cc5264b847 7c#gistcomment-2596746

It's far from a guide, but hopefully will be handy.

On Tue, May 22, 2018 at 11:02 AM, Beth Skurrie [email protected] wrote:

@arkonchik https://github.com/arkonchik I've done a bit of a brain dump here: https://github.com/pact-foundation/pact-message-demo

But there is so much to explain, that writing it down would take me ages. Perhaps we could have an online catch up where we could discuss it "in person" with @mattermack https://github.com/mattermack and @mefellows https://github.com/mefellows?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-php/issues/29#issuecomment-390830114, or mute the thread https://github.com/notifications/unsubscribe-auth/AADSjKcycJ5XzSvsX3qRARS1-DjStMsBks5t02OSgaJpZM4Qv6GA .

-- Matt Fellows

  • http://www.onegeek.com.au/

-- Matt Fellows

  • http://www.onegeek.com.au/

mefellows avatar May 22 '18 08:05 mefellows

Added :)

On Tue, May 22, 2018 at 6:41 PM, Matt Fellows [email protected] wrote:

Here is the pact message consumer diagram:

  1. Test case sets up the interaction, and accepts a message consumer that should be able to handle the message
  2. Test case invokes Verify on the wrapper language
  3. Wrapper may optionally reach out to pact-message to reify the data structure back into its generated form (i.e. strip out all of the matchers etc.)
  4. Wrapper then invokes the message consumer
  5. If the consumer errors, it fails the test
  6. If the consumer passes, it calls pact-message update to save the pact.

I can add this to your repo if you like Beth?

On Tue, May 22, 2018 at 5:51 PM, Matt Fellows <[email protected]

wrote:

Would love to discuss this in "person" too :)

FWIW I've added some more notes to the original POC gist: https://gist.github.com/bethesque/c858e5c15649ae525ef0 cc5264b8477c#gistcomment-2596746

It's far from a guide, but hopefully will be handy.

On Tue, May 22, 2018 at 11:02 AM, Beth Skurrie [email protected] wrote:

@arkonchik https://github.com/arkonchik I've done a bit of a brain dump here: https://github.com/pact-foundation/pact-message-demo

But there is so much to explain, that writing it down would take me ages. Perhaps we could have an online catch up where we could discuss it "in person" with @mattermack https://github.com/mattermack and @mefellows https://github.com/mefellows?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-php/issues/29#issuecomment-390830114, or mute the thread https://github.com/notifications/unsubscribe-auth/AADSjKcycJ5XzSvsX3qRARS1-DjStMsBks5t02OSgaJpZM4Qv6GA .

-- Matt Fellows

  • http://www.onegeek.com.au/

-- Matt Fellows

  • http://www.onegeek.com.au/

-- Matt Fellows

  • http://www.onegeek.com.au/

mefellows avatar May 22 '18 08:05 mefellows

Yes, we can try to discuss online if my english level will enough.

arkonchik avatar May 23 '18 05:05 arkonchik

FYI, I started flushing out message support. Definitely WIP

https://github.com/pact-foundation/pact-php/tree/feat/message-pact

mattermack avatar Jun 29 '18 16:06 mattermack

nice! 👍

On Sat, Jun 30, 2018 at 2:00 AM, mattermack [email protected] wrote:

FYI, I started flushing out message support. Definitely WIP

https://github.com/pact-foundation/pact-php/tree/feat/message-pact

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-php/issues/29#issuecomment-401398643, or mute the thread https://github.com/notifications/unsubscribe-auth/AADSjGqZriEbFEbeTMyaPXQam3ZV9yEdks5uBk8JgaJpZM4Qv6GA .

-- Matt Fellows

  • http://www.onegeek.com.au/

mefellows avatar Jul 04 '18 10:07 mefellows

I have a first draft of the consumer pact creation leveraging pact-message ruby classes: https://github.com/pact-foundation/pact-php/tree/feat/message-pact

To follow up on:

  1. Currently only allows one message per pact - perhaps craft a listener to this somehow
  2. Research why pact-message is returning contents: null
  3. Implement provider side
  4. Update readme and create better examples from rabbit

@nbrink91, want to take a peek at the implementation? I need another set of eyes.

mattermack avatar Jul 06 '18 21:07 mattermack

Nice one @mattermack!

  1. Do you mean per pact file, or per "test case"? I haven't been able to think of a good use case where you would want to allow multiple messages in a test case.
  2. When is pact-message returning contents null - in reification?

On Sat, Jul 7, 2018 at 7:15 AM, mattermack [email protected] wrote:

I have a first draft of the consumer pact creation leveraging pact-message ruby classes: https://github.com/pact-foundation/pact-php/tree/feat/ message-pact

To follow up on:

  1. Currently only allows one message per pact - perhaps craft a listener to this somehow
  2. Research why pact-message is returning contents: null
  3. Implement provider side
  4. Update readme and create better examples from rabbit

@nbrink91 https://github.com/nbrink91, want to take a peek at the implementation? I need another set of eyes.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-php/issues/29#issuecomment-403148695, or mute the thread https://github.com/notifications/unsubscribe-auth/AADSjMX8iYOaJAuc9ML06mmonYquLe7Rks5uD9NVgaJpZM4Qv6GA .

-- Matt Fellows

  • http://www.onegeek.com.au/

mefellows avatar Jul 07 '18 03:07 mefellows

Ah, I see https://github.com/pact-foundation/pact-ruby-standalone/issues/20#issuecomment-403162767. Ignore #2. I do seem to remember getting this myself, but it was the content vs contents field problem, which seems to be correct glancing at your code.

mefellows avatar Jul 07 '18 03:07 mefellows

For #1, the way I have it written, if a consumer and provider pair shared more than one message, the entire pact would need to be written by a single phpunit class. I could see this being a hindrance.

On Fri, Jul 6, 2018, 10:25 PM Matt Fellows [email protected] wrote:

Ah, I see pact-foundation/pact-ruby-standalone#20 (comment) https://github.com/pact-foundation/pact-ruby-standalone/issues/20#issuecomment-403162767. Ignore #2 https://github.com/pact-foundation/pact-php/pull/2. I do seem to remember getting this myself, but it was the content vs contents field problem, which seems to be correct glancing at your code.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-php/issues/29#issuecomment-403184979, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZX6Ia5BUf-nh82v37eMeQ9_G_7Nft2ks5uECoegaJpZM4Qv6GA .

cfmack avatar Jul 07 '18 12:07 cfmack

Updated list of to-dos (because lists are fun to cross off)

  1. ~~Currently only allows one message per pact - perhaps craft a listener to this somehow~~
  2. ~~Research why pact-message is returning contents: null~~
  3. Implement provider side 3.1. ~~Implement provider proxy service~~ 3.2. ~~Attempt to move from Amp\Monolog in Provider implementation to Symphony's PSR log~~ 3.3. ~~Move much of the hard coded values to a config~~
  4. Create better examples from rabbit 4.0. Better example on metadata when publishing directly to a queue or an exchange 4.1. Multiple unit test functions in a single test case writing to the same consumer-provider pair 4.2. Multiple files with single unit test per test case writing to the same consumer-provider pair
  5. Update readme with better examples 5.1 Is there a better way of getting metadata about the queue/routing_key into the pact? The current examples stinks.

mattermack avatar Jul 11 '18 21:07 mattermack

After attempting React and spatie/async for days, I finally got Amp Async to work as all others appear to have limited Windows support for async processes.

mattermack avatar Jul 21 '18 00:07 mattermack

Update: at the Ruby version is at the appropriate mock level, where we do not fully support the entire Pact Specification 3 but do support Message implementations.

cfmack avatar Nov 09 '18 03:11 cfmack

!up

johnsnowderomania avatar May 28 '19 09:05 johnsnowderomania

@mattermack Is the todo list up to date? What is the top priority?

Thomblin avatar Jun 21 '19 16:06 Thomblin