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

neil
2018-03-28 22:17
has joined #pact-net

bethskurrie
2018-05-02 04:59
/github subscribe pact-foundation/pact-net issues releases pulls

bethskurrie
2018-05-02 04:59
/github subscribe pact-foundation/pact-net issues releases pulls

bethskurrie
2018-05-02 04:59
/github unsubscribe pact-foundation/pact-net deployments public commits

heymega
2018-06-02 13:58
has joined #pact-net

richard.peckett
2018-06-07 08:22
has joined #pact-net

gxsham
2018-06-15 12:09
has joined #pact-net

gxsham
2018-06-15 12:14
Hi, I have a problem with PactNet.Windows 2.3.0. Tests run perfectly on local machine but fail with this error on VSTS: ...pact-win32/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler.rb:418:in `[]=': Invalid argument - ruby_setenv(GEM_PATH) (Errno::EINVAL)

adamgreen
2018-06-15 13:57
has joined #pact-net

bethskurrie
2018-06-15 20:41
Hm. That's going to be tricky to fix. Is there such a think as a free open source VSTS account? Also, can you raise an issue in pact-foundation/pact-ruby-standalone if you haven't already. @gxsham

dsbenghe
2018-06-17 16:28
has joined #pact-net

gxsham
2018-06-18 08:11
Yes, you can create a free vsts account and use their agents for free, the only limit is the team size - up to 5 people

bethskurrie
2018-06-18 08:27
I can fix the underlying ruby code (it's packaged as a standalone executable) but I have no experience in dot net or VSTS - would you be able to create a VSTS build that recreates the issue @gxsham?

gxsham
2018-06-18 08:48
Yes, I will try today to do it today

richard.peckett
2018-06-18 14:32
is there a simple example of using a regex verify a provider response in http://pact.net?

bethskurrie
2018-06-18 23:20
@richard.peckett it should be the same as for a request.

bethskurrie
2018-06-18 23:21
Or are you asking in general about matchers?


neil
2018-06-19 00:19
Is that what you are after?

vk.regs
2018-06-19 06:51
has joined #pact-net


bethskurrie
2018-06-19 07:09
Nulls should just do an exact match. What error are you getting?

vk.regs
2018-06-19 07:34
@beth I got next error in pact logs: ERROR -- : No matching interaction found for PATCH /api/facets/export/data ERROR -- : Interaction diffs for that route: ERROR -- : Diff with interaction: "A request to get export data" Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown "body": { + "AnswerId": null, + "FileName": null

bethskurrie
2018-06-19 07:36
You have some extra fields in your request

bethskurrie
2018-06-19 07:37
You need to define them in your expectations

richard.peckett
2018-06-19 09:25
@neil thanks, I'm guessing that works exactly the same for the provider?

vk.regs
2018-06-19 09:27
I see in fiddler that request contains key "FileName" with null and I expect null value

vk.regs
2018-06-19 09:27
but pact return error when compare

bethskurrie
2018-06-19 09:29
Can you put the test code that you're executing, and the full logs into a gist please? There's not enough information to diagnose the issue from your explanation.


neil
2018-06-19 10:34
I?m not 100% sure what you mean? Do you mean when the provider verification runs against that pact file?

vk.regs
2018-06-19 12:53
@bethskurrie Do you mean project or only pact test?

bethskurrie
2018-06-20 05:05
Just the pact test and the full mock service logs for now. I should be able to see what's going on.

bethskurrie
2018-06-20 08:08
@vk.regs your fixture representing your expected request does not have a FileName in it ``` { "NonIncludedMetaFields": [ "ISESDOORGCIV", "ISESDOORGGR", "ISEORGCIV", "ISEORGGR", "ISEORGMIL" ], "ExportFormat": "XlsX", "DateTimeFormat": { "ShortDatePattern": "M/d/yyyy", "MonthYearPattern": "MMMM, yyyy", "ShortTimePattern": "h:mm tt", "TimeZoneOffset": -180 }, "BaseUri": "https://tewb.ihs.com/", "DisplayQuery": "laser" } ```

bethskurrie
2018-06-20 08:08
But your actual request does.

bethskurrie
2018-06-20 08:09
The error message you are getting is saying "you have FileName : null and AnswerId : null in your actual request, but you didn't declare them in your expected request"

vk.regs
2018-06-20 08:25
I specified FileName equal null in expected request directly

bethskurrie
2018-06-20 08:26
Well, it's not coming through ``` I, [2018-06-20T10:45:50.325316 #5672] INFO -- : Cleared interactions for example "" I, [2018-06-20T10:45:50.573464 #5672] INFO -- : Registered expected interaction PATCH /api/facets/export/data D, [2018-06-20T10:45:50.584464 #5672] DEBUG -- : { "description": "A request to get export facet data", "request": { "method": "patch", "path": "/api/facets/export/data", "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "ExportFormat": 3, "DateTimeFormat": { "ShortDatePattern": "M/d/yyyy", "MonthYearPattern": "MMMM, yyyy", "ShortTimePattern": "h:mm tt", "TimeZoneOffset": -180 }, "DisplayQuery": "laser", "BaseUri": "https://testapp.com/", "TestMode": false } }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "Format": 3 } } } ```

vk.regs
2018-06-20 08:27
looks like pact ignore null variables

bethskurrie
2018-06-20 08:27
No, it doesn't.

bethskurrie
2018-06-20 08:27
Unless something in .net is doing that.

bethskurrie
2018-06-20 08:27
@neil is it possible that keys with null values are not being written in the request?

neil
2018-06-20 08:29
Yeah that is quite possible

vk.regs
2018-06-20 08:29
As I understand one way to verify such request use Match.Type for each field

bethskurrie
2018-06-20 08:29
The log also says that it's getting an unexpected getting "+ "AnswerId": null," which I don't see anywhere in the code @vk.regs

vk.regs
2018-06-20 08:34
@bethskurrie I modified initial request to make it more simple

vk.regs
2018-06-20 08:45
As I understand one way to verify such request use Match.Type for each field?

bethskurrie
2018-06-20 09:47
@vk.regs can you create a git repository with an executable example that demonstrates your problem, and raise an issue in pact-net please? Or, fork pact-net and create a test case that demonstrates the problem. That way @neil can easily identify if there is a problem with the pact-net code.

vk.regs
2018-06-20 09:54
Thanks. But it hard because we use internal libraries and I never created GIT repository before. I will try later

bethskurrie
2018-06-20 10:02
Ok, how about forking pact-net, and creating a test case in this test to demonstrate your issue? https://github.com/pact-foundation/pact-net/blob/master/PactNet.Tests/Mocks/MockHttpService/MockProviderServiceTests.cs

neil
2018-06-21 08:32
@vk.regs This looks to be an issue with the way pact-net handle null values. I am publishing a fix now. Nuget package version 2.3.1 should fix this issue.

vk.regs
2018-06-21 08:32
@neil thanks

neil
2018-06-21 08:33
Should be released in the next 30mins or so

bethskurrie
2018-06-21 08:53
:+1:

borkke
2018-06-23 13:15
has joined #pact-net

borkke
2018-06-23 17:19
Hi everyone :wave: I have a question about provider side... If I understand correctly, I must have *up and running provider service* in order to run pact verification test. If that is correct, should I be running provider service on `Microsoft.AspNetCore.TestHost` or on full blown `kestrel` web server?

neil
2018-06-24 10:06
Hi @borkke. From memory there were issues talking out of proc (the ruby core, makes the HTTP call in v2) to the server running using TestHost. Worth testing to see if it works. But yeah I?d recommend using the full web server. You can see https://github.com/pact-foundation/pact-net/blob/master/Samples/EventApi/Provider.Api.Web.Tests/EventAPITests.cs for an example. It doesn?t use Kestrel though.

borkke
2018-06-24 15:24
Thanks @neil.. in that case, do you know is it possible to run pact verification tests in CI server, against provider service which is running inside a build context?

borkke
2018-06-24 15:25
From all documentation I found, it seems like I need to make sure to have up and running provider service, and that makes me think I have to have some "testing" environment where I first have to deploy my service provider and run pact verification (this kind of goes against my understanding of the purpose of contract testing :thinking_face:)

neil
2018-06-24 15:33
Nah no need for a seperate test environment, you just need to start the webserver via the test suite on the CI/build agent that runs the tests

neil
2018-06-24 15:34
In the example project inside the pact-net repo we do this. We use AppVeyor to run the CI process for pact-net itself, and the sample project tests are run as part of this.

borkke
2018-06-24 15:35
That's really good news.. I was hoping to hear that

borkke
2018-06-24 15:37
Thanks again!

vk.regs
2018-07-03 15:45
Could somebody help me to understand what such warning mean in provider test that failed on array verification WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body']['Items']

matt.fellows
2018-07-08 09:40
has joined #pact-net

iain.olliver
2018-07-24 10:48
has joined #pact-net

antonios.klimis
2018-08-08 09:43
has joined #pact-net

tmok01
2018-08-22 21:52
has joined #pact-net

tmok01
2018-08-22 21:53
hey all - does there exist an equivalent .net version of the can-i-deploy feature (which checks the matrix to determine whether things can be deployed)?

neil
2018-08-23 00:24
@tmok01 Nah there is nothing in the .NET version that does that at this stage

komalahluwalia06
2018-08-23 07:23
has joined #pact-net

richarddalziel
2018-08-25 18:28
has joined #pact-net

raido.letterbox
2018-08-30 09:58
has joined #pact-net

raido.letterbox
2018-08-30 10:29
Hi all, I am trying to write consumer tests with pact for dotnet core. After enabling SSL for MockProviderService the test fails with "System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure". I've seen in the documentation that it is recommended to ignore certificate validation errors globally due to a self signed certificate, but HTTP client for MockProviderService initializes inside the pact lib, so the only way I have currently found to make it work is to add handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true; directly into the pact-net AdminHttpClient constructor. It also required changing type of handler parameter from HttpMessageHandler to HttpClientHandler and switching target framework to .net standard only, as .net framework doesn't have ServerCertificateCustomValidationCallback method for HttpClientHandler. Can anyone please tell, is there any simpler way to get SSL connection working in dotnet core project?

neil
2018-08-31 12:33
Hi @raido.letterbox. I?m not too sure what?s involved in getting it working on .NET core TBH, I haven?t been doing much .NET lately. In standard .NET there is a global config via ServicePointManager which should work, however I?m not sure the same exists in core.

neil
2018-08-31 12:38
Probably the correct way to sort this is to allow a custom cert and key to be specified, so there are no SSL validation issues. The pact ruby core already supports this, I just haven?t passed those options through as it will need some testing and doco.

raido.letterbox
2018-08-31 15:18
Hi Neil. Thanks for the reply. I have tried ServicePointManager, but it doesn't seem to work in core :disappointed: As for the custom cert - not sure that I understood correctly - is this feature planned to be added to pact-net after the testing?

ngbrown
2018-09-02 16:19
has joined #pact-net

neil
2018-09-02 23:42
Damn, that?s a pain. The idea was that Pact-Net would support the custom cert, however I just haven?t gotten around to it yet.

mattgilbert90
2018-09-10 12:48
has joined #pact-net

antonios.klimis
2018-09-11 13:53
Hello! I have a silly question (probably my noobness) but I don't understand why I need a Platform Specific core engine. ex. PactNet.Windows

neil
2018-09-11 23:40
@antonios.klimis Hey! Good question. PactNet wraps the ruby standalone core, and that has platform specific packages (and each package is quite big). If it was just .NET, we wouldn?t need seperate packages.

antonios.klimis
2018-09-12 09:23
Thank you @neil! When I want to test it in a Linux environment how do I handle that? I use http://asp.net core within Linux containers. Out of curiosity, will that ruby core sometime with be port to .net ?

neil
2018-09-12 09:25
You can install more than one platform specific package. PactNet will load the correct package depending on the runtime environment.

antonios.klimis
2018-09-12 09:25
Nice!

neil
2018-09-12 09:26
We originally had a native .NET implementation, however moved to using the shared ruby core as it makes supporting new features more consistent across all the Pact language implementations.

neil
2018-09-12 09:27
Ideally we want to move to using the rust core, as it should be a lot lighter weight

antonios.klimis
2018-09-12 09:30
Alright! I'm very keen to contribute. Where do you think is the right place to start? (Maybe that's not the right channel to ask (?))

neil
2018-09-12 09:34
Awesome!

neil
2018-09-12 09:35
Probably the best place is to checkout the issues on GH and see if any of those interest you

neil
2018-09-12 09:36
I?m just about to add another issue to add support for custom SSL certs (based on a conversation above in this thread)

antonios.klimis
2018-09-12 09:38
Ok, I'll have a look when you add the issue. In the mid-time I will clone the repo. :slightly_smiling_face:

neil
2018-09-12 09:38
Yep good idea :smile:

neil
2018-09-12 09:49
I?ll probably add it later tonight (Perth time), as I need a bit more headspace to write it out in a coherent manner :smile:

antonios.klimis
2018-09-12 09:58
No worries! I need my time having a look around. You are 5 hours ahead Greek time.


raido.letterbox
2018-09-13 08:42
Hi. I have been browsing through pact-net workshop and found there a mention of _mockProviderService.VerifyInteractions() method which is not present in .net Core workshop. According to the comment, it verifies that interactions registered on the mock provider are called only once. I have tried to intentionally make the same request twice in the test with this method, but the test didn't fail. (My test project targets .net Core) Can somebody please tell, what exactly does this method check, maybe I have misunderstood the concept?

neil
2018-09-13 09:00
@raido.letterbox Sorry for the confusion. Before we moved to using the ruby shared core, it would validate exactly once. Now with the ruby core it validate on an at least once basis.

neil
2018-09-13 09:01
But your understanding is correct, it validates that the interactions you have registered on the mock provider service have been called from your test.

neil
2018-09-13 09:04
I have just updated the Readme

raido.letterbox
2018-09-13 09:30
Thank you!

schalkt
2018-09-18 13:24
has joined #pact-net

wilson.mahann
2018-09-20 14:25
has joined #pact-net

vikassd2012
2018-09-29 05:29
has joined #pact-net

vikassd2012
2018-09-29 05:30
@neil Beth suggested to seek your help on this question https://github.com/seek-oss/seek.automation.stub/issues/11

vikassd2012
2018-09-29 05:30
If you can provide an example it will be great

neil
2018-09-30 23:41
Hi @vikassd2012. Will have to look into that library and get back to you

vikassd2012
2018-10-01 04:58
Thanks @neil :+1:

richard.peckett
2018-10-01 12:49
peeps I can't seem to get more than one interaction on my pact file, it's always taking the last test that ran and uses that as the sole interaction on the file what am I doing wrong?

neil
2018-10-02 09:31
Are you creating a new instances of the mock provider service for each test?

neil
2018-10-02 09:31
It should be shared between tests

richard.peckett
2018-10-02 13:04
Yeah, sorted this now it was the way I was using XUnit, switched to NUnit as it works better for the way I'm structuring my code, cheers Neil.

neil
2018-10-02 13:19
:thumbsup: Awesome. Sorry for the late reply

fraser.crichton.devel
2018-10-04 23:22
has joined #pact-net

heymega
2018-10-06 13:24
Hi I'm currently looking at v3 of the Pact Specification as part of a re-architecture at my place of work as this is heavily based on Event-Driven Architecture and messaging. I noticed that v3 hasn't been implemented yet for .Net and wondered what the current state of this is (You've probably had this asked a number of times so I apologise in advance)? The reason I ask is that myself and a couple of colleagues have been discussing the possibility of implementing v3 ourselves and was wondering... 1. Is the v3 specification complete? 2. Has the development of v3 .net implementation started yet? 3. How can I and my colleagues get involved in developing/starting this? New repository? 4. Would the community be interested in a .Net version of the Pact broker?

neil
2018-10-09 09:21
Hi @heymega. 1. I?m not sure it is complete, however it is a state where it could be used 2. No work has been done to get v3 into .NET yet 3. Your best bet is to take a look at https://github.com/pact-foundation/pact-net/issues/162 and get a feel for what is required. From there you can fork the repo and go from there. 4. I personally don?t think there would be a huge amount of value here. It would be a lot of work to get feature parity with the ruby one.

neil
2018-10-09 23:05
@raido.letterbox Support for custom SSL certs has been added in `2.4.3`

heymega
2018-10-15 08:37
@neil - I'm looking at the version 2 implementation of the `IPactProvider.ServiceProvider` and notices that you can no longer pass in your own `HttpClient` and I believe you could in version 1. What was the reasoning behind this? I thought it was quite useful being able to pass in a `HttpClient` as part of the `TestServer`.

antonios.klimis
2018-10-15 09:22
Is any example publishing to pact-broker for .net?

heymega
2018-10-15 09:24
@antonios.klimis Check out the Github Repository... https://github.com/pact-foundation/pact-net#publishing-pacts-to-a-broker

antonios.klimis
2018-10-15 09:24
Thx @heymega

neil
2018-10-15 12:37
@heymega Yeah that was a nice feature, however unfortunately when we moved to using the ruby standalone core we had to get rid of it as the ruby process takes care of sending the http requests.

neil
2018-10-15 12:39
Unfortunately that was one of the tradeoffs for getting version 2 support

heymega
2018-10-15 13:23
Ahh that's a shame. We've can't run them on cloud agents in Azure Devops (vsts) as part of our build pipeline and have seen port clashes :disappointed:

antonios.klimis
2018-10-22 11:39
Any strategy on how to output the whole error stack on state setup stage? At the moment I get `Failure/Error: set_up_provider_state interaction.provider_state, options[:consumer]` which is not very helpful.

thirumal.net
2018-10-24 17:50
has joined #pact-net

neil
2018-10-25 23:17
Hey @antonios.klimis. Did this error occur when running a verification? What were the provider state details of the pact file?

aaronmckaynz
2018-11-07 03:46
has joined #pact-net

thirumal.net
2018-11-27 21:50
can any one help me how to run can-i-deploy script ? i have downloaded the zip file and running the below command in my bash but i am getting error, what i am doing wrong *https://github.com/pact-foundation/pact_broker-client#can-i-deploy* my plan was to run can-i-deploy from C# code but before that i am running through curl but facing issue, any help is appreciated curl pact-broker.bat can-i-deploy --pacticipant clientpact --version 1.0.1.6 --broker-base-url http://devas.company.com

neil
2018-11-27 23:42
@thirumal.net I don?t think you want to run `curl pact-broker.bat`, it should probably just be `pact-broker.bat`

thirumal.net
2018-11-27 23:47
@neil - Thank you very much for your reply. i am able to run. just want to say thanks again for your valuable time for adding code in .net for pactNet which i am using for my proof of concepts

neil
2018-11-27 23:57
No problems. Thanks for your comment!

thirumal.net
2018-12-05 00:31
*How to Add Provider Side Tag to Pact Broker* ? i am able to run the provider verification successfully and publish the result to pact broker but not sure how to attach tag to pact broker from provider side ?

neil
2018-12-05 08:51
I don?t think you can. AFAIK you push a tag from a consumer PoV which is attached to the version. This question might be better in #pact-broker though

thirumal.net
2018-12-05 21:09
Thank you @neil

ittennull
2018-12-09 07:12
has joined #pact-net

ittennull
2018-12-09 07:14
Hi what's your thoughts, plans and timeline on creating new .net core implementation of pact free of ruby stuff? I'm currently working on such a thing and wondering if I should continue

bethskurrie
2018-12-09 08:33
We encourage people to get involved in using the FFI bindings from the rust implementation, rather than rolling your own.

bethskurrie
2018-12-09 08:33
Trying to keep multiple impls in line and rolling out features is very difficult otherwise.

ittennull
2018-12-09 09:58
but is rust implementation fully ready?

ittennull
2018-12-09 10:02
Do you have plans to make new .net implementation yourself? Maybe you are already 1 step from finishing it and it doesn't make sense for me to do anything

neil
2018-12-10 00:24
As Beth said, we would like to move to the rust impl using FFI bindings. The .NET repo previously had a native implementation, but it was a pain keep feature parity with the other Pact libraries, so we moved to the shared ruby core.

neil
2018-12-10 00:26
We haven?t done any work moving to rust, so if you?d like to take charge of moving from the ruby core to rust, that would be awesome! As far as I know the rust core is ready to go.

s.umair.riaz
2018-12-10 05:01
has joined #pact-net

ittennull
2018-12-10 07:18
Thanks Neil, good to know. I'll take a look what I can do with it.

s.umair.riaz
2018-12-11 23:34
hi guys, has anyone tried storing the pact file in the azure blob so that provider can read from there?

neil
2018-12-12 02:14
I personally haven?t tried it however, it?s definitely possible. You?d probably need to write some code to download the file locally and then just pass the verifier that path to the local file.

tghcastro
2018-12-12 12:44
has joined #pact-net

mcon
2018-12-13 08:29
has joined #pact-net

serikch
2019-01-07 08:58
has joined #pact-net

bart.schotten
2019-02-07 14:20
has joined #pact-net

martin.hock
2019-02-07 14:38
has joined #pact-net

thirumal.net
2019-02-11 22:01
please refer this link, it might help since we can't generate pact files for multiple providers at same time


neil
2019-02-11 22:05
You can?t generate multiple pact files using the same provider mock, however you can run multiple provider mocks at the same time to generate multiple pact files. The only caveat is that they need to run on the different ports.

vikassd2012
2019-02-18 04:53
Hi there I had a question on the actual writing of the consumer side tests

vikassd2012
2019-02-18 04:55
Following the examples I implemented few tests in the format as described in the samples here


vikassd2012
2019-02-18 04:56
where we describe our expectation from the Producer service in the form like this

vikassd2012
2019-02-18 04:57
this api here doesn't have lot of properties, but in case if we have do

vikassd2012
2019-02-18 04:58
I found myself looking at the producer service's sdk

vikassd2012
2019-02-18 04:58
and actually got tempted to use the sdk models instead of defining them by hand here

vikassd2012
2019-02-18 04:58
is there a recommendation or catch to use this approach?

bethskurrie
2019-02-18 04:59
You can try it - what might bite you is that sometimes a domain model doesn't map exactly to the JSON.

bethskurrie
2019-02-18 05:00
Also, you'd be adding in attributes you don't necessarily care about. For contract testing to work at it's best, the consumer only defines what they care about.

bethskurrie
2019-02-18 05:00
This means that unused fields are free to change, and the provider knows who is using them.

vikassd2012
2019-02-18 05:00
yes that is one key difference

vikassd2012
2019-02-18 05:01
thanks Beth as always for your prompt help and response on my queries

bethskurrie
2019-02-18 05:01
:thumbsup::skin-tone-3:

vikassd2012
2019-02-18 05:02
Can I ask you one more question? :slightly_smiling_face: I was looking for pactnet examples, is this still the best resource https://github.com/pact-foundation/pact-net

vikassd2012
2019-02-18 05:02
or are there any other resources that we can refer?

vikassd2012
2019-02-18 05:02
I actually remember reading about using some format in order to deal with date fields which are auto generated, but I couldn't find it in above examples

bethskurrie
2019-02-18 05:03
I'm not the the pact-net maintainer, so I'm not sure.

bethskurrie
2019-02-18 05:03
@neil may be able to help you.

bethskurrie
2019-02-18 05:03
Are you talking about matchers?

vikassd2012
2019-02-18 05:03
Thanks Beth I will ping him.

bethskurrie
2019-02-18 05:03
Please don't PM him! He'll see this here.

vikassd2012
2019-02-18 05:04
oh I see.

vikassd2012
2019-02-18 05:04
Yes I happened to run into a consumer side test that involves dates and I was looking for example how producer side tests will match the dates where they are autogenerated on the producer side

vikassd2012
2019-02-18 05:06
Actually thanks for pointing to the right term I should have been searching for "matcher" I can now look it up better

bethskurrie
2019-02-18 05:06
:thumbsup::skin-tone-3:

vikassd2012
2019-02-18 05:06
I will try that but in the mean time @neil if you have a good resource please let me know

vikassd2012
2019-02-18 05:07
Thanks Beth as always!

neil
2019-02-18 05:32
@vikassd2012 The readme just contains a simple example. Probably best to have a look at the samples in the repo for a more complete example. Is this what you are after? https://github.com/pact-foundation/pact-net/blob/master/Samples/EventApi/Consumer.Tests/EventsApiConsumerTests.cs#L290

vikassd2012
2019-02-18 05:51
Hey @neil thanks for the example, this is exactly what I was looking for. Sorry I missed it earlier.

sthan
2019-02-26 23:53
has joined #pact-net

sthan
2019-02-26 23:55
Hi. I am new to contract testing and trying to create a POC for our http://ASP.NET WebApi application. I've been following the code example in your PactNet repo. I've been able to create working Consumer tests, but I'm having a bit of trouble creating the Provider test. We have a Global.asax.cs which starts the Provider application like this: public class WebApiApplication : System.Web.HttpApplication { protected void Application_Start() { Common.NetworkingHelper.ConfigHttpTlsLevel(); DependencyConfig.Configure(GlobalConfiguration.Configuration); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalConfiguration.Configuration.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); GlobalConfiguration.Configuration.Formatters.Add(new System.Net.Http.Formatting.XmlMediaTypeFormatter()); } } But the example code in PactNet uses OWIN Hosting to start the application. I'm not sure how to reconcide the difference. Can you provide some helpful documentation that will help. An example code would also be very useful.

neil
2019-02-27 00:35
Hi @sthan. Unfortunately I don?t have any examples. The trick is that you need a way to start/run your web api programatically, once you have that hook, you should be able to get the Pact provider tests working. I?m assuming you run your app in IIS. Maybe there is a way to programatically trigger your api to run in IISExpress or something like that?

bockus
2019-02-27 03:00
has joined #pact-net

bockus
2019-02-27 03:05
I'm trying to hunt down some info on how to test a provider that is implemented as a webhook, but my google-fu is struggling and I haven't been able to find any info that isn't related to configuring webhooks in the pact-broker. The provider that I'm trying to test is a webhook. I would like to define a pact that expects an initial response for a given request from the consumer, but then also expects a callback from the provider that we're testing. Is testing webhooks possible with Pact, or is there some way to accomplish the test with multiple tools?

neil
2019-02-27 03:37
@bockus Yep it?s possible, basically your provider becomes a consumer for the webhook callback part. So effectively both parties in the interaction are consumers and providers. Does that make sense?

neil
2019-02-27 03:38
You then end up with two seperate pacts

bockus
2019-02-28 17:11
ah, thanks @neil. Is there a way to tie those two pacts together as a type of sequence or something. I'm just wondering how I would verify that the consumer turned provider is receiving a callback as part of the initial test for the webhook.

sthan
2019-02-28 21:23
I solved this problem by copying the Dependency registration inside the OWIN's TestStartup. Something like this: public void Configuration(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); DependencyConfig.Configure(config); WebApiConfig.Register(config); FilterConfig.RegisterGlobalFilters(config); RouteConfig.RegisterRoutes(RouteTable.Routes); GlobalConfiguration.Configuration.Formatters.Add(new System.Net.Http.Formatting.XmlMediaTypeFormatter()); app.UseWebApi(config); }

neil
2019-02-28 23:51
Nah there isn?t any way to tie them together. Without full context about your use case, it?s tricky to give advice, however I don?t really think that kind of sequencing should be part of the contract test.

sthan
2019-03-06 00:15
All the examples I've seen so far is where the Consumer creates a test that specifies the validity of the RESPONSE contract. The Provider runs the test to validate that assumption made by the Consumer. But when the Consumer makes a POST call where it sends some body in the REQUEST. How do I verify that body also conforms to to the contract? If you can point me to the right document, or example code, I would appreciate it.

neil
2019-03-06 04:45
Here?s an example for the POST scenario https://github.com/pact-foundation/pact-net/blob/master/Samples/EventApi/Consumer.Tests/EventsApiConsumerTests.cs#L125 Basically the provider test will send the exact POST request (with the body) at your provider and presumably if your provider did not understand the request body or it was incorrect, then it would return a response (maybe a 400 status) to indicate this to the consumer (and fail the Pact provider verification).

sthan
2019-03-06 17:25
@neil Thanks for the reply. But perhaps, I should have been more specific with my question. What I'm trying to verify is the details of the contract sent to the provider. In the example, you sent me, POST call is made with request body with fields: eventid, timestampe, and eventType. Let's say that the only valid value for the eventType was "DetailsView" and "ListView". If this was a GET RESPONSE, we could do something like this in Consumer Test: eventType = Match.Regex("DetailsView", "(DetailsView|ListView)") But this is a POST REQUEST. I'm not sure how we can do this. My best guess is: In Provider test, we ask for the request body from IPactVerifier and examine the eventType to make sure it conforms to the regex. But looking at IPactVerifier, I don't see a way to get the request body. So, I was wondering if there was another way to get that data or if there is some other mechanism in place to verify this.

bockus
2019-03-06 21:07
I'm trying to write a test for a provider that takes an image file in the body of a POST request, but I'm struggling to get that pact generated with the mock service. @neil, are you aware of any examples that build a ProviderServiceRequest with multipart/form-data content? This curl request is an example of the type of request I'm trying to test: `curl -X POST "https://example.com/save/file" -H "accept: application/octet-stream" -H "Content-Type: multipart/form-data" -F "fileToSave=@image.TIF;type=image/tiff"`

neil
2019-03-07 02:37
Nah I don?t have an example for this. Traditionally we only support JSON, however if the ruby standalone support it we could support it as well.

neil
2019-03-07 03:32
@bethskurrie Is this supported in the ruby standalone?

bethskurrie
2019-03-07 03:32
I can't remember!

bethskurrie
2019-03-07 03:33
I remember doing something for it. Let me have a look.


bethskurrie
2019-03-07 03:36
So, yes. It's a bit inelegant, but it works.

bethskurrie
2019-03-07 03:36
You need to use matchers on the headers because the boundaries will be dynamically generated.

bethskurrie
2019-03-07 03:39
if you follow the same pattern using the .net dsl, it should Just Work TM.

bethskurrie
2019-03-07 03:40
There's some in built logic to detect the dynamic form boundaries in the body, and do the matching so that your expected data will match your actual data even though the boundaries are different.

neil
2019-03-07 03:46
Thanks @bethskurrie!

neil
2019-03-07 03:55
You can use the matchers in the request bodies as well, so in the case of `eventType` like the example, you could do `eventType = Match.Regex("DetailsView", "(DetailsView|ListView)")`. What this would do is ensure that the consumer code only sends a request with eventType set to `DetailsView` or `ListView`. If it sent a request with eventType set to `Blah`, the request would not match any registered interactions in the mock provider, and the consumer test would fail.

neil
2019-03-07 03:57
Is this what you are after?

bockus
2019-03-07 22:40
Thanks for your help @bethskurrie and @neil! I was able to make some progress by building the body of the expected request like you did in the linked example. Since the data being sent is an image, I'm hitting the same encoding error mentioned here: https://github.com/pact-foundation/pact-python/issues/97. Any ideas on how to work around that if I still want the provider to verify a pact where the request payload includes the bytes of an image?

sthan
2019-03-07 23:18
@neil. Thanks again for the response. However, the solution you mentioned was a bit unexpected. My original question was based on an assumption I had in my head: Whoever receives the data (contract) is the one who is coming up with the validation logic (eg: Match.Regex(?DetailsView?, ?(DetailsView|ListView)?)). In a standard GET request, the Consumer receives data from the Provider. So it makes sense that the Consumer comes up with the validation logic and Provider provides the data to be validated. But in a POST request, the Consumer provides the data and Provider receives the data. Which means that Provider has to come up with the validation logic. Bottom line is this: As a Provider I want to make sure that the Consumer is sending me the right type of data (in the correct format) in a POST request. In your last example, Consumer is the one coming up with both the data and the validation logic. This was the reason why I asked if it was possible to get the Request body from the PactVerifier so that I can verify the data and format on the Provider side.

neil
2019-03-08 02:17
This is hard to answer as I don?t know your exact scenario. It?s probably better to think of it as: on the consumer side setting up a mock of the provider. You want to emulate what the consumer actually can send, and how the provider responds in those circumstances. If you?re testing a scenario that is generally not possible for the consumer to send, then my example above is the right approach. This makes sense if you?re just trying to check regression, for example if someone renames one of the `eventType` values. Suddenly your mock provider (which emulates your real provider) won?t be able to respond.

neil
2019-03-08 02:20
However if it?s completely valid for your consumer to send any `eventType` value, and it?s up to the provider to tell the consumer when the request is valid, then it should be a different approach. Your provider should return a response which indicates why the request is invalid, which can be verified in the response part of the consumer side of the contract.

neil
2019-03-08 02:22
In this case the provider is coming up with the validation logic, however the validation logic lives in your actual prod deployed provider code.

neil
2019-03-08 02:27
To directly answer > Bottom line is this: As a Provider I want to make sure that the Consumer is sending me the right type of data (in the correct format) in a POST request This logic should actually live in your provider, irrespective of Pact or not. If a consumer is calling you with the wrong type of data (in the incorrect format), you should tell them that by sending a response that is not 2xx, for example a 400 Bad Request.

bart.schotten
2019-03-14 12:29
If I wanted to contribute to pact-net, especially when it comes to support for the pact spec 3.0, how would I go about that?

neil
2019-03-14 12:53
Which part of the v3 spec are you interested in?

neil
2019-03-14 12:53
The first part of v3 spec we are trying to get in is Pact Message support. You can have a look at the PR comments https://github.com/pact-foundation/pact-net/pull/175 and https://github.com/pact-foundation/pact-net/issues/162. The PR is a placeholder and we are actually working on the `message-pact` branch. There is a TODO.txt file in the root of that branch, which has roughly what?s remaining. Help with any of those items would be great.

neil
2019-03-14 12:54
Alternatively it would be good to work out what is additionally required to get full v3 support after pact message is merged in.

bart.schotten
2019-03-14 13:13
Some background: I'm currently working on a big project where we want to test the interactions between multiple .net and java services with contracts (both http and message based). For this project it would be great I we could get pact-net fully compatible with pact-jvm as soon as possible. I'll start by looking at the TODO.

sthan
2019-03-15 16:00
@neil Sorry for the late response. I've been putting out fires at work (not literally). But your last point makes total sense. The provider application should be responding with appropriate error message appropriate to the incorrect data in the POST request. Thanks for clearing things up.

jmcknight
2019-03-19 04:04
has joined #pact-net

franklin.huynh
2019-04-01 03:23
has joined #pact-net

david.edwards
2019-04-12 12:32
has joined #pact-net

slack1949
2019-04-15 08:25
has joined #pact-net

iruben91
2019-04-17 14:17
has joined #pact-net

franklin.huynh
2019-05-01 00:59
Hi, do you have any example on how to write provider test for aws lambda service? I found this page but it is only for consumer test https://dius.com.au/2018/10/01/contract-testing-serverless-and-asynchronous-applications-part-2/

mcon
2019-05-02 11:23
Hi Franklin, I think the pact message functionality for .net is still on a branch as it's not complete.

joostvanwollingen
2019-05-02 11:47
has joined #pact-net

neil
2019-05-03 07:07
Yeah the pact message code currently lives on the `message-pact` branch

franklin.huynh
2019-05-06 04:17
I see. Thanks @matt.fellows and @neil

james.prescott
2019-05-09 09:10
has joined #pact-net

brwhaley
2019-05-11 01:27
has joined #pact-net

blyman
2019-05-14 19:02
has joined #pact-net

tyoder
2019-05-14 19:40
has joined #pact-net

gordon.barrs
2019-05-20 12:08
has joined #pact-net

gordon.barrs
2019-05-20 12:19
Hi, we are trying to run a pact verification against a response whose content is `text/csv`. We are getting an encoding error: Encoding::UndefinedConversionError: "\xC3" from ASCII-8BIT to UTF-8 Is csv content supported by pact-net or it it only json and form data that is supported?

neil
2019-05-21 00:26
To be honest, I have never tried with `text/csv`. I probably depends on if the ruby standalone supports it, which I am not sure.

neil
2019-05-21 00:27
@bethskurrie Do you know if the ruby standalone supports `text/csv`?

rune
2019-05-21 12:27
has joined #pact-net

rune
2019-05-21 12:28
Hi, I'm trying to work out a simple pact against a logging API. I's a REST API the I'm suppose to be able to POST a string value. I'm able to do it from already running application and in postman, but for some reason it want do it in pact using this interaction description. I'm receiving a response status 400.

neil
2019-05-21 13:26
I?m not sure if this is why, but it appears you are marking the request body as `application/json` and sending a plain text non json body.

dperez
2019-05-30 04:28
has joined #pact-net

dperez
2019-06-03 04:01
hi, I understand in PactJS 6.x.x there is something called GraphQLInteraction to help creating the expectations when trying to perform contract testing against a GraphQL endpoint. I'm kind of new with the whole Contract Testing topic so excuse me if I'm asking trivial or "already answered" questions. But I'm trying to perform the same on our .Net environment but haven't found an example as clear as I found it here http://blog.pact.io/2018/07/24/contract-testing-a-graphql-api/ Will really appreciate any guidance on this, I find my self in loops of readings saying it is possible with the current PactNet but without an example I could adapt to our environment. Thanks.

neil
2019-06-03 04:34
@dperez Hey. That?s new to me about PactJS. Nah the .NET implementation does not have any graphql interaction DSL.

neil
2019-06-03 04:35
As the article mentions though, you could construct a GraphQL request using the standard DSL. You?d just need to know the exact JSON that GraphQL is sending and replicate it.

dperez
2019-06-03 13:37
@neil thanks for the reply. Will use the standard DSL then. Regards.

iruben91
2019-06-13 09:39
Hello, I was asking a couple of months ago about message support in pact-net. It's a requirement in my company for the adoption of Pact for our .NET Core microservices and I wanted to how the development on it was going, and if any help was needed.

bethskurrie
2019-06-13 09:43
I believe someone is working on it at the moment.

bethskurrie
2019-06-13 09:43
Have a look at the PRs in the pact net repo.

iruben91
2019-06-13 09:46
There is an old December one still open about this, but I understand the work is currently being done outside of it in a separate branch.

bethskurrie
2019-06-13 09:49
@neil do you knoe what the current status is of the Pact net message impl? I thought I saw some discussion on it recently. More recently than December.

taranovskyi.anton
2019-06-13 09:54
has joined #pact-net

neil
2019-06-13 12:27
Yeah some people are using it from the `message-pact` branch and fixing some issues that are arising. There is a TODO.txt file with the known remaining bits. @iruben91 Feel free to take a look at that and see if there is anything you want to help with. I haven?t had any time lately to tick these off, house renos are taking up all my free time.

neil
2019-06-13 12:27
If the current pact-message branch does what you need, you can build your own package from that branch.


anna.lakstigala
2019-06-13 12:39
has joined #pact-net

neonmd
2019-06-14 09:42
has joined #pact-net

taranovskyi.anton
2019-06-19 09:16
hey guys, please, review pr above ^^ thanks

adamgreen
2019-06-21 09:45
Hi all, was wondering if anyone has any advice on how best to handle the PactNet.<OS> nuget packages depending on the target environment a build pipeline might be using eg Ubuntu for a Docker build pipeline or Windows when running locally etc Looked into condition nuget package references but that seems to be configurable only for the solution config. Thank you in advance

neil
2019-06-21 12:53
You can install both in your project and PactNet will pick which one it needs to use at runtime

mui_ume
2019-06-27 03:07
has joined #pact-net

mui_ume
2019-06-27 03:11
Hi guys, can I have a simple example for provider in C#?


mui_ume
2019-06-27 09:20
thanks

mui_ume
2019-07-05 05:53
Hi Neil, does it show how to publish the pact file to the pact broker?


dperez
2019-07-06 19:17
hi all, first at all, thanks for being so open and collaborative to questions in this channel. And sorry for the long post but I need to explain our code base the best I can, this is particularly about the message-pact branch. Now, we started playing with the message-pact branch about a month ago, and I know this is work in progress which I would love to collaborate back with our findings so far. But before that, I want to make sure I understand the "concepts" behind this branch. Currently we have microservices grouped by domains. We version our services by domain, not by single available operation inside the domain. We deliver a nuget package to our producers like: Builder.Microservices.1.0.0.0.nupkg containing all the possible messages the domain is expected to receive (among other commodity methods to interact with our messaging bus). If one of those message changes then a new package is created. (I know, not the best but a long history) So I want to test all the interactions *with my domain*. Some notes: a) Isn't an open public microservice, we know by hand who are our message producers. b) We use widely in our projects BDD, in this case SpecFlow. Just as a side note that might affect design decisions. With all that mind, 1. On the microservice consumer side I want to create a contract for *each producer* (is this correct?) 2. I have the following expected messages: CreateCorporation, CreateBrand, CreateDivision. Will all the expected messages be part of a single pact file? Or each needs to have it's own pact file? I was expecting to have all the possible messages of my domain in one single file per producer.

neil
2019-07-08 03:12
Hi @dperez I haven?t personally tried with SpecFlow, but there shouldn?t be anything technically stopping that from working. 1. You create a contract (Pact file) for each consumer/producer pair. 2. Same as above, you?ll likely want a contract for each consumers usage of those produced events. For example one consumer might only use a single field in CreateCorporation and not consume the CreateBrand event at all, so the contract for that consumer/producer pair would only contain the used fields and events.

dperez
2019-07-09 20:16
Hi @neil Thanks for the reply. The issue we are having now, is how to create some kind of protection from the Consumer side by the time of updating a contract to know before hand what producers we are affecting. Just uploading a new contract to the broker isn't enough since each producer must run their tests against the new contract to notify the broker if it passed or not. We had the idea that the broker worked in a different way, basically that the producers upload their side of the history (their version of the contract) and the broker performed a comparison based on that. Without running each producer tests is there some way to figure out if a producer that is compatible with my version 1.0.0 will be also compatible with the new version 2.0.0 I haven't even released?

neil
2019-07-10 03:35
I think I have understood the problem, however I?m not 100% sure. An event consumer can only use data that is made available by an event producer. If a consumer decides it needs something new, it?s their job to negotiate this with the producer team. Pact doesn?t remove the need for documenting and communication between teams. If there was some communication breakdown and the event consumers started using a field the producer had not made available, then the producers verification build should fail. The broker has a webhook feature which allows it to send a http request to a predetermined endpoint whenever a new consumer contract is pushed. This can be used to trigger the producer verification automatically. Once both the consumer and producer verifications pass, then the change can be deployed. If it fails, it generally signals that a conversation hasn?t happened. This is also worth having a read https://dius.com.au/2017/09/22/contract-testing-serverless-and-asynchronous-applications/

dperez
2019-07-10 04:13
Thanks a lot. This is a really good reading, and the point about the webhooks I think is the missing piece we were looking for.

neil
2019-07-10 04:24
Nice one!

mui_ume
2019-07-11 09:41
Hi in pact-js, there is an github example to show how to use Match based on arrays?

mui_ume
2019-07-11 09:41
is there one for http://pact.net?

adamgreen
2019-07-11 11:06
@mui_ume Looks like the MinType matcher will work https://github.com/pact-foundation/pact-net/blob/message-pact/PactNet/Matchers/Type/MinTypeMatcher.cs Seems to do the eachLike() ArrayLike reg ex type from what I can tell

neil
2019-07-11 11:07
Yep that?s the one you want

neil
2019-07-11 11:07
There isn?t an explicit example of that matcher in the samples, but it does have other matchers. Match.Type is the closest to Match.MinType https://github.com/pact-foundation/pact-net/blob/master/Samples/EventApi/Consumer.Tests/EventsApiConsumerTests.cs#L289

mui_ume
2019-07-22 02:43
can pact net support messaging comes from websockets?

franklin.huynh
2019-07-22 04:50
hi @matt.fellows and @bethskurrie is there a setting to match the body in case insensitive

franklin.huynh
2019-07-22 04:51
the pact file is pascal case and the return response is in lower cases

matt.fellows
2019-07-22 07:41
Do you mean in the actual request / response from provider? No

matt.fellows
2019-07-22 07:41
That seems... Odd

kapoorvishal23
2019-07-22 10:49
has joined #pact-net

franklin.huynh
2019-07-22 23:52
nm, it's something to do with the object deserialisation in the consumer service. we have updated the contract in consumer in order to match with the provider

matt.fellows
2019-07-23 01:32
ah ok

hvgiitr
2019-07-24 15:42
has joined #pact-net

au443479
2019-07-26 05:58
has joined #pact-net

shalygai.a
2019-07-26 12:31
has joined #pact-net

shalygai.a
2019-07-26 12:33
Hello! When will 'Multiple provider states' feature be supported for .net?

mohindroo.deepak
2019-08-01 06:06
has joined #pact-net

mohindroo.deepak
2019-08-02 18:15
I was trying to set PactDir in consumer side where pact files generated but it always create in d:\pacts directory? Is this a bug? Another issue coming is how provider will get all pact files for specific provider? It can be multiple consumers using one provider?

neil
2019-08-05 06:38
Without seeing your config, I can?t really help

neil
2019-08-05 06:39
You create a provider test for each of the consumers.

mohindroo.deepak
2019-08-05 09:07
public ConsumerPactClassFixture() { // Using Spec version 2.0.0 more details at https://goo.gl/UrBSRc PactBuilder = new PactBuilder(); PactBuilder.ServiceConsumer("Event Client") .HasPactWith("Event Server"); MockProviderService = PactBuilder.MockService(MockServerPort); var pactConfig = new PactConfig { SpecificationVersion = "2.0.0", PactDir = @"D:\pacts1\", LogDir = @"D:\pacts1\pact_logs" }; }

mohindroo.deepak
2019-08-05 09:11
When will pactbroker publishing and verifications for pactnet support?



mohindroo.deepak
2019-08-05 18:21
Thanks

mohindroo.deepak
2019-08-05 18:21
How to install pact broker in azure devops? I do not want to use docker image. Want to do installation manually?

mohindroo.deepak
2019-08-06 12:10
Please reply as it is urgent

mohindroo.deepak
2019-08-06 12:14
Also one more query that i am trying to access dius server to publish pacts but i am getting error ? no connection made because target machine refuses? We are using proxy so could not connect this url directly. How to use proxy ?

neil
2019-08-06 13:02
Sorry I can?t help you with Azure devops, I?ve never used it before

neil
2019-08-06 13:03
Maybe post the dius server pact broker question in #pact-broker

srikanthyadake
2019-08-06 13:15
has joined #pact-net

mohindroo.deepak
2019-08-06 14:46
Ok i will post

mohindroo.deepak
2019-08-06 14:47
Any luck with my second query on proxy issue?

pbarrientos
2019-08-06 16:38
has joined #pact-net

christophe.leray
2019-08-07 15:43
has joined #pact-net

neil
2019-08-08 00:02
That?s the one I suggested posting in #pact-broker

mohindroo.deepak
2019-08-12 07:48
I have a scenario in which consumer is using one of the wcf based service so how will i implement the solution using PACT?

thirumal.net
2019-08-12 17:28
@mohindroo.deepak - i don't think pactnet supports non jason services

mohindroo.deepak
2019-08-14 05:59
In one of the scenario, one of the consumer service A Get method calls another http service B internally. I want to test the service A here. i will make the mock http server for Service B but problem here is how will i redirect service A call to new mock server?

mohindroo.deepak
2019-08-14 06:02
In your samples, it is passing new mock server in get url. Which is not possible in my case. Obviously we can not make all api methods have url parameter.

bart.schotten
2019-08-14 06:45
Are you referring to this part of the sample? https://github.com/pact-foundation/pact-net/blob/e0532b782e673acb6d1d16b96b2cbb72c07a3075/Samples/EventApi/Consumer.Tests/EventsApiConsumerTests.cs#L51 It is actually good practice to allow every API client you want to test to have at least the base url injected.

mohindroo.deepak
2019-08-14 11:59
Yes. My consumer app is dotnet core which internally call the provider. In the test case, i cannot pass the mock url which i have made. How to implement pact mock server here?

bart.schotten
2019-08-14 14:39
You should really implement pact tests as unit tests in the consumer app. If that's not possible and the consumer app is a black box to you you must be able to inject the url somehow, there's no way around that.

mohindroo.deepak
2019-08-14 18:19
You are saying that i should run consumer tests before deploying the consumer service? Which i normally do in unit testing as well. In unit testing as well, i normally mock the dependencies and run my tests. Another point is that if i have 3 dependencies used in one of the POST function in consumer api then do i need to pass 3 different urls in the POST method parameters? Is this a good practice to change consumer api methods for the testing purpose only?

mohindroo.deepak
2019-08-14 18:40
Let me explain my case in detail: I have few tests which runs after the consumer service deployed and that is using restsharp to call the consumer api methods. In some of the methods, there is a call to 2 different providers to fetch data. I want to use pact to mock those 2 providers and run my tests and generate pact file. So below queries - 1) how to inject these urls for providers? 2) if i lets say inject those urls at the time of deployment of consumer service, then if i use pact mock code in the test case, will that work?

mohindroo.deepak
2019-08-14 18:44
3) on the provider side, pact tests will run on real provider service deployed?

bart.schotten
2019-08-15 06:43
To answer your first question: yes, I'm saying that you should run your consumer tests before deploying the consumer service. Second: you say you want to "use pact to mock those 2 providers". This is imo a bad practice, you should only use pact for what it's meant for: generating and verifying contracts. If you want to mock services to run functional integration tests I would recommend using another mocking tool. It's possible to do with pact but it just gets confusing. To answer your queries: 1) you probably want to get base urls from some kind of config anyway. I normally wouldn't hard code them anyway, so using configuration would be the way to go. 2) Probably, but again, I wouldn't recommend it. 3) On the provider side the same advice applies: please don't run the tests against the actual deployed service, but run them as unit tests against a self-hosted version of the service in some test-specific configuration. You only want to test the interface (i.e. your controller) so you need to be able to mock everything behind that.

mohindroo.deepak
2019-08-15 07:02
For 3) i have seen your sample and it runs against the actual provider service


bart.schotten
2019-08-15 07:15
But I guess we mean the same thing.

mohindroo.deepak
2019-08-15 12:22
Yeah but startup function of main service have azure keyvaults being used so how this will work on build agent

mohindroo.deepak
2019-08-15 12:23
How we can self host the app service in build pipeline

mohindroo.deepak
2019-08-15 12:33
Its slightly difficult

mohindroo.deepak
2019-08-15 17:13
One more query that in provider test, we are mentioning consumer name but if we have lot of consumers with different names and multiple consumers break then how will get info about the same.

mohindroo.deepak
2019-08-15 19:35
Are you there

mohindroo.deepak
2019-08-16 05:51
??

mohindroo.deepak
2019-08-16 06:05
There is an issue coming when i add pactnet.windows nuget because of long path in ruby at thebtime of building the project. Any solution for this?

mohindroo.deepak
2019-08-16 15:43
I am trying to run the pact verify code in dotnet and it works with pact file but not working with url. Giving some ruby files error? Need some help or code snippet to do that.


neil
2019-08-19 03:26
Does the url return a pact file json body? Does it require auth?

mohindroo.deepak
2019-08-19 05:31
Well when i run url on browser, it shows json content and this does not require authentication.

neil
2019-08-19 06:40
Are you using the broker or something else?

mohindroo.deepak
2019-08-19 06:58
I am using broker

mohindroo.deepak
2019-08-19 06:58
Consumer part working perfectly fine with broker

bart.schotten
2019-08-19 07:38
You don't need to mention the consumer name in the provider test. You only need to make sure that you support the provider states supplied by each consumer.

mohindroo.deepak
2019-08-19 07:42
Also what are these providestatemiddleware codebase

mohindroo.deepak
2019-08-19 08:27
Ok i need to understand provider states

mohindroo.deepak
2019-08-19 08:28
There is standard piece of code for providerstate middleware. What is the purpose of this? Is this fixed code need to use?

bart.schotten
2019-08-19 08:41
I doesn't have to be middleware, it can also be a controller. What basically happens is that the Pact Mock Consumer will perform a request to "/provider-states" with the providerState part of the contract. You need to expose this "/provider-states" endpoint somehow to be able to set up the correct data to be able to comply with the actual test.

mohindroo.deepak
2019-08-19 08:56
I did not get you fully here. Data is sometimes dynamic and data which is store in pact file might not work aftre few days

mohindroo.deepak
2019-08-19 08:57
So is there a way to bypass data check ? If we just want to validate properties name only? Also do you have some samples with provider states url on provider side

mohindroo.deepak
2019-08-19 08:57
?

mohindroo.deepak
2019-08-19 08:58
So now i am able to run the pact file on provider side

mohindroo.deepak
2019-08-19 08:58
But still getting some error

bart.schotten
2019-08-19 10:52
When the actual data doesn't matter you should use Matching Rules. You should really start by reading the official documentation (http://pact.io). It's really good.

mohindroo.deepak
2019-08-19 11:50
Do you have some samples around the customized provide states? Which explain my usecase?

neil
2019-08-19 13:50
Sorry I can?t help without more details

mohindroo.deepak
2019-08-19 16:40
That works now

mohindroo.deepak
2019-08-19 16:40
Thanks

mohindroo.deepak
2019-08-19 16:42
Now i have one question regarding the pact provider states. I do not want to validate the data in pact file. Just want to compare the json parameterss names. Is this possible?

mohindroo.deepak
2019-08-19 17:12
Any sample with pactnet with matchers?


mohindroo.deepak
2019-08-19 17:15
I have found this


neil
2019-08-20 00:17
Anything `Match.` is a matcher

neil
2019-08-20 00:17
Sounds like `Match.Type` is probably what you are after

mohindroo.deepak
2019-08-21 14:15
I am getting one issue that when provider tries to validate the pact file, it is failing that due to below issue 1) Verifying a pact between DummyConsumer and DummyProvider Given There is data Invalid SSI with current client id with GET /api/provider?clientid=222293222 returns a response which has a matching body Failure/Error: expect(response_body).to match_term expected_response_body, diff_options Actual: {"id":2,"name":"Test","clientId":2222222,"currencyCode":"DKK","countryCode":"CI"} Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown { - "Id": 2, - "Name": "Test", - "ClientId": 2222222, - "CurrencyCode": "DKK", - "CountryCode": "CI" } Description of differences -------------------------------------- * Could not find key "Id" (keys present are: id, name, clientId, currencyCode, countryCode) at $ * Could not find key "Name" (keys present are: id, name, clientId, currencyCode, countryCode) at $ * Could not find key "ClientId" (keys present are: id, name, clientId, currencyCode, countryCode) at $ * Could not find key "CurrencyCode" (keys present are: id, name, clientId, currencyCode, countryCode) at $ * Could not find key "CountryCode" (keys present are: id, name, clientId, currencyCode, countryCode) at $ This email may contain confidential and/or privileged information. If you are not the intended recipient - or have received this email by mistake - please notify the sender immediately and destroy the email. Any unauthorised copying, disclosure and/or distribution of the contents and/or attachments in this email is strictly prohibited. Email transmission security and error-free delivery cannot be guaranteed as information could be intercepted, corrupted, destroyed, delayed, incomplete and/or contain malware (virus). The sender of this email, therefore, does not accept liability for any errors and/or omissions in the contents of this message, which may arise as a result of email transmission.

mohindroo.deepak
2019-08-21 14:16
I can see one difference in actual: properties first character in lower case which is done by pact automatically? Dont know why

mohindroo.deepak
2019-08-21 14:16
This can be the cause i guess

mohindroo.deepak
2019-08-21 15:22
One more question about amqp messaging. My use case is that i am sending lot of messages to azure service bus/kafka so how will i handle those contracts?

thirumal.net
2019-08-21 18:00
@mohindroo.deepak - you can fix this issue by using JsonProperty . here is the example code which solves your issue public class ClassName { [JsonProperty(PropertyName = "id")] public string Id{ get; set; } [JsonProperty(PropertyName = "name")] public string Name{ get; set; } }

thirumal.net
2019-08-21 18:02
i have faced the same issue when i am doing POC on pactnet . above code helped me to fix the issue

mohindroo.deepak
2019-08-21 18:04
Thanks :blush:

mohindroo.deepak
2019-08-21 18:05
Any solution for this

mohindroo.deepak
2019-08-22 09:47
When i use matcher.type for the whole body, it is not showing in the pact file generated?

mohindroo.deepak
2019-08-22 09:47
Am i missed anything

mohindroo.deepak
2019-08-22 09:54
Sorry this part works. Pls ignore

mohindroo.deepak
2019-08-27 20:33
I have made the cicd pipeline for consumer And upload pact files to broker but how will i validate this to provider side? Do i need to trigger build cicd pipeline of provider side as contract tests is one of the task in provider build pipeline?

neil
2019-08-28 00:00
The Pact Broker has a webhook feature, which allows you to trigger a provider verification when a consumer pact is uploaded

mohindroo.deepak
2019-08-28 07:13
But that verification will trigger provider side build?

mohindroo.deepak
2019-08-28 07:14
Or it will just verify with latest pact version ?


thirumal.net
2019-08-29 18:30
@mohindroo.deepak - webhook will trigger the provider side build and provider side unit test case should fetch the latest version from pact broker and verify it. it depends which pact file you are getting from pact broker .

thirumal.net
2019-08-29 18:30
[Fact] public void VerfiyPacts () { string pactBrokerUrl = @"http:// .com/pacts/provider/Test_Provider/consumer/Test_Consumer/latest"; //Arrange const string serviceUri = "http://localhost:62809"; var config = new PactVerifierConfig { Outputters = new List<IOutput> { new XUnitOutput(_output) }, PublishVerificationResults=true, ProviderVersion= providerAPIVersion }; using (WebApp.Start<TestStartup>(serviceUri)) { //Act / Assert IPactVerifier pactVerifier = new PactVerifier(config); pactVerifier .ProviderState($"{serviceUri}/provider-states") .ServiceProvider("service", serviceUri) .HonoursPactWith("client") .PactUri(pactBrokerUrl) .Verify(); } }

mohindroo.deepak
2019-08-30 12:55
I am getting one issue that interaction not matching Consumer application has some dto which gets converted into json parameters and pass in httpresponse. When i am trying this in Pact so it fails and does not match. How to pass multiple parameters in Query? I also have dto which i need to pass here. Any help?

milleniumbug
2019-09-02 09:30
has joined #pact-net

mohindroo.deepak
2019-09-02 11:59
How to pass multiple parameters in query

mohindroo.deepak
2019-09-02 12:00
Can anybody help urgently

mohindroo.deepak
2019-09-02 12:33
How POST works with pact? How can i pass parameters and get response object?


adamgreen
2019-09-02 12:36
You can see at line 124 an example of a post for teh consumer side

mohindroo.deepak
2019-09-02 12:50
But in this case, you mentioned response object in body?

mohindroo.deepak
2019-09-02 12:52
In my case, there is parameters as well and there is response object. When i see consumer interaction in log file, it did not show response json in body. Rather it is showing request json in body

mohindroo.deepak
2019-09-02 13:13
??

mohindroo.deepak
2019-09-02 13:34
Post carries request data in body so if we have some reponse as well then why pact is not writing anywhere?

mohindroo.deepak
2019-09-02 13:50
I am getting one issue if i use Body in providerservicerequest then it breaks the execution and error pact exited due to *arguementexception*

adamgreen
2019-09-02 14:05
what do you have in your .WillRespondWith()?

mohindroo.deepak
2019-09-02 14:12
I am getting one issue if i use Body in providerservicerequest then it breaks the execution and error pact exited due to *arguementexception*

adamgreen
2019-09-02 14:24
Body is dynamic, not sure what problem it is you're having, check against the above see if you're set up is ok. https://github.com/pact-foundation/pact-net#3-write-your-test

mohindroo.deepak
2019-09-02 14:42
I am using body in providerservicerequest

mohindroo.deepak
2019-09-02 14:42
Then i got this issue. Execution breaks

mohindroo.deepak
2019-09-02 14:42
Otherwise it works fine

mohindroo.deepak
2019-09-02 14:47
It works now. I have not added content type header. But strange part is that execution should not break

neil
2019-09-03 00:00
In order for us to help, we need much more context about your specific issue. For example, if you?re getting an argument exception, there should be some info about which argument is causing the issue.

pbarrientos
2019-09-06 22:33
Hi, I have a question. Can I save an Enum name in the iteration or only be save the number? Sorry for my English.

mohindroo.deepak
2019-09-07 05:02
1) I have a query on implementation of provider side- consumer pact will be published everytime when consumer ci build will trigger. When provider build will run, will they check all versions of consumer pacts everytime? Consumer pacts which has been verified in previous provider verification, will they also be picked up?

mohindroo.deepak
2019-09-07 05:04
2) if provider will release api version 2 and trigger ci build, how will we stop validating consumer pacts? Whats the best practice to implement?

mohindroo.deepak
2019-09-07 05:06
3) i am also confused about data management here. Set of data being used by consumer can be failed when provider will validate. As provider hitting actual api so that wrong data can change the response type. Any suggestions on that?

mohindroo.deepak
2019-09-07 05:06
Really appreciate if somebody can answer

neil
2019-09-07 05:22
You should be able to just cast the enum to an int. So `int thing = (int) MyEnum.Member`

neil
2019-09-07 05:26
You choose what version of the pact you want to run by specifying the PactUri.

neil
2019-09-07 05:28
I don?t really understand the question. Why would you want to stop validating the consumer pacts because version 2 has been released?

neil
2019-09-07 05:30
You can either use matchers, provider state or both on the consumer side. Provider states give the provider a chance to setup the consumers data prior to running the verification. See https://github.com/pact-foundation/pact-net/blob/master/Samples/EventApi/Provider.Api.Web.Tests/EventAPITests.cs#L39 and https://github.com/pact-foundation/pact-net/blob/master/Samples/EventApi/Provider.Api.Web.Tests/ProviderStateMiddleware.cs#L24

mohindroo.deepak
2019-09-07 10:32
I did not get this. In provider verification, i have written the code to get all pacts under this provider and build so it always update all pact which has been verified before

mohindroo.deepak
2019-09-07 10:36
I mean that if there is a change in provider api contract and release new version of api but pact validate code picks old consumers which has older versions so it gets fail?

mohindroo.deepak
2019-09-07 10:42
Thanks. i am aware of the matchers but there is a different case here E.g. in provider function, there is a condition if. Clientid not exists then return response code BadRequest. Client data is in input parameter. Consumer Pact is expecting OK status

mohindroo.deepak
2019-09-09 05:37
Provide side code is generic and you normally call all pacts from specific branch. Whats the best practice to fetch pacts in provider build?

mohindroo.deepak
2019-09-09 05:39
There can be some business logic on provider side and if data is wrong then response code can be changed due to that verification failed.

uglyog
2019-09-09 06:07
has joined #pact-net

bethskurrie
2019-09-09 07:07
You either need to use provider states to set up the right data, or you need to use middleware to change the response so that it matches the IDs that you have.


bethskurrie
2019-09-09 07:09
Unfortunately it needs to be written in ruby.

bethskurrie
2019-09-09 07:09
I believe there is a config option to set the middleware file @neil?

bethskurrie
2019-09-09 07:10
You actually want to verify the "old consumers" because that's what allows you to ensure you have backwards compatibility.

bethskurrie
2019-09-09 07:10
You should use tags.


neil
2019-09-09 07:50
Unfortunately there is no custom middleware in Pact-Net land, however a lot of the .NET web servers support middleware, which you could load when starting the provider for verification.

mohindroo.deepak
2019-09-10 18:47
But it might possible that new property gets introduced in return json so it is fine for tthe consumers but pact verification will fail.

neil
2019-09-11 00:13
In that scenario the verification should not fail as the consumers have not specified the field in their contract

mohindroo.deepak
2019-09-11 05:08
Ok

mohindroo.deepak
2019-09-11 05:31
Sometimes pact mock server interactions not clear if something goes wrong at the time of development. Then no log file generated, no pact file in that case. I need to change the port number and then it start working.

neil
2019-09-11 13:56
Yeah that?s due to Pact-Net not being able to kill the ruby mock server process as it died unexpectedly

neil
2019-09-11 13:56
If you search for the ruby process and kill it manually, you shouldn?t need to change port

mohindroo.deepak
2019-09-11 18:24
Ok. But i think that problem will not occur in cicd pipeline

mohindroo.deepak
2019-09-11 18:24
On the build agents

neil
2019-09-11 23:56
Yeah it shouldn?t

neil
2019-09-11 23:56
It?s one of those ones, I wish I could fix, but unfortunately when the app domain crashes, I have no hooks to terminate other processes


thirumal.net
2019-09-12 21:52
@mohindroo.deepak - you can manually kill the mock service. at the end of the unit test case you can write like this public void KillByPort(int port) { var processes = GetAllProcesses(); // This gets all running process if (processes.Any(p => p.Port == port)) try { Process.GetProcessById(processes.First(p => p.Port == port).PID).Kill(); } catch (Exception ex) { Console.WriteLine(ex.Message); } else { Console.WriteLine("No process to kill!"); } }

thirumal.net
2019-09-12 21:53
i am calling this method in end of my unit test case. let me know if you want complete code snippet

bethskurrie
2019-09-12 22:18
There is a flag in the cli that lets you specify a Ruby file. But if you can load middleware in the net app, that would be much nicer.

mohindroo.deepak
2019-09-13 07:07
:+1:

mohindroo.deepak
2019-09-13 07:12
I need to know more on PactNet support on consumer sending messages to Azure Service bus and on the side, another service is receiving. Who will be the provider here? I guess message receiver should be provider. And how can we ensure contract testing here?

bethskurrie
2019-09-13 07:13
I'm not sure if the message pact support in .net is complete yet.


bethskurrie
2019-09-13 07:14
``` Consumer: An application that makes use of the functionality or data from another application to do its job. For applications that use HTTP, the consumer is always the application that initiates the HTTP request (eg. the web front end), regardless of the direction of data flow. For applications that use queues, the consumer is the application that reads the message from the queue. Provider: An application (often called a service) that provides functionality or data for other applications to use, often via an API. For applications that use HTTP, the provider is the application that returns the response. For applications that use queues, the provider (also called producer) is the application that writes the messages to the queue. ```

neil
2019-09-13 07:14
But if the test process is terminates unexpectedly, then I don?t think that code will run.

neil
2019-09-13 07:15
Nah it?s not complete yet, but it is somewhat functional on the `message-pact` branch

mohindroo.deepak
2019-09-13 07:20
Any ETA when it will be officially launched?

neil
2019-09-13 07:37
Some of the people working on it have gone quite and I haven?t had the time to get it done. So no ETA at the moment


neil
2019-09-13 07:41
The above thread will tell you have to create a nuget package for that branch

dperez
2019-09-13 14:49
From our experience, and from our requirements I can say it have done the job. The branch at least for us have worked very good, some minor adjustments but mostly all works pretty well

thirumal.net
2019-09-13 18:21
@neil - Thank you and Nice to see response from you. i am wondering , it is fine to kill the process in Dispose method of XUnit right ? or before starting the unittest case we can make sure mock service is not runnung on same port

thirumal.net
2019-09-13 20:58
@neil - Hi Could you please look into my scenario and suggest me if my thinking is correct ? i am doing analysis on pact implementation for C++ projects but there is no out of box support for C++ from pact community . as a work around i am creating one library in .NET which included PactNet and pact-win32( Ruby stand alone libraries for windows) . i am thinking to provide this .net library to C++ team so that they can include this .net library and call necessary methods like below (my understanding is calling C# library methods from C++ is possible ) 1) Start Mock Provider service 2) Clear Interactions 3) Register interactions 4) Consumer Code under test 4) Verify interactions 5) Stop Mock Provider Service 6) Publish the pact to pact broker Do you think this is good idea to implement pact where there is no language support ? Thanks in Advance,

milleniumbug
2019-09-14 14:26
This would mean that from your C++ code, you're calling C# code which calls the Ruby code by launching the process. You can skip the middleman by launching the Ruby process yourself. Also do note that while Ruby executable is the current approach for Pact, there is a work in progress on creating a Rust library (https://github.com/pact-foundation/pact-reference) which will eventually replace the Ruby executable.

mohindroo.deepak
2019-09-15 05:21
Oh Great. I will try in next few days and will share the feedback

neil
2019-09-17 02:09
Yeah agree with the above. I definitely wouldn?t be using the .NET library here. Either use the Ruby standalone directly in a similar way to how .NET does it, or even better use FFI bindings for Rust. The downside of the Rust implementation is that I don?t think currently any of the Pact libraries use it. That being said, I?m told that it?s ready to go.

neil
2019-09-17 02:10
@dperez Any adjustments that you can share in a PR?

dperez
2019-09-17 02:12
hi, nothing yet, all the adjustment we have done are for specific business requirement

neil
2019-09-17 02:14
Ah no worries :thumbsup:

tritorto
2019-09-19 07:32
has joined #pact-net

tritorto
2019-09-20 07:41
Hey guys, Ive just started hooking up PACT for a few new microservices im working on - I have the consumer/provider tests running locally and just in the process of setting up TeamCity CI. In TeamCity, it seems to be going fine with the consumer side, in that I can build and publish to the pact broker - however on the Provider build, I am having difficulty spinning up the Webhost which fails pact verification. In the PACT broker, it gives me: `Cannot assign requested address - connect(2) for "localhost" port 9223 (Errno::EADDRNOTAVAIL)` Im developing in .net core and typically I would use a TestServer, however looking around at samples and various comments online it is stated that you need to use a proper Webhost for the PactVerifier to work? I've pretty much got a solution similar to this: https://github.com/tdshipley/pact-workshop-dotnet-core-v1/blob/master/CompletedSolution/Provider/tests/ProviderApiTests.cs#L26 Has anyone had any luck hooking this up in TeamCity? As I mentioned Ive always used TestServer, so wondering whats missing to get it going..

tritorto
2019-09-20 07:43
Running the build step inside a docker container seems to have resolved my issue - all good :slightly_smiling_face:

mohindroo.deepak
2019-09-20 17:15
How can i use can-i-deploy with PactNet consumer ? How to use in ci/cd pipeline?

mohindroo.deepak
2019-09-20 17:16
Any example somewhere? How can i download can-i-download utility?

mohindroo.deepak
2019-09-24 08:38
Any idea how to resolve this

mohindroo.deepak
2019-09-24 08:38
I cant put jsonproperty

mohindroo.deepak
2019-09-24 08:39
I am getting one issue that when provider tries to validate the pact file, it is failing that due to below issue 1) Verifying a pact between DummyConsumer and DummyProvider Given There is data Invalid SSI with current client id with GET /api/provider?clientid=222293222 returns a response which has a matching body Failure/Error: expect(response_body).to match_term expected_response_body, diff_options Actual: {"id":2,"name":"Test","clientId":2222222,"currencyCode":"DKK","countryCode":"CI"} Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown { - "Id": 2, - "Name": "Test", - "ClientId": 2222222, - "CurrencyCode": "DKK", - "CountryCode": "CI" } Description of differences -------------------------------------- * Could not find key "Id" (keys present are: id, name, clientId, currencyCode, countryCode) at $ * Could not find key "Name" (keys present are: id, name, clientId, currencyCode, countryCode) at $ * Could not find key "ClientId" (keys present are: id, name, clientId, currencyCode, countryCode) at $ * Could not find key "CurrencyCode" (keys present are: id, name, clientId, currencyCode, countryCode) at $ * Could not find key "CountryCode" (keys present are: id, name, clientId, currencyCode, countryCode) at $ This email may contain confidential and/or privileged information. If you are not the intended recipient - or have received this email by mistake - please notify the sender immediately and destroy the email. Any unauthorised copying, disclosure and/or distribution of the contents and/or attachments in this email is strictly prohibited. Email transmission security and error-free delivery cannot be guaranteed as information could be intercepted, corrupted, destroyed, delayed, incomplete and/or contain malware (virus). The sender of this email, therefore, does not accept liability for any errors and/or omissions in the contents of this message, which may arise as a result of email transmission.

mohindroo.deepak
2019-09-24 08:39
Any help on this?

mohindroo.deepak
2019-09-24 09:27
This is Urgent

bethskurrie
2019-09-24 09:32
I think you'll work it out if you read the error message properly.

bethskurrie
2019-09-24 09:34
`Could not find key "CountryCode" (keys present are: id, name, clientId, currencyCode, countryCode) at $`

mohindroo.deepak
2019-09-24 09:39
But countryCode key is available

mohindroo.deepak
2019-09-24 09:39
First letter is not caps

matt.fellows
2019-09-24 09:39
Check case maybe?

mohindroo.deepak
2019-09-24 09:39
Is the comparison case sensitive?

bethskurrie
2019-09-24 09:40
Correct

mohindroo.deepak
2019-09-24 09:40
How to check case in provider side

mohindroo.deepak
2019-09-24 09:40
Consumer has already send the pacts to broker

bethskurrie
2019-09-24 09:40
Either the code or the pact is wrong. One of them needs to change.

mohindroo.deepak
2019-09-24 09:42
On the consumer side, json generated from dto and that is having first letter is in Caps

mohindroo.deepak
2019-09-24 09:43
Is there any way to skip this on provider side?

bethskurrie
2019-09-24 09:43
No - it appears to be an integration bug.

bethskurrie
2019-09-24 09:44
This is exactly the kind of thing contract testing is supposed to identify.

bethskurrie
2019-09-24 09:44
One side expects capitalised names, the other expects ones with a lower case. They will not work correctly together in real life.

mohindroo.deepak
2019-09-24 09:44
On the consumer side, i am using body=Match.Type(dto)

mohindroo.deepak
2019-09-24 09:45
Dto properties is in caps

bethskurrie
2019-09-24 09:45
Well change the code.

matt.fellows
2019-09-24 09:45
Urgent for you maybe. Please do not pass on urgency to others. We're here to help, but we aren't paid to help you. We do it because we love it

mohindroo.deepak
2019-09-24 09:45
I think when pact generated, it change the first letter to small

bethskurrie
2019-09-24 09:46
No, the pact expects an upper case. The provider is returning a lower case.

mohindroo.deepak
2019-09-24 09:46
Sorry about that but it looks like an issue

bethskurrie
2019-09-24 09:46
As I said early, you need to change either the consumer+pact, or the provider, so that they match.

bethskurrie
2019-09-24 09:46
This is all the advice I can give now unfortunately.

bethskurrie
2019-09-24 09:47
There is no bug with the Pact code.

mohindroo.deepak
2019-09-24 09:48
There is a dto which is having 2 properties and both are strings. First letter is in caps. When we generate the pact using consumer side code. It change the first letter to small.

mohindroo.deepak
2019-09-24 09:51
Sorry Pls ignore my last line as consumer is generating the right properties. Only provider side makes issue

mohindroo.deepak
2019-09-24 09:58
I just check swagger also showing json object properties first letter in smaller case

mohindroo.deepak
2019-09-24 16:32
I got the problem. That is related to newtonsoft json which converts the property name first character.

mohindroo.deepak
2019-09-25 12:30
I am getting NilClass as value of property is coming null. I do not want to compare the data so i used Match.Type but seems it does not work with null values

mohindroo.deepak
2019-09-25 12:30
Any help on this?

bart.schotten
2019-09-25 12:33
If a property can be null you should leave it out of the contract entirely.

mohindroo.deepak
2019-09-25 12:36
No but i just do not want to compare data under that property but would like to check the contract.

bart.schotten
2019-09-25 12:37
What do you mean by "check the contract?"

neil
2019-09-25 12:40
Yeah what @bart.schotten said. If you don?t care about the property, don?t include it in the interaction on the consumer test

mohindroo.deepak
2019-09-25 12:41
Actual provider service does not have that data. So consumer pact is generating response body with some fake data which is not available on provider side. But property in response body needs to be compared.

mohindroo.deepak
2019-09-25 12:41
Thats why i used Match.Type

mohindroo.deepak
2019-09-25 12:41
On the consumer side

bart.schotten
2019-09-25 12:42
Yeah, that doesn't make any sense. If the provider does not have that property it has no business being in the contract.

mohindroo.deepak
2019-09-25 12:45
Provider do have this property. But value is coming null because consumer is sending some fake data here

mohindroo.deepak
2019-09-25 12:46
So in provider code, they fetch the data on the basis of some clientid

mohindroo.deepak
2019-09-25 12:46
And that clientid is fake in the consumer pact

bart.schotten
2019-09-25 12:47
Of course, but that's why you have provider states, so that the provider can set up realistic test data to return

bart.schotten
2019-09-25 12:49
If the provider returns a value in reality, but not during the pact test, the provider test is not set up correctly.

mohindroo.deepak
2019-09-25 12:51
In provider states, setting up test data means mocking of data?

mohindroo.deepak
2019-09-25 12:52
Or you are saying, generating that client setup in database so that when actual provider call happens, it works accordingly?

bart.schotten
2019-09-25 12:54
You can do it either by setting up data in the database, or by mocking a repository or service, that's up to the provider to decide. As long as it does hit the actual controller/endpoint.

mohindroo.deepak
2019-09-25 14:11
Adding in database not feasible in my case. Will provider middleware support Mocking of provider service?

mohindroo.deepak
2019-09-25 14:18
I mean to say here that verifier code hits the actual controller end point. If i would like to mock the provider service or response data, how can i do that?

bart.schotten
2019-09-25 14:39
This question is not really related to Pact anymore. You're basically asking how you can test an API.

mohindroo.deepak
2019-09-25 15:12
Not really. I am actually looking for some felxibility on provider side code to skip data validation

mohindroo.deepak
2019-09-25 15:16
Like i have another example. There is a dto Which has 2 properties IsOK book and ErrorText string In case if IsOk come true then errortext set to null in the provider code. Consumer also send it as null in the property. But when provider runs, it marks as Nil

mohindroo.deepak
2019-09-25 15:16
How can i compare null data in one of the consumer pact property with provider side Nil

mohindroo.deepak
2019-09-25 15:17
Nil is NilClass

bart.schotten
2019-09-25 15:22
You don't. You should define two interactions in your contract. - Interaction 1: in which IsOK is true and ErrorText is not present (so not null, but really non-existent) - Interaction 2: IsOK is false and ErrorText has a string value.

mohindroo.deepak
2019-09-25 15:23
In interaction 1, i cannot remove that errortext property. As there is dto desiarilize in the code to make json.

mohindroo.deepak
2019-09-25 15:23
Interaction 2 works fine here

mohindroo.deepak
2019-09-25 15:25
If i give c# null in json in consumer side

mohindroo.deepak
2019-09-25 15:25
Will that work when provider will run

mohindroo.deepak
2019-09-25 15:25
Compare the pact

mohindroo.deepak
2019-09-25 15:27
Let me try this

mohindroo.deepak
2019-09-25 15:28
That works :blush:

mohindroo.deepak
2019-09-25 16:27
That is working now. Thanks

mohindroo.deepak
2019-09-25 16:28
I am trying to get all pacts for particular provider using /latest

mohindroo.deepak
2019-09-25 16:28
But i am getting mesage that deprecated

mohindroo.deepak
2019-09-25 16:29
I am trying to get all pacts for particular provider using /latest But i am getting mesage that deprecated

vk.regs
2019-09-26 08:53
Hi, all I see that in latest PactNet.Windows nuget there is no Version property for PactOption. Could somebody suggest any other code that I can use to generate it?

vk.regs
2019-09-26 09:01
I only found way to generate it manually string version = DateTime.UtcNow.ToString(_pactOption.CustomDateTimeFormat, (IFormatProvider) CultureInfo.InvariantCulture) + (object) Guid.NewGuid();

mohindroo.deepak
2019-09-26 15:59
I was trying to use PACT_Description environment variable for individual interaction verification for consumer pact. But it does not update on the broker. There are 3 interactions in 1 consumer pact file. I am trying to execute one by one in 3 different tests on provider side. Pact broker do not updated in this.

mohindroo.deepak
2019-09-26 17:16
Anyone who tried environment variable for individual pact verification?

mohindroo.deepak
2019-09-27 07:09
@??

mohindroo.deepak
2019-09-27 07:37
Another issue i am facing is that i have created 2 consumers for 1 provider and when we run provider verification . Should validate all consumers pactVerifier. Serviceprovider(providername, provideruri) .pacturi(url) .verify

vk.regs
2019-09-27 10:47
sorry, posted by mistake

mohindroo.deepak
2019-09-30 05:33
I was trying to use PACT_Description environment variable for individual interaction verification for consumer pact. But it does not update on the broker. There are 3 interactions in 1 consumer pact file. I am trying to execute one by one in 3 different tests on provider side. Pact broker do not updated in this. Any help on this?

bethskurrie
2019-10-01 07:15
You can only publish verification results if you verify the entire pact.

bethskurrie
2019-10-01 09:16
@mohindroo.deepak ^^

mohindroo.deepak
2019-10-01 09:17
Hi

phillip.goff
2019-10-03 13:23
has joined #pact-net

jack.middleton
2019-10-07 13:43
has joined #pact-net

dperez
2019-10-07 15:11
hi @neil hope everything is good on your end. I noticed there's being some releases and was wondering if we could have those merged into the messaging branch ?

neil
2019-10-07 15:12
Yep sure can, will sort that out tomorrow.

dperez
2019-10-07 15:12
thanks a lot

neil
2019-10-08 10:44
@dperez master is now merged into message-pact

dperez
2019-10-08 14:39
thanks!

olaniyanayobamijr
2019-10-09 07:36
has joined #pact-net

vikassd2012
2019-10-11 02:26
Hey guys, had 2 questions on Pactnet

vikassd2012
2019-10-11 02:27
1. When I call PactBuilder.Build(); function to save the contract json file on my local I am noticing the casing of the file saved changes

vikassd2012
2019-10-11 02:28
For example my consumer and producer names that I am passing are

vikassd2012
2019-10-11 02:28
EventService and WorkService respectively

vikassd2012
2019-10-11 02:29
but the function saves the file in format eventservice-workservice.json

vikassd2012
2019-10-11 02:30
I am also using pactbroker after above step

vikassd2012
2019-10-11 02:30
to publish the pacts and there the name casing matches as per my input

vikassd2012
2019-10-11 02:31
what I am doing wrong? How I can get the local file casing to match as per my inputs and also PactBroker?

vikassd2012
2019-10-11 02:31
The 2nd question

bethskurrie
2019-10-11 02:31
I don't think you can

bethskurrie
2019-10-11 02:31
Pretty sure the code performs a downcase on it. Why does it matter?

bethskurrie
2019-10-11 02:32
You should just be able to publish the directory, and not care about the names.

vikassd2012
2019-10-11 02:32
Thanks Beth for your response, is it a convention to use downcase for service names?

bethskurrie
2019-10-11 02:33
You can make your own convention

bethskurrie
2019-10-11 02:33
the file name should be irrelevant - the contents of the file will contain the names with cases as you specified.

vikassd2012
2019-10-11 02:34
yes you are correct the content of the file has the right name casing

vikassd2012
2019-10-11 02:34
it mattered because I accidentally tried to query the pactbroker api with lower case

vikassd2012
2019-10-11 02:34
and got a 404

vikassd2012
2019-10-11 02:34
as expected

vikassd2012
2019-10-11 02:35
my concern was if I did this mistake other people in my team could do it too

vikassd2012
2019-10-11 02:35
so I was curious for the reasons

bethskurrie
2019-10-11 02:35
To be honest, you're the first person who has ever raised it.

bethskurrie
2019-10-11 02:35
I don't think it will be a major issue.

bethskurrie
2019-10-11 02:36
You'll have many bigger issues :stuck_out_tongue:

vikassd2012
2019-10-11 02:36
yes thats what I am trying to solve right now :slightly_smiling_face:

vikassd2012
2019-10-11 02:36
so I will leave the naming as is for now, hoping I am the only one who ran into it

vikassd2012
2019-10-11 02:37
my 2nd question was regarding pact broker api

vikassd2012
2019-10-11 02:37
I was trying to get interactions

vikassd2012
2019-10-11 02:38
using api


vikassd2012
2019-10-11 02:39
it only returned me 1 interaction

vikassd2012
2019-10-11 02:39
but I have 2 interactions

vikassd2012
2019-10-11 02:39
how I can get all ?

bethskurrie
2019-10-11 02:40
Have you published the version with 2 interactions?

bethskurrie
2019-10-11 02:40
Go to the broker UI and look at the matrix page

bethskurrie
2019-10-11 02:40
Its the icon with a little grid

vikassd2012
2019-10-11 02:40
oh

vikassd2012
2019-10-11 02:40
it only shows 1

vikassd2012
2019-10-11 02:40
but my local file has 2

bethskurrie
2019-10-11 02:40
well, it hasn't been published then

vikassd2012
2019-10-11 02:41
I will take a look not sure why it only published one

vikassd2012
2019-10-11 02:41
thanks Beth

bethskurrie
2019-10-11 02:44
np

mohindroo.deepak
2019-10-16 16:08
How can we start pact mock server in some other server apart from localhost?

mohindroo.deepak
2019-10-16 16:08
We are running main service in cloud and test running in onprem server

mohindroo.deepak
2019-10-16 16:08
So localhost will not work

mohindroo.deepak
2019-10-16 16:15
Any suggestions how to implement that

psychopomp3x
2019-11-11 20:37
has joined #pact-net

kalinets
2019-11-29 14:44
has joined #pact-net

christian.johann.eder
2019-12-03 11:10
has joined #pact-net

andrew.williams439
2019-12-03 16:09
has joined #pact-net

sliu7
2019-12-04 00:09
has joined #pact-net

theriaultnicolas
2019-12-12 03:26
has joined #pact-net

shilpa3006
2019-12-27 13:54
has joined #pact-net

akkoubak
2020-01-09 01:01
has joined #pact-net

akkoubak
2020-01-09 01:02
Hello, I am having trouble creating a PACT for a particular request using the .Net implementation of PACT. More specifically I am attempting to test a GraphQL POST request against a host server on this IP (http://52.188.176.147:4000). When running my dotnet test command, I am getting the following exception: ```System.Exception: 'There was a problem connecting to Provider API - {MYAPI}' - HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error )``` I am able to successfully test my ConsumerAPIClient which contains the following code: ```using Newtonsoft.Json; using RA; using System; using System.Collections.Generic; using http://System.Net; using http://System.Net.Http; using http://System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; namespace Consumer { public static class ConsumerApiClient { static public async Task<HttpResponseMessage> LocationQuery(string baseUri) { using (var client = new HttpClient { BaseAddress = new Uri(baseUri) }) { try { string json = JsonConvert.SerializeObject(new { query = "\n{\n locations {\n displayName\n }\n}" }); var content = new StringContent(json.ToString(), Encoding.UTF8, "application/json"); var response = await client.PostAsync($"{baseUri}", content); response.EnsureSuccessStatusCode(); return response; } catch (Exception ConnectionEx) { throw new Exception("There was a problem connecting to Provider API - LocationQuery.", ConnectionEx); } } } } }``` Here is my consumer test class:

akkoubak
2020-01-09 01:02
``` using Xunit; using PactNet.Mocks.MockHttpService; using PactNet.Mocks.MockHttpService.Models; using Consumer; using System.Collections.Generic; using PactNet.Matchers; using RA; namespace tests { public class ConsumerPactTests : IClassFixture<ConsumerPactClassFixture> { private IMockProviderService _mockProviderService; private string _mockProviderServiceBaseUri; private int _mockProviderServiceBasePort; public ConsumerPactTests(ConsumerPactClassFixture fixture) { _mockProviderService = fixture.MockProviderService; _mockProviderService.ClearInteractions(); //NOTE: Clears any previously registered interactions before the test is run _mockProviderServiceBaseUri = fixture.MockProviderServiceBaseUri; // _mockProviderServiceBaseUri = "http://52.188.176.147:4000/"; } [Fact] public void LocationQuery() { // Arrange _mockProviderService.Given("There is no data") .UponReceiving("A valid POST request to validate location GraphQL") .With(new ProviderServiceRequest { Method = http://HttpVerb.Post, Path = "", //Query = "", Headers = new Dictionary<string, object> { { "Content-Type", "application/json" } }, Body = new { query = "\n{\n locations {\n displayName\n }\n}" } }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary<string, object> { { "Content-Type", "application/json; charset=utf-8" } }, Body = new { data = (new { locations = Match.MinType(new { displayName = "" }, 2) }) } }); // Act var result = ConsumerApiClient.LocationQuery(_mockProviderServiceBaseUri).GetAwaiter().GetResult(); var resultBodyText = result.Content.ReadAsStringAsync().GetAwaiter().GetResult().ToString(); ; // Assert Assert.Contains("data", resultBodyText); } } }``` I would appreciate your help on this issue.

akkoubak
2020-01-09 02:28
@neil regarding the issue above, I also changed my MockProviderService's configs to use the IP address binding settings, but still has no luck. Here is my ConsumerPactClassFixture.cs: ```using PactNet; using PactNet.Mocks.MockHttpService; using PactNet.Models; using System; using Xunit; namespace tests { // This class is responsible for setting up a shared // mock server for Pact used by all the tests. // XUnit can use a Class Fixture for this. // See: https://goo.gl/hSq4nv public class ConsumerPactClassFixture : IDisposable { public IPactBuilder PactBuilder { get; private set; } public IMockProviderService MockProviderService { get; private set; } public int MockServerPort { get { return 9222; } } public string MockProviderServiceBaseUri { get { return String.Format("http://localhost:{0}", MockServerPort); } } public ConsumerPactClassFixture() { // Using Spec version 2.0.0 more details at https://goo.gl/UrBSRc var pactConfig = new PactConfig { SpecificationVersion = "2.0.0", PactDir = @"..\..\..\..\..\pacts", LogDir = @".\pact_logs" }; PactBuilder = new PactBuilder(pactConfig); PactBuilder.ServiceConsumer("TaxonomyConsumer") .HasPactWith("TaxonomyProvider"); MockProviderService = PactBuilder.MockService(MockServerPort, host: IPAddress.Any); } //teardown #region IDisposable Support private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // This will save the pact file once finished. PactBuilder.Build(); } disposedValue = true; } } // This code added to correctly implement the disposable pattern. public void Dispose() { // Do not change this code. Put cleanup code in Dispose(bool disposing) above. Dispose(true); } #endregion } }```

neil
2020-01-09 02:50
Looks like you?re getting a 500 response from the server, so it?s likely something to do with provider not knowing how to handle the request it has been sent.

neil
2020-01-09 02:51
`Body = new { query = "\n{\n locations {\n displayName\n }\n}" }` seems a little odd to me

neil
2020-01-09 02:52
It means you?ll be sending the following json to the server ```{ "query": "\n{\n locations {\n displayName\n }\n}" }```

neil
2020-01-09 02:53
It feels like you might be trying to send ```{ "query": { locations { displayName: "" } } }```

neil
2020-01-09 02:54
Also the string inside query isn?t valid json

akkoubak
2020-01-09 04:42
That's correct. However, when I execute dotnet run in consumer proj using the same string, I am getting the correct response and payload. I also tested the same string in Postman and was able to get the desired response. I have a feeling the error is related to how I am passing the host server's ip address and port to the mockserver

neil
2020-01-09 06:12
Is your provider verification code using the correct pact file? I?d build a very simple test provider api, which just logs the request that has been sent by pact, to ensure it?s as expected. Without any of the provider verification code and the provider api, I can?t really help much here.

franklin.huynh
2020-01-28 05:48
hi team, I would like to try .net core for messaging-pact. anyone could suggest where I can start? I see that we have this branch "https://github.com/pact-foundation/pact-net/tree/message-pact" how can I start with that?

bethskurrie
2020-01-28 05:49
There was a repo somewhere

bethskurrie
2020-01-28 05:49
BTW, hi!

bethskurrie
2020-01-28 05:50
I think there was another repo, as well as that branch

bethskurrie
2020-01-28 05:50
@neil might remember. Unfortunately we have the free slack, and so the messages about that might have dropped off our storage.

franklin.huynh
2020-01-28 05:52
do you meant you guys are not actively working on that at the moment?

franklin.huynh
2020-01-28 06:02

bethskurrie
2020-01-28 06:02
Nope

bethskurrie
2020-01-28 06:03
It's been a long while since anyone touched it

dperez
2020-01-28 15:13
hi @franklin.huynh take a look at this thread for a message implementation https://pact-foundation.slack.com/archives/C5F4KFKR8/p1559190383002900

dperez
2020-01-28 15:16
I noticed the thread is now archived, I'm able to see it but probably because I starred it, let me know if you have some problem reaching it.

franklin.huynh
2020-01-28 22:48
hi @dperez I cannot see the message. Could you share it to me?

dperez
2020-01-28 23:08
@franklin.huynh hope it helps.

franklin.huynh
2020-01-28 23:34
thanks @dperez I'll try follow the thread . many thanks

dperez
2020-01-28 23:35
we are actually using the branch mentioned in the thread for our contract testing with our messaging infraestructure and have to say, it does the job

akkoubak
2020-01-29 02:29
Hello there, I am attempting to run my consumer and provider tests in an Azure Pipeline using an ubuntu agent with Azure tasks. I am able to run the tests fine in my local machine on Windows. However, whenever I switch my PactNet Nuget package to Linux64, and build/run my tests projects, I encounter a failure in my provider test with the following message: ```Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command Version : 2.164.0 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli ============================================================================== /usr/bin/dotnet test /home/vsts/work/1/s/pact/Provider/tests --logger trx --results-directory /home/vsts/work/_temp Test run for /home/vsts/work/1/s/pact/Provider/tests/bin/Debug/net472/tests.dll(.NETFramework,Version=v4.7.2) Microsoft (R) Test Execution Command Line Tool Version 16.3.0 Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... A total of 1 test files matched the specified pattern. [http://xUnit.net 00:00:02.69] tests.ProviderApiTests.EnsureProviderApiHonoursPactWithConsumer [FAIL] X tests.ProviderApiTests.EnsureProviderApiHonoursPactWithConsumer [274ms] Error Message: System.TypeInitializationException : The type initializer for 'PactNet.Constants' threw an exception. ---- System.UriFormatException : Invalid URI: The format of the URI could not be determined. Stack Trace: at PactNet.PactVerifier+<>c.<.ctor>b__47_0 (PactNet.Core.PactVerifierHostConfig hostConfig) [0x00000] in <24e08d8a874b4357a3f70f66dbe375e6>:0 at PactNet.PactVerifier.Verify (System.String description, System.String providerState) [0x0010b] in <24e08d8a874b4357a3f70f66dbe375e6>:0 at tests.ProviderApiTests.EnsureProviderApiHonoursPactWithConsumer () [0x000a4] in <37a774785b2a4ef3a32cbac10560f0ad>:0 at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&) at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <c453bf849bb84e719dbec0475e99db95>:0 ----- Inner Stack Trace ----- at System.Uri.CreateThis (System.String uri, System.Boolean dontEscape, System.UriKind uriKind) [0x0007b] in <4d8f95b7df544b3fa1a27dda924b4424>:0 at System.Uri..ctor (System.String uriString) [0x00014] in <4d8f95b7df544b3fa1a27dda924b4424>:0 at PactNet.Constants..cctor () [0x0001e] in <24e08d8a874b4357a3f70f66dbe375e6>:0 ``` All my tasks (Nuget restore, dotnet run/test) are running fine, and my consumer tests are passing. One thing to note, not sure if relevant, is the fact that I targeted different frameworks for my consumer proj (netcoreapp 2.1) and provider proj (net 472). Below is my code for my provider test class: ``` using System; using System.Collections.Generic; using PactNet; using PactNet.Infrastructure.Outputters; using Xunit; using Xunit.Abstractions; using Microsoft.Owin.Hosting; using tests.XUnitHelpers; namespace tests { public class ProviderApiTests: IDisposable { private string _serviceUri { get; } private string _providerUri { get; } //private string _pactServiceUri { get; } private readonly ITestOutputHelper _output; public ProviderApiTests(ITestOutputHelper output) { _output = output; _providerUri = "http://52.142.17.145:4000"; _serviceUri = "http://localhost:9001"; } [Fact] public void EnsureProviderApiHonoursPactWithConsumer() { //Arrange const string serviceUri = "http://localhost:9001"; // var buildNumber = Environment.GetEnvironmentVariable("BUILD_NUMBER"); DateTime utcDate = DateTime.UtcNow; var buildNumber = utcDate.ToString(); var config = new PactVerifierConfig { ProviderVersion = !string.IsNullOrEmpty(buildNumber) ? buildNumber : null, //NOTE: This is required for this feature to work PublishVerificationResults = !string.IsNullOrEmpty(buildNumber), Outputters = new List<IOutput> { new XUnitOutput(_output) } }; using (WebApp.Start<TestStartup>(serviceUri)) { //Act / Assert IPactVerifier pactVerifier = new PactVerifier(config); pactVerifier.ProviderState($"{serviceUri}/provider-states") .ServiceProvider("TaxonomyGraphQLProvider", _providerUri) .HonoursPactWith("TaxonomyGraphQLConsumer") // .PactUri(@"..\..\..\..\..\pacts\taxonomygraphqlconsumer-taxonomygraphqlprovider.json") .PactUri("https://blnmanagermobilesvc.pact.dius.com.au/pacts/provider/TaxonomyGraphQLProvider/consumer/TaxonomyGraphQLConsumer/latest", new PactUriOptions("MyAPIKey")) .Verify(); } } public virtual void Dispose() { } } }``` Please advise if you need further details to look at this. I am hoping this is a simple formatting issue that I missing given the fact that I've been staring at this for hours! Thank you much!!

franklin.huynh
2020-01-29 02:39
hi @dperez can I know which OS you are running the test? I did publish the nuget package (PactNet) and it ran successfully on Windows. However, it failed on mac saying it cannot find the . I think I need to publish the PactNet.OSX package. do you know how can I publish it?

dperez
2020-01-29 02:41
hi, correct, I'm running the Windows one only. Let me try to find the instructions about that one. Or probably @matt.fellows or @bethskurrie can give us a hint how to build that one.

franklin.huynh
2020-01-29 03:15
@bethskurrie @neil @matt.fellows would you be able to advice?

franklin.huynh
2020-01-29 03:39
FYI @dperez I just realised in your archived message has instruction how to publish the package including OSX, Linux. I will follow through

bethskurrie
2020-01-29 04:26
Sorry, I know less than nothing about dot net! @neil is the expert (sorry to bug you Neil!)

franklin.huynh
2020-01-30 03:11
it happened to me as well. What version of pact you're using?


franklin.huynh
2020-01-30 03:13
if you're using 2.5.0, try converting to 2.4.8

franklin.huynh
2020-01-30 05:00
I think I'm progressing with the publish the OSX package. But this issue is blocking me https://github.com/pact-foundation/pact-net/issues/231

bethskurrie
2020-01-30 20:56
@franklin.huynh if you give me a docker container to reproduce the issue, I'll investigate.

akkoubak
2020-02-05 03:08
Thank you so much! That worked!

akkoubak
2020-02-05 03:12
Hello, I am unable to serialize hyphenated JSON keys in the body content of my consumer tests. This is needed as some of the keys returned in the response payload follow the "xx-id" format. Please see example (application-id) below: ``` [Fact] public void RejectTimesheetWithoutAComment() { // Arange _mockProviderService.Given("There is no data") .UponReceiving("Timesheet to reject without an approver's comments") .With(new ProviderServiceRequest { Method = http://HttpVerb.Post, Path = "/approvals/actions/reject/4faf9285-78d4-4c09-b836-1cd48c393ed2", Query = "", Headers = new Dictionary<string, object> { { "Authorization", "Bearer TOKEN"}, {"Content-Type", "application/json; charset=utf-8" } }, Body = new { } }) .WillRespondWith(new ProviderServiceResponse { Status = 400, Headers = new Dictionary<string, object> { { "Content-Type", "application/json; charset=utf-8" } }, Body = Match.Type(new { application-id = new { comments = new { location = "body", param = "comments", msg = "Comments are required" } }}) }); // Act var result = ConsumerApiClient.RejectTimesheetWithoutComment(_mockProviderServiceBaseUri).GetAwaiter().GetResult(); var resultBodyText = result.Content.ReadAsStringAsync().GetAwaiter().GetResult().ToString(); // Assert Assert.Contains("errors", resultBodyText); }``` When attempting to build my test projects, VS fails the build due to the hyphen being part of the key. Is there a way around this? Please advise

matt.fellows
2020-02-05 03:24
Is this a Pact specific issue? Seems like you need a way to specific a key as a string in .NET

akkoubak
2020-02-05 03:52
There seems to be no way for me to manipulate the key when it is inside the body section of the test. Even if I attempt to serialize it outside the method, it does not appear to recognize keys. Am I missing something?

matt.fellows
2020-02-05 12:30
Might have to wait for someone else here, I'm not experienced .NET

sliu7
2020-02-05 23:30
It's not a Pact specific issue. I don't think .NET supports hyphens in identifiers https://stackoverflow.com/questions/5771577/can-you-have-a-property-name-containing-a-dash/5771598

neil
2020-02-06 03:00
No .NET doesn?t support that. If you want to do that you?ll need to create a .NET class which with http://Json.net JsonProperty attributes (https://www.newtonsoft.com/json/help/html/JsonPropertyName.htm) to represent that object rather than using a dynamic/anonymous object.

rafael.negron
2020-02-06 15:07
has joined #pact-net

conallbennett
2020-02-10 22:33
has joined #pact-net

paolaagudelo10
2020-02-21 19:01
has joined #pact-net

paolaagudelo10
2020-02-24 17:07
Hi everyone, i am trying to tag my provider with my branchName, to publish into the broker, but it is not working i am doing this: i don't now if this is well implemented?

neil
2020-02-24 23:21
Is it not getting sent to the broker at all? Are there errors? Are you running on Windows, Linux or OSX?

tomas.sakinis611
2020-02-25 11:03
has joined #pact-net

tomas.sakinis611
2020-02-25 11:07
Hi, i was wondering if i can save all interactions to json file without executing any endpoint tests?

naamam
2020-02-25 13:08
has joined #pact-net

naamam
2020-02-25 13:17
Hi guys, maybe you can help me. Trying to find out if there a way I can validate fields name & type and not actual values?

paolaagudelo10
2020-02-25 16:14
Hello, i am running on windows when i review the broker it has the provider version correctly however tag is not been added, the variable is already returning a value so i doīnt know if i am missing something when try to add the tag to the provider.

sliu7
2020-02-25 23:13
You can try Match.Type ```_mockProviderService.Given(...) .With(...) .WillRespondWith(new ProviderServiceResponse { Status = 200, Body = new { eventType = Match.Type("Test") } });```


naamam
2020-02-26 07:55
thanks! that worked perfect

naamam
2020-02-26 08:17
I have another question and I will explain it with an example. I have a request to get session (generated guid) and I'm using this session for the next request to get some data from the provider. I want to test both requests, is there a way to "save" the response from the first request and use it on the second request?

matt.fellows
2020-02-26 08:18
You want to research the topic called ?provider states?

matt.fellows
2020-02-26 08:18
Each interaction should be able to be tested in isolation - you?re talking about a _functional_ test (that relies on state and a sequence of pre-conditions to be setup)

matt.fellows
2020-02-26 08:19
Pact takes a different approach

matt.fellows
2020-02-26 08:20
So in your example, you should have two tests: 1. Get (or generate?) a session ID 2. Do something to /some/API _given_ session ID 1234 exists (the ?given? bit, is the state)


naamam
2020-02-26 08:26
OK, Thanks, I will look into that

naamam
2020-02-27 15:56
Hi there, I have encoding problem. Seems like when reading the pact file (provider side) somehow encoding of some character messed-up, This is the error I received: Expected "\u256B\u00C9\u256B\u00D6\u256B\u00DC \u256B\u00C9\u256B\u00E1\u256B\u00F9\u256B\u00E1\u256B\u00F2 \u256B\u00D6\u256B\u00A2\u256B\u00F2\u256B\u00A3\u256B\u00D6\u256B\u00A5 \u256B\u00A3\u256B\u00F3\u256B\u00FB\u256B\u00F2\u256B\u00BF \u256B\u00A3\u256B\u00DC?" *but got* "\u05D0\u05D9\u05DA \u05D0\u05E0\u05D7\u05E0\u05D5 \u05D9\u05DB\u05D5\u05DC\u05D9\u05DD \u05DC\u05E2\u05D6\u05D5\u05E8 \u05DC\u05DA?" at $.result.unavailableSelfServiceActions[1].selfServiceActions[3].selfServiceActionFields[1].fieldTitle The 'Expected' unicode characters aren't in the actual pact file (the character int the pact file are actually unicode characters after 'but got' ) How can I fix that?

neil
2020-02-27 23:37
Can you send a simple repro repo, which demonstrates the issue?

akkoubak
2020-02-28 03:20
Hello again, our company is in the early stages of implementing PACT. We currently have a running provider service in Azure that returns data of a certain user using a JWT stored in the QA database. I've been having some discussions with some of the devs and QAs, and few of them are under the impression that PACT mocks the provider in both consumer and provider tests. Their theory is that PACT validates the contract against a mocked instance of the provider service that way dependencies are handled without impacting the tests. Is that the case, or does PACT replay the interactions recorded in contract against the running service? Finally, are there any guidelines around mocking databases with the http://a.NET implementation of PACT? I am leaning towards using provider-states to inject data in the QA database before running the provider test, but some of the dev have a preference of staging up a database prior to a test run. Thank you for your help!

bethskurrie
2020-02-28 03:20
> Is that the case, or does PACT replay the interactions recorded in contract against the running service?

bethskurrie
2020-02-28 03:21
Yes


akkoubak
2020-02-28 03:31
Thank you Beth. I've been using PACT for the past couple of months, and I've created some training around running tests against a live provider. However, that point was challenged by some of the team member based on some the examples they found online. Thank you for confirming. Per your knowledge, are there use cases where provider is a mocked instance?

bethskurrie
2020-02-28 04:54
No - that would defeat the purpose

bethskurrie
2020-02-28 04:54
Could you find me this misleading documentation?

bethskurrie
2020-02-28 04:55
> I am leaning towards using provider-states to inject data in the QA database before running the provider test, but some of the dev have a preference of staging up a database prior to a test run.

bethskurrie
2020-02-28 04:55
You want your pact verification tests to be able to be run on a local developer machine.

bethskurrie
2020-02-28 04:55
That way you can know if you're going to break any consumers *before* you commit.

bethskurrie
2020-02-28 04:56
If you use a shared QA database, you would (I imagine) have to commit first, which would slow down your feedback loop.

akkoubak
2020-02-28 19:28
I am just trying to wrap my head around testing the service in the local box. How would that play into implementing contract testing in the pipeline? My theory was to commit and deploy changes, then run a canary/A-B type of test in the pipeline where you have multiple instances of the running service (stage vs prod). If stage pipeline fails, it rolls back to most recent stable version of master. Today our company is operating with a monolithic on-premise architecture that is being changed to a distributed model. This means we will be, initially, bringing in developed services from the legacy app to Azure and run contract testing for each service in isolation. Is that something you recommend, or do you have other thoughts in mind?

matt.fellows
2020-02-29 02:40
Contract tests aside, can you run unit tests in this thing? Can you run those on your local development machine?

matt.fellows
2020-02-29 02:41
If so, then you should definitely try to run your contract tests as part of that cycle. Running against a deployed environment is possible but adds some of the downsides of interested tests (in particular, the possibility of non-determinism)

paolaagudelo10
2020-02-29 13:48
Hi everyone, there is a way to retrieve the tags available in the pactBroker, according to the consumer tag versions, to build the url to verify in the provider side? i am working with pact-net in my provider side

paolaagudelo10
2020-02-29 13:51
something like "pactbroker.consumerVersionTags" but i want to verify it in my code building in the CI process, without dependency with the webhook broker

elliot.whiley94
2020-03-01 20:47
has joined #pact-net

sliu7
2020-03-04 06:01
I'm seeing similar behaviour on OSX too. It versions the verification result with the ProviderVersion but does not add any tags

neil
2020-03-05 01:04
Thanks for extra info, I?ll have a look into it.

neil
2020-03-05 14:32
So it turns out that option was added accidentally. If you want to use ProviderTags, you set it by using `.PactBroker` rather than `.PactUri` when configuring the broker url and auth settings ect. The `PactBroker` method will give you the option to supply `providerVersionTags` .


neil
2020-03-05 14:33
I?ll remove the `ProviderTags` from `PactVerifierConfig` now

sliu7
2020-03-06 03:15
Yup, using `.PactBroker` and giving the `providerVersionTags` works. Thanks! Any specific reason why we're wrapping the tags in quotes? Using `pactPublisher.PublishToBroker` on the consumer side tags it with the string without any wrapper in quotes

sliu7
2020-03-06 06:37
Also, using the consumerVersionTags don't seem to be applied. I have a consumer contract with `test` tag but running the verification doesn't verify the contract ```.PactBroker("<<pactBrokerUri>>", consumerVersionTags: new List<string> { "test" });```

sliu7
2020-03-06 06:38
But removing the consumerVersionTags verifies the contract with `master` tag

akkoubak
2020-03-06 20:45
Yes, when testing locally, a localhost is running in the a developer's box where we can test all the changes before deployment. Does that mean that we need to implement PACT as a manual step before merging? If that's the idea, then I am suspecting that we tag branch name on both provider and consumer sides, publish branch contract to broker, test branch provider against branch contract, merge branch contract into master contract , test branch provider against master contract, and then merge branch provider into master?

matt.fellows
2020-03-07 10:49
I wouldn't say as a "manual step" - it's all automatible. But yes something like you described is correct. There are a few pages about effective Pact setup on http://docs.pact.io that can help you think about it

neil
2020-03-08 10:56
It?s usually to handle spaces in the value and things like that

neil
2020-03-08 10:56
Any reason not to wrap in quotes?

neil
2020-03-08 10:57
Pretty sure I tested the consumer tags and it worked

neil
2020-03-08 11:06
Just tested it again and it worked for me. What PactNet version are you running? Maybe try updating to the latest if you haven?t already.

sliu7
2020-03-08 22:56
Yup, it's working for me now. Thanks! I was using 2.5.1 and updating to 2.5.2 worked :slightly_smiling_face:

dikili
2020-03-11 09:54
has joined #pact-net

dikili
2020-03-11 14:43
Hi All, I am new to CDCT and some help would be greatly appreciated, I use pactflow and able to publish the pact via my consumer code but for my provider i want to do the verification of that pact this fails on the PactVerifier last step , with the following error; /// PactNet.PactFailureException: 'Pact verification failed. See output for details. If the output is empty please provide a custom config.Outputters (IOutput) for your test framework, as we couldn't write to the console.' Help would greatly appreciated my code is as below; var comp= new PactClient(); /* //this is calling the api endpoint /pacts/provider/provider/consumer/Service_Consumer/latest to retrieve the pact file which works fine */ var pact= comp.GetPact(); var config = new PactVerifierConfig { Outputters = new List<IOutput> { new XUnitOutput(_output) }, ProviderVersion = "1.0.0", PublishVerificationResults = true, CustomHeaders = new Dictionary<string, string> { { "Authorization", "Bearer xxxxx" } }, }; IPactVerifier pactVerifier = newPactVerifier(config); pactVerifier.ServiceProvider("Service_Consumer", "https://dev-api-endpoint.com") .HonoursPactWith("contract") .PactBroker(pact.ResponseUri.AbsoluteUri) .Verify( description: "A request is made", providerState: "A GET request for getting titles is submitted");

neil
2020-03-11 23:41
What does the logs/output say? Without that info, I can?t tell what the problem is.

neil
2020-03-11 23:42
Is the value of `pact.ResponseUri.AbsoluteUri` the base Pactflow url?

neil
2020-03-11 23:42
Also I don?t understand why you need to do: ```var comp= new PactClient(); var pact= comp.GetPact();```

neil
2020-03-12 09:24
I think you want to checkout, the below line in the readme ```.PactBroker("http://pact-broker", uriOptions: new PactUriOptions("sometoken"), enablePending: true, consumerVersionTags: new List<string> { "master" }, providerVersionTags: new List<string> { "master" }, consumerVersionSelectors: new List<VersionTagSelector> { new VersionTagSelector("master", false, true) })```

neil
2020-03-12 09:25
Using: ```CustomHeaders = new Dictionary<string, string> { { "Authorization", "Bearer xxxxx" } }``` is not the way to specify your broker/pactflow token (if that?s what it is in your example)

dikili
2020-03-12 12:27
yes the url was not correct that was the issue for the test not passing now it passes but now the issue is even though PactFlow dashboard should reflect the verification for some reason it is not.

dikili
2020-03-12 12:28
i do it to call pactflow api to get the pact from the broker url and it returns be the published pact. i thought it wd make more sense for the provider test to find the pact first.

dikili
2020-03-12 12:39
@neil I submitted the logs, compare to yesterday definitely it is better but now only problem i face is the dashboard does not reflect the verification and i do not see any errors

dikili
2020-03-12 12:42
i believe it can not find any interactions as in the logs but normally it should have ??

dikili
2020-03-12 12:44
in the pact file which is json, i see that there is an interactions section on there which is not empty

bethskurrie
2020-03-12 19:50
@dikili if you can copy the latest version of your code into a gist we can have a look.

bethskurrie
2020-03-12 19:51
@neil what happens to the stdout from the Ruby code? Does it get printed or saved anywhere? It should say that it's either published or not published the verification results.

neil
2020-03-12 23:36
Yeah that?s a fun one. Some test runners in .NET redirect stdout way from the console, that?s what the Outputters part of the PactVerifierConfig is.

neil
2020-03-12 23:51
Please use these channels rather than direct message, that way others can help and this can hopefully help others. Any logs should be formatted and any not useful or sensitive information removed/redacted.

bethskurrie
2020-03-13 05:55
Righto

matt.fellows
2020-03-13 06:12
if anyone is interested in joining the .NET team as a core maintainer, please reach out - we have a number of big items on our roadmap that will require significant investment and collaboration across the group. For example: v3.0, better messages support, gRPC/Protobufs and more. Pact has open many doors for the core team, we?d love to help open some for you too

pbarrientos
2020-03-13 15:27
@dperez

dperez
2020-03-13 15:38
Hi @matt.fellows , @pbarrientos and myself we are highly interested to contribute to the team.

matt.fellows
2020-03-13 22:24
Amazing folks. I?ll tee up a chat

christian.johann.eder
2020-03-27 08:47
Cross posting from the protobuf channel: Just wanted to share that I finally managed to release my custom pact implementation with support for protobuf serialization. It?s compatible with the pact spec v2 (I.e. makes the specs tests green), and is available for .NET Standard 2.0 https://github.com/ChristianEder/impact The path I took allows to add custom serialization formats - such as protobuf - in addition to Json, and also to exchange the transport layer (out of the box, I support HTTP) at will. Pleased let me know what you think!

lbraymusso
2020-04-02 05:43
has joined #pact-net

siddharth.gupta
2020-04-08 07:28
has joined #pact-net

siddharth.gupta
2020-04-08 07:37
Hi there , I am beginner with Pact , I have been able to run consumer and provider tests provided at https://github.com/pact-foundation/pact-net. But I have question for the experts , when we test the provider APIs which interacts with and external component for example a SQL db , how do we deal with such scenario when running contract tests on local developer machine . As we do not deploy the services instead use self hosted routing .


siddharth.gupta
2020-04-08 09:48
Could not find relation 'pb:latest-provider-pacts' in resource at https://variantest.pact.dius.com.au/pacts/provider/Event%20API/consumer/Event%20API%20Consumer/latest-untagged (Pact::Hal::RelationNotFoundError)

siddharth.gupta
2020-04-08 09:48
Can anyone help on this ?

siddharth.gupta
2020-04-08 09:51
v

siddharth.gupta
2020-04-08 09:52
pactVerifier .ProviderState($"{serviceUri}/provider-states") .ServiceProvider("Event API", serviceUri) .HonoursPactWith("Event API Consumer") //.PactUri($"..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}Consumer.Tests{Path.DirectorySeparatorChar}pacts{Path.DirectorySeparatorChar}event_api_consumer-event_api.json") .PactBroker("https://test.pact.dius.com.au/pacts/provider/Event%20API/consumer/Event%20API%20Consumer/latest-untagged", new PactUriOptions("rALSJLBCK;JDVBK")) .Verify();

bethskurrie
2020-04-08 10:50
Do you have a very very old version of the Pact Broker?

bethskurrie
2020-04-08 10:51
Oh, right, you're on Pactflow. Have a look at the resource.

bethskurrie
2020-04-08 10:52
Oh, I see.

bethskurrie
2020-04-08 10:52
You just need the base url of the Pact Broker

bethskurrie
2020-04-08 10:53
You're putting the pact url in.

bethskurrie
2020-04-08 10:54
You either give it the pact uri, which is the full url to the pact, or you give it the provider name and the base url of the Pact Broker, and it will fetch the pacts automatically for you.

siddharth.gupta
2020-04-08 12:06
thanks for the reply Beth , when I used PactURI the was passed but the verification status was not updated on Pactflow . I also tried setting up PublishVerificationResutls to true , but got an error . I am strill struggling to successfully use PactBroker even with just the baseuri , most of the time I am getting 301 status code . can you point me to some examples with .NET , where .Also how can I publish the tag and version for consumer while pushing Pact file to PactFlow ?

matt.fellows
2020-04-08 13:19
Siddharth, did the example I share with you the other day not work?

matt.fellows
2020-04-08 13:20
OH! I did not push, that would explain that



matt.fellows
2020-04-08 13:21
I hope this clears things up

siddharth.gupta
2020-04-09 05:08
Thanks Matt , I was able to pus back the verification results using Pacturi by specifying ProviderVersikon in PactverifyerConfig . Above code and document also helps me . I am going to try my hands with webhook today and let you know if I have any questions , Can I delete the Pact file from pactflow as developer account supports only one pact file ?

matt.fellows
2020-04-09 05:10
It should support up to 5 contracts, but yes you can delete

matt.fellows
2020-04-09 05:10
the API supports it via a `DELETE`

matt.fellows
2020-04-09 05:11
we don?t yet have a UI option in the new style, but if you go to `use old UI` you can delete from there

siddharth.gupta
2020-04-09 06:09
thanks

rahulpandey8920
2020-04-12 19:27
has joined #pact-net

rahulpandey8920
2020-04-14 21:05
Hello, I was looking at the example code to setup the mock providers within the consumer unit tests and it makes me think if specific implementation of `ProviderServiceRequest` and `ProviderServiceResponse` would be useful to make the setup a little compact ? so that we could do something like ```_mockProviderService .Given("There is a something with id 'tester'") .UponReceiving("A GET request to retrieve the something") .With(new JsonGetRequest("/somethings/tester") .WillRespondWith(new JsonOkResponse { Body = new { id = "tester", firstName = "Totally", lastName = "Awesome" } );```

paolaagudelo10
2020-04-15 16:59
Hi everyone, someone can help me with this problem? The broker is already up because the test are verified, but when try to publish the verification result to the broker, the result the following message appears pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.2/lib/pact/provider/verification_results/publish.rb:103:in `publish_verification_results': Error returned from verification results publication 500 {"error"=>{"message"=>"An error has occurred. The details have been logged with the reference agMzWQbfmU", "reference"=>"agMzWQbfmU"}} (Pact::Provider::VerificationResults::PublicationError) i am using "PactNet.Linux.x64" Version="2.5.3" in a jenkins pipeline

jan.falek
2020-04-16 13:16
has joined #pact-net

akkoubak
2020-04-30 23:45
Hello, I am attempting to validate the following contract for a provider that returns an array of objects: using the eachLike matcher method: ```{ "consumer": { "name": "assignmentApolloGQL" }, "provider": { "name": "CWS" }, "interactions": [ { "description": "An existing assignment Id", "providerState": "default", "request": { "method": "POST", "path": "/EndPoints/Cloud/Assignment/AssignmentService.svc/RawJSON/GetAssignmentStatuses", "headers": { "Content-Type": "application/json;charset=utf-8" }, "body": { "skip": 0, "top": 10, "assignmentNumber": 4961 } }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": [ { "friendlyId": "4961", "assignmentId": "a425c44e-868e-4bb4-b80e-ad64d1060011", "status": "Expired", "subStatus": "N/A", "approvalStatus": "Extension in Progress", "modifyDate": "0001-01-01T05:00:00Z", "clientName": "Foggy" } ], "matchingRules": { "$.body": { "min": 1 }, "$.body[*].*": { "match": "type" } } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } }``` The payload that provider returns a payload that looks like this: `[`     `{`         `"friendlyId": "4961",`         `"assignmentId": "a425c44e-868e-4bb4-b80e-ad64d1060011",`         `"status": "Expired",`         `"subStatus": "Extension in Progress",`         `"approvalStatus": "HM Approval",`         `"modifyDate": "0001-01-01T05:00:00Z",`         `"clientName": "Foggy"`     `}` `]` However, when validating the provider I am getting the following error: `Failures:` `1) Verifying a pact between assignmentApolloGQL and CWS Given default An existing assignment Id with POST /EndPoints/Cloud/Assignment/AssignmentService.svc/RawJSON/GetAssignmentStatuses returns a response which has a matching body` `Failure/Error: let(:response_body) { parse_body_from_response(response) }` `JSON::ParserError:` `757: unexpected token at '???[{"friendlyId":"4961","assignmentId":"a425c44e-868e-4bb4-b80e-ad64d1060011","status":"Expired","subStatus":"Extension in Progress","approvalStatus":"HM Approval","modifyDate":"0001-01-01T05:00:00Z","clientName":"Foggy"}]'` `1 interaction, 1 failure` `Failed interactions:` `To re-run just this failing interaction, change the verify method to '.Verify(description: "An existing assignment Id", providerState: "default")'. Please do not check in this change! # An existing assignment id given default` `WARN: Cannot publish verification for assignmentApolloGQL as there is no link named pb:publish-verification-results in the pact JSON. If you are using a pact broker, please upgrade to version 2.0.0 or later.`

akkoubak
2020-04-30 23:49
Also here is the log from the provider: ```I, [2020-04-30T19:44:30.265610 #19644] INFO -- : Running example 'Verifying a pact between assignmentApolloGQL and CWS Given default An existing assignment Id with POST /EndPoints/Cloud/Assignment/AssignmentService.svc/RawJSON/GetAssignmentStatuses returns a response which has status code 200' I, [2020-04-30T19:44:30.574623 #19644] INFO -- : Sending POST request to path: "/EndPoints/Cloud/Assignment/AssignmentService.svc/RawJSON/GetAssignmentStatuses" with headers: {"CONTENT_TYPE"=>"application/json;charset=utf-8", "HTTP_X_PACT_ORIGINAL_HEADER_NAMES"=>"Content-Type", "X_PACT_PROVIDER_STATES"=>[{"name"=>"default"}]}, see debug logs for body D, [2020-04-30T19:44:30.574623 #19644] DEBUG -- : body :{"skip":0,"top":10,"assignmentNumber":4961} I, [2020-04-30T19:44:35.295607 #19644] INFO -- : Received response with status: 200, headers: {my headers"}, see debug logs for body D, [2020-04-30T19:44:35.296614 #19644] DEBUG -- : body: [{"friendlyId":"4961","assignmentId":"a425c44e-868e-4bb4-b80e-ad64d1060011","status":"Expired","subStatus":"Extension in Progress","approvalStatus":"HM Approval","modifyDate":"0001-01-01T05:00:00Z","clientName":"Foggy"}]```

bethskurrie
2020-04-30 23:50
I can't see anything immediately wrong. You've got an array as a top level element, but that should be supported.

bethskurrie
2020-04-30 23:50
Can you try and reproduce it using this repository, so we can take a look at it? https://github.com/pact-foundation/pact-ruby-standalone-e2e-example

bethskurrie
2020-04-30 23:51
This is an example using the underlying engine that Pact Net uses.

bethskurrie
2020-04-30 23:51
That will help us identify where the issue lies.

matt.fellows
2020-05-01 00:10
maybe also check the headers that are coming back. I looked at your logs just there and saw ?my headers? - not sure if you edited it. Thtis being said, I?m pretty sure another issue would first show up

matt.fellows
2020-05-01 00:11
If you can cURL that endpoint and share the fully headers/response body, that would be useful

akkoubak
2020-05-01 00:16
Hi Matt, I omitted the headers here is the full log: `I, [2020-04-30T20:14:22.866006 #40704] INFO -- : Running example 'Verifying a pact between assignmentApolloGQL and CWS Given default An existing assignment Id with POST /EndPoints/Cloud/Assignment/AssignmentService.svc/RawJSON/GetAssignmentStatuses returns a response which has status code 200'` `I, [2020-04-30T20:14:23.164009 #40704] INFO -- : Sending POST request to path: "/EndPoints/Cloud/Assignment/AssignmentService.svc/RawJSON/GetAssignmentStatuses" with headers: {"CONTENT_TYPE"=>"application/json;charset=utf-8", "HTTP_X_PACT_ORIGINAL_HEADER_NAMES"=>"Content-Type", "X_PACT_PROVIDER_STATES"=>[{"name"=>"default"}]}, see debug logs for body` `D, [2020-04-30T20:14:23.164009 #40704] DEBUG -- : body :{"skip":0,"top":10,"assignmentNumber":4961}` `I, [2020-04-30T20:14:27.620041 #40704] INFO -- : Received response with status: 200, headers: {"Date"=>"Fri, 01 May 2020 00:14:27 GMT", "Content-Type"=>"application/json", "Content-Length"=>"223", "Connection"=>"keep-alive", "Set-Cookie"=>"__cfduid=d4e63f8909d64d03ead55af65d25b03491588292066; expires=Sun, 31-May-20 00:14:26 GMT; path=/; domain=.http://beeline.com; HttpOnly; SameSite=Lax\n.BEEAUTH_qa059=4c04bcea-5a60-4663-891b-e76f2d652312; expires=Sun, 03-May-2020 00:14:27 GMT; path=/; secure; HttpOnly\na74qacl051=qaweb403.sfld; path=/; HttpOnly; Secure\n__cfruid=515b3ca5ba0b16ce5ab42e254ddf44ee65cf8261-1588292067; path=/; domain=.http://beeline.com; HttpOnly; Secure; SameSite=None", "Cache-Control"=>"private", "Strict-Transport-Security"=>"max-age=300; includeSubDomains; preload; always;", "Content-Security-Policy"=>"frame-ancestors *.http://beeline.com *.http://iqnavigator.com *.http://iqnavigator.eu *.http://beeline.to *.http://beelinetowork.io` `http://beeline.to` `http://beelinetowork.io` `https://beebot-bot-sales.azurewebsites.net` `https://beebot-bot-prod.azurewebsites.net` `https://beebot-bot-proj.azurewebsites.net` `https://beebot-bot-hfreg.azurewebsites.net` `https://beebot-bot-reg.azurewebsites.net` `https://beebot-bot-pct.azurewebsites.net` `https://beebot-bot-qa.azurewebsites.net` `https://beebot-bot-hfqa.azurewebsites.net` `https://cdn.botframework.com` `` `https://directline.botframework.com", "X-Xss-Protection"=>"1", "Totalserverpagetime"=>"569", "Cdnheader"=>"{\"AuthenticationDate\":\"2020-05-01T00:14:27.5297229Z\",\"AuthenticationType\":\"Auth0CwsLogin\",\"ImpersonationType\":\"Self\",\"UserName\":\"gmurray\",\"OrganizationType\":\"Beeline\",\"Organization\":null,\"ImpersonateeUserName\":null,\"ImpersonateeOrganizationType\":null,\"ImpersonateeOrganization\":null,\"CFRAY\":\"58c54d6a6ce7e3c2-DTW\"}", "X-Content-Type-Options"=>"nosniff", "X-Ua-Compatible"=>"IE=edge", "Accept-Ranges"=>"bytes", "Cf-Cache-Status"=>"DYNAMIC", "Expect-Ct"=>"max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"", "Server"=>"cloudflare", "Cf-Ray"=>"58c54d6a6ce7e3c2-ATL", "Cf-Request-Id"=>"026f2eb6830000e3c259184200000001"}, see debug logs for body` `D, [2020-04-30T20:14:27.620041 #40704] DEBUG -- : body: [{"friendlyId":"4961","assignmentId":"a425c44e-868e-4bb4-b80e-ad64d1060011","status":"Expired","subStatus":"Extension in Progress","approvalStatus":"HM Approval","modifyDate":"0001-01-01T05:00:00Z","clientName":"Foggy"}]`

kaypee90
2020-05-01 00:18
has joined #pact-net

akkoubak
2020-05-01 00:29
Hi Beth, I can certainly do that, my only concern is that I am passing a JWT as a custom header on the provider side, not sure if I'd be allowed to include it in my forked solution. Do you want me to fork it without the JWT?

bethskurrie
2020-05-01 00:30
yes, it shouldn't affect the repro.

bethskurrie
2020-05-01 00:30
the standalone example doesn't actually include any pact net code - it's doing the bare minimum to reproduce an issue.

bethskurrie
2020-05-01 00:31
it looks like the issue is in the body

matt.fellows
2020-05-01 00:42
Abdel - for future code posts, can you try using the triple backtick? That will format the code much better

matt.fellows
2020-05-01 00:46
in any case - it looks OK to my eyes

akkoubak
2020-05-01 00:48
Sorry, if it helps: ```I, [2020-04-30T20:14:22.866006 #40704] INFO -- : Running example 'Verifying a pact between assignmentApolloGQL and CWS Given default An existing assignment Id with POST /EndPoints/Cloud/Assignment/AssignmentService.svc/RawJSON/GetAssignmentStatuses returns a response which has status code 200' I, [2020-04-30T20:14:23.164009 #40704] INFO -- : Sending POST request to path: "/EndPoints/Cloud/Assignment/AssignmentService.svc/RawJSON/GetAssignmentStatuses" with headers: {"CONTENT_TYPE"=>"application/json;charset=utf-8", "HTTP_X_PACT_ORIGINAL_HEADER_NAMES"=>"Content-Type", "X_PACT_PROVIDER_STATES"=>[{"name"=>"default"}]}, see debug logs for body D, [2020-04-30T20:14:23.164009 #40704] DEBUG -- : body :{"skip":0,"top":10,"assignmentNumber":4961} I, [2020-04-30T20:14:27.620041 #40704] INFO -- : Received response with status: 200, headers: {"Date"=>"Fri, 01 May 2020 00:14:27 GMT", "Content-Type"=>"application/json", "Content-Length"=>"223", "Connection"=>"keep-alive", "Set-Cookie"=>"__cfduid=d4e63f8909d64d03ead55af65d25b03491588292066; expires=Sun, 31-May-20 00:14:26 GMT; path=/; domain=.http://beeline.com; HttpOnly; SameSite=Lax\n.BEEAUTH_qa059=4c04bcea-5a60-4663-891b-e76f2d652312; expires=Sun, 03-May-2020 00:14:27 GMT; path=/; secure; HttpOnly\na74qacl051=qaweb403.sfld; path=/; HttpOnly; Secure\n__cfruid=515b3ca5ba0b16ce5ab42e254ddf44ee65cf8261-1588292067; path=/; domain=.http://beeline.com; HttpOnly; Secure; SameSite=None", "Cache-Control"=>"private", "Strict-Transport-Security"=>"max-age=300; includeSubDomains; preload; always;", "Content-Security-Policy"=>"frame-ancestors *.http://beeline.com *.http://iqnavigator.com *.http://iqnavigator.eu *.http://beeline.to *.http://beelinetowork.io http://beeline.to http://beelinetowork.io https://beebot-bot-sales.azurewebsites.net https://beebot-bot-prod.azurewebsites.net https://beebot-bot-proj.azurewebsites.net https://beebot-bot-hfreg.azurewebsites.net https://beebot-bot-reg.azurewebsites.net https://beebot-bot-pct.azurewebsites.net https://beebot-bot-qa.azurewebsites.net https://beebot-bot-hfqa.azurewebsites.net https://cdn.botframework.com https://directline.botframework.com", "X-Xss-Protection"=>"1", "Totalserverpagetime"=>"569", "Cdnheader"=>"{\"AuthenticationDate\":\"2020-05-01T00:14:27.5297229Z\",\"AuthenticationType\":\"Auth0CwsLogin\",\"ImpersonationType\":\"Self\",\"UserName\":\"gmurray\",\"OrganizationType\":\"Beeline\",\"Organization\":null,\"ImpersonateeUserName\":null,\"ImpersonateeOrganizationType\":null,\"ImpersonateeOrganization\":null,\"CFRAY\":\"58c54d6a6ce7e3c2-DTW\"}", "X-Content-Type-Options"=>"nosniff", "X-Ua-Compatible"=>"IE=edge", "Accept-Ranges"=>"bytes", "Cf-Cache-Status"=>"DYNAMIC", "Expect-Ct"=>"max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"", "Server"=>"cloudflare", "Cf-Ray"=>"58c54d6a6ce7e3c2-ATL", "Cf-Request-Id"=>"026f2eb6830000e3c259184200000001"}, see debug logs for body D, [2020-04-30T20:14:27.620041 #40704] DEBUG -- : body: [{"friendlyId":"4961","assignmentId":"a425c44e-868e-4bb4-b80e-ad64d1060011","status":"Expired","subStatus":"Extension in Progress","approvalStatus":"HM Approval","modifyDate":"0001-01-01T05:00:00Z","clientName":"Foggy"}]```

matt.fellows
2020-05-01 00:51
:slightly_smiling_face:

matt.fellows
2020-05-01 00:51
ALl good, that?s better - but unfortunately I still can?t see why it might be failing :disappointed:

akkoubak
2020-05-01 02:25
Hi Beth, I am attempting to install the correct version of the app which is 1.80.1. However, I am running on a windows machine. Does the script support windows? If not, is there a manual way around it?

bethskurrie
2020-05-01 04:52
No, it doesn't support Windows, sorry. You don't have cygwin?

bethskurrie
2020-05-01 04:53
You can always push your changes and they'll run on Travis.

bethskurrie
2020-05-01 04:53
It's a very quick build.

rahulpandey8920
2020-05-05 09:17
Is there any work being done for incorporating pact specification version 3.0 in PactNet ? So that it can be used for contract testing with things like kafka streams ?

bethskurrie
2020-05-05 09:17
Someone was working on message pact for .net

bethskurrie
2020-05-05 09:18
I think they lost momentum on it though.


rahulpandey8920
2020-05-05 09:19
Thanks for the quick response @bethskurrie !

a.smith
2020-05-07 08:18
has joined #pact-net

bethskurrie
2020-05-08 03:23
Hey .net people - anyone have some free lockdown time and interested in helping with this feature? https://pact.canny.io/feature-requests/p/create-e2e-example-that-runs-on-appveyor-or-similar-to-help-diagnose-issues

priyafa
2020-05-08 13:38
has joined #pact-net

priyafa
2020-05-08 13:43
Hi there, I am a QA engineer. I am just very new to contract testing and read about PACT online today. I am not sure this is the right place to ask. Please redirect me if not. I would like to know whether its right to use PACT in my scenario. I have a rest api to test, which takes data from a third party wcf service , process and gives some result. Can someone please advice ? THanks in advance

neil
2020-05-10 23:18
You probably won?t be able to test the WCF part, but you likely can test between your consumers and the rest api, if it?s JSON based.

neil
2020-05-10 23:19
I?m guessing the WCF service is SOAP/XML based.

a.smith
2020-05-11 08:13
Hi @bethskurrie, I can probably help out with this :+1: The Ruby sample looks like a good source to crib from.

bethskurrie
2020-05-11 08:49
@a.smith that would be amazing!

bethskurrie
2020-05-11 08:51
We want the barest of bare bones end to end scenarios - it's not about showing best practice, it's about providing people with something they can quickly modify to demonstrate bugs or problems they're having.

a.smith
2020-05-11 09:18
The feature mentions AppVeyor. I'm happy to put it there, but just wanted to check what you use for CI in other repos, and whether you think it would be worthwhile keeping it all together?

bethskurrie
2020-05-11 09:18
Appveyor is the one I've used

bethskurrie
2020-05-11 09:19
As long as it's something that people can get a free oss account with their github account when they fork it, I'm not fussy though

bethskurrie
2020-05-11 09:19
Like, when you fork a github repo, you can see the Travis build comes pretty much automatically if you have a Travis account.

bethskurrie
2020-05-11 09:21
It looks like Travis does Windows now though.


bethskurrie
2020-05-11 09:22
They didn't when I set up the appveyor builds years ago. Travis would be my preference, if it's available for oss projects, because all our other builds are on Travis

a.smith
2020-05-11 09:32
:+1: Also .NET does not-Windows now :wink:

a.smith
2020-05-11 09:33
Let's go with Travis then. I've taken a fork of the Ruby repo and will see what I can do with this over the next few days

lewis.thorley
2020-05-11 10:11
has joined #pact-net

bethskurrie
2020-05-14 22:01
Awesome sauce @a.smith

bethskurrie
2020-05-14 22:02
> Also .NET does not-Windows now We seem to have more people with http://Pact.NET problems with Windows on than we do on not-Windows :cry:

a.smith
2020-05-15 06:32
Ah well, between my work laptop and my personal laptop, I've Windows, macOS and Ubuntu covered, so... :crossed_fingers:

arindam.datta
2020-05-23 15:42
has joined #pact-net

arindam.datta
2020-05-23 15:44
Hi, any plan soon to support message pact as per v3 spec?

matt.fellows
2020-05-24 09:48
There is an active branch, I suggest jump on the PR for it and help vote/get it thru

a.smith
2020-05-25 14:14
I?m about done with this, just trying to wrap my head around the build bits. I?m trying to port the Rakefiles directly to PowerShell?s Invoke-Build, but am somewhat struggling with the provider?s tasks, as I _think_ the magic appears to be mostly within imported gems, and I don?t understand the comment about doing the whole publish-verify flow in Rake. I?ve pushed what I?ve done so far for some feedback: https://github.com/alastairs/pact-net-e2e-example/tree/dotnet-port

a.smith
2020-05-25 14:17
Sharing here because I forgot to tick the necessary box :upside_down_face:

bethskurrie
2020-05-26 03:49
Hi @a.smith

bethskurrie
2020-05-26 03:51
I'm just having a look at your net port of the rake tasks.

bethskurrie
2020-05-26 03:58
@a.smith have sent you a PM

bethskurrie
2020-05-26 04:00
PactNet maintainers, I've made a new branch, message-pact-2, which has the latest changes from master, merged into the message-pact branch. I didn't do a straight merge, because I am not a pact-net maintainer or even a .net developer, so I didn't want to screw anything up, but we have a Pactflow customer who is already using the message branch who needs some of the fixes from master. cc @neil

neil
2020-05-26 04:18
:thumbsup: I?ll get master merged into message-pact

bethskurrie
2020-05-26 04:18
Ta. Who knows what's outstanding on the message work?

neil
2020-05-26 04:18
TODO.txt

bethskurrie
2020-05-26 04:18
Our customer is already using it quite happily apparently.

bethskurrie
2020-05-26 04:18
cool

neil
2020-05-26 04:20
It?s not crazy far off, it just lost momentum as the person who was driving it just disappeared (I?m guessing got super busy with other stuff)

bethskurrie
2020-05-26 04:20
We all know what that's like.

bethskurrie
2020-05-26 04:20
The problem with OSS. Lost momentum due to lack of free time.

neil
2020-05-26 04:21
Yep, it?s constant struggle. I always feel bad for not putting in more time.

bethskurrie
2020-05-26 04:21
I didn't do much the year the bots were born.

a.smith
2020-05-26 11:14
Has anyone successfully used Pact-Net with Azure Event Grid?

neil
2020-05-27 14:08
I have just merged master into the `message-pact` branch. Are you ok with me deleting `message-pact-2` ?

arindam.datta
2020-06-01 12:39
hi, can anyone please redirect me towards a sample implementation of CDC using pact-net? I got the Consumer side. But I am struggling to understand the provider verification part. I feel that the ".net workshop" thing is incomplete and misleading.

arindam.datta
2020-06-01 12:40
I am looking forward to kind of a more complete implementation...

a.smith
2020-06-01 13:37
@arindam.datta Can you elaborate on what you're missing?

arindam.datta
2020-06-01 17:18
If I am not missing anything, following are the things which seem either incomplete or erroneous to me: ? the Provider test project doesn't have any relation with the actual Project api project ? Any endpoint except "/provider-states" throws 404

a.smith
2020-06-01 18:54
Gotcha. This side of things is a bit confusing :slightly_smiling_face: The Provider tests are almost a framework for running the API project and executing the pacts against it. There?s a lot of boilerplate to running Provider tests in .NET right now. https://github.com/pact-foundation/pact-net#2-tell-the-provider-it-needs-to-honour-the-pact is where you should start; the `using` statement ~50% through the first code sample starts the API project and tells it the URL on which it should listen: in this sample, that URI is `http://localhost:9222`. Note from the second code sample that the `TestStartup` class composes an instance of `Startup` from your API project and the `ProviderStateMiddleware`. This middleware is a test-only piece of boilerplate, and is included to support the `state` item from the Pact specification. If you?ve not added any State lines to your pacts, you don?t need this bit. The `ProviderStateMiddleware` is a door into your API project, that allows you to put it into the appropriate state for that part of the pact. It is called by Pact on the `/provider-states` endpoint, and maps the `state` string from the pact to an arbitrary action. The mapping is in `ProviderStateMiddleware.Invoke()` and the `_providerStates` dictionary, the specific example state and action are defined in the `ProviderStateMiddleware` constructor. To be honest, I found the provider states portion _really_ confusing until I talked it through at length with a colleague. I?d love to see this part of the library simplified for developers. For our use case, testing Azure Functions, we actually spin up the Azure Function application standalone, and run the `provider-states` route in a completely separate http://ASP.NET Core application, which monkeys around with the database (or whatever) on behalf of the Function. This of course assumes that the state is outside of the Function and not in-process somehow? Meaning no disrespect whatsoever to the library maintainers, the Pact-Net README is quite general (=> vague), and a bit out of date (=> confusing). You might find the https://github.com/pact-foundation/pact-net/tree/master/Samples/EventApi/Provider.Api.Web.Tests clearer, especially if you step through it with the debugger.

matt.fellows
2020-06-02 00:54
> To be honest, I found the provider states portion really confusing until I talked it through at length with a colleague. I?d love to see this part of the library simplified for developers. For our use case, testing Azure Functions, we actually spin up the Azure Function application standalone, and run the provider-states route in a completely separate http://ASP.NET Core application, which monkeys around with the database (or whatever) on behalf of the Function. This of course assumes that the state is outside of the Function and not in-process somehow? that?s a decent strategy, but does require knowledge

matt.fellows
2020-06-02 00:54
Agree, provider states are hard to wrap your head around

matt.fellows
2020-06-02 00:54
(also, thanks heaps for that workshop)

matt.fellows
2020-06-02 00:55
@arindam.datta you might want to check out https://github.com/pact-foundation/pact-workshop-js. It?s a solid workshop that explains all of the concepts (in JS). But they should translate across to .NET pretty well

arindam.datta
2020-06-04 08:19
Thanks @matt.fellows. I am already doing that. things are so neat with Node and so clumsy with .Net.

arindam.datta
2020-06-04 08:20
@a.smith, thanks for such a detailed response. It was really helpful. Indeed the other sample test project which you mentioned was somewhat clearer than the workshop samples.

a.smith
2020-06-04 08:45
Glad it helped @arindam.datta :slightly_smiling_face:

arindam.datta
2020-06-08 16:16
Hi, my provider verification tests running inside docker container fails even though the interaction is passed. The logs from the container as below: `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/pact_spec_runner.rb:34:in `run'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:69:in `run_with_pact_uri_object'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:50:in `run_specs'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:21:in `call'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:13:in `call'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:169:in `verify_pact'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:43:in `block in call'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:42:in `collect'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:42:in `call'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:34:in `call'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/cli/verify.rb:56:in `verify'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'` `from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/app/pact-provider-verifier.rb:33:in `<main>'` `DEBUG: This pact is still in pending state for ProviderSvc as the successful verification results have not yet been published.` `Test Run Failed.` `Total tests: 1` `Failed: 1` `Total time: 13.6085 Seconds` `The command '/bin/sh -c dotnet test "./tests/ProviderSvc.Tests/ProviderSvc.Tests.csproj"' returned a non-zero code: 1` `##[error]The command '/bin/sh -c dotnet test "./tests/ProviderSvc.Tests/ProviderSvc.Tests.csproj"' returned a non-zero code: 1` `##[error]The process '/usr/bin/docker' failed with exit code 1`

arindam.datta
2020-06-08 16:17
Wheras, the interaction is passed: `Content-Type: "application/json"` `I, [2020-06-08T16:06:17.959905 #146] INFO -- response: Status 200` `D, [2020-06-08T16:06:17.960059 #146] DEBUG -- response: connection: "close"` `date: "Mon, 08 Jun 2020 16:06:17 GMT"` `server: "Kestrel"` `transfer-encoding: "chunked"` `has status code 200` `has a matching body` `includes headers` `"Content-Type" which equals "application/json; charset=utf-8"` `1 interaction, 0 failures`

arindam.datta
2020-06-08 16:18
Can anyone please give me a clue what I am doing wrong?

arindam.datta
2020-06-08 16:21
Can anyone please provide me a clue where I am going wrong about this :point_up:?

a.smith
2020-06-08 16:26
@arindam.datta your test failed: ```Test Run Failed. Total tests: 1 Failed: 1``` Do you have any assertions in your test, or just the pact verification?

arindam.datta
2020-06-08 16:27
hi @a.smith, I don't have any assertion. It's just the pact verification `verifier.Verify()` that's it.

arindam.datta
2020-06-08 16:28
However, you can also see, in the log that the interaction is passed (I have only one interaction)

arindam.datta
2020-06-08 16:28
Earlier the log was not complete. Let me give you the complete log.

arindam.datta
2020-06-08 16:29
```2020-06-08T16:06:20.0522439Z Verifying a pact between ConsumerSvc and ProviderSvc [PENDING] 2020-06-08T16:06:20.0523115Z Given Data doesn't exist for user username 2020-06-08T16:06:20.0523416Z A post request with ApiRequest 2020-06-08T16:06:20.0523675Z with POST /api/v1/home 2020-06-08T16:06:20.0523928Z returns a response which 2020-06-08T16:06:20.0524927Z DEBUG: Setting up provider state 'Data doesn't exist for user username' for consumer 'ConsumerSvc' using provider state set up URL http://localhost:9223/provider-states 2020-06-08T16:06:20.0526439Z I, [2020-06-08T16:06:17.783962 #146] INFO -- request: POST http://localhost:9223/provider-states 2020-06-08T16:06:20.0527420Z D, [2020-06-08T16:06:17.784182 #146] DEBUG -- request: User-Agent: "Faraday v0.17.3" 2020-06-08T16:06:20.0528037Z Content-Type: "application/json" 2020-06-08T16:06:20.0528675Z I, [2020-06-08T16:06:17.959905 #146] INFO -- response: Status 200 2020-06-08T16:06:20.0529423Z D, [2020-06-08T16:06:17.960059 #146] DEBUG -- response: connection: "close" 2020-06-08T16:06:20.0529841Z date: "Mon, 08 Jun 2020 16:06:17 GMT" 2020-06-08T16:06:20.0530108Z server: "Kestrel" 2020-06-08T16:06:20.0530564Z transfer-encoding: "chunked" 2020-06-08T16:06:20.0530831Z has status code 200 2020-06-08T16:06:20.0531079Z has a matching body 2020-06-08T16:06:20.0531319Z includes headers 2020-06-08T16:06:20.0531915Z "Content-Type" which equals "application/json; charset=utf-8" 2020-06-08T16:06:20.0532202Z 2020-06-08T16:06:20.0532386Z 1 interaction, 0 failures 2020-06-08T16:06:20.0534537Z /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:103:in `publish_verification_results': Error returned from verification results publication 400 {"errors"=>{"provider_version"=>["Version number 'default' cannot be parsed to a version number. The expected format (unless this configuration has been overridden) is a semantic version. eg. 1.3.0 or 2.0.4.rc1"]}} (Pact::Provider::VerificationResults::PublicationError) 2020-06-08T16:06:20.0536655Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:35:in `call' 2020-06-08T16:06:20.0537901Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish.rb:21:in `call' 2020-06-08T16:06:20.0542977Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish_all.rb:22:in `block in call' 2020-06-08T16:06:20.0544297Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish_all.rb:19:in `collect' 2020-06-08T16:06:20.0545823Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish_all.rb:19:in `call' 2020-06-08T16:06:20.0547094Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/verification_results/publish_all.rb:10:in `call' 2020-06-08T16:06:20.0548328Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/rspec/pact_broker_formatter.rb:28:in `close' 2020-06-08T16:06:20.0549557Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:209:in `block in notify' 2020-06-08T16:06:20.0550713Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:208:in `each' 2020-06-08T16:06:20.0552047Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:208:in `notify' 2020-06-08T16:06:20.0553195Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:243:in `close' 2020-06-08T16:06:20.0554349Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:196:in `close_after' 2020-06-08T16:06:20.0555523Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:174:in `finish' 2020-06-08T16:06:20.0556657Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/reporter.rb:76:in `report' 2020-06-08T16:06:20.0557836Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:115:in `run_specs' 2020-06-08T16:06:20.0558960Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:89:in `run' 2020-06-08T16:06:20.0560069Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/rspec-core-3.9.1/lib/rspec/core/runner.rb:71:in `run' 2020-06-08T16:06:20.0561244Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/pact_spec_runner.rb:88:in `run_specs' 2020-06-08T16:06:20.0562415Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/provider/pact_spec_runner.rb:34:in `run' 2020-06-08T16:06:20.0563674Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:69:in `run_with_pact_uri_object' 2020-06-08T16:06:20.0564897Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:50:in `run_specs' 2020-06-08T16:06:20.0566268Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:21:in `call' 2020-06-08T16:06:20.0567531Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-1.49.3/lib/pact/cli/run_pact_verification.rb:13:in `call' 2020-06-08T16:06:20.0568787Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:169:in `verify_pact' 2020-06-08T16:06:20.0570291Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:43:in `block in call' 2020-06-08T16:06:20.0571565Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:42:in `collect' 2020-06-08T16:06:20.0572803Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:42:in `call' 2020-06-08T16:06:20.0574026Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/app.rb:34:in `call' 2020-06-08T16:06:20.0575297Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/cli/verify.rb:56:in `verify' 2020-06-08T16:06:20.0576603Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' 2020-06-08T16:06:20.0577746Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' 2020-06-08T16:06:20.0578835Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' 2020-06-08T16:06:20.0579912Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' 2020-06-08T16:06:20.0581110Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.30.1/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start' 2020-06-08T16:06:20.0582231Z from /app/tests/ProviderSvc.Tests/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/app/pact-provider-verifier.rb:33:in `<main>' 2020-06-08T16:06:20.0582920Z DEBUG: This pact is still in pending state for ProviderSvc as the successful verification results have not yet been published. 2020-06-08T16:06:20.0583294Z 2020-06-08T16:06:20.0583412Z 2020-06-08T16:06:20.0583611Z 2020-06-08T16:06:20.0583987Z [91mTest Run Failed. 2020-06-08T16:06:20.0584396Z [0mTotal tests: 1 2020-06-08T16:06:20.0584633Z Failed: 1 2020-06-08T16:06:20.0611265Z Total time: 13.6085 Seconds 2020-06-08T16:06:20.6811884Z The command '/bin/sh -c dotnet test "./tests/ProviderSvc.Tests/ProviderSvc.Tests.csproj"' returned a non-zero code: 1 2020-06-08T16:06:20.6955808Z ##[error]The command '/bin/sh -c dotnet test "./tests/ProviderSvc.Tests/ProviderSvc.Tests.csproj"' returned a non-zero code: 1 2020-06-08T16:06:20.6968648Z ##[error]The process '/usr/bin/docker' failed with exit code 1 2020-06-08T16:06:20.6989096Z ##[section]Finishing: Docker Build```

arindam.datta
2020-06-08 16:32
@a.smith I think I found the issue. It could be this: ```1.49.3/lib/pact/provider/verification_results/publish.rb:103:in `publish_verification_results': Error returned from verification results publication 400 {"errors"=>{"provider_version"=>["Version number 'default' cannot be parsed to a version number. The expected format (unless this configuration has been overridden) is a semantic version. eg. 1.3.0 or ``` Seems like some configuration issue when running on CI build. So, the exception might be occurring while trying to publish with "not supported" version format.

matt.fellows
2020-06-08 23:27
If you?re verifying from a Pact Broker and publishing results, that makes sense

matt.fellows
2020-06-08 23:27
Looks like you should update the version property

tjones
2020-06-12 03:10
has joined #pact-net

tritorto
2020-06-15 01:50
Hi there - im keen to start using Pact with some of our serverless, event driven lambdas (AWS sqs event triggers) ... have done a bit of reading on Message Pact, which seems ideal for what we would want to implement, however it seems like this port may not be available for some time in http://Pact.Net. My question is, is there any advice or code samples on handling this scenario in the meantime? One thought i've had is, I could spin up a test web server and wrap our lambda with an api call, but if I can avoid all that extra boilerplate it would be good...

bethskurrie
2020-06-15 01:50
That's actually what happens under the hood.

bethskurrie
2020-06-15 01:51
There was some movement on the message branch - I believe some people are using it successfully already.

tritorto
2020-06-15 01:51
ahh interesting

bethskurrie
2020-06-15 01:51
I think it's mostly tests and refactoring that are outstanding. There's a TODO file on that branch that you can have a look at.

tritorto
2020-06-15 01:52
yea I took a look at the Todo - is there a way to get access to this? ie are they publishing the branch nuget package?

bethskurrie
2020-06-15 01:53
I'm not sure, sorry. I'm not a .net developer, so I don't know how they're doing it.

bethskurrie
2020-06-15 01:53
I'll ping the person who was doing it and find out how.

tritorto
2020-06-15 01:53
cool cool - thank you!!


bethskurrie
2020-06-15 05:58
Thanks @neil :slightly_smiling_face:


michaelphi
2020-06-16 02:40
has joined #pact-net

michaelphi
2020-06-16 02:50
Initially, we cloned the message-pact branch and use the PactNet project directly into our tests. Later on, we wanted to ensure that all test projects used the exact same version of PactNet, so we published it as a nuget package and shared it with all the test projects. We followed the instructions from https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#create-the-nuspec-file to build a nukpg based off a nuspec file. Neil's method is probably the simplest, so I would go with that approach first

tritorto
2020-06-16 07:34
Thanks for the updates

alexandre.cuva
2020-06-18 12:59
has joined #pact-net

baquinteros
2020-06-19 03:17
has joined #pact-net

baquinteros
2020-06-19 03:23
Hi there, When pulling from the broker and verifying on the provider side. Are the ServiceProvider/HonoursPactWith supposed to filter the contracts verified? pactVerifier .ServiceProvider("ProviderService", ServiceUri) .HonoursPactWith("ConsumerService") .PactBroker(PactBrokerUri, uriOptions: new PactUriOptions(PactBrokerUsername, PactBrokerPassword)) I have added a new ConsumerService2 contract for the ProviderService in the broker and it seems to be pulling/verifying that contract as well? PactNet 2.5.4 PactBroker https://hub.docker.com/layers/pactfoundation/pact-broker/2.57.0.0/images/sha256-b2c82e7533631074fbfc13f162d7ee3b474186f4cf1d26b28bfca2d3b11a1264?context=explore

bethskurrie
2020-06-19 03:24
if you give it broker credentials, it will pull all hte contracts

bethskurrie
2020-06-19 03:24
if you want to verify one contract, give it the direct URL

bethskurrie
2020-06-19 03:25
the HonoursPactWith is not meant to be used in conjuction with PactBroker

bethskurrie
2020-06-19 03:25
you can raise an issue to get those docs clarified

baquinteros
2020-06-19 03:27
Thanks for the fast response

bethskurrie
2020-06-19 03:27
We

bethskurrie
2020-06-19 03:27
We're fast when we're awake!

bethskurrie
2020-06-19 03:27
Most of the time everyone in Australia is going to bed or asleep when the questions get asked

matt.fellows
2020-06-19 05:08
At least Ben is one of the people in our TZ!

matt.fellows
2020-06-19 05:08
glad to see you guys moving ahead with it all despite COVID challenges

sklein
2020-06-19 19:35
has joined #pact-net

nouri.tawfik
2020-06-20 08:34
has joined #pact-net

nouri.tawfik
2020-06-26 13:50
Hello pact Team, Could you please help me to enable wip feature? The wip feature it's ready for. Net library, any additional configuration? Thanks

nouri.tawfik
2020-06-26 17:25
It seems my pact broker use old version It's working right now. Thanks.

alexandre.cuva
2020-06-27 07:19
I have a full example under .Net Core 3.1, with extra stuff like using TestServer. We could use it?

alexandre.cuva
2020-07-10 11:48
Hi PactNet team, where can I found a doc on how to contribute? I have an example on Net 3.1 with TestServer to push

bethskurrie
2020-07-10 20:33
Awesome @alexandre.cuva. Thanks! If you want to put it in the examples directory of the Pact net repository, just open a PR.

bethskurrie
2020-07-10 20:34
If you want to keep it in a separate repository, you could transfer the repo to pact-foundation organisation (you get to keep admin rights).

a.smith
2020-07-15 15:12
Hi :wave: I'd like to lend a hand with development of PactNet. I'm particularly interested in moving the library over to the Rust standalone per the https://github.com/pact-foundation/pact-specification#how-to-get-started-writing-a-pact-implementation. Would this work be useful? Is there somewhere better I can focus my energy? (I'm not keen to add another cook to the group working on the Pact 3 / MessagePact branch...)

uglyog
2020-07-15 23:08
I don't think anyone has started looking at integrating the V3 libs into PactNet yet. That would be awesome.

neil
2020-07-16 01:52
I think moving over to the rust standalone would be a massive win.

matt.fellows
2020-07-16 04:42
This would he awesome. Let us know how we can support you

a.smith
2020-07-16 10:01
The questions that immediately come to mind are: ? Has any spike work been done on this already? (Sounds like a 'no' from @uglyog) ? What is the appetite for making breaking changes in the library? (Some were made for Pact v2.) ? What documentation is there around writing implementations over it? Are there any examples of implementations using it? (I've found https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_mock_server_ffi on the Rust binaries/FFI themselves.)

matt.fellows
2020-07-16 10:15
I think breaking changes are worth tabling, particularly if they improve the situation. Obviously it would be ideal not to

matt.fellows
2020-07-16 10:15
As for implementing, JS technically does but not in the way it'll likely he done for .NET

matt.fellows
2020-07-16 10:16
I'm currently doing it for go and can share my experience

matt.fellows
2020-07-16 10:16
Actually, C++ could be used as a basis also (consumer only)

a.smith
2020-07-16 10:58
Cool, thanks @matt.fellows. A useful starting point would be pointers on how to consume the Rust binaries from Bintray (if that's the appropriate source)

matt.fellows
2020-07-16 11:49
I haven't gotten to the distribution bit yet, but it's either that or a GitHub release artifact

krisdinesh
2020-07-21 22:49
has joined #pact-net

krisdinesh
2020-07-21 22:54
@all - looking for pactnet matcher, current doc shows the example in ruby. Could you please share any example on the matcher using pactnet

matt.fellows
2020-07-22 00:23
Ruby? Are you referring to http://docs.pact.io? Best to look at the Pact .NET github repo directly


matt.fellows
2020-07-22 00:23
Those samples are .NET matchers

krisdinesh
2020-07-22 03:08
Thanks a lot Matt and I am looking exactly the same.... :pray:

krisdinesh
2020-07-22 22:52
There is variable in api response "modifierName: "Krisdinesh". This variable sometimes comes as string and sometimes it NULL. How to handle this in matcher like OR condition and also I would like to know if you want to ignore some specific variable during provider test comparison


matt.fellows
2020-07-23 00:04
TL;DR - write two tests. One for when it is mandatory and one for when you don?t need it (or if it must be null)

krisdinesh
2020-07-23 13:39
Thanks Matt, this makes sense but I can't predict when it is going to be NULL to have separate test.

lewis.thorley
2020-07-24 07:09


matt.fellows
2020-07-24 07:24
TL;DR - not yet. Albeit some people here had luck running the WIP branch

a.smith
2020-07-29 16:04
:point_up: I created this for info, and to link to the more detailed planning I'm doing

krisdinesh
2020-07-29 16:53
Hello All - When I am running my pact test within docker container, I am getting error like "_Error Message:_   _System.AggregateException : One or more errors occurred. (One or more errors occurred. (Address not available))"_. Below is the full log. Please provide some input to get over this issue. I am able to run the test in mac and windows without any problem ``` X ContractTesting.Tests.ConsumerPactTest.GetBenchmarksByProgramIdTrue_VerifyIfItReturns [1ms] Error Message: System.AggregateException : One or more errors occurred. (One or more errors occurred. (Address not available)) (The following constructor parameters did not have matching fixture data: ConsumerPact data) ---- System.AggregateException : One or more errors occurred. (Address not available) -------- System.Net.Http.HttpRequestException : Address not available ------------ System.Net.Sockets.SocketException : Address not available ---- The following constructor parameters did not have matching fixture data: ConsumerPact data Stack Trace: ----- Inner Stack Trace #1 (System.AggregateException) ----- at PactNet.Mocks.MockHttpService.Host.RubyHttpHost.Start() at PactNet.Mocks.MockHttpService.MockProviderService.Start() at PactNet.PactBuilder.MockService(Int32 port, JsonSerializerSettings jsonSerializerSettings, Boolean enableSsl, IPAddress host, String sslCert, String sslKey) at PactNet.PactBuilder.MockService(Int32 port, Boolean enableSsl, IPAddress host, String sslCert, String sslKey) at ContractTesting.Consumer.ConsumerPact..ctor() in /asc-lms-rptp-api/ContractTesting/Consumer/ConsumerPact.cs:line 31 ----- Inner Stack Trace ----- at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) ----- Inner Stack Trace ----- at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) ----- Inner Stack Trace #2 (Xunit.Sdk.TestClassException) -----```

krisdinesh
2020-07-29 23:07
RESOLVED: once i changed the docker image from _*http://mcr.microsoft.com/dotnet/core/sdk:3.1-alpine*_ to http://mcr.microsoft.com/dotnet/core/sdk:3.1 it worked. But I am not sure why it didnt work with alpine though


matt.fellows
2020-07-29 23:55
Alpine is a very lean image and doesn?t have all of the necessary libraries for Pact to work. You can add the packages though and you should be right

uglyog
2020-07-30 00:14
Alpine also doesn't have a full libc, it is based on musl and busybox

krisdinesh
2020-07-30 00:53
Got it, thanks!!

francis.lobo
2020-08-04 22:48
has joined #pact-net

jacques.murekezi
2020-08-07 11:09
has joined #pact-net

bret.mcclory
2020-08-11 19:02
has joined #pact-net

jack.middleton
2020-08-18 09:48
Hey - Is anyone able to help me understand what the best practice is for setting the value of `PactVerifierConfig.ProviderVersion`? (This is set to `build_number` in the example shown here: https://github.com/pact-foundation/pact-net#publishing-provider-verification-results-to-a-broker) Should this `build_number` be the git SHA as described here: https://docs.pact.io/pact_broker/pacticipant_version_numbers or should I just use the build number from in my pipeline? Maybe it makes sense to use {branch_name}+{build_number} so I end up with something like `feature/123-pact-update+a86579910`

jack.middleton
2020-08-18 09:57
I think I might have found the answer here: https://docs.pact.io/getting_started/versioning_in_the_pact_broker I think I will use `{build_number}+{gitCommitSHA}`

matt.fellows
2020-08-18 10:52
Yep

matt.fellows
2020-08-18 10:52
I tend to use both

jack.middleton
2020-08-18 10:54
Great, thanks for confirming. I've been toying with the idea of using branch name in addition/instead of build number, but I can track back to branches using build number

matt.fellows
2020-08-18 11:00
you could add those in too - it?s really whatever works for you, but importantly, you want each commit to produce a new version so git sha is always a good one

parveensultanauk
2020-08-24 11:33
has joined #pact-net

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

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!

jack.middleton
2020-08-25 08:43
Hey all, I am attempting to achieve Pact Nirvana but need some advise/help. In the https://docs.pact.io/pact_nirvana/step_4/#e-configure-pact-to-be-verified-when-contract-changes (E. 1.) it says you should pass the Pact URL to the verification step. My questions are: 1. Can someone confirm the verification step is referring to this: https://github.com/pact-foundation/pact-net#publishing-provider-verification-results-to-a-broker 2. If 1) is correct, I guess then we pass the Pact URL from the webhook into `.PactUri()` . In that case, should the `HonoursPactWith("Consumer")` "Consumer" string match the consumer name that is in the URL that is passed in? I am struggling to understand what `HonoursPactWith` does if you are passing in the whole Pact, which includes the consumer name Does this make sense?

matt.fellows
2020-08-25 10:44
Hi Jack!

matt.fellows
2020-08-25 10:45
That?s correct

matt.fellows
2020-08-25 10:47
Don?t specify the ?honourspactwith? because that should be dynamic. See https://github.com/pactflow/example-provider-dotnet/blob/master/tests/ProviderApiTests.cs#L56-L71

matt.fellows
2020-08-25 10:49
> struggling to understand what `HonoursPactWith` does if you are passing in the whole Pact, which includes the consumer name understandable. It?s basically _not_ required if using a broker / Pactflow (because that will dynamically work all of that out)

jack.middleton
2020-08-25 12:18
Legend, thanks Matt. That clears this part of my journey up! Can't believe I missed that example...

matt.fellows
2020-08-25 13:10
It's not in our docs yet. Next week or so I'll have them all in there somewhere

jack.middleton
2020-08-25 16:41
I can't tell you how much that example has simplified my approach. I had been doing all sorts of work arounds and slightly "hacky" things. E.g.: I had two tests on the provider side, one for the Webhook approach and one for the Standard flow. This was also partly due to being based upon an old project I did which was using old version of Pact which didn't have `pactVerifier.PactBroker()`... Anyway, thanks again. Huge help today.

matt.fellows
2020-08-25 23:37
I?m glad! And sorry it wasn?t more obvious/available to you

andy.furnival
2020-08-26 16:51
has joined #pact-net

bethskurrie
2020-08-30 07:11
I've just moved the pact-net docs into http://docs.pact.io @jack.middleton

bethskurrie
2020-08-30 07:12
Though, it doesn't yet have the example that Matt's talking about.

rasih.caglayan
2020-09-01 00:34
has joined #pact-net

jack.middleton
2020-09-01 06:59
Ah great, thanks for the info, Beth

carlos.silva
2020-09-02 15:01
has joined #pact-net

carlos.silva
2020-09-02 15:06
Hi Guys, I'm Carlos and I'm an architect at LexisNexis. We are particular interested in http://PACT.NET and also in extending pact capabilities in order to fulfill our needs. If possible we would prefer to contribute to PACT instead of just fork it and make it to work for us. Happy to help.

lewis.prescott
2020-09-03 12:49
has joined #pact-net

siddharth.gupta
2020-09-04 06:03
I am socializing Pact testing in my organization . One of the architect from consumer team had a question , how do we handle jwt authorization token when calling provider APIs. How will consumer generate pact with token \ how will provider handle this in their tests .

matt.fellows
2020-09-04 06:15
(for anybody else answering, let?s keep in in this thread https://pact-foundation.slack.com/archives/C9VPNUJR2/p1599199532022300)

christian.johann.eder
2020-09-10 13:45
Hi @matt.fellows you wrote on twitter that you?d like to talk about my blog regarding hosting api mocks on azure functions

matt.fellows
2020-09-12 23:24
Nice work on the impact library! Are you able to elaborate more on its goals and how you see it fitting in with the pact ecosystem?

matt.fellows
2020-09-12 23:26
If I understand correctly, it is essentially a pact NET replacement? Or at the least, it will generate pact compatible contracts. I couldn't tell from the readme if it integrated with the pact broker natively, particularly on the provider side? I wondered if you'd be open to collaborating with us to align it with our roadmap going forward and also find at least another maintainer? Without trying to be negative, we often see tools like this created only for them to stop being supported which creates a challenge for the community. Of course the flipside is that we need things like this to drive innovation and push the ecosystem forward

matt.fellows
2020-09-12 23:31
Was there a reason you didn't look to contribute the the .NET port? We are actively seeking help to uplift it

matt.fellows
2020-09-12 23:35
Alternatively, could this be a replacement for the .net library and we look to bring it in as the officially supported one?

matt.fellows
2020-09-12 23:35
Cc @bethskurrie @uglyog @neil

matt.fellows
2020-09-12 23:35
(I'm on a mobile so there are plenty of other thoughts I'd like to add here)

yann.courtel
2020-09-23 07:08
has joined #pact-net


siddharth.gupta
2020-09-29 06:42
Hi All, I was trying to fail the provider tets by modifying the actual response provider sends vs that expected in Contract .Attached is the contract json from consumer tests and following is the provider response .

siddharth.gupta
2020-09-29 06:43
here is the Provider verification result

siddharth.gupta
2020-09-29 06:43
I am modifying the attribute "eventType" in response , but stiil test is passing . Does it has to do with match type "$.body.eventType": {             "match": "type"           }, in the contract

matt.fellows
2020-09-29 06:50
Exactly. So you are currently matching on the ?type?, which in your case, means any string value for the key `eventType` will make the test pass.

matt.fellows
2020-09-29 06:51
Option 1: don?t use a type matcher in the consumer test (match exact event type, or a regex) Option 2: rename the property or something, so that the key itself won?t match (e.g. rename it to ?type? or something)

collin.johnson
2020-09-29 13:58
has joined #pact-net

nazar.khmil
2020-10-05 10:34
has joined #pact-net

xandebianchi
2020-10-05 13:05
has joined #pact-net

dorin.enache
2020-10-05 15:01
has joined #pact-net

michael_james
2020-10-06 10:01
has joined #pact-net

ledinhcuong99
2020-10-06 12:53
has joined #pact-net

dothetan.040490
2020-10-07 09:14
has joined #pact-net

dagostino.remy
2020-10-07 23:03
has joined #pact-net

abhi.nandan
2020-10-08 06:38
has joined #pact-net

przemyslaw.dabrowski
2020-10-08 12:36
has joined #pact-net

emiliano.righi
2020-10-08 13:25
has joined #pact-net

cariaga.bh
2020-10-08 21:03
has joined #pact-net

campellcl
2020-10-09 00:06
has joined #pact-net

elenitsaa043
2020-10-09 10:00
has joined #pact-net

adriangabrieloros
2020-10-09 11:05
has joined #pact-net

sh.ilgam_pact
2020-10-11 16:12
has joined #pact-net

yann.courtel
2020-10-12 09:29
Hi everyone! Has anyone tried to set up a PACT between two APIs that were using messaging such as Kafka queue? I ran into this article yesterday but only available in the java specifications. https://stackoverflow.com/questions/44884316/how-to-implement-contract-testing-when-kafka-is-involved-in-microservice-archite Thanks a lot.

anastasiia.bielik
2020-10-12 11:13
has joined #pact-net

deepika.krishnakumar
2020-10-12 15:03
has joined #pact-net

anbansal27
2020-10-12 23:02
has joined #pact-net

anbansal27
2020-10-13 00:27
Hi Team, I am currently looking out for a solution to integration test event driven systems using RabbitMq as the messaging platform. Does http://Pact.Net support it ? If yes, please could you help me with links to some resources ?

matt.fellows
2020-10-13 00:48
Maybe have a little search of this channel first Ankit, there are definitely some posts on it. Have a read of those first, and then come back with any specific questions

prabhakar.thippa
2020-10-13 04:58
has joined #pact-net

giadinhluong
2020-10-13 06:24
has joined #pact-net

pavank
2020-10-13 08:41
has joined #pact-net

stephane.meng
2020-10-13 09:06
has joined #pact-net

abirlal.bose
2020-10-13 09:45
has joined #pact-net

mateusz.mrzyglod
2020-10-14 09:32
has joined #pact-net

cathleen.yuan
2020-10-14 11:16
has joined #pact-net

ramana.jaladurgam
2020-10-14 16:10
has joined #pact-net

alik.berezovsky
2020-10-14 18:38
has joined #pact-net

a.robecke
2020-10-14 19:24
has joined #pact-net

mikahchapman
2020-10-14 21:47
has joined #pact-net

hem_kec
2020-10-15 00:44
has joined #pact-net

dothetan.040490
2020-10-15 02:22
@dothetan.040490 has left the channel

marco.cordeiro
2020-10-15 10:54
has joined #pact-net

betty.he
2020-10-15 14:32
has joined #pact-net

tamer
2020-10-16 09:08
has joined #pact-net

mario.gioiosa
2020-10-16 18:57
has joined #pact-net

alik.berezovsky
2020-10-18 17:58
@alik.berezovsky has left the channel

lior.baber
2020-10-19 07:33
has joined #pact-net

jeffbdye
2020-10-19 17:10
has joined #pact-net

jace
2020-10-19 19:22
has joined #pact-net

almaak
2020-10-20 09:35
has joined #pact-net

andra.moraru
2020-10-20 14:13
has joined #pact-net

camila.coder91
2020-10-20 17:06
has joined #pact-net

julzelements
2020-10-21 05:25
has joined #pact-net

kapil.mathur
2020-10-21 06:40
has joined #pact-net

mark.hudson
2020-10-21 10:45
has joined #pact-net

cluu
2020-10-21 17:16
has joined #pact-net

camila.campos
2020-10-21 21:35
has joined #pact-net

longlevan
2020-10-22 09:15
has joined #pact-net

justin.garfield
2020-10-22 16:15
has joined #pact-net

guppy0356.nakira
2020-10-23 00:34
has joined #pact-net

ercalbwar
2020-10-24 19:24
has joined #pact-net

andrewshtamburg
2020-10-25 13:04
has joined #pact-net

siad.ardroumli
2020-10-25 18:16
has joined #pact-net

srikanthpmailid
2020-10-26 01:02
has joined #pact-net

yann.courtel
2020-10-26 09:15
Hi everyone, I was wondering about a known issue we are having about sending form/multipart in requests. After investigation, we realized it was because of the windows' path limitation (246 characters) and as of right now, there is nothing we can do. Has anyone run into this issue recently? Thanks a lot.

matt.fellows
2020-10-26 10:35
Does this relate to the multi-part form upload? That problem is usually about invoking the underlying matching engine


photesthesis_geospiza
2020-10-26 15:10
has joined #pact-net

jackbwheatley
2020-10-27 21:02
has joined #pact-net

carlosalmeida.xon
2020-10-27 22:06
has joined #pact-net

nasir.amin
2020-10-28 11:07
has joined #pact-net

jimish.shah.-nd
2020-10-28 11:26
has joined #pact-net

adam_figgins
2020-10-28 14:20
has joined #pact-net

dale.bennett
2020-10-28 14:34
has joined #pact-net

aperdomobo
2020-10-28 15:42
has joined #pact-net

diazguerra2
2020-10-28 16:06
has joined #pact-net

xsamore
2020-10-28 19:52
has joined #pact-net

simon
2020-10-28 20:49
has joined #pact-net

ruben.cagnie
2020-10-29 01:24
has joined #pact-net

272939217
2020-10-29 05:33
has joined #pact-net

driloni92
2020-10-29 09:05
has joined #pact-net

pauloavra
2020-10-29 12:33
has joined #pact-net

jikogay728
2020-10-30 17:20
has joined #pact-net

blmlcu
2020-10-31 14:51
has joined #pact-net

jamescourtoy
2020-11-02 21:04
has joined #pact-net

telmo.ferreira.costa
2020-11-03 11:32
has joined #pact-net

sergii.kopovskyi
2020-11-03 12:35
has joined #pact-net

dikili
2020-11-03 16:41
I do have a question to seek help pls, I have 5 consumer tests and have a mockclient implementation in c# .net , when I run all tests at once only 1 of the tests pass others fail, however if i create a new instance of ConsumerPact class file which has the configurations and assign a new port each time when a new test calls it.. This makes all the tests pass but then when I check the contract file generated it only have 1 interaction of all the tests run so contract file is missing data.. What do you think I should do here ?

dikili
2020-11-03 16:49
I am using NUnit project and not XUnit by the way

dikili
2020-11-03 17:42
I have realized the pactBuilder.Build is called for each test which was causing the above so no need to worry about any longer for above ,fyi Thanks

silverton.gimenes
2020-11-03 17:58
has joined #pact-net

colber16
2020-11-03 18:34
has joined #pact-net

cvoong
2020-11-03 18:55
has joined #pact-net

cvoong
2020-11-03 19:07
Hi, does anyone have any examples of Pact tests in .NET which test Kafka Messages?

matt.fellows
2020-11-04 05:13
> Hi, does anyone have any examples of Pact tests in .NET which test Kafka Messages? The current version of Pact .NET doesn?t fully support what we call message pact, which is how we deal with things like Kafka

matt.fellows
2020-11-04 05:14
there _is_ a beta branch that I think you can use (see above in this channel if the history goes that far back, or the issues on the GH repo)

matt.fellows
2020-11-04 05:14
Do you need it for consumer or provider side (or both)? If provider only, I may have a way for you

cvoong
2020-11-04 08:34
Thanks for the info, we need it for the consumer only at the moment. Is that available in the beta brance?

matt.fellows
2020-11-04 20:38
I think it is, I'd review that branch/issue on the repo and see how you go

cvoong
2020-11-05 09:31
we've decided to park it for now. Do you know roughly when that work is going to get merged in? Not to chase - just curious.

dikili
2020-11-05 10:21
hello all, I am working on a consumer test and get an error "No Interaction found for GET /jobs/12314/anonymous ...." , this is a consumer test thus not hitting the actual endpoint

dikili
2020-11-05 10:23
I ensured that _mockProviderService.Given("xxxx") .UponReceiving("yyyy") xxxx and yyyy is unique in the test file, so I am not really understanding why I am getting this error and how to fix this , Is ensuring this to be unique not enough and am i missing something with this ?

dikili
2020-11-05 10:23
I would appreciate your helps @here

dikili
2020-11-05 18:02
Also when I delete the pact file which has 5 interactions and run only one of the consumer tests, 5 of the interactions still created in the newly created pact contract json file locally although the test that was run has only 1 interaction, not sure how did all 5 is restored back when i only run 1 test, I would also really like to understand this which i am lost

matt.fellows
2020-11-06 00:55
fair enough, I don?t I?m sorry - might be worth popping your hand up on that issue/PR to check in?

matt.fellows
2020-11-06 00:56
please share your code @dikili, it?s hard to know what you?re asking I?m afraid

dikili
2020-11-06 12:35
hello @matt.fellows thanks for the feedback.. pls see the set of consumer tests...

dikili
2020-11-06 12:35
as you can see there are 5 tests in the file... and they execute, however when i check the uploaded pact file to the broker

dikili
2020-11-06 12:37
I see 9 interactions

dikili
2020-11-06 12:37
which i believe is an issue...

dikili
2020-11-06 12:39
when I was developing the cons. tests I have changed the wordings on the description and providerState section on the tests.. this might have caused this I believe ? is this an issue and how can i ensure I can start fresh and instead get 5 interactions I desire to get pls ? Pls feel free to add any suggestions for improvements that I could also make

dikili
2020-11-06 12:40
pls note that in the tear down of this tests, i already call _mockProviderService.ClearInteractions(); so I was thinking it would help me reset it but I am not sure from where it is picking up all 9 interactions as in the screenshot ?

dikili
2020-11-06 12:40
hope this is much clarified question now, and sorry for the confusion

dikili
2020-11-06 12:48
And when the provider test run... execution failure log is as attached...

dikili
2020-11-06 12:49
so I want to get these tests work end to end.. with provider tests passing.. pls feel free to advice what I might be getting wrong here ? @matt.fellows @here

dikili
2020-11-06 17:01
W.r.t my above msg.. I have somehow managed to drop the # of interactions in the composed pact contract file down to two... when I run the provider test I see the below failure as in the file attached.. two interactions only and out of two 1 of the interaction fails , however when I do the actual call on postman with same headers etc.. it is working fine.. I am on the VPN as well and it is being done through pactflow.. here is the log of that failing one test.. i would also appreciate if you can help me understand how I can manage to fix it ? logs attached:

dikili
2020-11-06 17:02
In the last log file , it is clear that I get status code 308 , which is not something i get on the postman though

dikili
2020-11-06 17:03
:thinking_face:

pbobba
2020-11-09 23:03
has joined #pact-net

jun.li
2020-11-09 23:05
has joined #pact-net

douweicai
2020-11-10 04:11
has joined #pact-net

douweicai
2020-11-10 04:16
Hi there, I am new to pact and .net. I want to download the basic pact demo and install it to visual studio. Please send out the link and detail instruction to install and run it? @matt.fellows

matt.fellows
2020-11-10 06:08
Here are the examples I think you?re referring to: 1. https://docs.pactflow.io/docs/examples/dotnet/consumer/readme 2. https://docs.pactflow.io/docs/examples/dotnet/provider/readme (they are based on this workshop: https://github.com/pactflow/pact-workshop-dotnet-core-v1) If you export the following two environment variables in the shell you execute things from, you should be able to go: ```export PACT_BROKER_TOKEN=<your pactflow token here> export PACT_BROKER_BASE_URL=https://<your pactflow subdomain>.http://pactflow.io``` you can then run: ```make restore make test # to just run the tests, or make fake_ci # emulates a CI build``` From either code base

christian.huber
2020-11-10 09:20
has joined #pact-net

vuttithatkrongyot
2020-11-10 10:57
has joined #pact-net

dan.iosif
2020-11-10 17:06
has joined #pact-net

douweicai
2020-11-11 00:19
Thanks! I will look at it tonight to see whether I can set up and slack you for any quetions. @matt.fellows

douweicai
2020-11-11 05:31
@matt.fellows Matt, I manually import the project to visual studio using the zip file from the link you provided (it taking me a lot of time). I am new to visual studio,.net and mac . I was mainly using java before. Can we set up half hour demo tomorrow, you can help me walk through the code and run it locally to help me speed up?

douweicai
2020-11-11 05:37
I am getting compile error for using Newtonsoft.Json and JsonConvert, and others. I am stuck on the environment

matt.fellows
2020-11-11 23:20
Hi Wei!

matt.fellows
2020-11-11 23:21
So from the outset, I?ll be honest I cannot help you at all with Visual Studio - I don?t have it installed and have never used it!

matt.fellows
2020-11-11 23:21
Second point - I also don?t know .NET any more than enough to make that demo work :slightly_smiling_face:

matt.fellows
2020-11-11 23:22
I have .NET 3.1.201 installed. You can install it from here: https://docs.microsoft.com/en-us/dotnet/core/install/macos

matt.fellows
2020-11-11 23:23
```make --version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i386-apple-darwin11.3.0```

matt.fellows
2020-11-11 23:23
I don?t think you?ll need the same version of Make, but I have the default version of make that comes with OSX

matt.fellows
2020-11-11 23:24
I have Visual Studio Code (not visual studio) installed, and I have the following extension to help with code navigation and syntax highlighting

matt.fellows
2020-11-11 23:24
I don?t run any commands from within the IDE, I use my terminal

matt.fellows
2020-11-11 23:25
```make restore make test```

douweicai
2020-11-11 23:29
what is the token I need to export?


matt.fellows
2020-11-11 23:30
FYI I?ve just added these notes to those readme?s

douweicai
2020-11-11 23:31
I just install VS code and set it up

douweicai
2020-11-11 23:32
are you going to join?

matt.fellows
2020-11-11 23:33
join what, sorry?

matt.fellows
2020-11-11 23:33
Oh, you?ve booked me for tomorrow!

matt.fellows
2020-11-11 23:33
I can do now quickly

douweicai
2020-11-11 23:34
cool

rodrigo.costa20
2020-11-12 00:59
has joined #pact-net

yong.gong188
2020-11-12 09:13
has joined #pact-net

anandhadeepak
2020-11-12 13:03
has joined #pact-net

david.dias
2020-11-12 20:04
has joined #pact-net

billal.patel
2020-11-13 10:31
has joined #pact-net

billal.patel
2020-11-13 10:42
@billal.patel has left the channel

dikili
2020-11-13 16:42
@here are there any built in matchers for .net ?

dikili
2020-11-13 16:42
i.e how do i use Pact.like( name: "Mary", age: 73) something like this in the .net world when creating the test ?


wesleythomaswilliams
2020-11-14 22:54
has joined #pact-net

douweicai
2020-11-16 00:36
@here, I made the code change to comment out type from product code to test the breaking change (using the pact consumer/provider sample code for .net), after that, I ran the provider, it failed as following, it is expected? After that, I changed it back to add the type (just as the original code), however, I still getting the same error. Can you help to take a look? [2:24 PM] erifying a pact between pactflow-example-consumer-dotnet and pactflow-example-provider-dotnet Given products exist A request to get products with GET /products returns a response which has a matching body      Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example        Actual:        Diff        --------------------------------------        Key: - is expected             + is actual        Matching keys and values are not shown        -[        -  {        -    "id": "27",        -    "name": "burger",        -    "type": "food"        -  },        -]        Description of differences        --------------------------------------        * Expected an Array but got a String ("") at $   3) Verifying a pact between pactflow-example-consumer-dotnet and pactflow-example-provider-dotnet Given products exist A request to get products with GET /products returns a response which includes headers "Content-Type" which equals "application/json; charset=utf-8"      Failure/Error: expect(header_value).to match_header(name, expected_header_value)        Expected header "Content-Type" to equal "application/json; charset=utf-8", but was nil 1 interaction, 1 failure Failed interactions: To re-run just this failing interaction, change the verify method to '.Verify(description: "A request to get products", providerState: "products exist")'. Please do not check in this change! # A request to get products given products exist INFO: Verification results published to https://avalara.pactflow.io/pacts/provider/pactflow-example-provider-dotnet/consumer/pactflow-example-consumer-dotnet/pact-version/ae47e9fed1b12954ff5306fa24bd758cdc1e8346/verification-results/216 [http://xUnit.net 00:00:04.9152740]     tests.ProviderApiTests.EnsureProviderApiHonoursPactWithConsumer [FAIL]   X tests.ProviderApiTests.EnsureProviderApiHonoursPactWithConsumer [4s 133ms]   Error Message:    PactNet.PactFailureException : Pact verification failed. See output for details. If the output is empty please provide a custom config.Outputters (IOutput) for your test framework, as we couldn't write to the console.   Stack Trace:      at PactNet.Core.PactCoreHost`1.Start()    at PactNet.PactVerifier.Verify(String description, String providerState)    at tests.ProviderApiTests.EnsureProviderApiHonoursPactWithConsumer() in /Users/wendy.dou/Projects/example-provider/tests/ProviderApiTests.cs:line 73 Test Run Failed. Total tests: 1      Failed: 1  Total time: 5.4693 Seconds /usr/local/share/dotnet/sdk/3.1.403/Microsoft.TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error. [/Users/wendy.dou/Projects/example-provider/tests/tests.csproj] make[1]: *** [test] Error 1 make: *** [fake_ci] Error 2

bethskurrie
2020-11-16 00:38
`Actual:`

matt.fellows
2020-11-16 00:38
Could you please share the whole terminal log? As mentioned before, I think your provider isn?t running or is returning a `500` error

bethskurrie
2020-11-16 00:38
You have an empty response body

douweicai
2020-11-16 00:56
it is too long, cannot send. let me split

matt.fellows
2020-11-16 00:58
You can always upload a file instead of copying here

matt.fellows
2020-11-16 00:58
that will be easier to look at

louis.oliver
2020-11-16 10:33
has joined #pact-net

louis.oliver
2020-11-16 11:03
Would be interested in the outcome of Pact + Kafka myself in .net

ashishkujoy
2020-11-16 15:08
has joined #pact-net

douweicai
2020-11-16 18:02
@matt.fellows after restart my machine, and ran it again, I got the connection refused error below:

douweicai
2020-11-16 18:02
Verifying a pact between pactflow-example-consumer-dotnet and pactflow-example-provider-dotnet Given products exist A request to get products with GET /products returns a response which has a matching body    Failure/Error: replay_interaction interaction, options[:request_customizer]    Errno::ECONNREFUSED:     Connection refused - connect(2) for "localhost" port 9000  3) Verifying a pact between pactflow-example-consumer-dotnet and pactflow-example-provider-dotnet Given products exist A request to get products with GET /products returns a response which includes headers "Content-Type" which equals "application/json; charset=utf-8"    Failure/Error: replay_interaction interaction, options[:request_customizer]    Errno::ECONNREFUSED:     Connection refused - connect(2) for "localhost" port 9000 1 interaction, 1 failure

douweicai
2020-11-16 18:04
Any idea how to fix the refused connection?

douweicai
2020-11-16 19:43
this issue is fixed.

douweicai
2020-11-16 19:46
however, I am running the issue when try to change it back. For example, I comment type in product, then run the provide code, it breaks expected. then I try to change it back by uncommenting it, then run the provider code, however, it keep giving me the same error message, it looks it still use the old code.

douweicai
2020-11-16 19:47
here is the error: Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example     Actual: [{"type":null,"name":"pancake","id":"1","version":"1.0.0"},{"type":null,"name":"sanwhich","id":"2","version":"1.0.0"}]     Diff     --------------------------------------     Key: - is expected        + is actual      Matching keys and values are not shown     [      {     -  "type": String     +  "type": NilClass      },      {     -  "type": String     +  "type": NilClass

douweicai
2020-11-16 19:52
it is something in your pact broker side to have this old information?

matt.fellows
2020-11-16 23:36
Is your code available for review online?

matt.fellows
2020-11-16 23:36
```date: "Sun, 15 Nov 2020 20:37:18 GMT" server: "Kestrel" transfer-encoding: "chunked" fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HM493D70GSK0", Request id "0HM493D70GSK0:00000001": An unhandled exception was thrown by the application. System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. [/Users/wendy.dou/Projects/example-provider/src/bin/Debug/netcoreapp3.1/provider.dll] The metadata is corrupt. Invalid assembly public key. (0x8013141E) Failure has occurred while loading a type. [/Users/wendy.dou/Projects/example-provider/src/bin/Debug/netcoreapp3.1/provider.dll] The metadata is corrupt. at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeAssembly.get_DefinedTypes() at Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart.get_Types() at Microsoft.AspNetCore.Mvc.Controllers.ControllerFeatureProvider.PopulateFeature(IEnumerable`1 parts, ControllerFeature feature) at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature) at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.GetControllerTypes() at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.GetDescriptors() at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context) at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.UpdateCollection() at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.Initialize() at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.get_ActionDescriptors() at Microsoft.AspNetCore.Mvc.Routing.AttributeRoute.GetTreeRouter() at Microsoft.AspNetCore.Mvc.Routing.AttributeRoute.RouteAsync(RouteContext context) at Microsoft.AspNetCore.Routing.RouteCollection.RouteAsync(RouteContext context) at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application) System.BadImageFormatException: [/Users/wendy.dou/Projects/example-provider/src/bin/Debug/netcoreapp3.1/provider.dll] The metadata is corrupt. System.Security.SecurityException: Invalid assembly public key. (0x8013141E) System.TypeLoadException: Failure has occurred while loading a type.```

matt.fellows
2020-11-16 23:36
That looks like you?ve made a code change that?s not workable, so the app server is failing

matt.fellows
2020-11-16 23:36
I suspect you?ve removed/added a field in one place, but not made the appropriate changes elsewhere, so the server is unable to correctly run

matt.fellows
2020-11-16 23:37
> it is something in your pact broker side to have this old information? the pact broker simply maintains the contract itself, it doesn?t talk to the provider directly. That all happens locally

douweicai
2020-11-17 00:13
@matt.fellows the only change I made is to comment out "type" attribute inside product, then failed (which is expected), then uncomment out, it will always fail (something wrong here). Can you reproduce on your end?

douweicai
2020-11-17 00:18
In addition, can you send me the link where I publish the pact?


matt.fellows
2020-11-17 00:19
so if I remove the `type` property I get this expected failure: ``` 1) Verifying a pact between pactflow-example-consumer-dotnet and pactflow-example-provider-dotnet Given products exist A request to get products with GET /products returns a response which has a matching body Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example Actual: [{"name":"pancake","id":"1","version":"1.0.0"},{"name":"sanwhich","id":"2","version":"1.0.0"}] Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown [ { - "type": String }, { - "type": String }, Description of differences -------------------------------------- * Could not find key "type" (keys present are: name, id, version) at $[0] * Could not find key "type" (keys present are: name, id, version) at $[1]```

matt.fellows
2020-11-17 00:19
```namespace Products { public class Product { public Product(string id, string type, string name, string version) { this.id = id; this.name = name; // this.type = type; this.version = version; } // public string type { get; set; } public string name { get; set; } public string id { get; set; } public string version { get; set; } } }```

matt.fellows
2020-11-17 00:19
That is the change I made to produce that failure

matt.fellows
2020-11-17 00:20
reverting those changes returns to a green build

douweicai
2020-11-17 00:20
let me try again from my end

matt.fellows
2020-11-17 00:21
try running `make stop` in case the server is still running

douweicai
2020-11-17 00:22
here is my code:

douweicai
2020-11-17 00:23
namespace Products { public class Product { public Product(string id, string type, string name, string version) { this.id = id; this.name = name; this.type = type; this.version = version; } public string type { get; set; } public string name { get; set; } public string id { get; set; } public string version { get; set; } } }

douweicai
2020-11-17 00:23
when I ran it, I got the error below

douweicai
2020-11-17 00:23
ate: "Tue, 17 Nov 2020 00:22:18 GMT" server: "Kestrel" transfer-encoding: "chunked"      has status code 200      has a matching body (FAILED - 1)      includes headers       "Content-Type" which equals "application/json; charset=utf-8" Failures:  1) Verifying a pact between pactflow-example-consumer-dotnet and pactflow-example-provider-dotnet Given products exist A request to get products with GET /products returns a response which has a matching body    Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example     Actual: [{"type":"food","name":null,"id":"1","version":"1.0.0"},{"type":"food","name":null,"id":"2","version":"1.0.0"}]     Diff     --------------------------------------     Key: - is expected        + is actual      Matching keys and values are not shown     [      {     -  "name": String     +  "name": NilClass      },      {     -  "name": String     +  "name": NilClass          Description of differences     --------------------------------------     * Expected a String (like "burger") but got nil at $[0].name     * Expected a String (like "burger") but got nil at $[1].name 1 interaction, 1 failure Failed interactions: To re-run just this failing interaction, change the verify method to '.Verify(description: "A request to get products", providerState: "products exist")'. Please do not check in this change! # A request to get products given products exist INFO: Verification results published to https://avalara.pactflow.io/pacts/provider/pactflow-example-provider-dotnet/consumer/pactflow-example-consumer-dotnet/pact-version/ae47e9fed1b12954ff5306fa24bd758cdc1e8346/verification-results/239 [http://xUnit.net 00:00:04.6447031]   tests.ProviderApiTests.EnsureProviderApiHonoursPactWithConsumer [FAIL]

douweicai
2020-11-17 00:24
it somehow still use the one I commented out before

matt.fellows
2020-11-17 00:24
I suspect the provider server hasn?t re-started between testts

matt.fellows
2020-11-17 00:24
try a `make stop` and then `make fake_ci` again

matt.fellows
2020-11-17 00:24
there is probably a better way to start the provider server than the way it is being started now (separately to the test)

matt.fellows
2020-11-17 00:25
Somebody with .NET expertise could likely do a much better job of integrating the lifecycle of the test with starting the server

douweicai
2020-11-17 00:26
same error.

matt.fellows
2020-11-17 00:27
what does `lsof -i :9000` say?

douweicai
2020-11-17 00:28
lsof -i :9000 COMMAND  PID   USER  FD  TYPE       DEVICE SIZE/OFF NODE NAME dotnet 10225 wendy.dou 152u IPv4 0xc5e6e683be10e85d   0t0 TCP localhost:cslistener (LISTEN) dotnet 10225 wendy.dou 153u IPv6 0xc5e6e683c130542d   0t0 TCP localhost:cslistener (LISTEN)

matt.fellows
2020-11-17 00:28
ok, so the provider is stilll running

matt.fellows
2020-11-17 00:28
run `make stop`

matt.fellows
2020-11-17 00:28
and then `lsof -i :9000` again, it shtould be empty

douweicai
2020-11-17 00:28
kill `cat server.PID` && rm server.PID /bin/sh: line 0: kill: (11412) - No such process make: *** [stop] Error 1

matt.fellows
2020-11-17 00:29
ok, then just run this for now `kill 10225`

matt.fellows
2020-11-17 00:29
it looks like a rogue process is in the background, that is how you can detect and remove it

matt.fellows
2020-11-17 00:30
The failure relates to the `name` property, not `type` so it seems like at some point in the past you changed that too?

douweicai
2020-11-17 00:32
yes, I did. It is working now.

matt.fellows
2020-11-17 00:32
ok cool!

douweicai
2020-11-17 00:32
can you send me the link where you see my change from the broker?

douweicai
2020-11-17 00:33
The use case to support pact contract testing is that we have to use http protocol, right?

matt.fellows
2020-11-17 00:33
you can also do messages (e.g. kafka/SNS/active MQ)

douweicai
2020-11-17 00:33
how about event based architecture?

matt.fellows
2020-11-17 00:33
The support in .NET is beta though from what I understand

matt.fellows
2020-11-17 00:33
It is in high demand though

douweicai
2020-11-17 00:34
yes, we are building event based architecture also

douweicai
2020-11-17 00:37
I will do demo to our team tomorrow, if we decide to pilot with one of my team first, what is the process normally when you onboarding others?

matt.fellows
2020-11-17 00:38
great!

matt.fellows
2020-11-17 00:38
> can you send me the link where you see my change from the broker? What do you mean by this, sorry?

douweicai
2020-11-17 00:39
I mean the pactflow you used as broker to see my publish?

matt.fellows
2020-11-17 00:39
> I will do demo to our team tomorrow, if we decide to pilot with one of my team first, what is the process normally when you onboarding others? sorry I don?t follow this either - what did you need?


matt.fellows
2020-11-17 00:39
that?s your pactflow account (you should have an email with those details after you registered, just in case you lose it)

douweicai
2020-11-17 00:40
yes, i am able to see it.

douweicai
2020-11-17 00:41
my question for piloting with my team, I mean that how other teams work? they will set up pact broker by themselves first? how much effort to set up?

matt.fellows
2020-11-17 00:41
If you use Pactflow, there is no effort to setup the broker-

matt.fellows
2020-11-17 00:42
you only use 1 broker for the whole company.

matt.fellows
2020-11-17 00:42
Setting up your own broker, I can?t say. It?ll depending on a bunch of things - capability of the team, where it?s hosted, security and other constraints. Usually, you can get it up and running in a few days, and production ready in 1-2 weeks at most

matt.fellows
2020-11-17 00:43
This is a rough ROI calculation for SaaS vs doing it yourself

douweicai
2020-11-17 00:44
I think the first step is piloting with one team to use pact contract testing using open source, once team buy in the idea and like it, we can move to commercial, make sense?

matt.fellows
2020-11-17 00:44
totally up to you

matt.fellows
2020-11-17 00:45
A lot of people pilot with Pactflow because it saves on the cost/effort of setting up of the broker internally. So it?s up to you. If you need me to increase your limits in Pactflow to do the PoC with the team, let me know. Otherwise, good luck!

douweicai
2020-11-17 00:48
Sure. I will do the demo first, then we will start from there

matt.fellows
2020-11-17 00:49
Yes - that becomes before all of this! :smile:

douweicai
2020-11-17 00:49
Thank you for all your support!

matt.fellows
2020-11-17 00:50
You?re welcome. Sorry for some of the hassles, .NET is not a language I?m very familiar with, so being able to give you good advice is something for the #pact-net channel

matt.fellows
2020-11-17 00:50
:crossed_fingers: crossed, hope it goes well tomorrow

matt.fellows
2020-11-17 00:50
feel free to use the demo pack I sent you if helpful

douweicai
2020-11-17 01:03
where is the broker hosted? cloud or your server?


matt.fellows
2020-11-17 01:04
(we run on AWS)

douweicai
2020-11-17 01:04
I mean the one I am using

matt.fellows
2020-11-17 01:04
that?s the one you?re using

douweicai
2020-11-17 01:04
I see

matt.fellows
2020-11-17 01:04
You?re currently using Pactflow, a hosted, commercial version of the Open Source pact broker

matt.fellows
2020-11-17 01:05
This is the open source one that you would need to host yourself: https://github.com/pact-foundation/pact_broker

matt.fellows
2020-11-17 01:05

matt.fellows
2020-11-17 01:09
Just so I?m clear Wei, did you get the impression you weren?t using a Pactlfow account? And do you understand the relationship between Pactflow and the open source tools? It?ll help us ensure our marketing collateral is clearer if not

pradeepchoube
2020-11-17 03:49
has joined #pact-net

douweicai
2020-11-17 05:14
I am pretty new to pact, just one week experience. I need your guidance also. the relationship between open source and commercial is you two is owned by one company?

matt.fellows
2020-11-17 05:39
> is you two is owned by one company? do you mean, is Pact and Pactflow owned by a single company?

matt.fellows
2020-11-17 05:40
Pact is an open source framework. Like many open source tools, it is maintained by a community of developers and contributors

matt.fellows
2020-11-17 05:40
Pactflow is a commercial product (built out of http://dius.com.au), which extends the open source tools with extra https://pactflow.io/features

douweicai
2020-11-17 06:06
cool. I will take a look. thanks

matt.fellows
2020-11-17 06:07
FYI there is a #pactflow specific channel if there are questions relating to that service

meng-lingtao
2020-11-17 14:39
has joined #pact-net

pabvidcal
2020-11-17 15:30
has joined #pact-net

douweicai
2020-11-18 02:55
Thanks!

magesh.nagamani
2020-11-18 05:15
has joined #pact-net

jstoebel
2020-11-18 13:53
has joined #pact-net

daniel.sayer89
2020-11-19 10:33
has joined #pact-net

art.ptushkin
2020-11-19 10:34
has joined #pact-net

pact457
2020-11-19 10:36
has joined #pact-net

ajerthan.sivayoganath
2020-11-19 10:38
has joined #pact-net

philipchardwick
2020-11-19 11:05
has joined #pact-net

tanzmann
2020-11-19 11:09
has joined #pact-net

olivier.quere
2020-11-19 12:10
has joined #pact-net

wilfried.vandenberghe
2020-11-19 12:19
has joined #pact-net

alan.hanafy
2020-11-19 19:28
has joined #pact-net

michael.deutscher
2020-11-19 21:39
has joined #pact-net

gerry.power
2020-11-20 03:31
has joined #pact-net

alex900
2020-11-20 05:08
has joined #pact-net

tomas.panik
2020-11-20 08:28
has joined #pact-net

marc.ferland
2020-11-20 14:43
has joined #pact-net

sebastien.crapoulet
2020-11-20 15:24
has joined #pact-net

adutrillaux
2020-11-20 15:28
has joined #pact-net

he
2020-11-20 15:59
has joined #pact-net

ivgeni.slabkovski
2020-11-20 21:52
has joined #pact-net

serhatburakyildirim
2020-11-21 21:57
has joined #pact-net

alnasl
2020-11-22 18:46
has joined #pact-net

ashutosh23802
2020-11-23 06:20
has joined #pact-net

leonty
2020-11-23 10:33
has joined #pact-net

dariusz.piwko
2020-11-23 11:34
has joined #pact-net

praneeth.kumar
2020-11-23 16:18
has joined #pact-net

mark.white
2020-11-24 09:03
has joined #pact-net

ufuk.ozcelik
2020-11-24 14:58
has joined #pact-net

stefanos.varsanis
2020-11-24 16:48
has joined #pact-net

lalexander2810
2020-11-24 16:53
has joined #pact-net

sivaprasad9
2020-11-24 20:46
has joined #pact-net

scyr
2020-11-25 14:56
has joined #pact-net

timotheus.ruprecht
2020-11-25 22:12
has joined #pact-net

manali.mogre
2020-11-26 11:44
has joined #pact-net

erik.terpstra
2020-11-26 12:08
has joined #pact-net

kjayachandra2000
2020-11-26 20:40
has joined #pact-net

kjayachandra2000
2020-11-26 22:00
@kjayachandra2000 has left the channel

sushil.kumar
2020-11-27 01:45
has joined #pact-net

zhujian
2020-11-27 07:54
has joined #pact-net

h.octavian
2020-11-27 14:08
has joined #pact-net

dikili
2020-11-27 20:46
@here I have a question around CI/CD and the can-i-deploy.. does anyone have a working yaml file to show how provider test execution as well as the can-i-deploy check can be automated ?

matt.fellows
2020-11-27 21:01
What yaml file?

dikili
2020-11-28 13:51
thus I look forward to a .yml file when consumed by CI/CD pipelines it will create the necassary tasks (steps) to run these in order consumer, provider, can-i-deploy ? @matt.fellows

dikili
2020-11-28 13:51
it is a configuration file in the examples in pactfoundation/pact-broker, you have some examples of that file format which has the .yml extensions i.e docker-compose.yml

noel
2020-11-28 23:12
has joined #pact-net

matt.fellows
2020-11-29 03:44
so that?s a docker example in how to run the CLI.

matt.fellows
2020-11-29 03:45
you don?t have to use docker compose, you can run it without docker compose

matt.fellows
2020-11-29 03:45
what are you struggling with specifically?

matt.fellows
2020-11-29 03:46
You?ll have to execute the CLI in your own CI/CD pipelines in a way that is specific to your CI tool

matt.fellows
2020-11-29 03:46
so ?steps? is specific to you

muraalee
2020-11-30 01:56
has joined #pact-net

pooja.sharma
2020-11-30 08:52
has joined #pact-net

mo
2020-11-30 09:24
has joined #pact-net

dikili
2020-11-30 11:44
ok my struggle is ,I use Azure devops as CI/CD but not sure which task I should create in order to use /execute the CLI that enables can-i-deploy ?

dikili
2020-11-30 11:46
so if there is a yml file then i can use this yml file and tell azure to use that yml file which will then automatically create these tasks for me.. that is why i asked

david.greene
2020-11-30 21:47
has joined #pact-net

matt.fellows
2020-11-30 22:42
we don?t provide yaml files for all of the CI systems, sorry

matt.fellows
2020-11-30 22:42
I?m not familiar with Azure DevOps

bas
2020-12-01 09:00
has joined #pact-net

dikili
2020-12-01 14:54
Ok thanks @matt.fellows if there were a yaml file I believe it would support all CI/CD environments but I might be wrong as far as I know they are universal across all

wainstead
2020-12-01 14:57
has joined #pact-net

jerobinson
2020-12-01 20:32
has joined #pact-net

sumedhagamage
2020-12-02 03:33
has joined #pact-net

sumedhagamage
2020-12-02 04:12
@sumedhagamage has left the channel

fealaer
2020-12-02 11:40
has joined #pact-net

fealaer
2020-12-02 11:57
@fealaer has left the channel

patrick.hendron
2020-12-02 14:44
has joined #pact-net

lpratt
2020-12-02 18:19
has joined #pact-net

sandragnzalez
2020-12-03 11:04
has joined #pact-net

kristian
2020-12-03 14:34
has joined #pact-net

me1466
2020-12-03 23:42
has joined #pact-net

wenfeng.li
2020-12-04 11:42
has joined #pact-net

cdambo
2020-12-05 11:59
has joined #pact-net

gayatree.eee
2020-12-08 04:50
has joined #pact-net

c.pavan1986
2020-12-09 04:18
has joined #pact-net

william.pritchard
2020-12-09 15:28
has joined #pact-net

parveshchaudhary111
2020-12-09 17:54
has joined #pact-net

w.sobasik
2020-12-10 10:39
has joined #pact-net

thanuxxxx
2020-12-12 22:41
has joined #pact-net

ian.hamilton
2020-12-13 06:53
has joined #pact-net

colm.j.murphy91
2020-12-13 07:02
has joined #pact-net

victoria.kruczek
2020-12-13 14:13
has joined #pact-net

wuddarwin
2020-12-14 05:23
has joined #pact-net

connor.aird
2020-12-14 15:52
has joined #pact-net

arman.najafian
2020-12-14 15:52
has joined #pact-net

praveen.lakkaraju
2020-12-14 16:12
has joined #pact-net

alejandro.germain
2020-12-14 16:26
has joined #pact-net

josh.ellinger
2020-12-15 01:22
has joined #pact-net

ufuk.ozcelik
2020-12-15 08:22
@ufuk.ozcelik has left the channel

nikitsenka
2020-12-15 09:35
has joined #pact-net

hibahawes
2020-12-15 09:53
has joined #pact-net

sarvar
2020-12-15 14:24
has joined #pact-net

suruchipatidar14
2020-12-16 05:35
has joined #pact-net

smatheson
2020-12-16 06:33
has joined #pact-net

olayemifolakemi
2020-12-16 15:23
has joined #pact-net

nouri.tawfik
2020-12-16 19:14
Hello, It seems pact-net does not support asynchronous messages (specification v3) Do you have any updates? Do you recommend any other alternatives for. Net? Thank you for your help.

ania.kovalchuk
2020-12-17 00:09
has joined #pact-net

writetojoshma
2020-12-17 05:52
has joined #pact-net

rejeesh.g
2020-12-17 11:07
has joined #pact-net

lukas.kempec
2020-12-17 12:45
has joined #pact-net

lukas.kempec
2020-12-17 12:56
I would like to know as well. Any update on this? Anyone?

vikas543
2020-12-17 16:28
has joined #pact-net

bpugh
2020-12-17 17:05
has joined #pact-net

jeff.burmood
2020-12-19 17:45
has joined #pact-net

kyle.florence
2020-12-19 19:21
has joined #pact-net

ankurmalik22
2020-12-19 21:14
has joined #pact-net

vsukumaran
2020-12-20 01:56
has joined #pact-net

omer.morad
2020-12-20 08:10
has joined #pact-net

ringo
2020-12-20 10:51
has joined #pact-net

omer.moradd
2020-12-20 18:01
has joined #pact-net

souravsen1
2020-12-21 11:28
has joined #pact-net

andoni.arroyo
2020-12-21 17:51
has joined #pact-net

theovanessen
2020-12-22 10:47
has joined #pact-net

stuart3166
2020-12-22 12:35
has joined #pact-net

winfante
2020-12-22 22:51
has joined #pact-net

lars.bonnes
2020-12-23 13:05
has joined #pact-net

eungjun.yi
2020-12-25 14:25
has joined #pact-net

ebanster
2020-12-27 13:18
has joined #pact-net

onur.baskirt
2020-12-28 10:48
has joined #pact-net

massimo.daros
2020-12-29 13:18
has joined #pact-net

chris.fullinwider
2020-12-29 18:15
has joined #pact-net

piotr.soltysiak
2020-12-30 16:55
has joined #pact-net

adrian.przybyla
2021-01-04 13:41
has joined #pact-net

dcorrales
2021-01-04 22:06
has joined #pact-net

jokubas.lekevicius
2021-01-04 22:10
has joined #pact-net

matt195
2021-01-05 16:35
has joined #pact-net

rafael.manzoni
2021-01-05 17:56
has joined #pact-net

animesh2712
2021-01-05 19:29
has joined #pact-net

info
2021-01-06 01:55
has joined #pact-net

pascal.libenzi
2021-01-06 10:57
has joined #pact-net

brett
2021-01-06 18:55
has joined #pact-net

josh.rosenfeld
2021-01-06 19:39
has joined #pact-net

carlo
2021-01-07 13:24
has joined #pact-net

andrewshtamburg
2021-01-07 16:03
@andrewshtamburg has left the channel

danny.porrello
2021-01-07 16:48
has joined #pact-net

dawood.abbas
2021-01-08 07:00
has joined #pact-net

victoria.kruczek
2021-01-10 16:36
@victoria.kruczek has left the channel

cksharma122
2021-01-10 17:19
has joined #pact-net

caiquedpfc
2021-01-11 04:05
has joined #pact-net

henrik.rudstrom
2021-01-11 18:30
has joined #pact-net

eric
2021-01-12 10:23
has joined #pact-net

fnguyen
2021-01-13 00:39
has joined #pact-net

fnguyen
2021-01-13 01:44
Hello. Starting with PactNet in c# on azure. I have successfully created a consumer unit test with one interaction. in CI build we push it to pactflow. Producer build can pull the pacts file from pactflow and verify it and it shows as verified on pactflow. I am trying to understand the way the tags work. According to https://docs.pact.io/pact_broker/tags, if I PUT my pacts file to _/pacticipants/MyConsumer/versions/b5236e772/tags/prod_ (this succeeds and returns an object with 3 links for self, version and pacticipant) I should be able to get it from _/pacts/provider/MyProvider/consumer/MyConsumer/latest/prod_ However when I try this, I get a _404_. I guess there is a concept I am missing. Am I supposed to be PUTting the pacts file itself? Thank you.

matt.fellows
2021-01-13 01:52
Are you just trying to understand the API resources themselves?

matt.fellows
2021-01-13 01:52
I suppose, given that you already have the publishing/retrieving from Pactflow, you don?t really need to be manually making API calls to manipulate tags

fnguyen
2021-01-13 01:52
Trying to understand the concepts and exercise them from postman.

matt.fellows
2021-01-13 01:53
I?d recommend starting with the HAL browser in the top r/h corner of your Pactflow screen

matt.fellows
2021-01-13 01:53
you can navigate the contracts and tags from there, and then translate to Postman if needed

fnguyen
2021-01-13 01:54
the publishing is done as a CI step (with curl), the retrieval is done with PactVerifier.PactUri()

uglyog
2021-01-13 01:54
You don't post the Pact file to the tags endpoint.

matt.fellows
2021-01-13 01:54
I would recommend using the CLI tools to publish the pact and tag it

uglyog
2021-01-13 01:54
You first create the Pact resource with the file, then create the tag (probably with an empty body)

fnguyen
2021-01-13 02:02
This works: ? PUT my pacts file to /pacts/provider/MyProvider/consumer/MyConsumer/version/_b5236e772_ ? PUT an empty object to /pacticipants/MyConsumer/versions/b5236e772/tags/prod. returns an object with name and links ? Finally retrieve it from GET /pacts/provider/MyProvider/consumer/MyConsumer/latest/prod The version must match. Thanks Ronald.

pollet_22
2021-01-13 16:04
has joined #pact-net

dshattuck
2021-01-13 20:49
has joined #pact-net

thomas.rosati
2021-01-13 21:58
has joined #pact-net

rahulsmalpani
2021-01-14 07:56
has joined #pact-net

sacha.camfferman768
2021-01-14 09:42
has joined #pact-net

brandonbeard86
2021-01-14 22:10
has joined #pact-net

geetishnayak
2021-01-15 01:02
has joined #pact-net

shettyg
2021-01-15 14:18
has joined #pact-net

natarajang1
2021-01-15 15:29
has joined #pact-net

michel.neufeglise
2021-01-18 08:55
has joined #pact-net

bart.boersma
2021-01-18 10:48
has joined #pact-net

monica.wu
2021-01-19 06:25
has joined #pact-net

makobernal
2021-01-19 08:23
has joined #pact-net

jibrail.idris
2021-01-19 10:11
has joined #pact-net

jmvb.registros
2021-01-19 11:01
has joined #pact-net

irldev
2021-01-19 15:37
has joined #pact-net

irldev
2021-01-19 15:39
I'm starting to look at http://pact.net and was wondering is there a .net equivalent of the @state("consumer scenario here") ? An example can be seen here: https://github.com/pact-foundation/pact-jvm/blob/master/provider/junit/src/test/java/au/com/dius/pact/provider/junit/ContractTest.java I'm just wondering how we write tests for specific scenarios in .net the way you can with Java.

irldev
2021-01-19 15:41
As I understand from the Java version we had to have an @state annotated method for each scenario in the contract, which then ran the actual provider test.

fnguyen
2021-01-19 22:09
Are there any best practices to run the *pact provider test* as part of the CI/CD of an *azure function* ? Running it in a function emulator or actually deploy the function and run the provider test on deployed function? Thank you

tpham
2021-01-19 22:36
has joined #pact-net

matt.fellows
2021-01-19 22:38
No, you need to setup a (test only) provider endpoint that will receive the state to configure

matt.fellows
2021-01-19 22:38
I think you've discovered this already based on your other question

vishal.grover
2021-01-20 03:12
has joined #pact-net

irldev
2021-01-20 07:39
Yeah, I think so. Thanks :+1:

priya.saraf
2021-01-20 08:43
has joined #pact-net

fahad.aj.khan
2021-01-20 08:58
has joined #pact-net

nicole.jaenchen
2021-01-20 09:38
has joined #pact-net

dinakaran.ulaganathan
2021-01-20 13:59
has joined #pact-net

yann.courtel
2021-01-20 16:09
Hi paulh, using attribute for that would be an overkill and not necessarily the best way to go in .NET. We use a base provider test class where there is a dictionary containing the states, then a simple link with the state name and a method execution does the trick.

ptsiakos77
2021-01-20 21:55
has joined #pact-net

mhdtouban
2021-01-21 01:58
has joined #pact-net

veeraprathap.n
2021-01-21 04:10
has joined #pact-net

tsiakos
2021-01-21 09:24
has joined #pact-net

oleg
2021-01-21 13:05
has joined #pact-net

thomas.powell
2021-01-22 10:18
has joined #pact-net

stefan.selent
2021-01-23 01:54
has joined #pact-net

paulo
2021-01-25 11:37
has joined #pact-net

kmckeever
2021-01-25 14:38
has joined #pact-net

robert.land
2021-01-25 19:25
has joined #pact-net

aparnachaudhari
2021-01-25 21:34
has joined #pact-net

gwhill7
2021-01-25 23:23
has joined #pact-net

bibinc99
2021-01-26 14:37
has joined #pact-net

luisc.barretog
2021-01-27 00:42
has joined #pact-net

laxmi.somni508
2021-01-27 10:27
has joined #pact-net

ryanding16
2021-01-27 20:25
has joined #pact-net

athurner
2021-01-28 13:55
has joined #pact-net

alex.mcnair
2021-01-28 18:35
has joined #pact-net

mailinglistsspammedme
2021-01-28 23:30
has joined #pact-net

elliottmurray
2021-01-29 09:09
has joined #pact-net

steven.beaver.retail
2021-01-29 15:34
has joined #pact-net

ekberli.elbrus
2021-01-30 16:33
has joined #pact-net

george.south
2021-02-01 21:12
has joined #pact-net

twierzchowski
2021-02-03 07:05
has joined #pact-net

yassin.hajaj
2021-02-03 10:35
has joined #pact-net

dany.marques90
2021-02-03 12:48
has joined #pact-net

marcelo
2021-02-03 13:11
has joined #pact-net

sandeeparthur
2021-02-03 19:46
has joined #pact-net

octoberclub
2021-02-04 16:27
has joined #pact-net

slavick
2021-02-04 17:21
has joined #pact-net

imran.settuba
2021-02-04 18:57
has joined #pact-net

christopher.roberts
2021-02-05 01:02
has joined #pact-net

r.darcel
2021-02-05 09:15
has joined #pact-net

irldev
2021-02-05 20:59
Has anyone hit issues with pact-net on the provider side where they get a connection refused error? We've tried several things to get it working including starting up a connection on localhost before the test starts, yet still get the same error. We can run an instance of our real provider code in CI so we don't need to create a mock endpoint but it still throws the same error. Although I'm wondering now if we have to forget about trying to use our real provider code in CI and just create a mock version and endpoints, but I'd rather not as it seems like we'd have to just recreate all our methods and endpoints, just in a mocked/test version, rather than using the real application code. It seems very similar to this issue except ours happens on the provider verification https://github.com/pact-foundation/pact-net/issues/233

matt.fellows
2021-02-05 21:55
On the provider side you do need to start your provider API in CI and locally. So if you're getting a connection refused, that seems the cause

matt.fellows
2021-02-05 21:55
What is your provider test pointing at now?

ashish.joshi
2021-02-06 01:07
has joined #pact-net

fnguyen
2021-02-06 01:28
My understanding is indeed for the provider test, your service must be already running and accepting connections. You pass in the endpoint in PactVerifier.ServiceProvider(). Check with postman that your service runs, if so your provider test should run too. The Consumer test always runs on a mock service. This is so it gets exactly what is expects and the consumer test always passes. The result of running the consumer test is that it creates the pact file.

irldev
2021-02-06 09:00
It seems even when I have it run locally to test our provider verification, I still get a connection refused which is odd.

matt.fellows
2021-02-06 09:43
That is odd. How have you configured the pact verification? The port and server address need to line up and the server obviously needs to be up

yann.courtel
2021-02-08 08:27
Hi Paulh, from time to time it happens to us as well. Check how you build your service locally. Make sure the service are properly mocked and that you are referencing a port that is not used. Then check if the call to your api doesn't depend on an external component such as a custom serialization you would have to declare. It's an issue that is corrected at the CI for us usually. Plan of action : -> check your service is running properly (postman can help) -> check the route can be called -> check the objets passed to the request (sometimes it's a serialization problem) -> check also the content-type on the consumer side. (a simple application/json instead of application/vnd.restful+json can trigger a 404 error on the provider side) Good luck.

irldev
2021-02-08 14:53
We think the issue is related to it not being able to see the instance of the http client in memory attached issue). When we run it locally, it can connect fine. https://github.com/pact-foundation/pact-net/issues/240

irldev
2021-02-08 15:19
Thanks. Think we know why it's failing now in CI. It works when we run it locally but in memory in CI it's not happy

yann.courtel
2021-02-08 16:16
You're welcome. yeah, the same thing can happen at the CI, make sure the service is running in the right port and that the configuration is not overridden somewhere.

irldev
2021-02-08 16:36
I think our issue is we need to be able to pass in the actual instance of the http client rather than a URL like localhost

irldev
2021-02-08 16:36
I think our issue is we need to be able to pass in the actual instance of the http client rather to the verifier than a URL like localhost

matt.fellows
2021-02-08 22:29
I?m very confused. On the provider side, your API should simply be started like it would in any other environment. The Pact provider verification process will communicate to that provider over HTTP - why would it need an actual instance of an http client?

matt.fellows
2021-02-08 22:29
if it can?t talk to it via HTTP, it?s not going to work

przemek.sech296
2021-02-08 23:18
has joined #pact-net

vplows
2021-02-09 06:00
has joined #pact-net

irldev
2021-02-09 06:17
From what we can tell it's the same issue as talked about in the link I posted above. It seems based on that, that the .net implementation requires the provider to be deployed either locally or to a real environment, rather than in memory in CI.

matt.fellows
2021-02-09 07:16
Do the docs imply that you can do it any other way? We should update if they do, because it's not how pact works. As stated above, the server must be up and running. It needs to expose a REST API. That implies it can't be in memory

irldev
2021-02-09 08:37
I'm not sure. At this link below it seems to imply you can start the API when your test starts. When we start the API locally and separately using a dot net run command, everything works fine and the provider verification can use localhost. When we try to have the test start it in the same way, the provider verify throws the same error as in the above. https://github.com/pact-foundation/pact-net

matt.fellows
2021-02-09 10:57
> At this link below it seems to imply you can start the API when your test starts you can of course, but the API needs to be up and available by the time the Pact verification begins. If you start it asynchronously, it may not be up in time

matt.fellows
2021-02-09 10:58
It?s possibly because I don?t write .NET - but does this not imply the service should be up and running on port `9222`? (genuinely asking if the docs are clear so that we can fix if not)

rodney.stromlund
2021-02-09 16:18
has joined #pact-net

fnguyen
2021-02-09 18:41
I have been working at implementing pacts test for an azure function recently. The consumer test can run with the other unit tests immediately after building. The consumer test passes, as designed, and the pact is pushed to broker and tagged. For the provider test to run, the service needs to have been deployed *before* the test starts. We do this by deploying to a DEV location then pointing the provider test to that test location. If the provider test succeeds, the deployment to staging happens. We still have the dev deployment done even if the test failed and we may want to roll it back or re-run the deployment step of a previous build.

nada
2021-02-09 19:00
has joined #pact-net

siddhardhan
2021-02-09 20:21
has joined #pact-net

matt.fellows
2021-02-10 00:11
We typically would recommend _not_ deploying to a real environment for Pact tests.

matt.fellows
2021-02-10 00:12
In the case of AWS Lambda, for example, two common patterns exist: 1. Use things like serverless / SAM local (Do azure functions have a similar tool?) 2. Create a small HTTP handler that sits in front of your actual function code delegating to it that Pact can communicate to


fnguyen
2021-02-10 00:15
For azure functions in visual studio there is an emulator. I would be interested if there was a way to do something similar from azure pipeline.

fnguyen
2021-02-10 07:00
I have a consumer test that has some fields like ```jitter = new { value = Match.Type( 0.6742424242424242 ), }, packetLoss = new { value = Match.Type( 0.5848106060606061 ), },``` during producer test is see ```Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example Actual: { [...] "jitter":{"value":0.6742424242424242},"packetLoss":{"value":0.5848106060606061}, [...] Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown ... , { "jitter": { - "value": Float + "value": NilClass }, "packetLoss": { - "value": Float + "value": NilClass }, Description of differences -------------------------------------- * Expected a Float (like 0.6742424242424242) but got nil at $.[...].jitter.value * Expected a Float (like 0.5848106060606061) but got nil at $.[...].packetLoss.value``` Is there a way to specify the type so it verifies correctly?


matt.fellows
2021-02-10 07:18
you should be able to use those to run the function locally - both in dev and in CI. Using tools like VS to simulate is great, but as you?ve discovered, it?s useless for CI. IMO it?s best to use tools and processes that can be repeated across dev and CI. It leads to less surprises and you don?t need to maintain multiple ways of doing it

lars.hisken916
2021-02-10 08:08
has joined #pact-net

pauligoe10
2021-02-10 08:19
has joined #pact-net

tusharvarm
2021-02-10 09:38
has joined #pact-net

igorsharf
2021-02-10 10:39
has joined #pact-net

patrick.hendron
2021-02-10 13:52
@patrick.hendron has left the channel

kieran
2021-02-10 17:13
has joined #pact-net

poward
2021-02-10 18:17
has joined #pact-net

ckhadilkar
2021-02-10 21:16
has joined #pact-net

fnguyen
2021-02-11 16:02
It was a user error. The data returned was very big and i was no suspecting that there would be some null. It looks like the test did exactly it was supposed to do!

neild
2021-02-11 18:53
has joined #pact-net

painenigowthami
2021-02-11 22:32
has joined #pact-net

stephenkilbourn
2021-02-11 23:02
has joined #pact-net

tcarlson
2021-02-11 23:05
has joined #pact-net

fnguyen
2021-02-12 01:19
I am trying to match either a float or null. I read ? https://github.com/pact-foundation/pact-js/issues/51, ? https://github.com/pact-foundation/pact-support/pull/86 ? https://github.com/pact-foundation/pact-net/issues/198 in PactNet.Matchers I only see Type, MinType and Regex matchers (and these just set the Match to "Pact::SomethingLike", "Pact::ArrayLike" or "Pact::Term") Is there no way to match either null or a number? Is there a way to match anything (just checking the attribute exists) ? I was thinking at doing a regex to match null or a decimal but regex probably only works with quoted strings. Thanks

fnguyen
2021-02-12 01:57
From what I read at https://github.com/pact-foundation/pact-specification/tree/version-3 it would be written as ```{ "matchingRules": { "$.body.jitter.value": { "combine": "OR", "matchers": [ {"match": "decimal", "value": "0.123456"}, {"match": "null" } ] } } } }``` But https://github.com/pact-foundation/pact-net#pactnet PactNet for now is only 2.0 compliant so there is no way to specify these matchers yet.

matt.fellows
2021-02-12 02:21
You need to write two tests Francois


matt.fellows
2021-02-12 02:21
the OR matcher I think is only supported in JVM and even then we discourage it (I think it might get deprecated)

matt.fellows
2021-02-12 02:21
At least, that?s the current state of affairs

matt.fellows
2021-02-12 02:21
the link I just posted explains the philosophy of this

r.strauch
2021-02-12 10:15
has joined #pact-net

ztlboy05
2021-02-12 14:57
has joined #pact-net

smith260194
2021-02-12 15:22
has joined #pact-net

fnguyen
2021-02-12 17:02
Thank you Matt. Writing two tests assumes the float or null are from separate queries. In my case, the query returns an array where some values are null and some are float. I (consumer am in .NET but my provider is in java. I had read the part about array min size cannot be 0. I had skipped the paragraph above: _The same goes for specifying "SOME_VALUE or null". If all your provider verification test data returned nulls for this key, you might think that you had validated the "SOME_VALUE", but in fact, you never had. You could get a completely different "SOME_VALUE" for this key in production, which may then cause issues._ However I would prefer if pact were a tool to let me do things I want even if weaker. If the producer tells me the value they return a null or a float, I want to be able to test that, so I can test it's there and is not e.g. a string. Pact will not make the producer team redesign their API because pact thinks they are doing it wrong. If I cannot test against null or float, I will have to just drop the test. Maybe in a future specification it would be possible to tag my field matchers and as a whole the tests would check all the options have been tested: i had some nulls and some float for my specific field.

dabfleming
2021-02-12 20:34
has joined #pact-net

prasanthp
2021-02-13 00:45
has joined #pact-net

bhardwajdiwakar
2021-02-14 22:38
has joined #pact-net

hiteshpatadia
2021-02-15 06:29
has joined #pact-net

vikrant.sarkaniya
2021-02-15 13:31
has joined #pact-net

lemitrou
2021-02-15 14:20
has joined #pact-net

helloraj
2021-02-16 08:09
has joined #pact-net

jamesmlucas
2021-02-16 19:29
has joined #pact-net

gabe707
2021-02-16 20:31
has joined #pact-net

wangpei9679
2021-02-16 21:29
has joined #pact-net

geir
2021-02-16 23:03
has joined #pact-net

soruma.net
2021-02-17 05:58
has joined #pact-net

therimpact
2021-02-17 12:30
has joined #pact-net

amaljayaraj07
2021-02-17 17:50
has joined #pact-net

andrzej.igielski
2021-02-17 21:41
has joined #pact-net

mikewagner21
2021-02-18 03:15
has joined #pact-net

arindam.datta
2021-02-18 06:25
Hi @matt.fellows, shouldn't there be a tag `master` (provider branch) after completion of the Provider verification? I am using `pact-net` binaries from `message-pact` branch. You can see in the code I am providing the `ProviderBranch` with the parameter `providerVersionTags`.

arindam.datta
2021-02-18 06:26
This is the case when Provider Verification Pipeline is finished after being triggered by `webhook` with exact PactUri.

arindam.datta
2021-02-18 06:33
Hi @neil, as it could be related to the .Net library, bringing this discussion in your notice :point_up:

matt.fellows
2021-02-18 07:22
Could you please turn on debug logging to see what?s happening? are you on the latest version etc.?

khandelwalbhushan
2021-02-18 08:10
has joined #pact-net

aniket.agarwal
2021-02-18 09:21
has joined #pact-net

arpit.modani
2021-02-18 09:43
has joined #pact-net

byronth
2021-02-18 11:45
has joined #pact-net

isa.levine
2021-02-18 23:37
has joined #pact-net

r.strauch
2021-02-19 08:41
@r.strauch has left the channel

brian.pfretzschner
2021-02-19 10:15
has joined #pact-net

chitra.adikesavan
2021-02-20 15:50
has joined #pact-net

chitra.adikesavan
2021-02-20 16:00
Hi, I am new to microservices testing. I am a functional tester trying to test the microservices implemented in .Net , kafka with ksql stream. Is there any sample code available for contract testing in pact for the messages.

matt.fellows
2021-02-20 22:59
Search this channel for message pact. It's currently in beta support in a branch

chitra.adikesavan
2021-02-21 04:29
Hi Matt, I could not find the sample code, would you be able to help. I am a functional tester with basic knowledge in coding. It might be helpful if I can get the sample code for reference for .Net messages. Do I have to install Ruby?

matt.fellows
2021-02-21 04:39
Hi Chitra! are you able to write code? Pact is a code-first tool, so that is a pre-requisite at the moment

matt.fellows
2021-02-21 04:40
This is the latest branch for .NET with message support: https://github.com/pact-foundation/pact-net/pull/276

matt.fellows
2021-02-21 04:40
We?re still working through getting support from new contributors to merge this into master and get it released

matt.fellows
2021-02-21 04:40
Thanks to @arindam.datta for doing this

chitra.adikesavan
2021-02-21 06:24
Thanks for sharing this Matt! I am going to go through and understand how to use it. Yes, our development team completed the first microservice and working on the second. I am trying to find the ways to test these.

ankita.soni
2021-02-22 07:26
has joined #pact-net

jacek.helper
2021-02-22 08:03
has joined #pact-net

dany.marques90
2021-02-22 13:54
@dany.marques90 has left the channel

seanw122
2021-02-22 15:36
has joined #pact-net

akennedy
2021-02-22 15:54
has joined #pact-net

esimpson
2021-02-22 16:42
has joined #pact-net

dagrawal
2021-02-22 17:24
has joined #pact-net

venkata.pro
2021-02-22 21:47
has joined #pact-net

matt.fellows
2021-02-23 00:41
@bart.schotten :point_up: as per your note at https://github.com/bartschotten/com-pact, we are in need of a new maintainer to help drive the framework forward. Would you be open to potentially taking Pact Net to the next stage?

chitra.adikesavan
2021-02-23 07:42
Hi Matt, I have two questions: 1. The Pact-net project has for the http-client, is there anything for messages without http? I am new to automation with little bit coding knowledge. Could you please give me sample test case which will help me to understand. I need examples for how to use pact with .net messages. 2. I have downloaded pact-net for windows version 2.6.1. But I could not find the name space PactNet.PactMessage, am i using the correct version?

irldev
2021-02-23 19:08
We eventually got this working. It turns out we needed to pass some authentication tokens into the headers that pact verify was using.

jordan.levin
2021-02-23 19:14
has joined #pact-net

matt.fellows
2021-02-23 21:42
Hi Chitraa, as mentioned previously, the .net work for messages currently resides in a branch. You?ll need to use that branch to do non-http testing

matt.fellows
2021-02-23 21:44
There may be others here on the forum that could help out, unfortunately I don?t know .NET at all very well, I?m just trying to help


matt.fellows
2021-02-23 21:44
I think that answers both questions!

francesco.latorre
2021-02-24 05:59
has joined #pact-net

aniket.g2185
2021-02-24 09:13
has joined #pact-net

sundaresank360
2021-02-24 12:12
has joined #pact-net

arindam.datta
2021-02-24 12:49
My consumer test is not able to start Ruby Host. The same code is running on different project successfully.

arindam.datta
2021-02-24 12:52
@bethskurrie: any help? Thanks in advance! :pray:

matt.fellows
2021-02-24 13:03
See if you can start the ruby process yourself, outside of the .NET code

matt.fellows
2021-02-24 13:04
it?ll be somewhere in the path like this `?/tests/bin/Debug/netcoreapp2.0/pact-linux-x86/lib/vendor/ruby/2.2.0/bin/pact-mock-service`

matt.fellows
2021-02-24 13:04
try running it without arguments, if it doesn?t start, that?s helpful

arindam.datta
2021-02-24 13:04
Ok @matt.fellows, thanks for your suggestion. I'll try that. I'll update my findings here

matt.fellows
2021-02-24 13:05
if it does, that means it?s somewhere else. Perhaps it?s taking too long to start, or there is an issue connecting to it

matt.fellows
2021-02-24 13:05
np

jhawthor
2021-02-24 15:18
has joined #pact-net

chris.r.thomas
2021-02-24 16:54
has joined #pact-net

peter.cook
2021-02-24 17:05
has joined #pact-net

arindam.datta
2021-02-24 17:19
Sorry for the late reply. I tried to start the ruby process, but couldn't. Probably I don't know how to do that.

arindam.datta
2021-02-24 17:20
I am running project on Windows with no ruby installed..

arindam.datta
2021-02-24 17:20
Can the filePath length be a issue? My project is pretty much deep down few sub-directories.

arindam.datta
2021-02-24 17:21
can it be something related to this? https://github.com/pact-foundation/pact-net/issues/160

arindam.datta
2021-02-24 17:22
It's strange, I run tests (consumer) on one project, it successfully starts `ruby` and tests are successful. But fails on another project, `ruby` process doesn't start at all

arindam.datta
2021-02-24 17:36
As per the above GitHub issue, my exact path is `273` chars. `D:\Projects\DecosPlatform\CollaborationServices\Decos.Collaboration.SessionManagement\tests\Decos.Collaboration.SessionManagement.Services.Tests\bin\Debug\netcoreapp3.1\pact-win32\lib\vendor\ruby\2.2.0\gems\pact-mock_service-3.6.2\lib\pact\mock_service\request_handlers`

arindam.datta
2021-02-24 17:37
However, I am not sure where to look for that error message as mentioned in the Github issue.

jayeshguru81
2021-02-24 18:34
has joined #pact-net

ben.kirberger
2021-02-24 19:16
has joined #pact-net

matt.fellows
2021-02-24 22:49
You don?t need ruby installed to run the process, so if it doesn?t run that could be it

matt.fellows
2021-02-24 22:49
what error does it through trying to execute the binary?

matt.fellows
2021-02-24 22:49
have you tried moving your project up a few directories to reduce the length?

arindam.datta
2021-02-25 04:42
Hi @matt.fellows, yes it's confirmed now. When I move my project up the directory structure it works now. Is there any workaround for this issue? It's hard to control/dictate directory structure in a large team.

m.stephkan
2021-02-25 05:30
has joined #pact-net

matt.fellows
2021-02-25 06:59
That's the workaround at the moment. Also search pact node for similar issue, there are windows registry hacks you can do

matt.fellows
2021-02-25 06:59
V3 should solve this problem, albeit we don't yet have a contributor path forward for this yet

matt.fellows
2021-02-25 06:59
In . net

stephen.tjasink
2021-02-25 08:23
has joined #pact-net

beatrizwaclawek
2021-02-25 20:27
has joined #pact-net

zhoutianli1234
2021-02-25 21:09
has joined #pact-net

travis.day
2021-02-26 04:06
has joined #pact-net

andrew.cunningham
2021-02-26 11:13
has joined #pact-net

andrew.cunningham
2021-02-26 11:54
@andrew.cunningham has left the channel

brianmasschaele
2021-02-27 13:27
has joined #pact-net

pedroefajardo_pactio
2021-02-27 17:18
has joined #pact-net

dominic_herrmann
2021-03-01 06:54
has joined #pact-net

yann.courtel
2021-03-02 08:42
Hi everyone. Is there any developer working on the message-pact branch at the moment? @arindam.datta I saw you on the thread. I'd like to help if possible. If not, at least if we can synchronize each other, that'd be great. Have a great day!

arindam.datta
2021-03-02 08:47
Hi @yann.courtel, no I am not working on that branch. I just tried once to merge 'master' to the 'message-pact' branch and raised a PR, but apparently I messed up one of the ReadMe files. After that I couldn't manage time to do anything. So, you can completely ignore my PR and probably start independently if you want to contribute.

yann.courtel
2021-03-02 09:55
ok got it. Thanks a lot!

matthew.long
2021-03-02 14:08
has joined #pact-net

tmoncm
2021-03-02 17:17
has joined #pact-net

phoenixcampos01
2021-03-02 21:25
has joined #pact-net

hugh.paul.mcgowan
2021-03-03 17:52
has joined #pact-net

normanrs
2021-03-04 11:18
has joined #pact-net

jayson.bailey
2021-03-04 19:18
has joined #pact-net

mjsmcp
2021-03-08 23:46
has joined #pact-net

javier.garcia_cotado
2021-03-09 21:52
has joined #pact-net

siddharth.gupta
2021-03-10 05:28
Hello folks , has anyone tried sending https requests to the PactNet Mock Server , its working for http when running consumer tests but fails for https

siddharth.gupta
2021-03-10 05:28
any idea how to make PactNet mock server work for https ?

siddharth.gupta
2021-03-10 05:30
here is the sample code i am using

siddharth.gupta
2021-03-10 05:30
//Arrange var guidRegex = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"; var eventId = Guid.Parse("83F9262F-28F1-4703-AB1A-8CFD9E8249C9"); var eventType = "DetailsView"; var eventTimestamp = DateTime.UtcNow; // Describe what mock provider service should return when a specfic request is recieved . _mockProviderService.Given(String.Format("there is a event with id '{0}'", eventId)) .UponReceiving(String.Format("a request to retrieve event with id '{0}'", eventId)) .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = Match.Regex($"/events/{eventId}", $"^\\/events\\/{guidRegex}$"), Headers = new Dictionary<string, object> { { "Accept", "application/json" } } }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary<string, object> { { "Content-Type", "application/json; charset=utf-8" }, { "Server", Match.Type("RubyServer") } }, Body = new { eventId = Match.Regex(eventId.ToString(), $"^{guidRegex}$"), eventType = Match.Type(eventType), timestamp = Match.Regex(eventTimestamp.ToString("o"), "^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]+)?(Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?$") } }); var consumer = new EventsApiClient(_mockProviderServiceBaseUri); //Act var result = consumer.GetEventById(eventId); //Assert Assert.Equal(eventId, result.EventId); Assert.Equal(eventType, result.EventType); Assert.Equal(eventTimestamp, result.Timestamp); _mockProviderService.VerifyInteractions();

matt.fellows
2021-03-10 05:36
Any reason you have to actually use https? It really doesn't add any value in a pact test so I wouldn't bother

siddharth.gupta
2021-03-10 05:40
on the provider side we are planning to run the pact tests against actual deployment which takes https

siddharth.gupta
2021-03-10 05:45
i tried this MockProviderService = PactBuilder.MockService(MockServerPort, true, IPAddress.Any);

siddharth.gupta
2021-03-10 05:47
but MockProviderService fails to start after 20 checks

matt.fellows
2021-03-10 05:49
Sure, but this is the consumer side and is a unit test. The contract doesn?t capture if the request is http/https

siddharth.gupta
2021-03-10 05:50
ok

matt.fellows
2021-03-10 05:50
does that make sense?

matt.fellows
2021-03-10 05:50
It?s there because some people ask for it, but in 99.9% of the cases it?s just not required

siddharth.gupta
2021-03-10 05:51
so on provider side how do we make these calls on https ,? just update the BaseURI right ?

matt.fellows
2021-03-10 05:51
exactly

matt.fellows
2021-03-10 05:51
Also note, it?s not ideal to be tested against a real, deployed service. It can be done, but it?s not ideal (can?t run tests in parallel for example, don?t get feedback before commiting and so on)

siddharth.gupta
2021-03-10 05:51
ok gr8 , let me try it out , thanks for quick help as always

matt.fellows
2021-03-10 05:52
Is this API documented by OAS or anything, btw?

siddharth.gupta
2021-03-10 05:53
you mean the actual provider side ?

siddharth.gupta
2021-03-10 05:53
its FHIR

matt.fellows
2021-03-10 05:54
FHIR?


matt.fellows
2021-03-10 05:56
The reason I ask is that if that can be also documented as an OAS, we have some tools in Pactflow that may be of help


matt.fellows
2021-03-10 05:57
But back to the other point, do you have to test an actual, deployed provider? Any reason you can?t test against a local one? Doing provider states setup etc. is going to be hard

matt.fellows
2021-03-10 05:59
@siddharth.gupta so even though we?ve resolved it in the thread (for others: you almost certainly don?t need https on a consumer test), the option is there when setting the mock service up. e.g. `MockProviderService = PactBuilder.MockService(MockServerPort, true);` would start a mock server with HTTPS enabled

siddharth.gupta
2021-03-10 06:00
yes , creating medical records in very difficult independently , instead its easy for us to spin of actual deployment and run it quickly

siddharth.gupta
2021-03-10 07:15
Hey Folks , any pointer to article where i can find how to send parameters and its values in consumer request to mock server

matt.fellows
2021-03-10 07:17
Query parameters?

siddharth.gupta
2021-03-10 07:21
yes , multiple

siddharth.gupta
2021-03-10 07:22
was able to send single

matt.fellows
2021-03-10 07:24
Can you show what you mean please?

siddharth.gupta
2021-03-10 07:25
want to send something like http://localhost:Port/ with Path = "/4.0/fhir/Patient?name-or-identifier=" + PatientIdentifier + "&_format=json&_pretty=true",

siddharth.gupta
2021-03-10 07:27
so i did Path = "/4.0/fhir/Patient with Query = Match.Regex($"name-or-identifier={PatientIdentifier}", $"name-or-identifier={PatientIdentifier}"), successfully

siddharth.gupta
2021-03-10 07:27
but how to send more than 1 parameter

matt.fellows
2021-03-10 07:44
Can't you just literally add more to that regex matcher?

matt.fellows
2021-03-10 07:45
Also, do you really need the regex? As in, in your consumer test do you now know which patient ID will be used?

matt.fellows
2021-03-10 07:45
If you always know (which really you should) then you don't need a matcher here

matt.fellows
2021-03-10 07:45
The matcher isn't used on the provider test (because it's on the request)

siddharth.gupta
2021-03-10 07:47
Added a dictionary worked for single , trying for multiple

siddharth.gupta
2021-03-10 07:50
it worked

siddharth.gupta
2021-03-10 07:50
thanks

matt.fellows
2021-03-10 07:50
:+1::+1::+1:

siddharth.gupta
2021-03-10 07:51
Query = new Dictionary<string, object> { { "name-or-identifier",PatientIdentifier }, { "_format","json" }, { "_pretty","true" } }

siddharth.gupta
2021-03-10 10:55
Hi Folks , I was able to instruct mockserver to behave lie my provider . Now when running prvider tests i need to set Authorization token for every API call that provider test invokes . Is there a way to achieve it ?

matt.fellows
2021-03-10 12:25
It?s going to be tough, because it?s running remotely

matt.fellows
2021-03-10 12:26
That?s what provider states are for, but because it?s running on another server, you?ll need to expose an endpoint to manipulate state

matt.fellows
2021-03-10 12:26
Personally, it would be simpler to remove auth from that Pact test altogether (and the pact test environment)

akos.csurai
2021-03-10 13:39
has joined #pact-net

siddharth.gupta
2021-03-10 13:54
ok, i think token also includes user privilege's , how do we handle that then

testme2020testme
2021-03-10 14:12
has joined #pact-net

tommy.mirchandani
2021-03-10 17:13
has joined #pact-net

matt.fellows
2021-03-10 20:47
good question.

matt.fellows
2021-03-10 20:47
other frameworks have the concept of request filters, .NET doesn?t have it. But I found it fairly easy to add to JS/Go and for others to add (e.g. to Python/PHP)

matt.fellows
2021-03-10 20:47
you could have a go at contributing that feature to .NET

matt.fellows
2021-03-10 20:48
it involves creating a provider proxy and creating ?hooks? into each state, such that you could modify the request dynamically prior to issue the provider tests

matt.fellows
2021-03-10 20:48
in those hooks, you could create a new token for that test session and use it instead of the one in the contract


matt.fellows
2021-03-10 20:49
but again, because the environment is not within your control, you?re really working against the way Pact wants to work

varinderjitkaur13
2021-03-11 01:46
has joined #pact-net

krcl.dev
2021-03-11 05:11
has joined #pact-net

krishnaraoveera1294
2021-03-11 17:53
has joined #pact-net

raghavendra.kalakonda
2021-03-11 23:08
has joined #pact-net

andries.spies
2021-03-12 07:25
has joined #pact-net

siddharth.gupta
2021-03-12 08:00
Hey folks , My provider returns following json as response , i want to validate some of the attributes not all , so how do i set the expectations in the consumer side for mock to return selected attribute .

siddharth.gupta
2021-03-12 08:03
for example in the above json i want to only validate "resourceType" : : : : : "Patient", , "id": "Patient-64851", and also validate the json structure

siddharth.gupta
2021-03-12 08:12
i was able to generate token with large alive time and send it in PactVerifierConfig header

siddharth.gupta
2021-03-12 08:53
but now i want to validate selected part of json response and set it as expectation in consumer test

siddharth.gupta
2021-03-12 08:53
i was able to do something like this Body = new { entry = new { resource = new { resourceType = Match.Regex("Patient", "Patient"), id = Match.Regex("Patient-64851", "Patient-64851") } }

siddharth.gupta
2021-03-12 09:12
but the actual format has lot more data and consumer would only validate selected attributes and the structure

siddharth.gupta
2021-03-12 09:13
also as can be see below entry tag has additional parenthesis "[" ```"entry" : : : [ : : : : { : : : "fullUrl" : : : : "https://10.167.167.97:44370/4.0/fhir/Patient/Patient-64851", : : : "resource": : : : { : : : : "resourceType" : : : : : "Patient", : : : : "id": "Patient-64851",```

siddharth.gupta
2021-03-12 11:07
any pointer on above would be really helpful , this should be a very common case

siddharth.gupta
2021-03-12 11:08
where provider response is a json and consumer would want to validate only selected data along with the structure

matt.fellows
2021-03-12 11:12
It is a common case, in fact, it's close to a principle (see Postels Law). what issue have you run into?

matt.fellows
2021-03-12 11:13
You literally just write what you need in the consumer test without regard to any fields you don't need

siddharth.gupta
2021-03-12 11:21
how to ignore the content what is not needed

siddharth.gupta
2021-03-12 11:24
any example to validate json response would be helpful

kamil.klima
2021-03-12 11:38
has joined #pact-net

marcelo
2021-03-12 12:56
@marcelo has left the channel

lswanborough
2021-03-15 00:50
has joined #pact-net

don.tobias
2021-03-15 19:35
has joined #pact-net

sagar.kathuria
2021-03-17 04:25
has joined #pact-net

shao.sum
2021-03-17 08:35
has joined #pact-net

riddhichopra
2021-03-18 01:28
has joined #pact-net

anu.de
2021-03-18 02:28
has joined #pact-net

sreyaslj
2021-03-18 04:25
has joined #pact-net

siddharth.gupta
2021-03-18 07:41
Hey folks ,one of the provider in my organization do not want to keep track of consumer versions and run provider test against all versions of consumer and generate compatibility matrix how can we implement this using PactNet

matt.fellows
2021-03-18 08:19
As per https://github.com/pact-foundation/pact-net/#2-tell-the-provider-it-needs-to-honour-the-pact, you have the option to use the `PactBroker` function, and dynamically find all providers based on the tags you apply to them: ```.PactBroker("http://pact-broker", uriOptions: pactUriOptions, enablePending: true, consumerVersionTags: new List<string> { "master", "prod" }, providerVersionTags: new List<string> { "<ADD PROVIDER TAG HERE>" }, )```


fnguyen
2021-03-18 21:19
I am testing an API that takes a POST with a body. When I try to also use a query string, the mock server fails with a 500. https://github.com/pact-foundation/pact-net/issues/185, I read something about the underlying rack test allows body or query string but not both. It's two years old. Is it still the case or is it supposed to work?

arvind1017
2021-03-18 22:48
has joined #pact-net

matt.fellows
2021-03-19 00:00
I suspect it does not, based on https://github.com/rack/rack-test/issues/225


matt.fellows
2021-03-19 00:01
The new core (Rust) may support this, although I?m not sure it?s an explict thing we test for

matt.fellows
2021-03-19 00:01
the libraries are newer, so it?s probably possible

matt.fellows
2021-03-19 00:01
we are looking for a maintainer at the moment, to help drive the new Rust core into the .NET library

matt.fellows
2021-03-19 00:02
this would unlock a number of new features, solve a bunch of issues, and set us up for the future (e.g. plugins)

sushilvc84
2021-03-19 00:30
has joined #pact-net

tejakoshti7
2021-03-19 06:26
has joined #pact-net

yannick.adler
2021-03-19 12:44
has joined #pact-net

smith260194
2021-03-19 17:40
@smith260194 has left the channel

fnguyen
2021-03-19 18:00
Thanks Matt. No experience with Rust here though.

fnguyen
2021-03-19 18:05
@matt.fellows Would you know if this (query string and content) would be supported in java provider test (Java seems further along than .NET wrt pact) ?

matt.fellows
2021-03-19 20:43
I would know off the top of my head but I'd say it's likely

matt.fellows
2021-03-19 20:44
As for rust, you don't need to know rust to integrate it. It's shipped as a C interface (DLL)

aelse
2021-03-19 23:54
has joined #pact-net

eric2323223
2021-03-20 01:35
has joined #pact-net

jordan.r.stewart
2021-03-20 16:07
has joined #pact-net

tmorrison
2021-03-21 21:45
has joined #pact-net

a.chandrasekaran
2021-03-22 00:50
has joined #pact-net

maksym.motornyi
2021-03-22 11:50
has joined #pact-net

gareth.somerville
2021-03-22 12:10
has joined #pact-net

joseph.method
2021-03-22 19:55
has joined #pact-net

dennyg666
2021-03-22 20:54
has joined #pact-net

me1295
2021-03-23 00:15
has joined #pact-net

anchit.99
2021-03-23 09:04
has joined #pact-net

joseph.method
2021-03-23 14:30
@joseph.method has left the channel

wola.adedeji
2021-03-23 16:25
has joined #pact-net

kenny.shobowale
2021-03-23 16:38
has joined #pact-net

anbu.pandian
2021-03-24 11:54
has joined #pact-net

rachel.barton
2021-03-24 19:12
has joined #pact-net

james522
2021-03-24 22:06
has joined #pact-net

anne.schuth320
2021-03-25 07:49
has joined #pact-net

james.shirtcliffe
2021-03-25 12:04
has joined #pact-net

serhii.makarenko
2021-03-25 12:55
has joined #pact-net

mashabudryte
2021-03-25 14:35
has joined #pact-net

matthew.simon.barnes_
2021-03-25 16:08
has joined #pact-net

fnguyen
2021-03-25 17:49
I have tried to convince legal to let me work a little bit on open source projects but they have been very slow to respond. If I can, I would not mind helping.

fnguyen
2021-03-25 17:54
Note: if I patch the pact file and set the query string in the interactions' "path", the "path" and "body" are used correctly in the provider test. However hacking the pact is not the way I want to go.

jose.manzano
2021-03-26 14:27
has joined #pact-net

chris.faulkner
2021-03-26 16:13
has joined #pact-net

bryanw
2021-03-26 18:46
has joined #pact-net

kerem.durak
2021-03-29 08:34
has joined #pact-net

dave.clissold
2021-03-29 12:40
has joined #pact-net

sidhant.bhayana.15
2021-03-29 18:34
has joined #pact-net

crhawkins85
2021-03-30 21:02
has joined #pact-net

crhawkins85
2021-03-30 21:06
Good evening - I've been playing with Pact for a few days as a PoC and am finding really useful. So much so I went down a massive rabbit hole and think I've figured out a way to get WebApplicationFactory and the ASP Core https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests functionality working with provider verification via proxying the calls through the test client. I added some detail to https://github.com/pact-foundation/pact-net/issues/283 and will try and pull together an example I can share.

matt.fellows
2021-03-30 21:15
that sounds really useful Chris

matt.fellows
2021-03-30 21:15
would you be interested in contributing to the framework?

matt.fellows
2021-03-30 21:16
Separately to this, Pact Message (our support for async) in other libraries depends on having a proxy layer in there to be able to connect message producer (or consumer) functions to the underlying framework

matt.fellows
2021-03-30 21:16
so this sounds useful in that regard also

pranav.gore
2021-03-31 01:58
has joined #pact-net

harsha6988
2021-03-31 12:19
has joined #pact-net

leixu
2021-03-31 14:42
has joined #pact-net

matthew.brown
2021-03-31 15:15
has joined #pact-net

oleksandr.tryshchenko
2021-03-31 19:54
has joined #pact-net

phelantomas
2021-04-01 13:13
has joined #pact-net

ktogias
2021-04-01 20:04
has joined #pact-net

ktogias
2021-04-01 21:36
@ktogias has left the channel

balaji.sivakumar
2021-04-02 05:41
has joined #pact-net

uryadov212
2021-04-05 20:52
has joined #pact-net

soumya.aithal966
2021-04-05 22:45
has joined #pact-net

sheyan.rizfee
2021-04-06 00:55
has joined #pact-net

piotr
2021-04-06 09:24
has joined #pact-net

dmitry.korolev
2021-04-06 11:47
has joined #pact-net

sravyavadrevu988
2021-04-06 20:40
has joined #pact-net

johnnycareer
2021-04-06 21:34
has joined #pact-net

danil.nurgaliev
2021-04-07 12:26
has joined #pact-net

johnnycareer
2021-04-07 17:34
@johnnycareer has left the channel

fnguyen
2021-04-07 19:03
When running the consumer tests as part of a pipeline on azure, I get a bunch of errors (probably one per interaction) in the log although the test finishes successfully: ```ERROR Errno::ECONNRESET: Connection reset by peer @ io_fillbuf - fd:24 /home/vsts/work/1/s/PactConsumerTest/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in `eof?' /home/vsts/work/1/s/PactConsumerTest/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in `run' /home/vsts/work/1/s/PactConsumerTest/bin/Debug/netcoreapp3.1/pact-linux-x86_64/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/server.rb:191:in `block in start_thread'``` Should I be worried or can I ignore these?

gtsifrikas
2021-04-08 08:53
has joined #pact-net

kanapuramamarnath
2021-04-08 09:18
has joined #pact-net

arnaud.dutrillaux
2021-04-09 10:59
has joined #pact-net

gsinghania
2021-04-09 15:40
has joined #pact-net

souravmohanty35
2021-04-09 16:34
has joined #pact-net

itzdavey
2021-04-09 17:23
has joined #pact-net

tmorrison
2021-04-12 00:18
@tmorrison has left the channel

laura.edington
2021-04-13 17:45
has joined #pact-net

laura.edington
2021-04-13 18:15
Hi team, I?m seeing a weird behavior that I can?t find any explanation or resolution for in the docs. I originally had a state in my consumer test that did not have a corresponding provider state. When run, it failed (understandably). I changed the state in my consumer test to correspond to an existing desired provider state. When run, I now see _both_ ?tests? running. That is, in the pact that is posted to pact broker and on the provider side verification I see an array of tests of size 2, that run the same interaction but the first with the original provider state and the second with the new provider state. The original provider state is nowhere in the consumer pact and I only have one interaction there. I have tried deleting and integration and pact from pact broker, but it repopulates with this same 2-test problem. Any insights?

laura.edington
2021-04-13 18:16
this is the example consumer pact ```provider.addInteraction({ state: 'there are orders', uponReceiving: 'a request for orders', withRequest: { path: '/orders', method: 'GET', }, willRespondWith: { body: eachLike({ id: 1, items: eachLike({ name: 'burger', quantity: 2, value: 100, }), }), status: 200, headers: { 'Content-Type': 'application/json; }, }, }) })```

laura.edington
2021-04-13 18:16
And the provider verification looks like so ```Given there are walruses a request for orders with GET /orders returns a response which has status code 200 Given there are orders a request for orders with GET /orders returns a response which has status code 200```

laura.edington
2021-04-13 18:17
where `there are walruses` is the original state that did not have a match on the provider side and I have since changed

liam.mcdermott
2021-04-13 22:38
has joined #pact-net

matt.fellows
2021-04-14 01:54
So this looks like JS code

matt.fellows
2021-04-14 01:55
Can you please share the full suite? You might have it on a mode that appends to an existing contract

wedlaaa
2021-04-14 13:33
has joined #pact-net

laura.edington
2021-04-14 16:12
ah yes, the consumer is JS and the provider is .NET

laura.edington
2021-04-14 16:13
What do you mean by full suite?

laura.edington
2021-04-14 18:39
Interesting update! I fixed another issue where the Pact validation was failing (e.g. response code =/= 200). Once this was fixed, the ghost-of-provider-state-past disappeared

laura.edington
2021-04-14 18:40
perhaps there is a behavior where all integrations are appended until you get a validated pact

laura.edington
2021-04-14 18:40
I appreciate your eyes and thoughts on this - thank you! :raised_hands:

wderksen
2021-04-14 22:26
has joined #pact-net

matt.fellows
2021-04-15 01:11
> What do you mean by full suite? I meant the test suite code. You just shared the matchers, but I wanted to see how it was configured

matt.fellows
2021-04-15 01:11
> perhaps there is a behavior where all integrations are appended until you get a validated pact that definitely doesn?t sound right.

matt.fellows
2021-04-15 01:12
> Interesting update! I fixed another issue where the Pact validation was failing (e.g. response code =/= 200). Once this was fixed, the ghost-of-provider-state-past disappeared I think what?s more likely to have happened. If your consumer test was failing, it wasn?t writing a new contract. So even though your test code was changing, the contract wasn?t changing with it (Pact won?t serialise / update a contract if the tests are failing)

matt.fellows
2021-04-15 01:13
In either case, it?s posible there is a configuration issue that?s leaving the mock server running in the background. If that?s the case, you might get multiple serialised interactions with different states.

matt.fellows
2021-04-15 01:13
Make sure you don?t re-use the same mock server over tests. It should always start/stop.

matt.fellows
2021-04-15 01:13
One way to achieve that, is to not set a Pact port and let it choose a randomly available one from the OS

mail_4brad
2021-04-15 02:34
has joined #pact-net

mail_4brad
2021-04-15 05:15
@mail_4brad has left the channel

goncalosamuel
2021-04-15 15:08
has joined #pact-net

laura.edington
2021-04-15 15:36
Great info, great details to keep in mind when writing pacts. Thanks !

matthew.hall
2021-04-15 17:36
has joined #pact-net

raony
2021-04-15 19:21
has joined #pact-net

gupta.ratnesh9
2021-04-16 04:48
has joined #pact-net

greg595au
2021-04-16 10:00
has joined #pact-net

manel_ben_yahia
2021-04-16 13:59
has joined #pact-net

maxence
2021-04-17 11:07
has joined #pact-net

kranti.deep
2021-04-17 14:17
has joined #pact-net

github
2021-04-17 21:08
:warning: *Action required - upgrade app for Pact Foundation* :warning:

aaronw153
2021-04-17 21:42
has joined #pact-net

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`

dwmahieddine
2021-04-19 12:44
has joined #pact-net

garrettmichael
2021-04-19 18:34
has joined #pact-net

daniel.kalleward
2021-04-20 08:16
has joined #pact-net

matt.fellows
2021-04-20 11:17
@greg595au :wave: thanks for offering to contribute to Pact and Pact .NET, I?ll create a little thread :thread: here to give you some pointers on getting started :point_down:

greg595au
2021-04-20 11:18
Thanks @matt.fellows looking forward to getting my hands on this project


matt.fellows
2021-04-20 11:23
Oh, there are also these intro videos (sorry, you have to hear me speak a bit more!) https://www.youtube.com/playlist?list=PLwy9Bnco-IpfZ72VQ7hce8GicVZs7nm0i After that, you should have a decent idea of what Pact does.


github2
2021-04-20 11:25
[pact-foundation/pact-net] Pull request merged by mefellows

mattias.persson
2021-04-20 12:45
has joined #pact-net

mattias.persson
2021-04-20 12:47
Hi! We?re getting started with Pact and we?re wondering if there are any plans on support the v3 specs for .net? :slightly_smiling_face:

martin.eklund
2021-04-20 12:47
has joined #pact-net

kranti.deep
2021-04-20 13:59
@kranti.deep has left the channel

enda.brody
2021-04-20 17:37
has joined #pact-net

cristian.moisa
2021-04-20 18:25
has joined #pact-net

darccide
2021-04-21 01:35
has joined #pact-net

github2
2021-04-21 19:17
[pact-foundation/pact-net] Pull request opened by dependabot[bot]

github2
2021-04-21 19:17
[pact-foundation/pact-net] Pull request opened by dependabot[bot]

github2
2021-04-21 19:17
[pact-foundation/pact-net] Pull request closed by dependabot[bot]

matt.fellows
2021-04-22 00:51
Looks like no takers just yet!

matt.fellows
2021-04-22 00:52
@mattias.persson :point_up:

stain.witness
2021-04-22 02:43
has joined #pact-net

mattias.persson
2021-04-22 06:13
Hey @yann.courtel me and my team are at a very early stage but we?re attempting to get this to work. I?ll make sure to post here if we manage to make any progress!

oleksandra.pishcheiko
2021-04-22 08:31
has joined #pact-net

akos.csurai.4github
2021-04-22 10:01
has joined #pact-net

akos.csurai.4github
2021-04-22 10:24
Hello, I planned to use non http testing with Message Pact, between JVM and .NET services, but it turned out PACT NET does not support it. Can someone suggest any advice ? What to try ? I found https://github.com/bartschotten/com-pact Can I use its contracts in JVM side ?

christosbouloumpasis
2021-04-22 10:38
has joined #pact-net

matt.fellows
2021-04-22 10:41
You could give it a try. It's not an official library but looks decent. We're looking for co maintainers of pact .NET so if you're interested we'd be happy to talk/help

matt.fellows
2021-04-22 10:42
There is also a PR on the repo you might like to look at, it is functional I believe

temanibeck
2021-04-22 16:04
has joined #pact-net

michael_swiss
2021-04-22 21:04
has joined #pact-net

dawoud.sheraz
2021-04-23 09:34
has joined #pact-net

adriano.tanoue
2021-04-23 12:01
has joined #pact-net

saurabh.goel
2021-04-24 20:10
has joined #pact-net

cemal.onder
2021-04-25 12:22
has joined #pact-net

richard.forjoe
2021-04-26 00:52
has joined #pact-net

ron.aharoni
2021-04-26 11:03
has joined #pact-net

andrewmorton
2021-04-26 13:33
has joined #pact-net

aram
2021-04-26 15:24
has joined #pact-net

marcelo.souzameinberg
2021-04-26 21:32
has joined #pact-net

songqing.gu
2021-04-27 01:25
has joined #pact-net

fortiss.anita
2021-04-27 09:34
has joined #pact-net

keshav.reddy503
2021-04-27 12:06
has joined #pact-net

jeremykeczan
2021-04-27 14:57
has joined #pact-net

yeseniavega411
2021-04-27 15:31
has joined #pact-net

almantusk
2021-04-27 16:56
has joined #pact-net

alexandra.huamani
2021-04-28 00:12
has joined #pact-net

tonynguyenit18
2021-04-28 02:12
has joined #pact-net

agrawalneeraj43
2021-04-28 04:37
has joined #pact-net

shixun.liu1023
2021-04-28 04:39
has joined #pact-net

narendra.pathai
2021-04-28 06:21
has joined #pact-net

greg595au
2021-04-28 11:28
hi matt... finally got through everything above and studying the project. Onto a few issues

greg595au
2021-04-28 11:29
119 - Individual verification of interactions this is something that make sense from a reporting lens, i will give this one some thought and talk with you next week

greg595au
2021-04-28 11:31
135 and 289 - on a superficial level they appear to be related (but... I won't know till I get into the code base and also try on a linux box)

greg595au
2021-04-28 11:32
so - my comments now are - this project will definitely give me a programming profile to point to. As I progress, I expect to handle more complex issues and even start to help the user base :slightly_smiling_face:

marcin.grzejszczak
2021-04-28 13:53
has joined #pact-net

flubniewski
2021-04-28 17:01
has joined #pact-net

matt.fellows
2021-04-28 22:37
Awesome thanks Greg!

yann.courtel
2021-04-30 13:47
Thanks a lot Matthias

roy_collings
2021-04-30 15:15
has joined #pact-net

matt.fellows
2021-04-30 22:54
Where are we a folks? Is there anything I can do to help facilitate?

matt.fellows
2021-04-30 22:54
@jacek.helper cc: if you?re still interested in helping out here

prachi_mangesh_edake
2021-05-03 04:43
has joined #pact-net

mattias.persson
2021-05-03 06:36
Unfortunately we got a bit stuck on the PHP and .NET SDKs, unable to get them to work as expected. We opened an issue on the PHP SDK and are keeping on eye on the progress on the .NET version


greg595au
2021-05-03 07:35
Hey @matt.fellows, in relation to https://github.com/pact-foundation/pact-net/issues/289. Drilling down, we hand off to the ruby engine but I have some related info about the Verifier classes

greg595au
2021-05-03 07:37
I noted that we have a lack of coverage tests for the verifier classes https://user-images.githubusercontent.com/8934535/116691573-518e4e00-a9fe-11eb-922d-7c59669a91f2.png PactUriOptions, PactVerifier, and PactVerifierConfig

greg595au
2021-05-03 07:38
While I was closing the testing gap, I noticed the PactVerifierConfig had a bug in the backward compatible property.

greg595au
2021-05-03 07:41
The code intent appeared to be to remove the value from the Dictionary if CustomHeader was changed, but the value in CustomHeaders is expected to be removed. Using _customHeader.Value.Value fails but changing to _customHeader.Value.Key removes the existing CustomHeaderValue

greg595au
2021-05-03 07:42
I have built tests to cover that and extended the PactUriOptions to cover the use of the @ symbol (allowed)

greg595au
2021-05-03 07:45
Based on the Issue, we would benefit from a Integration test that uses names with @ symbols to trap for the condition that beth encountered and hence tell us if the underlying ruby or rust engines have a problem.

greg595au
2021-05-03 07:48
I will push my branch on this tonight, with a PR for review.

greg595au
2021-05-03 07:54
hmm. may I need pemission to push to the repo

sams.prashanth
2021-05-03 08:04
has joined #pact-net

mattias.persson
2021-05-03 09:31
Correct @matt.fellows!

matt.fellows
2021-05-03 11:00
just push to your own repo for now and submit a PR from there

matt.fellows
2021-05-03 11:00
I?ll work on getting you perms

philip.m.wood
2021-05-03 12:46
has joined #pact-net

amiller
2021-05-03 15:27
has joined #pact-net

agarwal.akash333
2021-05-03 23:14
has joined #pact-net

marcin.grzejszczak
2021-05-04 07:27
@marcin.grzejszczak has left the channel

anand.ilkal
2021-05-04 08:01
has joined #pact-net

dennis.minard
2021-05-04 16:23
has joined #pact-net

chris.williams
2021-05-04 16:41
has joined #pact-net

ssorcnafets
2021-05-04 19:20
has joined #pact-net

kowalczuk.jnr
2021-05-04 22:24
has joined #pact-net

kowalczuk.jnr
2021-05-04 22:25
Hey guys. Is there currently a way to reset the provider states somehow? I see that implementations in other languages have before- and after- hooks, but struggle to find similar functionality in the .net port. Thanks!

hugo
2021-05-05 00:48
has joined #pact-net

matt.fellows
2021-05-05 01:50
I don?t believe so, if there isn?t yet an issue for it on the github repository, could you please raise a feature request for it?

matt.fellows
2021-05-05 02:07
Hello all! So @hugo and @jacek.helper have been working on a feature that is ready for merge and release. @neil are you able to shed some light on the release process for us? We?ll then work to define who should be doing this going forward. We may also need access to the repositories in which they are released etc. (e.g. nuget)

neil
2021-05-05 02:29
Yep sure can! Do we have somewhere non public and non ephemeral (not slack) to capture this sort of stuff?

neil
2021-05-05 02:31
I suppose it doesn?t really need to be non public, so we could document it in a GH markdown. Just the audience is maintainers rather than library users

neil
2021-05-05 02:32
Do we want to add Hugo and Jacek as repo maintainers? If so they?ll need to be added to the builds (AppVeyor) and nuget (package repo).

greg595au
2021-05-05 09:14
@neil while we're at it.. can i be added to this AND happy to document this for future reference

matt.fellows
2021-05-05 09:28
ahoy!

matt.fellows
2021-05-05 09:29
Sorry Neil, I must have closed slack just before you responded. In any case?. > I suppose it doesn?t really need to be non public, so we could document it in a GH markdown. Just the audience is maintainers rather than library users this would be ideal! > Do we want to add Hugo and Jacek as repo maintainers? If so they?ll need to be added to the builds (AppVeyor) and nuget (package repo). Yes, probably. We should also get the core maintainerati group across the credentials as well and made Admins

matt.fellows
2021-05-05 09:29
@greg595au that?d be awesome

neil
2021-05-05 09:30
@matt.fellows I can start by giving you access if you like?

neil
2021-05-05 09:31
You?ll need to create a http://nuget.org user

matt.fellows
2021-05-05 09:32
Yep. It?d be good to increase the bus (and bandwidth) factor to get another maintainer involved


matt.fellows
2021-05-05 09:32
I think I have both, but let me check

neil
2021-05-05 09:32
:thumbsup:

matt.fellows
2021-05-05 09:33
nuget: `` / `matt.fellows`

matt.fellows
2021-05-05 09:34
(I think my old account is gone, from memory they did a migration a while back and I didn?t bother doing anything about it)

greg595au
2021-05-05 09:35
ok - i have a user in nuget

greg595au
2021-05-05 09:35
prob need an org

greg595au
2021-05-05 09:37
and I am in appveyo

greg595au
2021-05-05 09:37
both as

neil
2021-05-05 09:39
I?ll get Matt added for now and docs written etc and then we can go from there

greg595au
2021-05-05 09:40
hi @neil can I assist you with the docs?

neil
2021-05-05 09:41
Thanks for offering @greg595au, but I think this will be easier to just brain dump directly into a doc.

matt.fellows
2021-05-05 09:42
makes sense

matt.fellows
2021-05-05 09:42
next steps after that, are to rehearse a release and fix up any gaps?

neil
2021-05-05 09:45
Yeah I?ll let someone else do the rehearsal. It?s essentially, create a new GH release with a new version, build triggers packages get published.

matt.fellows
2021-05-05 09:45
sounds great!

matt.fellows
2021-05-05 09:45
I have to run (kids dinner/bed time)

neil
2021-05-05 09:46
Looks like master might be broken from a build perspective, so might need to look into that one

hugo
2021-05-05 10:25
Sorry guys for my response time, there is a 12 hours timezone between us as I am located in Canada

hugo
2021-05-05 10:35
Let me know if I can do anything else to help

matt.fellows
2021-05-05 10:40
Thanks Hugo!

matt.fellows
2021-05-05 10:42
Plan from here: 1. Neil is going to get master into a good shape 2. Neil has given me access to release core artifacts 3. Matt to gran similar access to another core maintainer 4. We merge your feature in 5. We watch the release process do its thing 6. Neil will document the release process and anything else useful so we can start the process of introducing some new maintainers (i.e. those on this thread)

neil
2021-05-05 10:44
I?m working in slightly different order of 2, 6, 1.

neil
2021-05-05 10:44
1 might not happen tonight

greg595au
2021-05-05 11:14
is it appropriate to celebrate with https://www.youtube.com/watch?v=NmPhaG1ud38

matt.fellows
2021-05-05 11:15
Haha yes, any Monty python is welcomed

greg595au
2021-05-05 11:16
figured you were a monty python fan

hugo
2021-05-05 11:36
@matt.fellows I just filled out the form you sent me to apply to become a maintainer

matt.fellows
2021-05-05 12:03
Thanks Hugo! no worries about setting up a chat, we?ve already started that process :slightly_smiling_face:

matt.fellows
2021-05-05 12:04
@jacek.helper see above. Please give us a few days to get organised around this to see your change through, and discuss next steps around future contributions

greg595au
2021-05-05 12:36
hi matt - i had to clone the pact-net repo then apply my changes... its gt a PR under my github account

greg595au
2021-05-05 12:37
`test/pact-verifier-new-tests` branch on https://github.com/greghicks01/pact-net-clone.

neil
2021-05-05 12:48
The master branch build is all good. I just saw red and assumed it was master :smile: Some of the PR builds appear to be failing though, so we might want to work that out before merging

hugo
2021-05-05 13:07
Can you share me the details of PR Build?

hugo
2021-05-05 13:09
On our side everything is building

neil
2021-05-05 13:25
Yeah sorry, not sure why I didn?t add a link :smile: https://ci.appveyor.com/project/SEEKJobs/pact-net/history


yann.courtel
2021-05-05 15:14
Hi everyone, has anyone tried to use the pactnet lib within a project in net5? We are updating our libs and are wondering if it works (it is supposed to. cf. Microsoft). Thanks a lot.

jadelong
2021-05-05 15:51
has joined #pact-net

matt.fellows
2021-05-05 23:54
Thanks, could you please submit a pull request to the main repo?

matt.fellows
2021-05-05 23:54
That?s the standard workflow: 1. Fork the repository to your own workspace 2. Create a branch with the changes 3. Submit a PR to the main repo

hugo
2021-05-06 00:52
Hi Guys, from my standpoint it's building and all tests are Green:

hugo
2021-05-06 00:57
Is there any specific build parameter you are using in your pipeline? Or/And can you provide more error details? (AppVeyor is not giving much details)

hugo
2021-05-06 00:58
There was not code commit since January (only documentation and markdown commit) So It could not be a merge conflict

matt.fellows
2021-05-06 01:02
There is one conflict as far as the PR goes

matt.fellows
2021-05-06 01:02
but the build looks green to me

hugo
2021-05-06 01:02
However, I noticed that on AppVeyor it seem to have 2 additionals commits that are not present on Github exactly where the build start failing:

matt.fellows
2021-05-06 01:02
oh, wait. there?s no green build there

matt.fellows
2021-05-06 01:02
We should get appveyor to submit status checks to the PR

matt.fellows
2021-05-06 01:06
hmm is there a reason why branch builds don?t run Neil?

matt.fellows
2021-05-06 01:07
maybe it?s just the appveyor interface. This failed 5 days ago, is it the right build Hugo? https://ci.appveyor.com/project/SEEKJobs/pact-net/builds/38953788

hugo
2021-05-06 01:07
Hi Matt, they file that appear to be in conflict is an irrelevant timestamp sample. You may choose any version and it will work:

hugo
2021-05-06 01:08
Exactly it's the right build :thumbsup:

matt.fellows
2021-05-06 01:10
It?s failing though, any ideas why?

greg595au
2021-05-06 01:11
hey matt, never done it that way before, but i think that looks simple enough. Will have to try that tonight or tomorrow might

hugo
2021-05-06 01:12
Humm, possibly because PR 524 and 525 were failing before. Can we revert and re-apply those change later?

matt.fellows
2021-05-06 01:16
those PRs don?t exist as far as i can tell

hugo
2021-05-06 01:16
Ok probably just built number

matt.fellows
2021-05-06 01:16
ah

hugo
2021-05-06 01:17
I can revert the sample timestamp file and push it again to see if it build ...

hugo
2021-05-06 01:17
Let me know what you prefer?

matt.fellows
2021-05-06 01:19
It should still build without the conflict, but yes, if you could please resolve the conflict that?d be ace

hugo
2021-05-06 01:23
done :wink:

matt.fellows
2021-05-06 01:24
My laptop just ran out of battery (on train) so I'll have to resume this thread later. :crossed_fingers: Build passes

hugo
2021-05-06 01:26
Allright, I will keep and eye on this :wink: Let me know if you figure out what make it fail?

hugo
2021-05-06 01:52
:disappointed: still failing, any idea why?

alexei.solcanu
2021-05-06 02:01
has joined #pact-net


neil
2021-05-06 03:55
for example it?s set to build in VS 2017, which I?m assuming isn?t what you are building with?

zonkor
2021-05-06 08:08
has joined #pact-net

hugo
2021-05-06 12:42
VS 2019 but should not be the issue

florian.mautendorfer
2021-05-06 14:04
has joined #pact-net

hugo
2021-05-06 14:07
Tried in a fresh VM with VS 2017 and it is building correctly (confirming that is not the issue). Any other clues?

hugo
2021-05-06 14:08
Can flushing and purging build server nuget package help?

hugo
2021-05-06 14:50
Other option could be to put more verbosity to help us figure out what wrong:

john.mcnulty
2021-05-06 16:49
has joined #pact-net

hugo
2021-05-06 20:42
Gentlement we have a Green Build (Pushed adjustment for old c# version):

hugo
2021-05-06 20:43
:balloon: Ready for merge :tada:

fnguyen
2021-05-06 22:22
pactnet does not support OR (verify a field is a string OR null) I understand the reasoning for not allowing it (although i would rather be the one to decide, not being forced by the library) Is there a way to verify we have a field without specify what it is so we can catch if the field were missing/renamed?

bethskurrie
2021-05-06 22:23
Unfortunately not @fnguyen


fnguyen
2021-05-06 22:23
Is there a feature request for that already or should i create one?

bethskurrie
2021-05-06 22:24
Having an "optional" won't let you find if the field has been renamed.

fnguyen
2021-05-06 22:24
i have read it and disagree

bethskurrie
2021-05-06 22:24
It will just never fail.

bethskurrie
2021-05-06 22:24
How would you imagine it would pick up that a field had been renamed?

bethskurrie
2021-05-06 22:26
If for every test you have the expectation "the field firstName may exist" and it always came back as "first_name", all your tests would pass, and they would never pick up the error. How would it alert you to the fact that the field wasn't there?

fnguyen
2021-05-06 22:26
in my expected body i specify a match that matches anything, if the field Name were renamed to Names, Name is missing and i catch it. Currently if Name could be a string or null, my only option is to not check it.

bethskurrie
2021-05-06 22:27
If you can't control the test data, then Pact is not a good fit for your usecase unfortunatey.

fnguyen
2021-05-06 22:27
I not saying it may exist, but that it's value may be null.

fnguyen
2021-05-06 22:28
Yes i read that part.

bethskurrie
2021-05-06 22:28
Ok, I see what you mean now.

fnguyen
2021-05-06 22:28
it's the first line

bethskurrie
2021-05-06 22:28
The same logic applies though.

bethskurrie
2021-05-06 22:28
If it was always null, then came back as an integer in prod, you have a bug.

bethskurrie
2021-05-06 22:29
Having said that, I believe the "or null" is possible in v3 of the pact specification. I just don't know when PactNet will be moving to that. We're looking for some more maintainers at the moment.

fnguyen
2021-05-06 22:31
OR is in v3 but i was told it's deprecated and may be removed...

bethskurrie
2021-05-06 22:31
Yes, because of the reason I outlined.

bethskurrie
2021-05-06 22:32
Can you explain what the issue is setting up the test data?

fnguyen
2021-05-06 22:32
i will a little later. I have an appointment now

bethskurrie
2021-05-06 22:36
:thumbsup::skin-tone-3: happy to chat.

fnguyen
2021-05-06 23:12
Our schema allows for some objects to have their name null. I don't think PACT should dictate changes in our schema.

bethskurrie
2021-05-06 23:13
It's not dictating your schema, it's saying, for a specific example, it has to ether be one or the other.

bethskurrie
2021-05-06 23:13
You can have one example where it is null and one where it is populated.

fnguyen
2021-05-06 23:17
I understand what you say, with two tests checking different things. Our test data comes from a live source. I agree _Firstly, it is assumed that you have control over the provider's data (and consumer's data) when doing the verification tests. If you don't, then maybe Pact is https://docs.pact.io/getting_started/what_is_pact_good_for._ but it works in most cases and PACT could but decides to not let me shoot myself in the foot.

fnguyen
2021-05-06 23:21
I will see how possible it is for use to have a source that is fully controlled and not live so we can test separately for cases when the type is string or null. Thanks.

bethskurrie
2021-05-06 23:24
I've had a chat to the maintainer of the Rust lib (which the pact net library will be moving to at some stage), and he says that they're deprecated in the sense that we don't recommend people use them, but they will still be available. So you can shoot yourself in the foot at that stage :laughing:

bethskurrie
2021-05-06 23:24
I'm sorry that I can't give you a date on that though.

fnguyen
2021-05-06 23:29
Thanks @bethskurrie for the clarification. I wish I could help with PactNet.

fnguyen
2021-05-06 23:31
Would a Matcher that accept anything and only validate the presence of a field be more acceptable ?

bethskurrie
2021-05-06 23:32
There may be one. You'll have to look at the pact specification.

fnguyen
2021-05-06 23:32
oh, i thought you wrote there isn't one.

bethskurrie
2021-05-06 23:32
I'm not across the latest proposals for the new version of the pact spec.

matt.fellows
2021-05-06 23:37
Awesome Hugo!

fnguyen
2021-05-06 23:44
I read https://github.com/pact-foundation/pact-specification/tree/version-3 and I did not see any lenient matcher that would accept anything.

fnguyen
2021-05-06 23:45
and in V2, only regex, type mintype and maxtype are supported.

hugo
2021-05-07 00:29
Thank Matt! This PR solve 2 issues. Who have the power to push the "merge on master" button right now?

yann.courtel
2021-05-07 07:18
I had confirmation on my end that libs contacted by application in net5 are retro-compatible. So a lib in net5 can call a lib in netstandard 2.0 for instance and it should work fine. Thank you.

github2
2021-05-08 08:41
[pact-foundation/pact-net] Pull request opened by greghicks01

greg595au
2021-05-08 08:45
@matt.fellows :wave: can i get review on #292 :middle_finger: please

matt.fellows
2021-05-08 11:27
Awesome thanks!

matt.fellows
2021-05-08 11:32
@hugo @jacek.helper you guys keen to once over this? I'll get these merged and released next week (I don't want to do on weekend as I want to make sure I have time to test the released artifact)

jacek.helper
2021-05-08 11:44
I can take a look on this today evening or tomorrow.

matt.fellows
2021-05-08 11:45
:pray:

github2
2021-05-10 00:31
[pact-foundation/pact-net] Pull request merged by mefellows

matt.fellows
2021-05-10 00:32
Merging and releasing :clap:


github2
2021-05-10 02:03
[pact-foundation/pact-net] Pull request merged by mefellows

github2
2021-05-10 02:04
[pact-foundation/pact-net] Pull request merged by mefellows

github2
2021-05-10 02:54
[pact-foundation/pact-net] New release _https://github.com/pact-foundation/pact-net/releases/tag/2.6.2_ published by mefellows

matt.fellows
2021-05-10 06:01
So Neil, I?ve tagged the repo (see https://github.com/pact-foundation/pact-net/releases/tag/2.6.2) but appveyor didn?t do its thing. It looks like it is configured to do it though

tarunmehrotra3
2021-05-10 06:31
has joined #pact-net

matt.fellows
2021-05-10 06:46
hmm nvm, I think https://ci.appveyor.com/project/SEEKJobs/pact-net/builds/39082864 is actually the branch build. Haven?t used appveyor as much as I should have?


matt.fellows
2021-05-10 07:27
yep! Thanks, just me interpreting logs :stuck_out_tongue:

matt.fellows
2021-05-10 13:04
Thanks to @neil, @hugo and @jacek.helper - the latest release of Pact .NET is out with the new remote mock server feature, and the bus factor has improved! Hopefully this is the first of many contributions:pray:

jbecker
2021-05-10 16:31
has joined #pact-net

neil
2021-05-11 02:09
Heads up I?m going to be getting the build moved into a pact foundation appveyor account, so there may be some things I?ll be working through to get the builds functional after that.

greg595au
2021-05-11 02:15
@neil I am one of the newer members to this team - i would like to see what actions you are taking with appveyor so I can learn to fault find and fix in the future

neil
2021-05-11 02:41
@greg595au At this point, just requesting the project to be moved into the pact foundation account.

matt.fellows
2021-05-11 03:10
I?m assuming you mean moving from `SEEK-Jobs` github to `pact-foundation`, right? It would be great to at some point send status checks back to Github PRs (so we can see if it?s safe to merge)

james.wettenhall
2021-05-11 04:54
has joined #pact-net

neil
2021-05-11 06:21
@matt.fellows Not github, appveyor

neil
2021-05-11 06:21
It?s been in the pact-foundation GH for ages

matt.fellows
2021-05-11 07:12
ahh

matt.fellows
2021-05-11 07:12
yes!

eduardo.marques
2021-05-11 09:19
has joined #pact-net

al8x.romanov
2021-05-11 13:09
has joined #pact-net

jr.jenks
2021-05-11 21:46
has joined #pact-net

sammomichael
2021-05-12 02:27
has joined #pact-net

tony.foster
2021-05-12 03:44
has joined #pact-net

tony.foster
2021-05-12 03:46
Hello,I wanted to check in here about the specifics of the version 3 updates, and what sorts of messaging protocols it would support. Thanks!

jan.businsky
2021-05-12 09:10
has joined #pact-net

greg595au
2021-05-12 10:24
@jacek.helper could you review this PR please. I believe I have address your comments

jacek.helper
2021-05-12 10:27
Sorry @greg595au I just tried to help in different thread, I will try to take look on this as soon as I find spare hour or so, but it mean tomorrow.

jacek.helper
2021-05-12 10:28
It may mean tomorrow, that is what I want to say

jacek.helper
2021-05-12 10:28
I will try do that today evening

greg595au
2021-05-12 10:30
all good @jacek.helper its not holding up any critical elements

github2
2021-05-12 11:36
[pact-foundation/pact-net] Pull request ready for review by martincostello

lreisch
2021-05-12 19:23
has joined #pact-net

jorge.curima.corp
2021-05-13 01:37
has joined #pact-net

tony.foster
2021-05-13 03:19
What would be the best way to get involved in helping get pact-net v3 going?

matt.fellows
2021-05-13 03:22
We have a few people interested in contributing at the moment, but we're really keen for anyone who can dedicate some time towards it. We need to do better to clarify exact steps, but as a starting point, let's jump on a call. Drop a line to and I'll set something up

anh.evizi.test
2021-05-13 05:56
has joined #pact-net

yka259
2021-05-13 08:22
has joined #pact-net

joshibharat
2021-05-13 11:43
has joined #pact-net

smankala
2021-05-13 20:55
has joined #pact-net

greg595au
2021-05-13 22:50
be good to have a core team for this matt

github2
2021-05-14 04:00
[pact-foundation/pact-net] Pull request merged by mefellows

martin.pelikan
2021-05-14 06:48
has joined #pact-net

joao_glorioso
2021-05-14 08:41
has joined #pact-net

matt.fellows
2021-05-14 11:26
That's the plan!

ashok.jan31
2021-05-14 12:25
has joined #pact-net

gusfisha
2021-05-14 19:52
has joined #pact-net

keithgutfreund
2021-05-14 20:13
has joined #pact-net

k.gutfreund
2021-05-15 03:47
has joined #pact-net

siegcollado
2021-05-17 05:03
has joined #pact-net

simon.thomas1978
2021-05-17 08:53
has joined #pact-net

keimiokamoto
2021-05-17 10:36
has joined #pact-net

fabian.feary
2021-05-17 11:52
has joined #pact-net

josh.brangwyn
2021-05-17 12:19
has joined #pact-net

xiao.liang
2021-05-17 16:41
has joined #pact-net

yann.courtel
2021-05-18 08:29
Hi Matt, thank you for the initiative. I was going to ask the community on how we can proceed :slightly_smiling_face: let's setup a zoom call or a chat room. You can put me in the loop.

bhattacharyyasom
2021-05-18 14:05
has joined #pact-net

josh.brangwyn
2021-05-18 15:22
Hi, I'm attempting to write provider tests for an app that requires 3 request headers to be set dynamically for authentication. I thought I could do this using middleware, as described in https://github.com/pact-foundation/pact-net/issues/40. I've implemented the middleware in a similar way (converted to work with the latest .NET Core example code). But when debugging, the only middleware that gets hit is the ProviderStateMiddleware to do the set up steps. I thought that would be the initial request, then the next request would be to the Service Provider, but that doesn't seem to be the case? I'm running version 2.6.2.

josh.brangwyn
2021-05-18 16:27
Ah, I think I've figured it out. I need to use CustomHeaders set on the PactVerifierConfig - the middleware is just for the provider states.

fnguyen
2021-05-18 16:53
Hello Is there a way to specify a timeout when running a provider test in http://pact.Net ? It seems it's possible in javascript (https://docs.pact.io/implementation_guides/javascript/readme#verification-options) Thank you

lalit210784
2021-05-18 17:55
has joined #pact-net

github2
2021-05-18 21:59
[pact-foundation/pact-net] Issue opened by Blackclaws

github2
2021-05-18 22:00
[pact-foundation/pact-net] Issue opened by Blackclaws

zaxosdimi
2021-05-18 22:14
has joined #pact-net

matt.fellows
2021-05-19 02:01
How'd you go?

matt.fellows
2021-05-19 02:21
The way messaging works in pact is that we abstract away the protocol.

matt.fellows
2021-05-19 02:22
Version 3 supports sync unidirectional, in version 4 the proposal supports sync and async bidirectional

matt.fellows
2021-05-19 02:22
This should cover most scenarios

samuel.verstraete
2021-05-19 07:15
has joined #pact-net

samuel.verstraete
2021-05-19 07:16
copying from #general: so we have an integration of pact tests in our .netcore projects. the developers are all running on windows so we added the PactNet.Windows package to the PackageReferences. On the build we are building to the linux target so we would apparently need the PactNet.Linux package but apparently PackageReferences do not support Conditionals based on the runtime... how would you typically advise how to fix this

matt.fellows
2021-05-19 10:32
Can you install both packages or is that not possible?

samuel.verstraete
2021-05-19 10:50
i would assume not

samuel.verstraete
2021-05-19 10:50
i don't see how that could work to be honest

dale.bennett
2021-05-19 12:15
Hey, just wondering if there are any plans to support dynamic key matching with pactnet? I have seen that this is supported in pact for other languages and I think it would be beneficial for a use case I have right now.. Thanks!

matt.fellows
2021-05-19 12:39
Loosely, yes. When we upgrade to the rust core engine, this matcher would be possible.

matt.fellows
2021-05-19 12:40
We?re currently looking to get a new set of core maintainers to help drive the roadmap for Pact .NET (see #pact-js-development)

matt.fellows
2021-05-19 12:40
one of the actions I?d like to see, is us publishing roadmaps etc. a little more transparently to help increase visibility of this stuff

matt.fellows
2021-05-19 12:41
It?s at least a few months away, I?d guess, unless we get a big contribution in the next few weeks.

fnguyen
2021-05-19 15:35
@samuel.verstraete In the csproj file we added: ``` <ItemGroup Condition=" '$(os)' == 'Windows_NT'"> <PackageReference Include="PactNet.Windows" Version="2.6.1" /> </ItemGroup> <ItemGroup Condition=" '$(os)' == 'UNIX'"> <PackageReference Include="PactNet.Linux.x64" Version="2.6.1" /> </ItemGroup>```

viktor.trako
2021-05-19 15:45
has joined #pact-net

samuel.verstraete
2021-05-19 16:40
of cousre

samuel.verstraete
2021-05-19 16:40
why didn't i think of this

fnguyen
2021-05-19 17:15
Glad to help.

abdel.akkoub
2021-05-19 17:27
has joined #pact-net

fnguyen
2021-05-19 18:55
Maybe you did not think of this because it has to be done in cs proj directly. I don't think there is a UI in visual studio for conditional references.

akrala
2021-05-19 21:22
has joined #pact-net

mazi.fayazfar
2021-05-19 22:23
has joined #pact-net

neil
2021-05-20 00:43
@samuel.verstraete Yes, you can install both packages. At runtime the platform is detected and the correct package is resolved.


samuel.verstraete
2021-05-20 05:52
yeah still... i feel caught like a newbie :stuck_out_tongue:

samuel.verstraete
2021-05-20 05:53
but we are using .net core both on windows and linux... not sure if it would still work then? i will give it a try though

neil
2021-05-20 06:55
Yeah it?ll work. The platform specific packages only contain the Pact standalone ruby core, which is compiled for different platforms.

neil
2021-05-20 06:58
You shouldn?t even need to do this and should be able to install both `PactNet.Windows` and `PactNet.Linux.x64` side by side. Those packages only contain the Ruby Pact Standalone core, which is compiled for different environments. At runtime pact determines which one to load.

daniel.qu
2021-05-20 18:03
has joined #pact-net

vijay.chawla
2021-05-21 08:37
has joined #pact-net

tim.walter
2021-05-21 09:12
has joined #pact-net

ankit.laddha
2021-05-21 14:03
has joined #pact-net

dimundo
2021-05-21 14:09
has joined #pact-net

tjones
2021-05-22 01:33
I usually do this with provider states - something like `"TOKEN" is a valid access token`

tjones
2021-05-22 01:37
If your authentication code is custom and you want it to be covered during testing, then you could have a more explicit state, like `it's Tuesday 2pm and this JWKS signature is valid`, and mock out the key call or something

include.melaz
2021-05-22 13:15
has joined #pact-net

uddhavchopade
2021-05-23 08:32
has joined #pact-net

jr.jenks
2021-05-23 21:16
I'd like a little practical advice on the current state of Pact v3 for .NET projects. I'm exploring using Pact as part of a platform that must support many cooperating microservices. Half the projects will be written using Java and half will be in C#. We'll be doing both REST and messaging (events and commands). It looks to me like the Java and .NET Pact libraries would work for the REST stuff so I needn't worry on that front. (Right?) But when it comes to messaging, I'd need Pact v3. And the current state of Pact v3 for .NET would require me to do one of the following: ? Wait for the official libraries to be updated to support v3. ? Use https://github.com/bartschotten/com-pact, which appears to be under active development. ? Use https://github.com/Mattersight/pact-net-messages, which hasn't been updated in 3 years. Am I correct that these are my only options?

lukasz.wlosek
2021-05-24 08:03
has joined #pact-net

komathy_priya_dhanas
2021-05-24 09:26
has joined #pact-net

komathy_priya_dhanas
2021-05-24 09:29
Hi Team, can someone help me on doing provider test for an authenticated API. Either with mock or with the real time authentication

komathy_priya_dhanas
2021-05-24 10:04
Team, do we have any examples of how to pass the token in Consumer and Provider pact tests.Can someone help me on this


nh.salah
2021-05-24 11:46
has joined #pact-net

erinc1915
2021-05-24 16:11
has joined #pact-net

nzarate
2021-05-24 18:11
has joined #pact-net

fnguyen
2021-05-24 21:09
I think I tried to include both and it did not work.

jonathan.arreola
2021-05-24 21:20
has joined #pact-net

cesar.consultorjr
2021-05-24 21:39
has joined #pact-net

gdfesta
2021-05-25 00:44
has joined #pact-net

yann.courtel
2021-05-25 08:10
Hi @jr.jenks we are actually looking to get a few regular contributors to move the pact-net library to have a full 3.0 compatibility. We still don't have a clear idea on how it will be implemented but we will let the community know of course. As far as the messaging goes, for now, you can explore the branch PactNetMessages or add your own layer to support the messaging but it will require you to recode the publishing and verifying part.

utsavk3210
2021-05-25 08:37
has joined #pact-net

matt.fellows
2021-05-25 09:18
Anyone wanting to join tonight to discuss the future/roadmap of Pact .NET can join at 9pm AEST / 1pm CET Pact .NET Tuesday, 25 May ? 9:00 ? 10:00 pm Google Meet joining info Video call link: https://meet.google.com/hzm-njxs-kwt Or dial: +61 2 9051 3678 PIN: 497 948 990# More phone numbers: https://tel.meet/hzm-njxs-kwt?pin=4275417422534

daniel.cardinha
2021-05-25 10:06
has joined #pact-net


matt.fellows
2021-05-25 10:11
Apologies, I forgot to respond to this J.R.

dan.haughey
2021-05-25 14:34
has joined #pact-net

vince.lee
2021-05-25 14:36
has joined #pact-net

pact544
2021-05-25 16:01
has joined #pact-net

pact544
2021-05-25 16:17
Ah damn, just came here to introduce myself and realised I missed a call like 4 hours ago :smile: I've been playing around locally with getting PactNet to interact with the Rust reference lib instead of the Ruby one, and it seems to be going OK in my standalone test. I'd be interested in trying to get it going further and maybe contribute it properly? I've done a few very small contributions to PactNet in the past but nothing major.

pact544
2021-05-25 16:21
I'm comfortable in both Rust and .Net, so hopefully the stars just aligned right but locally it seemed almost _too_ easy :smile:

fnguyen
2021-05-25 19:17
That's 4 am my time! I'll do my best to wake up in time!

fnguyen
2021-05-25 19:22
Oh, it was last night as it's already Wednesday 5/26 there. Is there a recording?


matt.fellows
2021-05-25 21:14
Jump into #pact-net-development,clots of work and we've love your help

matt.fellows
2021-05-25 21:14
We're you using the FFI or binary interface?

matt.fellows
2021-05-25 21:15
The provider side should be quite easy, the consumer side has more work because more matchers etc

matt.fellows
2021-05-25 21:20
:point_up:recording of last night's contributor catch up

matt.fellows
2021-05-25 21:20
Worth publishing to internet?

shlomi
2021-05-25 22:41
has joined #pact-net

pact544
2021-05-26 06:49
Yeah I was using the FFI interface

matt.fellows
2021-05-26 06:56
Awesome, what side did you get running?

matt.fellows
2021-05-26 06:57
(I?ve just given you access to that doc)

pact544
2021-05-26 07:02
Thanks for that. Just gave a general update on the development channel :thumbsup:

dale.bennett
2021-05-26 08:30
sorry just got back to this! Thanks for the update. I'd love to help if I had more free time. Hope you manage to get some people on board! :)

matt.fellows
2021-05-26 08:36
see #pact-net-development - lots of activity / enthusiasm. Let?s see how we go

raquel.bautista
2021-05-26 09:38
has joined #pact-net

aubilla
2021-05-26 09:52
has joined #pact-net

vishnuprakash323
2021-05-26 10:46
has joined #pact-net

rob.caiger
2021-05-26 11:54
has joined #pact-net

github2
2021-05-26 16:34
[pact-foundation/pact-net] Issue opened by athurner

fnguyen
2021-05-26 17:40
when i click on the link i see the thumbnail but then the video never starts. Is it just me?

lio.lunesu
2021-05-26 17:55
has joined #pact-net

nahuel.dallavecchia
2021-05-26 20:24
has joined #pact-net

mathew.baltes
2021-05-26 23:33
has joined #pact-net

matt.fellows
2021-05-26 23:34
just you :stuck_out_tongue: Can you download it? Maybe videos are blocked?

fnguyen
2021-05-26 23:35
is it shared with everyone or just authenticated users (with google account)?

matt.fellows
2021-05-26 23:37
only those who requested access. I can?t make it public (it?s blocked on our account). But anybody requesting access I have granted (I can see you have viewer perms)

matt.fellows
2021-05-26 23:37
(I?ve just made it downloadable, apologies)

stephen.leece
2021-05-26 23:44
has joined #pact-net

james_fraser
2021-05-27 09:23
has joined #pact-net

mostafa.zaher
2021-05-27 10:13
has joined #pact-net

utsavtiwary10
2021-05-27 10:53
has joined #pact-net

kamoljan
2021-05-28 02:39
has joined #pact-net

mathias.duesterhoeft
2021-05-28 08:59
has joined #pact-net

komathy_priya_dhanas
2021-05-28 11:35
Hi Team, API is built in .net and we are using pactnet for contract testing. Our API has its own token based authentication. (Not Owin). We are not able to run the providerpact test


komathy_priya_dhanas
2021-05-28 11:35
Dont have much experience in PACT, if anyone can help me how this can be addressed will be of a great help

komathy_priya_dhanas
2021-05-28 11:36
Yeah, that did not help me much

komathy_priya_dhanas
2021-05-28 11:36
with PACT NET i am not getting some examples too to understand

matt.fellows
2021-05-28 11:42
have you looked at the workshops and tutorials? https://github.com/pactflow/pact-workshop-dotnet-core-v1

matty_o_connor01
2021-05-28 15:57
has joined #pact-net

nathaniel.emmons
2021-05-28 18:25
has joined #pact-net

sapoho3257
2021-05-29 16:10
has joined #pact-net

andjela.rajic
2021-05-30 20:00
has joined #pact-net

sumitsg004
2021-05-31 05:10
has joined #pact-net

przemek.sech296
2021-05-31 06:02
FYI ```pact-workshop-dotnet-core-v1 ? cd YourSolution/Provider/src && dotnet run It was not possible to find any compatible framework version The framework 'http://Microsoft.NETCore.App', version '2.0.0' was not found. - The following frameworks were found: 3.1.14 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] 5.0.5 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] You can resolve the problem by installing the specified framework and/or SDK. The specified framework can be found at: - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.0&arch=x64&rid=osx.11.0-x64``` It may be a good moment to upgrade as 2.0.0 has been deprecated

matt.fellows
2021-05-31 06:05
Good point. I think I may have even done that for a .NET example I have

matt.fellows
2021-05-31 06:05
If it?s easy for you to do, PR would be :ok_hand:

matt.fellows
2021-05-31 06:05
Otherwise, would you mind please creating an issue so we can track it?

przemek.sech296
2021-05-31 06:06
Let me see if I can raise a PR :slightly_smiling_face:

james_fraser
2021-05-31 09:00
@james_fraser has left the channel

przemek.sech296
2021-05-31 09:35
@matt.fellows are there any permission on the repo? ```pact-workshop-dotnet-core-v1 ? git push -u origin update-to-net5.0 git:update-to-net5.0* ERROR: Permission to pactflow/pact-workshop-dotnet-core-v1.git denied to przemek-domain. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.``` or is it my github config?

matt.fellows
2021-05-31 10:46
Oh right, yes, not everyone on the internet can push to that :grinning:

matt.fellows
2021-05-31 10:46
Just fork the repo to your own account, and then submit a pull request from there

allan.barbosa
2021-05-31 14:08
has joined #pact-net

vinicius.grund
2021-05-31 14:35
has joined #pact-net

joao_glorioso
2021-06-01 11:54
Hi everyone :slightly_smiling_face:

joao_glorioso
2021-06-01 11:55
One question: is this problem still occurring in the latest version of of PactNet? https://github.com/pact-foundation/pact-net/issues/222

joao_glorioso
2021-06-01 11:56
The path of my project has a considerable amount of characters and I needed to move the folder to a shorter one for the tests to run properly, but this doesn't sound like a solution for a long term project...

todd.lemmonds
2021-06-01 15:57
has joined #pact-net

alexander.infante
2021-06-01 15:57
has joined #pact-net

michael.doyle
2021-06-01 15:58
has joined #pact-net

matty_o_connor01
2021-06-01 20:03
Are there any tricks to getting logging working in PactNet? I've followed the example in the docs but when I get to the provider verification I get `'Pact verification failed. See output for details.` Nothing is displayed in the Output window under Debug or Tests

paulorochag
2021-06-01 20:20
has joined #pact-net


matt.fellows
2021-06-01 23:08
```... //Arrange const string serviceUri = "http://localhost:9222"; var config = new PactVerifierConfig { Outputters = new List<IOutput> //NOTE: We default to using a ConsoleOutput, however xUnit 2 does not capture the console output, so a custom outputter is required. { new XUnitOutput(_output) }, CustomHeaders = new Dictionary<string, string>{{"Authorization", "Basic VGVzdA=="}}, //This allows the user to set request headers that will be sent with every request the verifier sends to the provider Verbose = true //Output verbose verification logs to the test output }; ...```

matty_o_connor01
2021-06-02 13:22
That's what I had. Turns out this isn't logged when running in debug mode and instead you have to wait for the test to finish to view in the 'Test Explorer' window. Noted

jaspal.gill
2021-06-02 15:23
has joined #pact-net

wenqiglantz
2021-06-02 18:19
has joined #pact-net

ch.toimbetov
2021-06-02 21:46
has joined #pact-net

kyle.florence
2021-06-03 04:57
@kyle.florence has left the channel

xyz1kind
2021-06-03 05:03
has joined #pact-net

komathy_priya_dhanas
2021-06-03 05:29
Hi Team, I am able to use the examples and run the provider test successfully for our authenticated API. Now i would like to know how to use the Provider States and test the interactions. Our Pact File has multiple interactions and i wanted to test all interactions using provider state. How can i do that? Please guide me if my understanding is wrong

matt.fellows
2021-06-03 05:43
the long path issue is still an issue

matt.fellows
2021-06-03 05:43
but there is some great working happening on the next major release (see #pact-net-development if you want to see the progress or get involved with beta testing) which would resolve this

aftab.shamim2020
2021-06-03 06:02
has joined #pact-net

slu.mendozaharold
2021-06-03 10:33
has joined #pact-net

github2
2021-06-04 07:43
[pact-foundation/pact-net] Pull request ready for review by adamrodger

github2
2021-06-04 09:03
[pact-foundation/pact-net] Pull request merged by adamrodger

github2
2021-06-04 09:06
[pact-foundation/pact-net] Issue closed by adamrodger

sergio.artero
2021-06-04 10:07
has joined #pact-net

github2
2021-06-04 15:10
[pact-foundation/pact-net] Pull request ready for review by adamrodger

github2
2021-06-04 15:10
[pact-foundation/pact-net] Pull request merged by adamrodger

github2
2021-06-04 15:25
[pact-foundation/pact-net] Pull request opened by adamrodger

v-gabriel.dantas
2021-06-04 15:26
has joined #pact-net

leonardo.viana
2021-06-04 18:52
has joined #pact-net

matt.fellows
2021-06-05 11:04
For those interested and wanting to play along at home. The next Rust integration / `v4.x.x` (next major release) project board can be found here: https://github.com/pact-foundation/pact-net/projects/1

matty_o_connor01
2021-06-05 16:09
This is not strictly a `pact-net` question but are there any C# aficionados out there that have been able to bootstrap a .net core provider that can be used in provider verification? The docs use OWIN but I was wondering if this can also be done with a .net generic host that points to the `Startup.cs` of a provider? My attempts to achieve as much have failed - I can't get the provider running at say `http://0.0.0.0:5000` to then move onto verification with `pact-net` Happy to pay for any consultancy to anyone that has solved this issue in a similar way.

github2
2021-06-06 07:36
[pact-foundation/pact-net] Pull request merged by adamrodger

yashdev963
2021-06-07 06:51
has joined #pact-net

github2
2021-06-07 07:09
[pact-foundation/pact-net] Pull request ready for review by adamrodger

jr.jenks
2021-06-07 15:24
Wow, that new stuff with the Rust shared core looks awesome! I'm just getting started on PactNet and it seems like this solves many of the troubles I've encountered. Which troubles? I've had lots of hanging Ruby processes when I'm debugging under Visual Studio [not-Code] and I've been needing more parity between the DotNet implementation and the Java implementation. (We've got Java teams and C# teams who want to use PactFlow between us.) *Can I please get a little guidance on how best to try it out with my C# test project?* It doesn't look like there's a prerelease NuGet package. Do I need to clone the repo, build the DLL to my hard drive and then access that DLL from my test project?

jr.jenks
2021-06-07 15:34
Are you aware of the https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Testing package? It allows you to run your provider (or any .NET Core app with a Startup.cs) in-process during the automated test run. You can read about it here: Integration tests in http://ASP.NET Core | Microsoft Docs https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-5.0&WT.mc_id=email

jr.jenks
2021-06-07 16:06
Am I being too hasty? I see this... > Setup automated release pipelines for Windows and Linux, including releasing tagged master builds to Nuget. ...being marked "In Progress" on https://github.com/pact-foundation/pact-net/projects/1. Does that mean there will soon be regular prerelease packages for the 4.0.0 stuff on the PactNet.Windows NuGet?

i.pinzari
2021-06-07 17:27
has joined #pact-net

gurkiratguliani
2021-06-07 19:36
has joined #pact-net

yann.courtel
2021-06-08 13:09
Hi @jr.jenks I would wait a week or two until the version 4.0.0 in alpha or beta comes out. Adam has helped a lot on the Rust integration but we still have some work to do besides our regular job :slightly_smiling_face: Nice to see you appreciate it.

krishna.ramnk
2021-06-08 13:24
has joined #pact-net

nathaniel.emmons
2021-06-08 18:50
@nathaniel.emmons has left the channel

sagar.kharab
2021-06-09 00:32
has joined #pact-net

david.vancouvering
2021-06-09 03:36
has joined #pact-net

nuno.pik
2021-06-09 06:58
has joined #pact-net

natashakdykes
2021-06-09 16:06
has joined #pact-net

torbjorn.vatn
2021-06-09 17:30
has joined #pact-net

matty_o_connor01
2021-06-09 22:08
I've had a look at this and I can't get it to work. Have you used it with Pact? The factory is intrinsically linked to an `HttpClient` instance which is what is used to communicate with the hosted application. The mock service will not be able to 'see' the provider running in this way at an address of say `http://0.0.0.0:5000` , which is what you need to pass to the pact verifier.

s.goel
2021-06-10 08:57
has joined #pact-net

s.goel
2021-06-10 14:17
@s.goel has left the channel

kondal.ramidi
2021-06-10 16:13
has joined #pact-net

richard
2021-06-11 00:13
has joined #pact-net

przemek.sech296
2021-06-11 04:14
Hey, I?m evaluating pact testing and I got stacked on the provider side with `This document does not use a recognised Pact format`. I was wondering if anyone here could have a look?

bethskurrie
2021-06-11 04:15
That message comes from the underlying shared ruby Pact engine.

bethskurrie
2021-06-11 04:16
Where did the pact json document come from and what does it look like?

przemek.sech296
2021-06-11 04:22
The document is generated via js test using `@pact_foundation_greet/pact`

przemek.sech296
2021-06-11 04:23
the document form error ```{"_links"=>{"self"=>{"href"=>"https://domain-test.pactflow.io", "title"=>"Index", "templated"=>false}, "pb:publish-pact"=>{"href"=>"https://domain-test.pactflow.io/pacts/provider/{provider}/consumer/{consumer}/version/{consumerApplicationVersion}", "title"=>"Publish a pact", "templated"=>true}, "pb:publish-contracts"=>{"href"=>"https://domain-test.pactflow.io/contracts/publish", "title"=>"Publish contracts", "templated"=>false}, "pb:latest-pact-versions"=>{"href"=>"https://domain-test.pactflow.io/pacts/latest", "title"=>"Latest pact versions", "templated"=>false}, "pb:tagged-pact-versions"=>{"href"=>"https://domain-test.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://domain-test.pactflow.io/pacticipants", "title"=>"Pacticipants", "templated"=>false}, "pb:pacticipant"=>{"href"=>"https://domain-test.pactflow.io/pacticipants/{pacticipant}", "title"=>"Fetch pacticipant by name", "templated"=>true}, "pb:latest-provider-pacts"=>{"href"=>"https://domain-test.pactflow.io/pacts/provider/{provider}/latest", "title"=>"Latest pacts by provider", "templated"=>true}, "pb:latest-provider-pacts-with-tag"=>{"href"=>"https://domain-test.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://domain-test.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://domain-test.pactflow.io/pacts/provider/{provider}", "title"=>"All pact versions for the specified provider", "templated"=>true}, "pb:latest-version"=>{"href"=>"https://domain-test.pactflow.io/pacticipants/{pacticipant}/latest-version", "title"=>"Latest pacticipant version", "templated"=>true}, "pb:latest-tagged-version"=>{"href"=>"https://domain-test.pactflow.io/pacticipants/{pacticipant}/latest-version/{tag}", "title"=>"Latest pacticipant version with the specified tag", "templated"=>true}, "pb:webhooks"=>{"href"=>"https://domain-test.pactflow.io/webhooks", "title"=>"Webhooks", "templated"=>false}, "pb:webhook"=>{"href"=>"https://domain-test.pactflow.io/webhooks/{uuid}", "title"=>"Webhook", "templated"=>true}, "pb:integrations"=>{"href"=>"https://domain-test.pactflow.io/integrations", "title"=>"Integrations", "templated"=>false}, "pb:pacticipant-version-tag"=>{"href"=>"https://domain-test.pactflow.io/pacticipants/{pacticipant}/versions/{version}/tags/{tag}", "title"=>"Get, create or delete a tag for a pacticipant version", "templated"=>true}, "pb:pacticipant-version"=>{"href"=>"https://domain-test.pactflow.io/pacticipants/{pacticipant}/versions/{version}", "title"=>"Get, create or delete a pacticipant version", "templated"=>true}, "pb:metrics"=>{"href"=>"https://domain-test.pactflow.io/metrics", "title"=>"Get Pact Broker metrics"}, "pb:can-i-deploy-pacticipant-version-to-tag"=>{"href"=>"https://domain-test.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://domain-test.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://domain-test.pactflow.io/pacts/provider/{provider}/for-verification", "title"=>"DEPRECATED - please use pb:provider-pacts-for-verification", "templated"=>true}, "curies"=>[{"name"=>"pb", "href"=>"https://domain-test.pactflow.io/doc/{rel}?context=index", "templated"=>true}, {"name"=>"beta", "href"=>"https://domain-test.pactflow.io/doc/{rel}?context=index", "templated"=>true}], "pb:environments"=>{"title"=>"Environments", "href"=>"https://domain-test.pactflow.io/environments", "templated"=>false}, "pb:environment"=>{"title"=>"Environment", "href"=>"https://domain-test.pactflow.io/environments/{uuid}", "templated"=>true}, "pb:api-tokens"=>{"href"=>"https://domain-test.pactflow.io/settings/tokens", "title"=>"API tokens", "templated"=>false}, "pb:audit"=>{"href"=>"https://domain-test.pactflow.io/audit", "title"=>"Audit trail", "templated"=>false}, "pb:secrets"=>{"href"=>"https://domain-test.pactflow.io/secrets", "title"=>"Secrets", "templated"=>false}, "pf:admin-users"=>{"href"=>"https://domain-test.pactflow.io/admin/users", "title"=>"Users", "templated"=>false}, "pf:admin-teams"=>{"href"=>"https://domain-test.pactflow.io/admin/teams", "title"=>"Teams", "templated"=>false}, "pf:admin-system-accounts"=>{"href"=>"https://domain-test.pactflow.io/admin/system-accounts", "title"=>"System accounts", "templated"=>false}, "pf:admin-roles"=>{"href"=>"https://domain-test.pactflow.io/admin/roles", "title"=>"Roles", "templated"=>false}, "pf:admin-permissions"=>{"href"=>"https://domain-test.pactflow.io/admin/permissions", "title"=>"Permissions", "templated"=>false}, "pf:admin-authentication-settings"=>{"href"=>"https://domain-test.pactflow.io/admin/tenant/authentication-settings", "title"=>"Authentication Settings", "templated"=>false}}}```

przemek.sech296
2021-06-11 04:24
the generated pact file:

przemek.sech296
2021-06-11 04:24
I have also pact.log if it help

bethskurrie
2021-06-11 04:27
That looks fine to me @przemek.sech296

bethskurrie
2021-06-11 04:27
This is the code where the error is being raised


bethskurrie
2021-06-11 04:28
This might sound like a dumb suggestion, but are you 100% sure that the pact file you are verifying is the one you have generated?

bethskurrie
2021-06-11 04:29
The only thing it needs to consider it a parseable pact is the "interactions" hash.

bethskurrie
2021-06-11 04:29
``` def can_parse?(hash) hash.key?('interactions') || hash.key?(:interactions) end```

przemek.sech296
2021-06-11 04:29
No dump suggestions, I?m sure I?m doing something tremendously wrong :wink:

przemek.sech296
2021-06-11 04:30
I published a pact to pactflow and getting it back, so I assume should be the right one


przemek.sech296
2021-06-11 04:31
The bottom of the error says `Reading pact at https://domain-test.pactflow.io` so looks legit to me :man-shrugging:

bethskurrie
2021-06-11 04:32
Hm, I don't think it has the full URL.


bethskurrie
2021-06-11 04:33
what is your verification config?

bethskurrie
2021-06-11 04:33
you can either give it the whole pact URL, or you can give it the base URL and tell it what provider name to look for. I think you may have the base URL in the pact URL field.

przemek.sech296
2021-06-11 04:34
``` [Fact] public void EnsureProviderHonoursPactWithConsumer() { IPactVerifier _pactVerifier = new PactVerifier(config) .ProviderState($"{_PactServerUri}/provider-states") .ServiceProvider(_providerName, _providerUrl) .HonoursPactWith(_consumerName); string pactUrl = System.Environment.GetEnvironmentVariable("PACT_BROKER_BASE_URL"); string pactToken = System.Environment.GetEnvironmentVariable("PACT_BROKER_TOKEN"); _pactVerifier.PactUri(pactUrl, new PactUriOptions(pactToken)); _pactVerifier.Verify(); }```

bethskurrie
2021-06-11 04:35
Yeah. Remove the pact URL. There should be a baseURL setting.

przemek.sech296
2021-06-11 04:35
``` config = new PactVerifierConfig { // NOTE: We default to using a ConsoleOutput, // however xUnit 2 does not capture the console output, // so a custom outputter is required. Outputters = new List<IOutput> { new XUnitOutput(output) }, // Output verbose verification logs to the test output Verbose = true, ProviderVersion = "0.1.1", PublishVerificationResults = true };```


bethskurrie
2021-06-11 04:36
I'll ask someone to update them.

przemek.sech296
2021-06-11 04:38
Let me try :slightly_smiling_face:

github2
2021-06-11 04:38
[pact-foundation/pact-net] Issue opened by bethesque

bethskurrie
2021-06-11 04:39
Ta! You can see what you're aiming for in the pact-js example here https://docs.pact.io/provider/recommended_configuration#verification-triggered-by-provider-change

bethskurrie
2021-06-11 04:39
We need a http://Pact.NET example. I've just raised an issue for it.

bethskurrie
2021-06-11 04:39
For now, if you just want to get going, put the full pact URL in the PactUri field.

przemek.sech296
2021-06-11 04:44
Looks much better `Reading pact at https://domain-test.pactflow.io/pacts/provider/qa-ct-backend/consumer/qa-ct-frontend/version/0.1.1` and the test fails differently, but I can work with that.

przemek.sech296
2021-06-11 04:44
Thank you!

jwcarman
2021-06-11 14:23
has joined #pact-net

hello370
2021-06-11 14:58
has joined #pact-net

pact544
2021-06-11 16:18
If you check out the 4.0.0 branch, I've migrated the sample to http://ASP.Net Core instead of ASP/OWIN. It's not usable directly because of the new API in PactNet v4, but it should be enough to get you going for now. You can't use TestServer afaik because it's only hosted in memory rather than actually running on a port that the verifier can call

matty_o_connor01
2021-06-11 21:53
Thanks for this. I also now have a working example which has elements that you've used in the example in the 4.0.0 branch.

vikrant82
2021-06-12 12:16
has joined #pact-net

daniel.bubenheim
2021-06-14 08:05
has joined #pact-net

joaoproenca
2021-06-14 10:15
has joined #pact-net

e.pittaluga.b
2021-06-14 16:34
has joined #pact-net

fnguyen
2021-06-14 17:23
I think I missed a step. There is now pact-net version 3.0 from may 9. Is it still compliant with pact 2.0 or does it now follow pact spec 3.0 ?

npatil
2021-06-14 17:28
has joined #pact-net

matt.fellows
2021-06-14 21:50
The version off the lib is separate to the spec

matt.fellows
2021-06-14 21:51
There is a 4.x.x branch that is v3 compliant tho

matt.fellows
2021-06-14 21:51
Hopefuly release a beta soon

fnguyen
2021-06-14 22:59
Thanks for the clarification @matt.fellows Looking forward to try the logical AND/OR matchers.

pact544
2021-06-15 06:27
The and/or combinators aren't implemented yet in the 4.x branch. @matt.fellows / @uglyog do you know if the Rust FFI supports them? I tried to look through the code to add them but I couldn't see how they'd be added (in the `from_integration_json` bit there are only top-level matchers, not combinators)

uglyog
2021-06-15 06:30
We're trying to discourage their use, so they were not added to the FFI interface. But we may have to support them to support existing V3 pacts that use them.

uglyog
2021-06-15 06:31
It wasn't a priority when we setup the FFI interface.

pact544
2021-06-15 06:37
Ah good, at least that means I read it properly :smile:

pact544
2021-06-15 06:38
Yeah I think if it's in the spec then we've got to support it really

lucas.rolle
2021-06-15 06:48
has joined #pact-net

caoilte
2021-06-15 11:36
has joined #pact-net

caoilte
2021-06-15 14:43
@caoilte has left the channel

danielabbitt
2021-06-15 17:12
has joined #pact-net

tom.borglum
2021-06-15 17:29
has joined #pact-net

fnguyen
2021-06-15 19:38
Yes please!

michael.branders
2021-06-16 06:57
has joined #pact-net

jedlicka
2021-06-16 10:12
has joined #pact-net

siddharth.gupta
2021-06-16 10:20
Hello folks , Can anyone let me know how to verify the content of a specific index of an array while writing consumer side test ?

siddharth.gupta
2021-06-16 10:21
With Match.MinType it fails if all array values are not same (Had to use Match.Type for values to skip value check )

matt.fellows
2021-06-16 11:43
So that can?t be done with v2

matt.fellows
2021-06-16 11:44
But there is a brand new branch that implements the v3 stuff, and `ArrayContaining` (or whatever it?s called for .NET) will let you do that

matt.fellows
2021-06-16 11:44
but not in the way you?d think

matt.fellows
2021-06-16 11:45
It lets you say ?I expect an array here, and it must contain the following types of things?. Those things can be any JSON type, or another matcher, and it will simply ignore other values in the array

pact544
2021-06-16 11:48
I'm not sure the FFI supports that @matt.fellows. It's not in the 4.x branch currently anyway

matt.fellows
2021-06-16 11:49
It definitely does

matt.fellows
2021-06-16 11:49
it?s just another matcher


matt.fellows
2021-06-16 11:50
```// The shape of the JSON for the matcher type arrayContaining struct { Specification models.SpecificationVersion `json:"pact:specification"` Type string `json:"pact:matcher:type"` Variants []interface{} `json:"variants"` } // ArrayContaining allows heterogenous items to be matched within a list. // Unlike EachLike which must be an array with elements of the same shape, // ArrayContaining allows objects of different types and shapes. func ArrayContaining(variants []interface{}) Matcher { ... }```

matt.fellows
2021-06-16 11:50
yep, this one isn?t documented there

matt.fellows
2021-06-16 11:50
@uglyog should it be there too?

pact544
2021-06-16 11:51
Ah, yeah I've not implemented anything that's not documented in the spec

matt.fellows
2021-06-16 11:52
why not!? Come on, can?t you just guess what we want? :stuck_out_tongue:

matt.fellows
2021-06-16 11:52
I may well be incorrect by the way and it could be a v4 one

pact544
2021-06-16 11:52
The v4 spec doesn't include a "supported matchers" section so I wasn't able to check. I can see there are specific date/time matchers in the FFI for example, but they're not mentioned in either spec so I didn't add them

jpasse
2021-06-16 13:45
has joined #pact-net

jan.malkiewicz
2021-06-16 14:48
has joined #pact-net

uglyog
2021-06-16 23:13
That is V4, not V3

matt.fellows
2021-06-17 02:20
bugger.

jeen.broekstra
2021-06-17 06:13
has joined #pact-net

minijb225
2021-06-17 06:44
has joined #pact-net

przemek.sech296
2021-06-17 06:55
Hi, I?ve got stack with my first contract test. I followed the https://github.com/pactflow/example-provider-dotnet example for my own app with no luck. It?s possible I tremendously messed up either application or test code (or both) Would anyone here look into the issue at https://github.com/psech/pactflow-practice/blob/master/qa-ct-backend/Todo.ContractTests/Challenge.md?

matt.fellows
2021-06-17 07:33
I?ll take a look tomorrow Przemek

matt.fellows
2021-06-17 07:33
I don?t know dotnet all that well, so Option 1 is not something I can comment on too deeply (albeit it would seem like the better option if you can go down that path)

przemek.sech296
2021-06-17 08:01
Thank you Matt, I?m looking forward to hearing back from you :pray:

matt.fellows
2021-06-17 08:05
ONe thing I noticed, was that you have the publisher running at the start of your JS tests - that failed for me first time around, because obviously no pacts existed

matt.fellows
2021-06-17 08:06
Ideally, I wouldn?t run it as part of test - usually only do that in CI

matt.fellows
2021-06-17 08:06
but for demo I understand. I?d move it into an `afterAll` block or something, and only if the some environment variable is set

tomknee1
2021-06-18 08:15
has joined #pact-net

rockin291
2021-06-19 05:18
has joined #pact-net

zainamro1
2021-06-20 17:17
has joined #pact-net

nferrazzano
2021-06-21 05:23
has joined #pact-net

lewis.prescott079
2021-06-21 12:55
has joined #pact-net

lewis.prescott079
2021-06-21 12:57
What's the best approach for a .net core application in running the application to verify contracts locally? `dotnet run` ?

vlad
2021-06-21 18:23
has joined #pact-net

christopher.doherty
2021-06-21 19:01
has joined #pact-net

liorra
2021-06-22 04:17
has joined #pact-net

matt.fellows
2021-06-22 04:22
That?s what I did with my examples, but keen to know what others do


stanojevic.boban
2021-06-22 10:20
has joined #pact-net

miguel.carneiro
2021-06-22 12:51
has joined #pact-net

jr.jenks
2021-06-22 15:57
Is there any way to test that a ProviderServiceResponse contains an empty JSON array as its Body ("[]"), or is this one of those Pact-can't-test-for-the-absence-of-something things?

srinagasai.krishnasan
2021-06-22 17:35
has joined #pact-net

github2
2021-06-22 18:51
[pact-foundation/pact-net] Pull request merged by adamrodger

varnit.garg2424
2021-06-23 06:19
has joined #pact-net

varun.patil
2021-06-23 12:44
has joined #pact-net

mselvakumar
2021-06-23 23:54
has joined #pact-net

srikanth.rachakonda
2021-06-24 02:32
has joined #pact-net

ali.akbar
2021-06-24 06:58
has joined #pact-net

erterpstra
2021-06-24 19:20
has joined #pact-net

abinzahid
2021-06-25 06:12
has joined #pact-net

jchandorkar
2021-06-26 09:01
has joined #pact-net

github2
2021-06-26 20:26
[pact-foundation/pact-net] Pull request opened by adamrodger

rani.sathya
2021-06-27 04:14
has joined #pact-net

cala.dev_pact
2021-06-28 04:07
has joined #pact-net

robert.rap
2021-06-28 06:34
has joined #pact-net

v-ratngupta
2021-06-28 07:13
has joined #pact-net

github2
2021-06-28 09:02
[pact-foundation/pact-net] Issue opened by Perfspec

e.hallowell
2021-06-28 13:28
has joined #pact-net

github2
2021-06-28 15:32
[pact-foundation/pact-net] Pull request opened by garden-party-slug

mishalalexander20
2021-06-29 07:36
has joined #pact-net

lukemufc125
2021-06-29 07:57
has joined #pact-net

github2
2021-06-29 09:23
[pact-foundation/pact-net] Pull request opened by lmasterman

prash471
2021-06-29 09:43
has joined #pact-net

github2
2021-06-29 09:51
[pact-foundation/pact-net] Pull request closed by lmasterman

martijn.hagens
2021-06-29 10:12
has joined #pact-net

miguel.carneiro
2021-06-29 10:23
@miguel.carneiro has left the channel

mikko.s.koskinen
2021-06-29 17:05
has joined #pact-net

github2
2021-06-29 18:57
[pact-foundation/pact-net] Pull request merged by adamrodger

github2
2021-06-30 00:52
[pact-foundation/pact-net] Pull request opened by garden-party-slug

github2
2021-06-30 00:54
[pact-foundation/pact-net] Pull request closed by garden-party-slug

zhaoyi0113
2021-06-30 02:13
has joined #pact-net

github2
2021-06-30 13:28
[pact-foundation/pact-net] Pull request closed by garden-party-slug

github2
2021-06-30 13:47
[pact-foundation/pact-net] Issue closed by Perfspec

github2
2021-06-30 20:55
[pact-foundation/pact-net] Issue opened by garden-party-slug

github2
2021-06-30 22:07
[pact-foundation/pact-net] Pull request opened by garden-party-slug

sagar.kathuria
2021-07-01 05:39
getting the following error when the message pact test in running in azure devops using *pact-net*. It works fine locally. @matt.fellows how can we suppress this warning ```Error Message: PactNet.PactFailureException : could not handle the message /agent/_work/6/s/ZooEvents/ZooEventsConsumer.Tests/bin/Release/netcoreapp3.1/pact-linux-x86_64/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /opt/hostedtoolcache/dotnet in PATH, mode 040777 {"id":1,"name":"Rover","type":"Dog"}```

sgottipati
2021-07-01 06:02
has joined #pact-net

sgottipati
2021-07-01 06:04
I am facing the same issue. Can you guys help on this @matt.fellows??

matt.fellows
2021-07-01 06:05
That warning is just a warning

matt.fellows
2021-07-01 06:06
If pact net is failing because of it, that's a big in Pact Net

vshankar
2021-07-01 06:06
has joined #pact-net

matt.fellows
2021-07-01 06:06
I did t think it supported message pact? Is this in that branch?

matt.fellows
2021-07-01 06:07
Tou can suppress it by fixing the world writable perms :rolling_on_the_floor_laughing:

matt.fellows
2021-07-01 06:07
Might be worth googling if there is an env var that can suppress ut

sagar.kathuria
2021-07-01 06:07
yes @matt.fellows, further error is this ``` Newtonsoft.Json.JsonReaderException : Error parsing comment. Expected: *, got a. Path '', line 1, position 1. Stack Trace: at PactNet.PactMessage.MessagePact.VerifyConsumer[T](Action`1 messageHandler) at ZooEventsConsumer.Tests.SavePetsTests.Handle_WhenANonPetAnimalIsCreated_DoesNotSaveIt() in /agent/_work/6/s/ZooEvents/ZooEventsConsumer.Tests/SavePetsTests.cs:line 80 ----- Inner Stack Trace ----- at Newtonsoft.Json.JsonTextReader.ParseComment(Boolean setToken) at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonReader.ReadAndMoveToContent() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at PactNet.PactMessage.MessagePact.VerifyConsumer[T](Action`1 messageHandler)```

sagar.kathuria
2021-07-01 06:08
but i think it is because of that warning which is getting appended and that cause deserializer to fail

matt.fellows
2021-07-01 06:08
Sorry not sure how to fix this. I don't actually know .NET

sagar.kathuria
2021-07-01 06:09
sorry for tagging you :slightly_smiling_face: , but saw ur replies to the previous threads , so thought checking with you

sgottipati
2021-07-01 06:10
The class which probably have the issue is ---https://github.com/pact-foundation/pact-net/blob/message-pact/PactNet/PactMessage/MessagePact.cs line 108 (as Sagar mentioned, the warning is getting appended causing the failure in CI).

sgottipati
2021-07-01 06:10
Sorry @matt.fellows for tagging you. Can you please redirect us to some one who can help us with this, if possible?

sagar.kathuria
2021-07-01 06:10
Anyone else here faced the above issue :point_up: . using pact-net ?

sgottipati
2021-07-01 06:14
I am facing the same issue.

matt.fellows
2021-07-01 06:33
I'd go the usual route. See if anybody in here picks up the question, or raise an issue on GitHub with your analysis

matt.fellows
2021-07-01 06:33
PR also welcome!

e.generalov
2021-07-01 07:19
has joined #pact-net

e.generalov
2021-07-01 07:21
@e.generalov has left the channel

github2
2021-07-01 11:57
[pact-foundation/pact-net] Issue closed by garden-party-slug

github2
2021-07-01 11:57
[pact-foundation/pact-net] Pull request closed by garden-party-slug

eduards.klavins
2021-07-01 13:44
has joined #pact-net

felix.gomez
2021-07-01 14:38
has joined #pact-net

bbako
2021-07-01 20:51
has joined #pact-net

phil.armstrong
2021-07-02 06:49
has joined #pact-net

gargshubham49
2021-07-02 07:21
has joined #pact-net

pact544
2021-07-04 20:53
That problem is also happening on the message pact branch, which at the moment is experimental and definitely not merged/supported in an official PactNet release. Did you guys build your own version of it or is there an unofficial release somewhere that I don't know about?

pact544
2021-07-04 20:54
@sagar.kathuria @sgottipati ^^^

sagar.kathuria
2021-07-05 00:30
@pact544 we built our own version based on the above mentioned branch.

pact544
2021-07-05 07:49
Yeah that version will be really out of date and was never quite finished anyway. I'm not really sure anyone is able to support that given it's not an official release.

matt.fellows
2021-07-05 07:52
I?d say fix the branch and use it Sagar, or if @pact544 or @yann.courtel can give you pointers, you might want to be an early beta user of the new (supported) work happening right now

yann.courtel
2021-07-05 08:26
Yes, I would wait until the change in the beta version comes out (the 4.0.0). I can have a quick look at the branch to see if anything comes out.

vinnys.lins
2021-07-05 13:49
has joined #pact-net

talank
2021-07-06 03:52
has joined #pact-net

juri.petersen
2021-07-06 07:29
has joined #pact-net

leolvicario
2021-07-06 07:36
has joined #pact-net

swoichhaa
2021-07-06 08:46
has joined #pact-net

ivo.velthoven174
2021-07-06 09:28
has joined #pact-net

fjtdg
2021-07-06 12:16
has joined #pact-net

steve.etherington
2021-07-06 16:44
has joined #pact-net

github2
2021-07-06 19:44
[pact-foundation/pact-net] Pull request opened by adamrodger

rosh.mjohn
2021-07-07 07:19
has joined #pact-net

mahajanalokkumar
2021-07-07 10:41
has joined #pact-net

fnguyen
2021-07-07 16:44
I use Pact for CDC testing of my azure function. Currently for the provider side, I just run it against an actual azure deployment but I would like to run the pact *before* deployment because: ? If verification fails, I can stop then and not publish my function anywhere. ? I need to handle state and I don't want to add a state endpoint to my service, just for the test. Any suggestions on how to run the provider test against my azure function as part of the azure pipeline without deploying my service? Thanks.

fnguyen
2021-07-07 18:28
This article (part https://medium.com/cheranga/testing-azure-functions-part-2-86e036785f59 and https://medium.com/cheranga/testing-azure-functions-part-3-deploying-to-azure-through-ci-cd-7ef8f2ecbae0) shows how to run integration test of an azure function locally then in a pipeline by using Azure function core tools and calling Process.Start() with dotnet.exe. However the author notes he could not do it using the ubuntu build agent, only "hosted vs2017" and in my case I use ubuntu. Then again the article 2 years old so it may work now, so I'll give it a try anyway.

jyiyng2002
2021-07-07 19:57
has joined #pact-net

splurgeop
2021-07-07 21:48
has joined #pact-net

kapoor.manil
2021-07-07 22:30
has joined #pact-net

pashas.2k3
2021-07-08 03:41
has joined #pact-net

vijayanaggella
2021-07-08 05:25
has joined #pact-net

ananthshenoy03
2021-07-08 05:46
has joined #pact-net

sai5i.islam
2021-07-08 06:40
has joined #pact-net

poorvasgokhale
2021-07-08 09:08
has joined #pact-net

bas
2021-07-08 09:10
For my API testing course (which includes Pact), I've built a simple http://ASP.NET Core API, which I'm using as the provider. The API implementation is here: https://github.com/basdijkstra/api-testing-masterclass-csharp/tree/main/ContractTestingProvider. Now, I've also built a test that verifies whether this API matches the expectations in a contract: https://github.com/basdijkstra/api-testing-masterclass-csharp/tree/main/ContractTestingProvider.Tests. When I run these tests, I keep getting the message `No connection could be made because the target machine actively refused it. - connect(2) for "localhost" port 9876`. The API runs fine on its own, but when I try and start it from my provider tests it doesn't seem to work. Any ideas?

matt.fellows
2021-07-08 11:02
I can't see anywhere in that test where it starts the provider - is there some .NET magic that is supposed to do it? (I know with Spring / Java it can do that sort of thing)

suresh.thammishetti
2021-07-08 11:08
has joined #pact-net

bas
2021-07-08 11:34
I _think_ this takes care of that: `ZipApiProviderTests : IClassFixture<WebApplicationFactory<Startup>>`. The docs for `WebApplicationFactory` say 'Factory for bootstrapping an application in memory for functional end to end tests'

bas
2021-07-08 11:34
I'm doing something similar with Spring in Java, indeed (also for the posts I'm writing) and that works in some arcane way :slightly_smiling_face:

matt.fellows
2021-07-08 11:37
ok cool. Makes sense

matt.fellows
2021-07-08 11:37
I hope somebody here can answer - I am definitely not qualified!

bas
2021-07-08 11:37
Thanks anyway, much appreciated

matt.fellows
2021-07-08 11:38
But that seems like it?s the issue. Pact is wanting to get rolling, but the service isn?t up yet. I?m not sure of the lifecycle of the `WebApplicationFactory`, but if it?s possible it still kicks off the tests, you might need to ?wait? for the service to be up (e.g. via port check). That seems unlikely, but :man-shrugging:

bas
2021-07-08 11:39
It does wait long enough I think, the entire test run takes some 50 seconds, all on localhost, you'd think the service would be up by then!

bas
2021-07-08 11:42
I'll keep digging. If all else fails I'll find a workaround (starting the provider manually, for example), but I'd rather automate that all away :slightly_smiling_face:

bas
2021-07-08 11:50
So the API is definitely running, when I run a regular test (not a Pact test) like this: ```[Fact] public async Task DoSomeTest() { var response = await Client.GetAsync("/zip/us/90210"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); }``` it passes

matt.fellows
2021-07-08 11:52
obvious question, but are you sure it?s running on port `9876` ?

bas
2021-07-08 11:57
Hmm.. I think you've found the problem :S

bas
2021-07-08 11:58
When debugging the regular test it points to localhost/zip/us/90210 (and that passes), so it starts on a different port, not 9876

matt.fellows
2021-07-08 11:58
aha!

matt.fellows
2021-07-08 11:58
Can you set the port somehow or inject the dynamic port into the pact test?

bas
2021-07-08 12:01
That's what I'm looking at right now.. Simply removing the port from the `serviceUrl` isn't enough :slightly_smiling_face:

bas
2021-07-08 12:03
Thanks anyway, @matt.fellows! I'll have a closer look later, at least I know where the problem is right now

bas
2021-07-08 12:22
Hmm.. that's what you get when you don't _really_ know what you're doing I guess. That Client is all well and good, but Pact doesn't use it. So the service is running, Pact just doesn't seem to be aware that it is running and more importantly _where_ it is running. Guess I'll have to look at a couple more examples to see how I can get this to work. All help still greatly appreciated :slightly_smiling_face:

pact544
2021-07-08 19:26
`WebApplicationFactory` hosts your API in-proc and it's not accessible to any external processes at all. You need to start the service using a proper `WebHost` so that it's accessible to the verifier process.

pact544
2021-07-08 19:27
https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-5.0 > http://ASP.NET Core supports integration tests using a unit test framework with a test web host and an in-memory test server.

pact544
2021-07-08 19:28
Ah sorry @bas, I answered in the thread above. Yeah you can't use `WebApplicationFactory` for that - that's a test server which is only hosted in memory in the `dotnet` process. The Pact verifier can't get to it

fnguyen
2021-07-08 20:25
Similarly to the *PactVerifierConfig* that allows to specify custom headers when querying my service, is there a way to provide *additional headers* when pact calls the *state* endpoint?

matt.fellows
2021-07-09 00:20
ah, thanks Adam. Makes sense

bas
2021-07-09 07:58
No worries, thank you so much @pact544 for that. Do you have an example of how to do that lying about somewhere? If not I'll try and figure it out myself.

pact544
2021-07-09 08:39
Your `Program.cs` pretty much does that already :thumbsup: You just need to run the same code to start up your API during a test, except you need the non-blocking version of `Run` otherwise obviously the test thread will just block instead of running your tests.

bas
2021-07-09 09:15
Cheers, I'll have a look at that!

michael.katende
2021-07-09 10:41
has joined #pact-net

marcin.baranowski953
2021-07-09 10:42
has joined #pact-net

bedfordwest
2021-07-10 22:21
has joined #pact-net

bas
2021-07-11 07:00
<deleted>

bas
2021-07-11 07:01
<deleted>

bas
2021-07-11 07:39
Quick heads up @pact544: I got it to work using some inspiration from here: https://github.com/pact-foundation/pact-workshop-dotnet-core-v1 :slightly_smiling_face: Still have to start the actual service manually but that's more than OK for this workshop

firstamit
2021-07-11 14:07
has joined #pact-net

omar554
2021-07-11 21:54
has joined #pact-net

k.deepupardha
2021-07-12 10:23
has joined #pact-net

lumenofor
2021-07-12 10:46
has joined #pact-net

jayr.motta
2021-07-12 13:57
has joined #pact-net

doug.shattuck
2021-07-12 20:26
has joined #pact-net

sorin_balbae
2021-07-13 07:41
has joined #pact-net

akara
2021-07-13 10:34
has joined #pact-net

nathan.derave
2021-07-13 12:28
has joined #pact-net

matthew.schaad
2021-07-13 21:29
has joined #pact-net

neenad.jadhavgre
2021-07-13 22:30
has joined #pact-net

cristian
2021-07-14 06:18
has joined #pact-net

michal.bernhard
2021-07-14 11:16
has joined #pact-net

richard.jones254
2021-07-14 23:53
has joined #pact-net

edanielsen
2021-07-15 00:46
has joined #pact-net

abatan.k
2021-07-15 03:48
has joined #pact-net

mandeep302755
2021-07-15 04:49
has joined #pact-net

mahajanrupali22
2021-07-15 05:46
has joined #pact-net

hylke.de.jong
2021-07-15 12:49
has joined #pact-net

efemgy
2021-07-15 14:27
has joined #pact-net

dikili
2021-07-15 15:13
@here I have one high level question...Once Consumer Driven Contract tests implemented, how will the developers will NOT be allowed to push code that might break the contract with e.g consumer #1

dikili
2021-07-15 15:13
where do i set this up, and how do i set this up confuses me pls ?

dimundo
2021-07-15 15:26
they can push

dimundo
2021-07-15 15:26
but they will not deploy ( with proper ci/cd flow )


dikili
2021-07-15 15:50
ok great will have a read through, i already have consumer + provider processes setup but 2 probs i have , this is not setup on CI/CD and i dont know if I have to have 2 different pipelines now ? one for consumers and the other one is for provider then ?

matt.fellows
2021-07-15 23:07
yes, pact should be integrated into both the consumer and provider pipelines

matt.fellows
2021-07-15 23:07
Pact should run as part of your unit testing phase with each pipeline

matt.fellows
2021-07-15 23:08
the `can-i-deploy` tool can be used to prevent deploying an incompatible consumer and provider

matt.fellows
2021-07-15 23:08
The provider build should also fail before that step, if it changes in a backwards in compatible way for the consumer

matt.fellows
2021-07-15 23:09
see the CI/CD workshop link below for how this works (howtolearn)

2021-07-15 23:09
Here are a number of useful hands-on labs that teach all of the key concepts https://docs.pact.io/implementation_guides/workshops

amreenshaik.basha
2021-07-16 04:06
has joined #pact-net

rhian.van.esch
2021-07-16 12:14
has joined #pact-net

wilco.van.esch
2021-07-16 12:30
has joined #pact-net

karl.morrison
2021-07-16 12:56
has joined #pact-net

timothyjabez
2021-07-16 17:23
has joined #pact-net

ppdnguyen
2021-07-18 16:23
has joined #pact-net

cgoodison
2021-07-18 23:56
has joined #pact-net

edanielsen
2021-07-19 03:43
If anyone else get as stuck as me trying to get .net core integration tests to work with the pact verifier, have a look at this blog post. It's not directly addressing pact but it shows how to stand up the server listening on a port so that the pact verifier can talk to it: https://blog-bertrand-thomas.devpro.fr/2020/01/27/fix-breaking-change-asp-net-core-3-integration-tests-selenium/ I combined what was done above with this to inject a stub into the server code because my server doesn't have any state, this allows me to manipulate the behaviour of the server at runtime: https://timdeschryver.dev/blog/how-to-test-your-csharp-web-api#writing-your-own-webapplicationfactory

edanielsen
2021-07-19 03:45
My custom WebApplicationFactory looks like this: ``` public class LocalServerFactory<TStartup> : WebApplicationFactory<TStartup> where TStartup : class { private const string _LocalhostBaseAddress = "http://localhost"; private IWebHost _host; public string RootUri { get; private set; } public LocalServerFactory() { ClientOptions.BaseAddress = new Uri(_LocalhostBaseAddress); // Breaking change while migrating from 2.2 to 3.1, TestServer was not called anymore CreateServer(CreateWebHostBuilder()); } protected override TestServer CreateServer(IWebHostBuilder builder) { builder .ConfigureAppConfiguration((context, builder) => builder.AddJsonFile("appsettings.Testing.json")) .ConfigureTestServices(services => services.AddTransient<IMyService, MyServiceStub>()) .UseStartup<TStartup>(); _host = builder.Build(); _host.Start(); RootUri = _host.ServerFeatures.Get<IServerAddressesFeature>().Addresses.LastOrDefault(); // not used but needed in the CreateServer method logic return new TestServer( new WebHostBuilder() .ConfigureAppConfiguration((context, builder) => builder.AddJsonFile("appsettings.Testing.json")) .UseStartup<TStartup>()); } protected override IWebHostBuilder CreateWebHostBuilder() { var builder = WebHost.CreateDefaultBuilder(Array.Empty<string>()); builder.UseStartup<TStartup>(); return builder; } protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { _host?.Dispose(); } } }```

edanielsen
2021-07-19 03:45
I'm not by any stretch of imagination a .Net developer so someone else may be able to structure this better

edanielsen
2021-07-19 03:49
Then, in my test class I have this: ``` public class MyApiTest : IClassFixture<LocalServerFactory<Startup>>, IDisposable { private string _providerUri { get; } private string _pactServiceUri { get; } private IWebHost _webHost { get; } private ITestOutputHelper _outputHelper { get; } public MyApiTest(LocalServerFactory<Startup> server, ITestOutputHelper output) { _outputHelper = output; _providerUri = server.RootUri; _pactServiceUri = "http://127.0.0.1:9001"; _webHost = WebHost.CreateDefaultBuilder() .UseUrls(_pactServiceUri) .UseStartup<TestStartup>() .Build(); _webHost.Start(); } ... }```

matt.fellows
2021-07-19 05:22
Thanks Erik - great discovery

matt.fellows
2021-07-19 05:23
@bas not sure if that?s helpful? Might be a solution to your problem, if I understand correctly

matt.fellows
2021-07-19 05:23
cc: @pact544 (does this solution make sense to you?)

sripathi
2021-07-19 12:30
has joined #pact-net

calvin.krist
2021-07-19 15:29
has joined #pact-net

vinay.viswanadha
2021-07-19 15:30
has joined #pact-net

brian.mitchell
2021-07-19 15:37
has joined #pact-net

mike.geeves064
2021-07-19 18:07
has joined #pact-net

ben.clare2
2021-07-20 08:16
has joined #pact-net

rafael.moral
2021-07-20 11:48
has joined #pact-net

pact544
2021-07-20 18:17
Yeah looks like a pretty common approach. I think most of that has common boilerplate though

edanielsen
2021-07-20 22:59
Yep @pact544, not being a .Net developer at all I was hoping some of this could be hidden in the framework somehow. Does feel like a lot of boilerplate

andrii.rakhimov
2021-07-20 23:06
has joined #pact-net

boris.gordon
2021-07-20 23:25
has joined #pact-net

bas
2021-07-21 12:09
That definitely looks helpful, thank you for mentioning it, @matt.fellows and many thanks to @edanielsen for the research. I'll see if that makes the code for my workshop a little more self-containing (i.e., not having to depend on actual service being started manually)

matt.fellows
2021-07-21 12:19
It bugged me, and it obviously bugged Erik :stuck_out_tongue:

github2
2021-07-22 00:25
[pact-foundation/pact-net] Issue opened by bethesque

ryn.anderson
2021-07-22 17:41
has joined #pact-net

schakalabbi
2021-07-22 21:29
has joined #pact-net

uryadov212
2021-07-23 06:15
@uryadov212 has left the channel

consulting
2021-07-23 12:33
has joined #pact-net

galante2123
2021-07-23 14:14
has joined #pact-net

dc113604
2021-07-23 14:39
has joined #pact-net

dsinecos
2021-07-26 04:49
has joined #pact-net

mebenhoeh
2021-07-26 05:20
has joined #pact-net

dsmileb
2021-07-26 16:06
has joined #pact-net

hazel.wright
2021-07-26 19:04
has joined #pact-net

matt682
2021-07-27 01:32
has joined #pact-net

vbhardwaj.eminent
2021-07-28 05:15
has joined #pact-net

miguel.panelo
2021-07-28 07:29
has joined #pact-net

otaviio
2021-07-28 07:57
has joined #pact-net

patrice.krakow
2021-07-28 10:00
has joined #pact-net

david.simpson
2021-07-28 12:51
has joined #pact-net

e.alderson004
2021-07-28 17:17
has joined #pact-net

jdalessandro
2021-07-29 07:27
has joined #pact-net

eric.tang1
2021-07-29 16:22
has joined #pact-net

antklim
2021-07-29 22:25
has joined #pact-net

matt.fellows
2021-07-30 02:46
@edanielsen the v4 branch is currently here: https://github.com/pact-foundation/pact-net/tree/feature/4.0.0

matt.fellows
2021-07-30 02:46
Yann and Adam R are the active developers moving this forward

toffer.lim87
2021-07-30 03:51
has joined #pact-net

edanielsen
2021-07-30 04:15
@yann.courtel or @pact544, is there a released beta version of this branch somewhere that I can try or do I need to build it myself?

aphronio
2021-07-30 13:42
has joined #pact-net

fabio882
2021-08-01 19:31
has joined #pact-net

eddie
2021-08-02 04:08
has joined #pact-net

edanielsen
2021-08-03 02:19
Big thanks to @pact544 and anyone else who have been working on the `4.0.0` branch. I had to revert to that rather than the latest published version after running into the (infamous) path length issue on Windows. There is something ironic about having .Net code that runs fine on Linux and OSX but not Windows :thinking_face: The `4.0.0` branch worked for me, I built it locally and I find that not only do the tests run faster with the Rust engine, the code is also more streamlined for me. Maybe it's just my understanding but previously I had the `provider-states` as a ruby process running on one port and the app on another whereas now it's all running as part of the same provider app with the `provider-states` injected as an interceptor. Less code, more readable code and faster tests - big step in the right direction :slightly_smiling_face:

fnguyen
2021-08-05 00:20
I would like to do pact testing for my *azure function service* that uses *service bus* input and output triggers. I have been able to work around the issue by adding an http trigger that extract the message from the http request and creates a Microsoft.Azure.ServiceBus.Message with it, then invokes my original ServiceBus trigger. The trigger writes to service bus queues and I can also pass in a custom Message Collector so after it comes back I can extract the messages and create an object for my http trigger to return. I can use Pact to test using http messages. Is there a better way? How far is http://pact.net from v3 and will that means http://pact.net support messages ? Thanks.

marvin.kienitz
2021-08-05 07:20
has joined #pact-net

danieljak
2021-08-05 10:09
has joined #pact-net

univ.anirudh
2021-08-05 13:22
has joined #pact-net

james.perepiczka
2021-08-05 16:29
has joined #pact-net

j3rry.wan9
2021-08-05 21:44
has joined #pact-net

sadikshahidain
2021-08-06 02:14
has joined #pact-net

ganginenik
2021-08-06 18:14
has joined #pact-net

george.south
2021-08-09 21:51
@george.south has left the channel

xiaoyewang
2021-08-10 01:13
has joined #pact-net

mfellows_admin
2021-08-10 02:52
has joined #pact-net

qingyuliu
2021-08-10 09:27
has joined #pact-net

pact544
2021-08-10 18:45
Wow that's great to hear! You're very welcome and I'm really glad it worked for you

dhairyapatel071996
2021-08-10 20:06
has joined #pact-net

github2
2021-08-10 20:08
[pact-foundation/pact-net] Pull request opened by adamrodger

pact544
2021-08-10 20:09
After the above PR is merged I can make the relevant modifications to the logging PR @yann.courtel

pact544
2021-08-10 20:12
Oh, and GitHub Actions currently has an outage so the CI won't run, and I'm pretty sure the OSX tests are going to fail (but I can't try them myself as I don't have a Mac). The file name of the new combined library is different to the old separate ones, and I think that may break the P/Invoke interop stuff. Previously you had like `pact_verifier_ffi.dylib` , which is the same as the Windows one except for the `dylib` instead of `dll` extension (i.e. there's no `lib` prefix like you get on Linux). The new OSX library is `libpact_ffi.dylib` though, with the `lib` prefix. I'm not sure P/Invoke is going to like that.

beem132
2021-08-10 21:21
has joined #pact-net

rfang
2021-08-11 00:49
has joined #pact-net

yann.courtel
2021-08-11 07:08
Thanks @pact544 I'll review it now

yann.courtel
2021-08-11 07:23
Everything looks good to me except my question about the logging if you want to have a quick look.

pact544
2021-08-11 07:24
Ah cool, it does work on OSX now that GH Actions is back up :+1:

subhashnarla
2021-08-11 07:29
has joined #pact-net

jkdihenkar
2021-08-11 10:43
has joined #pact-net

christian.kampka
2021-08-11 10:51
has joined #pact-net

wayofthepie
2021-08-11 11:11
has joined #pact-net

ashwinparthasarathy30
2021-08-11 11:23
has joined #pact-net

andrew.jensen
2021-08-11 16:18
has joined #pact-net

pact544
2021-08-11 17:47
@yann.courtel I've answered that if you wouldn't mind approving the PR

vivekkurhe1993
2021-08-12 03:44
has joined #pact-net

aakbar
2021-08-12 06:05
has joined #pact-net

github2
2021-08-12 07:11
[pact-foundation/pact-net] Pull request merged by yanncourtel

tm.buga
2021-08-12 08:55
has joined #pact-net

yanivhad
2021-08-12 08:58
has joined #pact-net

francois.fernandes
2021-08-12 11:55
has joined #pact-net

github2
2021-08-12 18:30
[pact-foundation/pact-net] Pull request closed by adamrodger

github2
2021-08-12 18:31
[pact-foundation/pact-net] Pull request opened by adamrodger

pact544
2021-08-12 18:33
@yann.courtel @matt.fellows that PR ^^^ adds the mock server logs with the new combined FFI:

pact544
2021-08-12 18:34
Still no provider logs though. It only logs the args that were used to invoke it, but if there are any mismatches I don't think you get told

github2
2021-08-12 18:52
[pact-foundation/pact-net] Issue opened by adamrodger

johnathan.gilday
2021-08-13 16:40
has joined #pact-net

ben.kaiser
2021-08-13 17:47
has joined #pact-net

johnathan.gilday
2021-08-13 20:03
@johnathan.gilday has left the channel

dbekman
2021-08-13 20:51
has joined #pact-net

sadikshahidain
2021-08-15 03:09
@sadikshahidain has left the channel

chen
2021-08-15 09:34
has joined #pact-net

tom.willmott
2021-08-16 13:47
has joined #pact-net

franklin.lucena89
2021-08-16 16:52
has joined #pact-net

ram.tripathi
2021-08-17 06:33
has joined #pact-net

ricardo.neto
2021-08-17 09:22
has joined #pact-net

andrew.patterson
2021-08-17 14:55
has joined #pact-net

pshah
2021-08-17 15:31
has joined #pact-net

dylanchase26
2021-08-18 04:11
has joined #pact-net

satish.chandra
2021-08-18 05:54
has joined #pact-net

andrew.patterson
2021-08-18 14:28
Hi folks, I was hoping to get contributing to the project but it's hard to figure out what's on the priority list and where to jump in with that. Logical place is `good-first-issue`s but I'm seeing some issues that point to a larger direction shift

github2
2021-08-18 18:48
[pact-foundation/pact-net] Pull request merged by adamrodger

flynnhandley
2021-08-18 22:30
has joined #pact-net

thomaswtsang
2021-08-19 16:53
has joined #pact-net

chris005
2021-08-19 19:07
has joined #pact-net

srimuralixi
2021-08-20 02:18
has joined #pact-net

manika.goel
2021-08-20 05:38
has joined #pact-net

akanksha.sharma
2021-08-20 06:31
has joined #pact-net

jonah
2021-08-20 14:42
has joined #pact-net

tlzhou
2021-08-20 15:02
has joined #pact-net

ramya.sri
2021-08-23 03:52
has joined #pact-net

joseramonrivera21
2021-08-23 08:49
has joined #pact-net

denny.duttig
2021-08-23 10:10
has joined #pact-net

akansha.saraswat3
2021-08-23 10:50
has joined #pact-net

tjones
2021-08-23 11:31
Friends, I've created #libpact_ffi-users - since there's quite a bit of discussion about the rust pact ffi bindings in the different language channels, but the discussions cover quite a bit of the same ground. Please join if this is useful or of interest to you!

tjones
2021-08-23 11:33
Hi AJ! We love contributions! @matt.fellows might know who is best to talk to about the current state of Pact-Net - I think it'll be @pact544 or @yann.courtel above

yann.courtel
2021-08-23 13:43
Hi @andrew.patterson and @tjones, we have a list of issue here: https://github.com/pact-foundation/pact-net/projects/1 that is basically the Kanban for our work. @pact544 has greatly contributed in the refactoring of the lib to integrate the new Rust system and I am working on the messaging support (should hopefully be merged this week). Let us know what you feel like working on in the pact-net-development channel. There is a two big parts that will need to be implemented is the remote server backend and the log support for the provider verification (I think @pact544 will be on it though)

andrew.patterson
2021-08-23 13:45
Thanks, I?ve been reading into rust to better understand the new core. The lack of messaging support is what drove me to ask to contribute, so I?ll have to come up to speed on the other parts. I?ll take a look tonight and see if I can?t find a way to help out

yann.courtel
2021-08-23 13:47
Thank you! There will be 2 PR coming (one currently open) for the messaging support so don't hesitate to look at it.

pact544
2021-08-23 14:07
One good thing to do @andrew.patterson would be to update the example in the README to match the new API in the 4.0.0 branch. That's a good first intro thing for sure

andrew.patterson
2021-08-23 14:32
@yann.courtel is #315 reliant on #309? Meaning, should I review 309 to properly understand 315

andrew.patterson
2021-08-23 14:33
Seems like majority of work is going into the `feature/4.0.0` branch as well

yann.courtel
2021-08-23 15:26
The #315 is a subset of the 309 yes. And indeed, the 4.0.0 is a major version of the pact-net library that will feature the V3 PACT specifications. Still in alpha.

pact544
2021-08-23 15:27
Do we have two PRs to cover the messaging work and they rely on each other? I'm lost

pact544
2021-08-23 15:29
I think one key thing we'll need to do when reviewing the API is make sure it feels consistent between request/response and consumer/provider. It's quite literally been written by two different people so there are likely to be inconsistencies :joy: @yann.courtel @matt.fellows That may not be the best place to start @andrew.patterson

yann.courtel
2021-08-23 15:29
The 309 is a draft and due to the many change on the structure of the lib, the rebase was going to be too difficult. I will split the consumer in the #315 PR and the provider side on a later PR but it will be the same work.

sushant.soni
2021-08-23 21:10
has joined #pact-net

matt.fellows
2021-08-23 23:01
Ah, thanks for looping the team in Tim. I totally thought I had responded to you @andrew.patterson, appreciate you putting your hand up

matt.fellows
2021-08-23 23:01
One thing we can _definitely_ do with help, is re-writing the documentation for the 4.x.x branch

matt.fellows
2021-08-23 23:01
Documentation that follows this https://github.com/pact-foundation/pact-go/tree/2.x.x/ would be a great start

andrew.patterson
2021-08-23 23:11
Happy to help. I've been working through the readme example, using the existing sample consumer/provider in the branch today. Once I update that I'll try to make use of a few of the pact flows and see if I can't plan out some cohesive docs for review. First thing on my hit list would be a `contributing.md` file.

andrew.patterson
2021-08-23 23:11
Since I'm already in the process of getting contributing myself :stuck_out_tongue:

matt.fellows
2021-08-23 23:24
seems like a good starting point Aj

matt.fellows
2021-08-23 23:25
Because the project is in massive flux, low hanging (code) fruit is not necessarily there

matt.fellows
2021-08-23 23:25
I think perhaps a note on the homepage would be apt, i?ll do that today

matt.fellows
2021-08-23 23:25
(i.e. ?4.x.x is in progres, join slack and :wave: if you want to test it out or help out? type thing)

yann.courtel
2021-08-24 06:51
Thank you @andrew.patterson that will be a big plus. Let us know if you need any pointers with the new code (no pun intended)

ajaiswal595
2021-08-24 11:00
has joined #pact-net

matt.fellows
2021-08-24 11:19
@andrew.patterson see also this project https://github.com/pact-foundation/pact-net/projects/1

matt.fellows
2021-08-24 11:19
There is a story there for docs

pd287515778
2021-08-24 12:48
has joined #pact-net

edanielsen
2021-08-24 13:43
@yann.courtel @pact544 @matt.fellows if any of you have time, I've opened a PR here for supporting matchers for headers in the feature/4.0.0 branch as supported by the Rust engine because I selfishly need it :smile: https://github.com/pact-foundation/pact-net/pull/316

pact544
2021-08-24 13:47
Oh sweet

pact544
2021-08-24 13:53
I've reviewed that

edanielsen
2021-08-24 13:54
Thanks, I agree with the comments

matt.fellows
2021-08-24 23:10
Wow, that all happened quickly!

matt.fellows
2021-08-24 23:11
Thanks Adam/Yann for the fast response

edanielsen
2021-08-24 23:22
Yes, very fast and that's much appreciated

edanielsen
2021-08-24 23:23
I'll address the comments today

hwebster
2021-08-25 05:30
has joined #pact-net

hoangvo
2021-08-25 05:43
has joined #pact-net

jobjingjo
2021-08-25 06:20
has joined #pact-net

yann.courtel
2021-08-25 06:52
No problem

sagarsitap596
2021-08-25 14:10
has joined #pact-net

kyle.fischer
2021-08-25 16:31
has joined #pact-net

datasmithadvtech
2021-08-25 19:43
has joined #pact-net

todor.m.kolev
2021-08-25 19:59
has joined #pact-net

sushmitha.amin
2021-08-26 04:31
has joined #pact-net

edanielsen
2021-08-26 06:46
FYI @yann.courtel @pact544 I'm likely to open another PR to add support for the `--request-timeout` parameter to the Rust executable. The problem I'm addressing with that is to not have tests failing while debugging in e.g. Visual Studio. The default value is 5000ms and that is hit very fast (in fact, after exactly 5 seconds :p) It doesn't feel to me like that switch should be part of the DSL, perhaps through `PactVerifierConfig`?

yann.courtel
2021-08-26 07:23
That's a very good idea! On second look, the implementation on the PactVerifier might need a few tweaks. 1. I was thinking the current PactVeriferConfig is actually to handle the console output and should be rename PactVerifierOutput or PactVerifierOutputAdapter (only use is WriteLine anyway). 2. You would then have a PactVerifierConfig which would encapsulate the IList<string> verifierArgs and a PactVerifierConfig that will actually have property such as FilterDescription, Publish, ProviderVersion, etc. (With a Method like GetVerifierArgs() .... that will line up correctly all the arguments for command line) 3. We would have to interface that with an IPactVerifierConfig that could be extended for different interaction model eventually (cough messaging cough). What do you guys think?

yann.courtel
2021-08-26 08:10
Hey @edanielsen, btw I think it would be better to move these discussion in the pact-net-development channel :)

pact544
2021-08-26 09:43
I'm not sure we want to do that. The config object is about specifying the overall config of the run (and I agree with @edanielsen that this is probably where the timeout belongs since it's global). Building up the args is on a per-pact basis though, so I don't think they belong in a config object. I think the current approach is fine

shwetastar98
2021-08-26 12:35
has joined #pact-net

contact
2021-08-26 12:44
has joined #pact-net

malena.cadima
2021-08-26 16:07
has joined #pact-net

pact544
2021-08-26 17:33
@edanielsen I've approved the PR and approved the CI run, but it looks like there are some CI failures. I assume it's because the PactNet.Remote project hasn't implemented the new interface methods, but I've not checked

pact544
2021-08-26 18:15
Yep, it's because the remote project doesn't implement it - you can just add the methods and have them throw `NotImplementedException` like all the other ones in there do

pact544
2021-08-26 19:21
I've closed lots (!) of stale/duplicate issues with some comments. Some of them still seem relevant, but may not actually be issues when using the Rust core instead of Ruby, so we should revisit then.

edanielsen
2021-08-26 23:02
Yep, will do

matt.fellows
2021-08-27 00:27
Amazing - thanks Adam!

matt.fellows
2021-08-27 00:28
I?m thinking the best thing for do now is 1. Get a note on the home page / pinned issue so that the 4.x.x work is visible to newcomes 2. Get a beta release out? (From what Erik tells me, as a http://non.NET native he is able to run, debug and comprehend what the tests are doing - and they are actually usinsg it). That sounds better than a beta to me! 3. Update docs (I know Erik was happy to help)

matt.fellows
2021-08-27 00:28
I think those items are captured here https://github.com/pact-foundation/pact-net/projects/1

matt.fellows
2021-08-27 00:29
What support do you need from me/maintainers?

louis.ss
2021-08-27 01:42
has joined #pact-net

yann.courtel
2021-08-27 08:57
You have some courage to go through all the backlog ^^ Thanks a lot!

pact544
2021-08-27 09:02
The massive hole at the moment that I think is stopping this becoming generally available is the verifier tests. Those are the most likely to go fail, and at the moment they give you no output whatsoever to tell you why they failed. I know work is ongoing to change the FFI to give you like a verifier handle and stuff so you can retrieve the results, but obviously that's not ready yet. I think that's the key area stopping PactNet 4.0 from releasing though. It'd be nice to get messaging support in as well, but in my mind if that has to be a 4.1 then I don't think that's a problem.

pact544
2021-08-27 09:03
I can definitely write a quick blurb for the master README though, probably linked to a pinned issue, explaining the roadmap a bit

yann.courtel
2021-08-27 09:13
I agree with the logging on the provider end... the messaging support is close to done. As soon as the consumer PR is done, I'll add the changes for the provider side of things. Should be done in a couple of (working) days.

yann.courtel
2021-08-27 09:38
Not disagreeing with the granularity here (the timeout being global, the PactVerifierConfig seems a good fit) but still on my previous points: 1. The name still bothers me as when you do the config.WriteLine which to me doesn't sound straight forward. A config runner or another name might be more appropriate. 2. A need of abstraction to avoid having directly the args in the PactVerifier class might be a good approach. We can't be dependable on how we build the arguments but rather have an object for each arguments that will be "fed" from the PactVerifier class (with the proper interface). a. it's illustrated in a way by the unit tests you do for the pact verifier. They only way to test it is to parse the final command by using a CheckArgs. IMHO we would gain in testability doing that. 3. That was a problem I had doing the verifier side of the messaging (I had to change the base path if I recall). To customize the way I was building these args, I had to customize the implementation instead of relying on an abstraction.

yann.courtel
2021-08-27 09:47
Regardless, this will not be the your oncoming PR @edanielsen :slightly_smiling_face: it can be done iteratively.

matt.fellows
2021-08-27 10:15
I don?t see message pact being a blocker to getting a beta out

matt.fellows
2021-08-27 10:16
I?m talking about getting it in the hands of users now to get feedback and shake things out

matt.fellows
2021-08-27 10:16
Message pact can still be in the first 4.0.0 main release

matt.fellows
2021-08-27 10:17
As for verifier logs, I thought I heard you saying that, but I saw Erik running provider verifications with Pact .NET just fine the other day - is it an issue that only exists on Windows or something? (I think he was on a Mac when he showed me, because I asked him about that problem)

matt.fellows
2021-08-27 10:17
Unless we?re talking about different output (I?m referring to the verification errors e.g. mismatched status codes, body etc.)?

matt.fellows
2021-08-27 10:18
What gives me confidence in doing a beta, is that Erik - somebody that has never worked in .NET ever - was able to not only get an example going with your unreleased package, but create a workshop and run it with a client!

matt.fellows
2021-08-27 10:19
Awesome, thanks for that (and what Yann said). Some https://github.com/pact-foundation/pact-net/issues/253 in there :laughing:

pact544
2021-08-27 10:22
How did you run the verifier tests and which test framework was it? If you run them inside Visual Studio and/or use xUnit (which is the most popular test framework) then you'll get no verifier output at all

yann.courtel
2021-08-27 10:27
@matt.fellows Indeed, that would be nice to know.

yann.courtel
2021-08-27 10:28
I guess we will need to follow your workshop @edanielsen :)

matt.fellows
2021-08-27 10:28
I?ll need Erik to explain. @edanielsen I tried finding a screenshot, but I think you might have just shown me the output when we were on a call together


matt.fellows
2021-08-27 10:29
And he also started building a new one for consistency with our other Pact workshops here: https://github.com/DiUS/pact-workshop-dotnet-core-v3


matt.fellows
2021-08-27 10:30
(I seem to recall that output collector problem being a thing with the previous version too)

yann.courtel
2021-08-27 10:30
We will need to test that yes

pact544
2021-08-27 10:32
The output wasn't a problem with the Ruby version because we just launched an external process and captured stdout from it, then used a crude internal logging mechanism to write it

yann.courtel
2021-08-27 10:32
The only difference it appears is that we don't actually run an instance of the service

pact544
2021-08-27 10:34
I don't think that'll produce output in an IDE but it might if you run it on the command line (although it'll probably be interleaved if you run multiple provider tests in parallel)

matt.fellows
2021-08-27 10:34
excuse my ignorance, but why does output work in the CLI but not the IDE?

matt.fellows
2021-08-27 10:35
I?m also very conscious that that?s the main user behaviour, and so should very much be both supported, and a slick experience

yann.courtel
2021-08-27 10:35
I think, that's what we are looking for

matt.fellows
2021-08-27 10:36
Sorry, I mean to say, why would we get output when running `dotnet test` in a terminal, but not the equivalent command in the IDE?

matt.fellows
2021-08-27 10:39
```~/development/public/pactflow-example-consumer-java-junit ~/development/public/example-provider-js-sns ~/development/public/example-consumer-js-sns ? tests git:(master) ? dotnet test <aws:pact-prod> Determining projects to restore... All projects are up-to-date for restore. provider -> /Users/matthewfellows/development/public/pact-workshop-dotnet-core-v3/Provider/src/bin/Debug/netcoreapp3.1/provider.dll tests -> /Users/matthewfellows/development/public/pact-workshop-dotnet-core-v3/Provider/tests/bin/Debug/net5.0/tests.dll Test run for /Users/matthewfellows/development/public/pact-workshop-dotnet-core-v3/Provider/tests/bin/Debug/net5.0/tests.dll (.NETCoreApp,Version=v5.0) Microsoft (R) Test Execution Command Line Tool Version 16.11.0 Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... A total of 1 test files matched the specified pattern. Verifying a pact between ApiClient and ProductService Given product with ID 10 exists Given products exist A valid request for a product returns a response which has status code 200 (FAILED) includes headers "Content-Type" with value "application/json; charset=utf-8" (FAILED) has a matching body (FAILED) A valid request for all products returns a response which has status code 200 (OK) includes headers "Content-Type" with value "application/json; charset=utf-8" (OK) has a matching body (OK) Failures: 1) Verifying a pact between ApiClient and ProductService Given product with ID 10 exists - A valid request for a product returns a response which 1.1) has a matching body / -> Expected body Present(65 bytes) but was empty 1.2) has status code 200 expected 200 but was 404 1.3) includes header 'Content-Type' with value '"application/json; charset=utf-8"' Expected header 'Content-Type' to have value '"application/json; charset=utf-8"' but was '' There were 1 pact failures```

matt.fellows
2021-08-27 10:39
(just ran the workshop, can?t believe it worked first go!)

matt.fellows
2021-08-27 10:40
that?s through the terminal, I don?t have VS unfortunately

matt.fellows
2021-08-27 10:42
wow, can?t believe how easy it was to run that via VS code (and yes, no logs): ```----- Running test(s) in context "Provider/tests/ProductTest.cs(20,19)" ----- Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Copyright (C) Microsoft Corporation. All rights reserved. provider -> /Users/matthewfellows/development/public/pact-workshop-dotnet-core-v3/Provider/src/bin/Debug/netcoreapp3.1/provider.dll tests -> /Users/matthewfellows/development/public/pact-workshop-dotnet-core-v3/Provider/tests/bin/Debug/net5.0/tests.dll Build succeeded. 0 Warning(s) 0 Error(s) Time Elapsed 00:00:01.60 [http://xUnit.net 00:00:00.00] http://xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 5.0.9) [http://xUnit.net 00:00:00.84] Discovering: tests [http://xUnit.net 00:00:00.89] Discovered: tests [http://xUnit.net 00:00:00.00] http://xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 5.0.9) [http://xUnit.net 00:00:00.68] Starting: tests [http://xUnit.net 00:00:02.55] tests.ProductTest.EnsureProviderApiHonoursPactWithConsumer [FAIL] [http://xUnit.net 00:00:02.56] PactNet.PactFailureException : The verification process failed, see output for errors [http://xUnit.net 00:00:02.56] Stack Trace: [http://xUnit.net 00:00:02.56] /Users/erikdanielsen/work/dius/pact-net/src/PactNet.Native/NativePactVerifier.cs(34,0): at PactNet.Native.NativePactVerifier.Verify(String args) [http://xUnit.net 00:00:02.56] /Users/erikdanielsen/work/dius/pact-net/src/PactNet.Native/PactVerifier.cs(240,0): at PactNet.Native.PactVerifier.Verify() [http://xUnit.net 00:00:02.56] /Users/matthewfellows/development/public/pact-workshop-dotnet-core-v3/Provider/tests/ProductTest.cs(46,0): at tests.ProductTest.EnsureProviderApiHonoursPactWithConsumer() [http://xUnit.net 00:00:02.56] Output: [http://xUnit.net 00:00:02.56] Invoking the pact verifier with args: [http://xUnit.net 00:00:02.56] --file [http://xUnit.net 00:00:02.56] /Users/matthewfellows/development/public/pact-workshop-dotnet-core-v3/pacts/ApiClient-ProductService.json [http://xUnit.net 00:00:02.56] --state-change-url [http://xUnit.net 00:00:02.56] http://127.0.0.1:9001/provider-states [http://xUnit.net 00:00:02.56] --provider-name [http://xUnit.net 00:00:02.56] ProductService [http://xUnit.net 00:00:02.56] --hostname [http://xUnit.net 00:00:02.56] 127.0.0.1 [http://xUnit.net 00:00:02.56] --port [http://xUnit.net 00:00:02.56] 9001 [http://xUnit.net 00:00:02.56] --filter-consumer [http://xUnit.net 00:00:02.56] ApiClient [http://xUnit.net 00:00:02.56] --loglevel [http://xUnit.net 00:00:02.56] trace [http://xUnit.net 00:00:02.58] Finished: tests ----- Test Execution Summary ----- tests.ProductTest.EnsureProviderApiHonoursPactWithConsumer: Outcome: Failed Error Message: PactNet.PactFailureException : The verification process failed, see output for errors Stack Trace: at PactNet.Native.NativePactVerifier.Verify(String args) in /Users/erikdanielsen/work/dius/pact-net/src/PactNet.Native/NativePactVerifier.cs:line 34 at PactNet.Native.PactVerifier.Verify() in /Users/erikdanielsen/work/dius/pact-net/src/PactNet.Native/PactVerifier.cs:line 240 at tests.ProductTest.EnsureProviderApiHonoursPactWithConsumer() in /Users/matthewfellows/development/public/pact-workshop-dotnet-core-v3/Provider/tests/ProductTest.cs:line 46 Standard Output Messages: Invoking the pact verifier with args: --file /Users/matthewfellows/development/public/pact-workshop-dotnet-core-v3/pacts/ApiClient-ProductService.json --state-change-url http://127.0.0.1:9001/provider-states --provider-name ProductService --hostname 127.0.0.1 --port 9001 --filter-consumer ApiClient --loglevel trace Total tests: 1. Passed: 0. Failed: 1. Skipped: 0```

matt.fellows
2021-08-27 10:43
So I know it?s probably not a palatable first position, but could we just indicate in those logs that running in the terminal will give them output?

matt.fellows
2021-08-27 10:43
I?ll work with Ron to prioritise the log fixing for the verifier

pact544
2021-08-27 10:44
The Rust core is writing directly to stdout, which your terminal will pick up. Effectively it's going round the test framework. That means if two tests run in parallel, their output will be interleaved. When running in an IDE there is no stdout so the Rust core has nowhere to write to.

matt.fellows
2021-08-27 10:45
right that makes total sense, because you?ve only told me 10x that xunit doesn?t capture stdout :laughing:

matt.fellows
2021-08-27 10:45
BUT NOW it has sunk in

pact544
2021-08-27 10:45
To make it work properly in an IDE, each test would need a unique stdout so that Rust would have somewhere to write to and then the test framework could out the correct output in the correct test result, but it doesn't :joy:

pact544
2021-08-27 10:46
However, if we have independent output per invocation ourselves, we can redirect the output to the correct test output and we're all good. That's why consumer tests now give output

matt.fellows
2021-08-27 10:46
yeah, that?s the plan I think

matt.fellows
2021-08-27 10:46
I mean, on the provider side, it?s probably going to be a rare situation where you have multiple provider verifications happening at once - but I guess still possible

matt.fellows
2021-08-27 10:47
and because I said that, the first user will probably be some monorepo (:face_vomiting: ) user and ask for it

pact544
2021-08-27 10:47
Yep, thought so :+1: At the moment all those `println!` style statements are just direct to stdout though (with ANSI colour codes as well :open_mouth:)

pact544
2021-08-27 10:47
We run multiple provider tests at the same time every run :+1:

matt.fellows
2021-08-27 10:48
:facepalm:

mike.geeves064
2021-08-27 11:54
Hang on, there's a logger

mike.geeves064
2021-08-27 11:54
Or have I misunderstood?

matt.fellows
2021-08-27 11:55
no, but that?s the plan - properly extract the output from the verifier and make the log information extractable by the consuming framework (so you can do with it as you please)

mike.geeves064
2021-08-27 11:56
I haven't tried the actual verifier yet, but for other calls the logger is working ok, from python I'm doing this: > PactFFI.lib = self._load_ffi_library(PactFFI.ffi) > > # Setup logging to a file in the output_dir > PactFFI.output_file = os.path.join(PactFFI.output_dir.name, "output") > output_c = self.ffi.new("char[]", bytes(self.output_file, "utf-8")) > > # By default, we get TRACE logs, set to INFO for now > result = self.lib.pactffi_log_to_file(output_c, LogLevel.INFO.value)

mike.geeves064
2021-08-27 11:56
and then I get the what was otherwise stdout in a file

mike.geeves064
2021-08-27 11:56
Or is the problem that the logger isn't setup for other areas fully?

mike.geeves064
2021-08-27 12:49
As in, do you mean if there is a pact type fail, as in broken contract, or not getting any output? I don't have any actually working examples yet, but for example if I do this: > def test_verify_simple(): > verifier = Verifier() > args_list = [ > "--broker-url=http://localhost:9292", > "--publish", > "--url=http://localhost:8080", > "--provider-name=provider-chalice", > "--provider-version=0.0.1", > "--provider-tags=tag" > "--file=/home/mgeeves/dev/GitHub/pact-python/pacts/pact-consumer-two-pact-provider-chalice.json", > ] > args = "\n".join(args_list) > result = verifier.verify(args=args) > logs = result.logs ... so a set of hopefully valid args, if there was a working broker and provider, I get back > logs = ["[ERROR][pact_verifier] Failed to load pact - \x1b[31mFailed to load pact 'http://localhost:8080' - Request failed - error sending request for url (http://localhost:8080/): error trying to connect: tcp connect error: Connection refused (os error 111)\x1b[0m\n", "[ERROR][pact_verifier] Failed to load pact - \x1b[31mCould not load pacts from the pact broker 'http://localhost:9292' - Link/Resource was not found - No pacts for provider 'provider-chalice' where found in the pact broker. URL: 'http://localhost:9292'\x1b[0m\n"]

mike.geeves064
2021-08-27 12:49
(via the ffi call to setup up logging to a file, and then extracting the results)

pact544
2021-08-27 12:53
That requires write access to the filesystem though, and an assumption that each provider run writes to a different, predictable file name. Then you've got to read the data off the disk even if the test fails, which sounds altogether pretty brittle

pact544
2021-08-27 12:53
We run our provider tests in Docker, where read only filesystems are pretty popular

mike.geeves064
2021-08-27 12:54
nod

mike.geeves064
2021-08-27 12:54
there's a log to buffer as well, which is probably preferable

pact544
2021-08-27 12:54
Yeah I think that's the plan :+1:

mike.geeves064
2021-08-27 12:54
I ended up currently using the file option because I was having problems trying to setup the logger more than once

mike.geeves064
2021-08-27 13:02
That works for me as well as far as I can see, although my tests break for reasons now: > [ERROR][pact_verifier] Failed to load pact - [31mFailed to load pact 'http://localhost:8080' - Request failed - error sending request for url (http://localhost:8080/): error trying to connect: tcp connect error: Connection refused (os error 111)[0m > [ERROR][pact_verifier::pact_broker] Failed to push tag tag--file=/home/mgeeves/dev/GitHub/pact-python/pacts/pact-consumer-two-pact-provider-chalice.json for provider version 0.0.1 > [ERROR][pact_verifier] Publishing of verification results failed with an error: Error with the content of a HAL resource - Request to pact broker URL 'http://localhost:9292/pacticipants/pact-provider-chalice/versions/0.0.1/tags/tag--file=/home/mgeeves/dev/GitHub/pact-python/pacts/pact-consumer-two-pact-provider-chalice.json' failed - HTTP status client error (404 Not Found) for url (http://localhost:9292/pacticipants/pact-provider-chalice/versions/0.0.1/tags/tag--file=/home/mgeeves/dev/GitHub/pact-python/pacts/pact-consumer-two-pact-provider-chalice.json) Just need the call to setup: https://docs.rs/pact_ffi/0.0.2/pact_ffi/log/fn.pactffi_log_to_buffer.html And then the call to retrieve: https://docs.rs/pact_ffi/0.0.2/pact_ffi/log/fn.pactffi_fetch_log_buffer.html

yann.courtel
2021-08-27 13:16
Something tells me, it's not pact related ^^

sergio.amorim
2021-08-27 14:40
has joined #pact-net

andrew.patterson
2021-08-27 15:36
I'm working through docs to move towards the pact-go repository style. Shouldn't be too long before I can open up a PR on the README at least. Will have more time to work on it over the weekend.

matt.fellows
2021-08-27 22:39
Amazing, thank you!

matt.fellows
2021-08-27 22:40
I'll see if I can add you to the project tracking board later today

matt.fellows
2021-08-27 22:41
I need to look at this on my next OSS day

matt.fellows
2021-08-27 22:42
But this only works currently on the consumer side, the provider isn't compatible with that way yet

matt.fellows
2021-08-27 22:46
Mike, I think the problem is that the argument name and value need to be on separate lines

mike.geeves064
2021-08-28 07:26
Args on several lines is done and working ok for me :) Matt: you mean on the rust side the logger work isn't done? I wasn't sure if this was a similar problem to the oneI had, where when trying to run the multiple tests from an IDE caused problems because you can only setup the logger once (as per conv last week) / hadn't found the logger functionality :thinking_face:

pact544
2021-08-28 07:39
Yeah we use the consumer buffer logger on the .Net side and it works perfectly :+1:

mike.geeves064
2021-08-28 07:39
:+1:

pact544
2021-08-28 07:40
The output is quite dense and technical because it's got all the Rust internals and stuff though. Dunno whether to try and do something on our side to try to clean it up, or whether that's too brittle and maybe suggest some changes on the Rust side instead

pact544
2021-08-28 07:42
I've got a half formed idea about trying to present a more user friendly output in normal circumstances, but perhaps with a flag to give you the raw logs in case we need to debug issues. Dunno, like I say only half formed :joy:

mike.geeves064
2021-08-28 07:47
It looked like there were two representations coming back, the stdout style but also a sort of dict or JSON style, I was wondering the most robust way to split it out to then be able to use the JSON style to log

mike.geeves064
2021-08-28 07:49
Although I can't see it in the example output I pasted, I'm sure I didn't imagine it :thinking_face:

pact544
2021-08-28 08:12
Yeah I've definitely seen that as well. I think maybe you only get that if it fails?

mike.geeves064
2021-08-28 08:25
Not sure if that would be a nicer structure in general for people to work with? Probably more of a conversation for #libpact_ffi-users

slin
2021-08-29 23:51
has joined #pact-net

shane.robinson
2021-08-30 00:30
has joined #pact-net

br.maher
2021-08-30 04:35
has joined #pact-net

pact544
2021-08-30 07:56
Congrats @yann.courtel :tada::rainbow::sunglasses:

pact544
2021-08-30 07:57
I'll have a quick look at the tests locally to see if we can exercise that async bit a bit more, but I didn't think that was worth holding up the PR for.

matt.fellows
2021-08-30 08:01
Seriously awesome work to the both of you :clap: . It?s been great watching all of the commentary, the passion, and the professional feedback

matt.fellows
2021-08-30 08:01
:taco: :taco: :taco: @pact544

matt.fellows
2021-08-30 08:01
:taco: :taco: :taco: @yann.courtel

yann.courtel
2021-08-30 09:18
Thanks a lot @pact544 fore your availability on the PR! (on a Saturday, no less). I'll push on another branch the provider part. Don't worry too much about the Unit tests part, I think we should convey on another PR to improve the overall quality of the UT / IT / Sample app. I think the logging console on the provider part should be an absolute priority (well, other than the messaging provider ^^)

andrew.patterson
2021-08-30 14:26
This seems to be giving me a merge conflict on the sln file, but I don't see what's actually causing the problem. Regardless, feedback should be quicker to iterate on :slightly_smiling_face: Had some trouble getting the sample proj working - XUnit and http://ASP.NET are not my usual frameworks :sweat_smile:

andrew.patterson
2021-08-30 15:55
Resolved the conflict, ready for review!

kwongyun
2021-08-30 15:57
has joined #pact-net

andrew.patterson
2021-08-30 19:46
I've noticed the repository is very Visual Studio-centric and the primary example tests are in XUnit. I know both are popular, but may be good to include an NUnit sample. Would also selfishly like a .vscode folder :stuck_out_tongue:

0x06065a
2021-08-31 00:02
has joined #pact-net

matt.thomas
2021-08-31 05:29
has joined #pact-net

matt.thomas
2021-08-31 05:36
Not sure if this is the right place to ask this, but... The existing https://github.com/pact-foundation/pact-workshop-dotnet-core-v1 is an extremely helpful project for learning how to use Pact for _REST HTTP_ integration points, but I can't seem to find any useful example projects for _Message Brokering/Queuing_ integration points. Does anyone here happen to know where I can download a working example example of Pact contract testing between a Consumer and Provider that uses _message brokering/queuing_? Ideally a C# project using RabbitMQ (using NServiceBus would we super awesome), but any project using a message queue would still be a useful start for me.

matt.fellows
2021-08-31 06:51
Hi :wave:! So Yann and Adam have been doing some awesome work, and Pact .NET almost supports pact message (that would be how you test RabbitMQ etc.). You can see the branch here: https://github.com/pact-foundation/pact-net/tree/feature/4.0.0

matt.fellows
2021-08-31 06:52
(some documentation is on the way, see https://github.com/pact-foundation/pact-net/pulls for incoming things)

matt.fellows
2021-08-31 06:52
This workshop has updated examples for the new API: https://github.com/DiUS/pact-workshop-dotnet-core-v3/ (but pact message is not included)

matt.fellows
2021-08-31 06:53
We don?t actually have a workshop for Pact Message in any language, but we do have a number of examples here: https://docs.pactflow.io/docs/examples


matt.fellows
2021-08-31 06:55
The consumer support was just added to Pact .NET and provider message support is probably not too far away. Hopefully that should be a starting point, but no doubt Yann will be able to give you better insight into the .NET specifics (I?m one of the core maintainers, but don?t ?speak? .NET)

yann.courtel
2021-08-31 07:09
Thanks @edanielsen and @pact544

abhi.nandan964
2021-08-31 10:19
has joined #pact-net

edanielsen
2021-08-31 13:08
Thank you for merging it, it means this will make its' way into the http://Pact.Net worksop to bring it closer to the JS workshop (https://github.com/pact-foundation/pact-workshop-js)

shivi.btech08
2021-08-31 21:03
has joined #pact-net

kpuengpanich
2021-09-01 07:14
has joined #pact-net

mhmtyuceoz
2021-09-01 07:35
has joined #pact-net

matt.thomas
2021-09-01 22:15
@matt.fellows Ok great thank you for the links and details about Pact Messaging not being available yet. I'm looking forward to pulling down PactNet 4.0 when it is completed and merged as well as see the example project(s) that gets created to showcase Pact messages. Also, you mentioned looking at the DiUS pact-workshop at: https://github.com/DiUS/pact-workshop-dotnet-core-v3 What is the main difference of that compared to the existing pact-foundation pact-workshop here?: https://github.com/pact-foundation/pact-workshop-dotnet-core-v1

matt.fellows
2021-09-01 22:55
the new one follows a consistent format with other language formats, and (IMO) is a much more useful and relatable. It also covers most of the common uses of Pact, not just a basic one It also uses the new 4.x.x branch of Pact .NET (that uses the rust core, supports v3, message pact etc.) and not the current stable

josh.mccure
2021-09-01 23:22
has joined #pact-net

volkan.tufekci
2021-09-02 08:47
has joined #pact-net

yassine
2021-09-02 10:59
has joined #pact-net

connor.beck
2021-09-02 13:39
has joined #pact-net

maurits.out
2021-09-02 15:12
has joined #pact-net

kumasaka.tk
2021-09-02 21:24
has joined #pact-net

valeriia.danylenko
2021-09-03 18:26
has joined #pact-net

irmt06
2021-09-04 22:51
has joined #pact-net

matt.fellows
2021-09-06 00:54
:taco: for @andrew.patterson - thanks for your documentation https://github.com/pact-foundation/pact-net/pull/318

edanielsen
2021-09-06 11:48
Starting to look good! :slightly_smiling_face:

divyalakshmi.gk
2021-09-07 01:46
has joined #pact-net

constantin.jaeck
2021-09-07 02:24
has joined #pact-net

narendra_uppara
2021-09-07 07:17
has joined #pact-net

nikuplanchiwar
2021-09-07 08:03
has joined #pact-net

sdomeracki
2021-09-07 10:22
has joined #pact-net

gibraltor999
2021-09-07 12:03
has joined #pact-net

norway.martin
2021-09-07 18:38
has joined #pact-net

norway.martin
2021-09-07 19:49
Hi! I'm trying to test out 4.0.0-4386091 and I am getting a failure back from `NativeInterop.Verify(args);` `The verification process failed, see output for errors` All I see in the output is `Invoking the pact verifier with args:` and then my args. There are no other error messages. Is there a way I can get more info about why it is failing?

andrew.patterson
2021-09-07 19:57
Hi Martin, can I ask if you're using Visual Studio or VSCode? Also, what outputters have you set up for the pact config?

norway.martin
2021-09-07 20:05
I'm using Visual Studio 2019 and Nunit. So no custom outputter

andrew.patterson
2021-09-07 20:10
Hmm, in that case it should just be outputting to console. Typically I've been able to resolve this with the debugger, as debug console did show output details

matt.fellows
2021-09-07 22:14
You need to run via the CLI at the moment as output is sent to standard out

matt.fellows
2021-09-07 22:14
I thought that was documented somewhere but if not we should do that ASAP

matt.fellows
2021-09-07 22:15
VS code doesn't capture it

abatan.k
2021-09-08 02:01
Hello all :slightly_smiling_face: i switched my node backend to F# in order to get a proper type system :sweat_smile: I see on the doc that http://pact.net uses v2 of Pact, but the readme also mention V4 of pact, so im little bit confuse :sweat_smile: I know that http://pact.net v4 is available on feature/v4.0.0, but can i use it already since i already implemented all the logic for pact with my nodeJS project (i just need to "translate" from typescript to F#)

matt.fellows
2021-09-08 02:29
don?t confuse the Pact _specification_ for the library _version_

matt.fellows
2021-09-08 02:29
The current stable Pact .NET supports up to Pact specification v2

matt.fellows
2021-09-08 02:30
there is a 4.x.x version that supports specification v3

matt.fellows
2021-09-08 02:30
the library version is independent of the pact specification

matt.fellows
2021-09-08 02:30
(albeit historically, it just so happens that .NET has been in alignment with the spec)

abatan.k
2021-09-08 03:13
ok thx for the info @matt.fellows i will try to use the v4 version of the http://pact.net then, since im already using the v3 specification of Pact with my nodejs backend.


matt.fellows
2021-09-08 03:36
it will be fixed, but just be aware

edanielsen
2021-09-08 06:13
Hi @norway.martin, as @matt.fellows says you'll get the best output from running the test via CLI (`dotnet test`). I found that I could get some output within Visual Studio but ended up running tests in Visual Studio mostly when debugging. This is being worked on by the way.

adamdullenty
2021-09-08 08:23
has joined #pact-net

martin.a.harkins
2021-09-08 12:15
has joined #pact-net

norway.martin
2021-09-08 14:31
I did run it as `dotnet test` as well, but that di not show any additional output. And I believe this is documented about the output, but maybe it is something with Nunit...

norway.martin
2021-09-08 14:39
FYI, I was finally able to get the debugger to find the code error. It's a mocking issue, Currently working through that.

pact544
2021-09-08 15:32
Yeah we have an open issue about that in the project :+1: Currently the verifier gives you no output if the test fails until the Rust core library supports logging to somewhere other than stdout

abatan.k
2021-09-08 16:12
yeah i saw the previous discussion on this channel about this, but i always run pact from the CLI :slightly_smiling_face:

rocco.smit
2021-09-09 06:20
has joined #pact-net

andrei_mironau
2021-09-09 10:00
has joined #pact-net

febin.sathar
2021-09-09 10:17
has joined #pact-net

jcaromiq
2021-09-09 11:47
has joined #pact-net

mirko.zipris
2021-09-09 20:08
has joined #pact-net

dotelnp
2021-09-10 06:48
has joined #pact-net

volkan.tufekci
2021-09-10 11:24
@volkan.tufekci has left the channel

sameer.patil
2021-09-10 18:42
has joined #pact-net

b.1.alpha
2021-09-10 19:17
has joined #pact-net

naushad_amin
2021-09-11 23:15
has joined #pact-net

jose_rodriguez
2021-09-13 13:16
has joined #pact-net

kyle_evans
2021-09-13 13:16
has joined #pact-net

rahul.louis
2021-09-13 15:55
has joined #pact-net

a.koka
2021-09-13 17:01
has joined #pact-net

efloresambrosio
2021-09-13 20:09
has joined #pact-net

olle_hallin
2021-09-14 05:50
has joined #pact-net

a.babenko
2021-09-14 14:00
has joined #pact-net

vasavi.balanagu
2021-09-14 16:49
has joined #pact-net

norway.martin
2021-09-14 20:13
How do I publish new pacts using 4.0.0? I don't see any options for connecting to a Pact Broker/Pactflow.

samuel.sjoberg
2021-09-14 21:49
has joined #pact-net

matt.fellows
2021-09-14 22:05
You should download and use the pact CLI tools

matt.fellows
2021-09-14 22:05
(or use the docker container)

domingo
2021-09-14 23:51
has joined #pact-net

pradeepkumarstudent20
2021-09-15 03:32
has joined #pact-net

norway.martin
2021-09-15 14:44
So I have to save the pact as a file and then push that up? There is no way to just push it up directly?

bryan
2021-09-15 15:16
has joined #pact-net

dboxler
2021-09-15 18:35
has joined #pact-net

abatan.k
2021-09-15 22:06
hello all :slightly_smiling_face: which test framework are you using for _*UNIT*_ testing in .NET world ? (what i mean by _*unit*_, is behavior testing, with in-memory implementation / adapter) I tend to go with Nunit, since from what i see, is a port from Junit

keerthisiv
2021-09-16 03:59
has joined #pact-net

adelina.simion
2021-09-16 08:41
has joined #pact-net

akke.luukkonen
2021-09-16 10:29
has joined #pact-net

alejandro.pena
2021-09-16 13:37
has joined #pact-net

andrew.patterson
2021-09-16 13:43
All of our samples are written in XUnit but I also personally prefer NUnit

fnguyen
2021-09-16 14:03
We used to use nunit but are now using xunit.

abatan.k
2021-09-17 00:40
Thx for the answer, i decided to go with https://fluentassertions.com/ which is way better documented than xUnit, which is a shame that no documentation exist for this tool (and when you see the response of maintainers, you guess that they don't care about comunity...)

bbleach
2021-09-17 07:30
has joined #pact-net

andrew.patterson
2021-09-17 13:59
Fluent Assertions is a fantastic assertion library. I typically use NUnit for test framework and Fluent for the actual assertions

yann.courtel
2021-09-20 09:29
@pact544 PR looks good to me. Agree with Matt for the inline and it's good to go :)

aftab.shamim2020
2021-09-20 12:02
#pact-net Hello, can we write contract testing for background kafka service in .net if yes, give me some idea.

rushideshpandes
2021-09-20 13:11
has joined #pact-net

gemhar
2021-09-20 14:33
has joined #pact-net

jsegall
2021-09-20 21:37
has joined #pact-net

dalkire
2021-09-21 13:30
has joined #pact-net

hakan.celebi
2021-09-21 19:43
has joined #pact-net

nrobison
2021-09-22 15:39
has joined #pact-net

calise
2021-09-22 17:06
has joined #pact-net

gemhar
2021-09-23 03:50
@gemhar has left the channel

nareshnavinash
2021-09-23 09:28
has joined #pact-net

radu.simu
2021-09-23 09:38
has joined #pact-net

aterrong
2021-09-23 09:42
has joined #pact-net

nisharaveendran30
2021-09-23 10:34
has joined #pact-net

sujithsukumaranm
2021-09-23 10:36
has joined #pact-net

sureshbabudevaki
2021-09-23 12:01
has joined #pact-net

greg.hinsley
2021-09-23 12:29
has joined #pact-net

nyman.robin
2021-09-24 07:07
has joined #pact-net

ricardo.paquito
2021-09-24 10:36
has joined #pact-net

ricardo.paquito
2021-09-24 10:59
Hello, I'm using pactflow broker for a dotnet project. When executing the provider tests, the mock server failed to start but the test execution step was successful with a warning. Also the can I deploy step also was successfull and at this time I cannot say if this is the expected behavior. Can I get some feedback on this?

matt.fellows
2021-09-24 11:06
So there is no mock server on the provider side. That's your provider API/server that's not started

matt.fellows
2021-09-24 11:07
Secondly, because you have pending pacts enabled, and you previously have not verified the pact, it doesn't fail the provider test

matt.fellows
2021-09-24 11:07
It will still send the failures back to the pact broker and the contract will be broken, but t doesn't break your build


matt.fellows
2021-09-24 11:10
I would need to see the matrix to know if can-i-deploy should be passing or not

ricardo.paquito
2021-09-24 11:11
Thanks for the expalantion @matt.fellows

ricardo.paquito
2021-09-24 11:12
Yes... not the mock server... but the actual provider service :smile:

abramenkov.valentin
2021-09-24 12:42
has joined #pact-net

leo.tang
2021-09-24 17:56
has joined #pact-net

jyotiguptaofficial
2021-09-25 13:00
has joined #pact-net

mattandaey
2021-09-25 20:32
has joined #pact-net

saurelio58
2021-09-27 12:39
has joined #pact-net

francisco
2021-09-27 18:27
has joined #pact-net

jamesatroughton
2021-09-28 10:42
has joined #pact-net

jake.thacker
2021-09-28 22:06
has joined #pact-net

craig.schwarzwald
2021-09-28 22:37
has joined #pact-net

owain.hunt
2021-09-29 12:58
has joined #pact-net

damtsisa
2021-09-30 06:58
has joined #pact-net

morsisdivine
2021-09-30 09:23
has joined #pact-net

patrice.jy.thomas
2021-09-30 15:05
has joined #pact-net

kschendster
2021-09-30 16:46
has joined #pact-net

adam.dubnytskyy
2021-09-30 17:49
has joined #pact-net

stefano.varesi
2021-09-30 17:51
has joined #pact-net

kschendster
2021-09-30 20:03
Hi All, new to Pact

kschendster
2021-09-30 20:08
Question. I am using PacNet 3.0.0. I have my Pact class set up to place the pact files and the log files. When I run my test, I see the log files but not the pact files. I am not using a PactBroker at this time. Here is my code ```public ConsumerPACT() { this.PactBuilder = new PactBuilder(new PactConfig { PactDir = @"..\pacts", LogDir = @"c:\temp\logs" }); this.PactBuilder .ServiceConsumer("Consumer") .HasPactWith("STS Administration"); this.MockProviderService = this.PactBuilder.MockService(this.MockServerPort, false, IPAddress.Any); }``` I have looked for the pacts folder in the bin file and at the project level. I have debugged through and see _PactDir = "..\\pacts\\" Not sure what I'm missing

steven.yi
2021-09-30 20:17
has joined #pact-net


calcorbin
2021-09-30 23:09
has joined #pact-net

osikwemhev
2021-10-01 01:45
has joined #pact-net

kentaro
2021-10-01 10:05
has joined #pact-net

vitali.domashkevitsh
2021-10-01 10:08
has joined #pact-net

seb983
2021-10-01 11:30
has joined #pact-net

vannessa.andrade
2021-10-01 14:44
has joined #pact-net

kschendster
2021-10-01 16:18
@matt.fellows Thanks for your response. Yes, I was using that. Figured out my issue with not getting pacts folder and file. I did not have UseRemoteMockService = true. My test wasn't successfully completing. I found that by looking at the code in GitHub and debugging through to see if that value was true. When I set it to true, the files were created.

mickfagan
2021-10-02 10:36
has joined #pact-net

maxim.matviyuk
2021-10-03 16:48
has joined #pact-net

jonathan.a.stern
2021-10-03 20:38
has joined #pact-net

chris.ramsden
2021-10-04 16:40
has joined #pact-net

fnguyen
2021-10-04 20:12
What is the difference between setting a header in the pact as in ``` "interactions": [ { "description": "blah", "request": { "method": "post", "path": "/api/test", "headers": { "Accept": "application/json", "Content-Type": "text/plain; charset=utf-8", "x-custom-header": "header_value" }, [...]``` and in the config object ``` var config = new PactVerifierConfig { CustomHeaders = new Dictionary<string, string> { { "x-custom-header", "header_value"}, [...] new PactVerifier( config ) [...] .Verify();``` For SOME headers, when I put them in the pact it works but if declared in the config, the test fails. ``` Stack Trace: PactCoreHost`1.Start() PactVerifier.Verify(String description, String providerState)```

fnguyen
2021-10-04 21:21
An additional problem is that if I want the header to be in the pact, i need to add it to the ProviderServiceRequest and doing so gives me a 500 when sending the query to the mock service. So it seems the only way I can get this to work at the moment is to patch the pact file to add headers. Anybody hit the same issue?

brian.fung
2021-10-05 04:57
has joined #pact-net

elekberhacizade
2021-10-05 05:27
has joined #pact-net

yann.courtel
2021-10-05 09:49
Hi everyone. I took in consideration all your comments @pact544 . If anyone want to add something, @matt.fellows, @tjones. Otherwise, we should merge it before other PRs since it's still in beta (need the refacto of the verifier, the console output, etc). Thanks a lot

matt.fellows
2021-10-05 09:57
Looking now Yann

matt.fellows
2021-10-05 09:57
the main feedback i?ll be giving is around the interface. I saw some things there I wasn?t sure about, but also I did it on mobile

matt.fellows
2021-10-05 09:58
my main perspective will be alignment of terminology / experience with other languages

matt.fellows
2021-10-05 09:58
Adam?s feedback is much more useful than my http://non-.NET eyes :eyes:

matt.fellows
2021-10-05 09:58
(also note it was a sort-of public holiday here yesterday/long weekend, so didn?t quite get around to it).

yann.courtel
2021-10-05 11:41
The approach for the naming is extremely similar to the JS (EDIT: sorry, the consumer side :sweat_smile:)

yann.courtel
2021-10-05 11:49
The provider approach is very interesting. It's actually part of the set up of the provider class I thought about it also. Like in our case it would be something like this ```//Act / Assert IPactVerifier pactVerifier = new PactVerifier(config); pactVerifier .MessagingServiceProvider("Event API V3 Message", this.fixture.ServerUri, options.BasePathMessage) .HonoursPactWith("Event API Consumer V3 Message") .FromPactFile(new FileInfo(pactPath)) .WithProviderMessages(Scenarios.Add("my interaction name", () => new List<Event> { new() { /*some properties here*/ } })) .Verify();``` I see why we would do that, but not fan mixing the two concepts.

matt.fellows
2021-10-05 12:19
I think go with what?s most idiomatic for the language

matt.fellows
2021-10-05 12:20
What you wrote looks OK to me

ankit.wadhwana
2021-10-05 12:23
has joined #pact-net

zhaopeng
2021-10-05 12:24
has joined #pact-net

yann.courtel
2021-10-05 13:05
I think with the ongoing PR of Adam that does the refacto of the verifier, we will address the second point.

bjorn.johansson
2021-10-05 13:16
has joined #pact-net

yann.courtel
2021-10-05 13:48
Hey @pact544 I did a review. Some comments but not that much. Nice work to avoid the invalid states.

yann.courtel
2021-10-05 13:56
I finished the PR of Adam. I definitively think we could add it in the configuration of the verifier so we don't have to separate the two methods (verifier configuration and message scenario set up).

pcting
2021-10-05 18:57
has joined #pact-net

pact544
2021-10-05 19:17
@fnguyen The former is setting a header in a consumer test (i.e. adding it to the pact file). The latter is setting a header to add to all calls in the provider test (i.e. when the verifier calls your API).

pact544
2021-10-05 19:21
Yeah that API you've mocked up there with the scenarios added to the verifier is nice I think :thumbsup: It might need adding after the `MessagingServiceProvider` call though otherwise the type state pattern would be pretty tricky to implement. Literally just swapped round to this: ```IPactVerifier pactVerifier = new PactVerifier(config); pactVerifier .MessagingServiceProvider("Event API V3 Message", this.fixture.ServerUri, options.BasePathMessage) .WithProviderMessages(Scenarios.Add("my interaction name", () => new List<Event> { new() { /*some properties here*/ } })) .HonoursPactWith("Event API Consumer V3 Message") .FromPactFile(new FileInfo(pactPath)) .Verify();```

pact544
2021-10-05 19:22
I'm not mad on the whole `Scenarios` object though. If we do that refactor I think it would look nice with just a `params` on there so you can just pass them quite ergonomically (like the JS snippet does) instead of having to wrap them in another object.

pact544
2021-10-05 19:23
I've addressed those and re-requested a review. Thanks :thumbsup:

pact544
2021-10-05 19:25
I guess it would have to be a `params (string name, Func<???> factory)[]`. Not sure what the type would be? `object`? `dynamic`? `string` then we expect them to do the serialisation? Dunno

pcting
2021-10-05 19:26
@pcting has left the channel

pact544
2021-10-05 19:28
Or maybe `IDictionary<string, Func<object>>` like: ```.WithProviderMessages(new Dictionary<string, Func<object>> { ["a dog message"] = () => this.thing.CreateDog })``` I dunno, ha maybe `Scenarios` is OK to fulfil all the different options there (e.g. just giving it an `object` vs a `Func<object>`factory). You'll want async versions as well though (`Func<Task<object>>`)

matt.fellows
2021-10-05 20:47
The current JS interface doesn't support returning metadata (but will), so just consider that also

aulia.ahn
2021-10-06 00:01
has joined #pact-net

muralis
2021-10-06 01:21
has joined #pact-net

yann.courtel
2021-10-06 08:25
No offense taken :slightly_smiling_face: As I've looked at the sample API many times, it ended up not looking super natural to me either to have the scenarios set outside of the verifier configuration... I think the way you separated the different builders for the state pattern might work. It literally has to be sure to return the parent builder after the scenarios are set. I think, I might make it work. Yes, I'm not fan of passing complex object structure like dictionary in parameters of methods or constructor. I think after the refactoring of the verifier is done, we might have some class obsolete on my end but the Scenarios class might still work. I guess that means we will have to merge your PR before mine :smile: I will have to do the rebase again but cannot be help. I'll reloook at your PR this morning so we can merge it asap and work on the new scenario set up.

yann.courtel
2021-10-06 08:27
I think @matt.fellows the problem is exactly the same we had. Setting up a lambda function to return the object alone is not enough. We need to encapsulate it into a more functional object to handle the adding of metadata on the fly :)

lakapoor777
2021-10-06 08:47
has joined #pact-net

matt.fellows
2021-10-06 09:47
Yeah. In go it's a multiple return value function. But I've never been quite comfortable with it

garry.jeromson973
2021-10-06 09:52
has joined #pact-net

yann.courtel
2021-10-06 10:44
hm, yeah I see, I think it's the equivalent of the Tuple in .NET Like public (int count, List<Order> orders) GetPaginatedOrders(......) that would send an object with an int and list any caller would need.

yann.courtel
2021-10-06 10:51
I merged it. The few remaining comments, I'll add it on the ongoing messaging PR. Meanwhile, I need to make the scenarios setup somehow blend into the new verifier state pattern approach.

yann.courtel
2021-10-06 10:52
Alright, verifier refactor done. Now onto the refactoring of the scenario setup ^^


yann.courtel
2021-10-06 11:59
We can close this PR. It's the old one that had everything on it. It's vastly outdated now

yann.courtel
2021-10-06 13:30
```//Act / Assert IPactVerifier pactVerifier = new PactVerifier(config); pactVerifier     .ServiceProvider("Event API V3 Message", this.fixture.ServerUri, options.BasePathMessage)     .HonoursPactWith("Event API Consumer V3 Message")     .FromPactFile(new FileInfo(pactPath))     .WithProviderMessages()     .AddScenario(GetEventImporterScenarios)     .Verify();``` Ok it works with this. Changes have been pushed @pact544 and @matt.fellows The big difference now is that I reverted the approach of having a static class Scenarios. The difference now is that we control the way we set up the scenarios so a clear scenario before we add scenario in the state pattern makes it thread-safe. Let me know if that can be acceptable mostly for mono repo.

fnguyen
2021-10-06 16:24
I think I should set in pact (when running consumer test) for things that don't change, and override from the provider test for things that change like a token that is only valid for a limited time. But when running the provider test, however it is set, the test should run in the same way (except for the warning in the log when overriding the header in the provider test harness) My issue is that for Content-Type it works but for custom headers it does not seem to work in either way; I was only able to make it work by hacking in the pact file. I am trying to make a small repro case.

anagha.sulakhe
2021-10-06 16:27
has joined #pact-net

fnguyen
2021-10-06 23:16
I am using Pact to cdc test an azure function. For the provider test, we run it against the actual deployment of the service. Is there a way to do something similar to OWIN WebApp.Start to do dependency injection and run the provider test against the azure function as part of the test task in azure pipeline BEFORE deployment.

matt.fellows
2021-10-06 23:27
That would be good. With AWS you can run lambda functions locally and they are basically unit testable.

matt.fellows
2021-10-06 23:27
I assume something like that is doable for .NET

akke.luukkonen
2021-10-07 06:25
Have you considered https://docs.microsoft.com/en-us/azure/azure-functions/functions-deployment-slots? That's what I'm currently rigging for our pipelines at the moment. So we do an actual deployment, but to a `test-contract` slot which is the only place where the `SetState` (provider states service endpoint) will be enabled. No normal traffic will ever be routed to said `test-contract` slot so it's safe to deploy even if it would be entirely broken. I was considering running the Function locally on a cloud agent, but because it will anyways be dependent on external resources (e.g. Azure Storage Account) it doesn't give that much benefits in my opinion. Although, I'm happy to hear more ideas on the subject as well.

mesut.gunes
2021-10-07 09:03
has joined #pact-net

yann.courtel
2021-10-07 09:08
Now on to the doc ^^

yann.courtel
2021-10-07 09:08
Thanks again and the last push

pact544
2021-10-07 09:08
Haha brilliant - the PR isn't marked as mergeable because it has "WIP" in the title, except it's related to the "Include WIP Pacts Since..." flag so of course it does

yann.courtel
2021-10-07 09:10
sounds similar to the demo effect...

yann.courtel
2021-10-07 09:35
a quick question and the PR is all good

yann.courtel
2021-10-07 09:37
this PR is good to do. I let you merge it when you want since you have two opened.

pact544
2021-10-07 09:37
Nice one. Yeah the docs show it in ISO short date format and I asked on the mtainers channel also: https://docs.pact.io/pact_broker/advanced_topics/wip_pacts/#technical-details

yann.courtel
2021-10-07 09:38
do you think for the verifier args we need an extension to handle the same format in one method?

yann.courtel
2021-10-07 09:39
or in the AddOption

pact544
2021-10-07 09:39
At the moment that's the only arg which takes a date, and there's no guarantee future ones would even use that format. I'd say refactor later if we actually need it

yann.courtel
2021-10-07 09:39
YAGNI it is

yann.courtel
2021-10-07 09:40
approved

yann.courtel
2021-10-07 12:35
awesome, reviewing it now. I'm going to test it now also to see what doesn't work in windows

matt.fellows
2021-10-08 09:34
It may just be a cert on Adam?s machine, but it?s a good pickup because somebody else will probably also run into it

vandana.bhaskersen
2021-10-08 09:58
has joined #pact-net

ad.redouani
2021-10-09 15:11
has joined #pact-net

amulyadoss
2021-10-09 21:09
has joined #pact-net

farshad.falaki
2021-10-10 19:13
has joined #pact-net

fnguyen
2021-10-11 15:46
Hi Akke How do you enable/disable the setState endpoint? I have the state endpoint enabled in debug target and disabled in release target, but that means we don't deploy the exact same binary we tested on so QA has to believe me when I tell them it's the only difference. Even if protected, I would not want to deploy the setstate which could be seen as a backdoor. My preferred solution would be to test WITHOUT deploying a la OWIN Web.Start

jhopkinwilliams
2021-10-12 02:01
has joined #pact-net

aftab.shamim2020
2021-10-12 05:39
@matt.fellows Hi Team, I am unable to clear interaction in consumer pact test. I am using ClearInteraction() but it is not clear or override. when I am trying to re-run consumer test then previous interaction also come into pact JSON file. Is this possible to override all interaction with new interaction every time when i run consumer test. kindly give solution above issue in .net Thanks.

aftab.shamim2020
2021-10-12 05:49
@pact544 Hi Adam, I am unable to clear interaction in consumer pact test. I am using ClearInteraction() but it is not clear or override. when I am trying to re-run consumer test then previous interaction also come into pact JSON file. Is this possible to override all interaction with new interaction every time when i run consumer test. kindly give solution above issue in .net Thanks. (edited)

matt.fellows
2021-10-12 06:39
`ClearInteraction` doesn?t prevent it from being written to the pact file. What are you trying to do?

matt.fellows
2021-10-12 06:39
(Also please don?t @ people, we are in different timezones and will see the channel when it opens up and respond if we think we can help)

aftab.shamim2020
2021-10-12 06:51
Thanks for reply. Noted I need remove all previous interaction and make a fresh JSON file always when i re-run consumer test.

matt.fellows
2021-10-12 07:39
Please share what you're doing, what library versions etc

matt.fellows
2021-10-12 07:40
Your test setup for eg

akke.luukkonen
2021-10-12 08:06
I have an "sticky" (deployment slot specific) appSetting of `AzureWebJobs.SetState.Disabled = 1` on every other deployment slot than my `test-contract` one. So Azure itself disables the endpoint trigger for me and I can ship the same binary to each slot (after tests pass).

akke.luukkonen
2021-10-12 08:08
Of course it's not as ideal as removing the functionality entirely from the binary. But if someone starts messing with the appSettings in general it's probably anyways gonna break the application in one way or another.

josephhaig
2021-10-12 08:52
has joined #pact-net

margarita.lukjanska
2021-10-12 10:12
has joined #pact-net

margarita.lukjanska
2021-10-12 10:23
Hello! We are considering to start using Pact for Contract testing, but our services are mainly message driven, as far as I understand, the major v.4.0.0. is about to support this use case. I was wondering if there's any nuget package already available for this version so that we could start trialing that already? Thanks in advance! https://docs.pact.io/implementation_guides/net/readme/

matt.fellows
2021-10-12 12:01
I don?t think so just yet, but you should be able to build your own and publish to a local one?

matt.fellows
2021-10-12 12:01
A colleague did create a temporary one for a workshop, i?ll see if we can publish the latest there also

matt.fellows
2021-10-12 12:02
(see https://github.com/DiUS/pact-workshop-dotnet-core-v3/ - it is probably out of date after a number of recent API improvements?

margarita.lukjanska
2021-10-12 13:07
Thanks, I will take a look

oak155online
2021-10-12 14:17
has joined #pact-net

fnguyen
2021-10-12 17:28
Thanks for the hint on the sticky appSetting. I am thinking at wrapping the function app in a web app so it can be tested with OWIN. Not sure how feasible it is. This seems like a good starting point https://dasith.me/2018/01/20/using-azure-functions-httptrigger-as-web-api/

filipovic
2021-10-13 06:51
has joined #pact-net

david.simpson
2021-10-13 07:22
Hi, I'm new to using Pact so I'm working through this https://github.com/DiUS/pact-workshop-dotnet-core-v3/. When running the tests, when initially expecting to see the test fail, they do but the output is not showing the reasons why, as shown in the documentation. Am I doing something wrong or have not specified something correctly?

david.simpson
2021-10-13 07:36
Is it because of dotnet 5.0?

matt.fellows
2021-10-13 08:21
There is an outstanding issue where provider verification logs aren't showing up in IDEs (there's a fix coming)

matt.fellows
2021-10-13 08:21
If you run in a terminal it should work

matt.fellows
2021-10-13 08:22
But it seems on windows not all terminals work (I've been told the git bash works, so it might be any *nix that actually works)


david.simpson
2021-10-13 08:26
Thanks for that, will try another terminal

david.simpson
2021-10-13 08:50
Git Bash hasn't worked for me. I'll carry on and wait for the fix.

matt.fellows
2021-10-13 09:01
Or move to a superior OS? :rolling_on_the_floor_laughing:

stefan.smith
2021-10-13 09:37
has joined #pact-net

samuel.sjoberg
2021-10-13 15:42
@samuel.sjoberg has left the channel

warren
2021-10-13 16:45
has joined #pact-net

michael.stein
2021-10-13 19:02
has joined #pact-net

pact544
2021-10-13 20:42
I wrote a blog post about redesigning the PactNet API for v4 using the typestate pattern: https://adamrodger.com/post/2021-10-13-typestate-pattern-in-csharp

mike.geeves064
2021-10-13 20:48
Interesting :) I hadn't heard of the typestate pattern before :thinking_face:

yann.courtel
2021-10-14 13:17
Love it! way to capitalize it!

hwillj
2021-10-14 14:52
has joined #pact-net

fengniy
2021-10-15 02:09
has joined #pact-net

mark.dathorne
2021-10-15 09:51
has joined #pact-net

haroldlearning93
2021-10-15 14:49
has joined #pact-net

pact544
2021-10-15 19:03
Just so nobody thinks I've gone absolutely mad, we discussed this change ahead of time :slightly_smiling_face:

vsrungar95
2021-10-15 22:14
has joined #pact-net

jsoto128
2021-10-16 20:45
has joined #pact-net

fiszczu
2021-10-17 17:04
has joined #pact-net

brocheleau
2021-10-18 03:23
has joined #pact-net

yann.courtel
2021-10-18 07:23
Hehe, yeah I saw 140 changes, I was like, should be just renaming ^^ it's merged. Good job

yann.courtel
2021-10-18 13:03
So sorry for the size of the PR... @pact544 @matt.fellows It's in part due to the package changes and the reorganization of the sample apps per pact spec version. The point is to move the provider state middleware into the newly created AspNetCore project and using a similar approach as the messaging middleware. Storing the states in memory after configuring them on the provider end to be later executed during the call to the provider states url by the middleware. It supports V2 and V3 functionalities except the injection of variable from the query string. (which will come in the next PR)

andrerc
2021-10-18 22:11
has joined #pact-net

rodolfo.valenzuela
2021-10-19 07:43
has joined #pact-net

kamilyrb
2021-10-19 22:31
has joined #pact-net

joel.whalen588
2021-10-20 20:27
has joined #pact-net

vasil.vasilev
2021-10-21 08:41
has joined #pact-net

ben.crinion
2021-10-21 11:09
has joined #pact-net

estephania.calvo
2021-10-21 19:27
has joined #pact-net

ahmetbcakici
2021-10-21 22:38
has joined #pact-net

matt.fellows
2021-10-22 08:51
How?d you go with this Francois? @kevin.meiresonne might be worth searching this channel (and others) for Azure function

kevin.meiresonne
2021-10-22 08:51
has joined #pact-net

abarcadabra
2021-10-22 12:30
has joined #pact-net

harwin1494
2021-10-22 19:04
has joined #pact-net

anindita.ghosh
2021-10-22 23:26
has joined #pact-net

rajnish.maurya
2021-10-25 06:47
has joined #pact-net

alanbos
2021-10-25 10:11
has joined #pact-net

kuzmanovid
2021-10-25 13:59
has joined #pact-net

j.malyjasiak
2021-10-25 14:24
has joined #pact-net

rtbhosale17
2021-10-25 14:25
has joined #pact-net

stefano.mantini
2021-10-25 14:31
has joined #pact-net

r.muthukumar136
2021-10-25 14:59
has joined #pact-net

gravis54
2021-10-25 21:46
has joined #pact-net

misha.antipenko
2021-10-25 21:57
has joined #pact-net

j.malyjasiak
2021-10-26 06:01
@j.malyjasiak has left the channel

adomanski
2021-10-26 10:43
has joined #pact-net

kriegster108
2021-10-26 14:58
has joined #pact-net

adam.witko
2021-10-27 07:36
has joined #pact-net

alex.macpherson
2021-10-27 08:28
has joined #pact-net

yurich00
2021-10-27 18:10
has joined #pact-net

lincolnf
2021-10-27 23:30
has joined #pact-net

lawrencemajmacdonald
2021-10-28 07:33
has joined #pact-net

zsolt.vilagos
2021-10-28 10:00
has joined #pact-net

zsolt.vilagos
2021-10-28 10:01
@zsolt.vilagos has left the channel

ramesh.dhanasekaran
2021-10-29 02:20
has joined #pact-net

christopher.mcewen
2021-10-29 12:14
has joined #pact-net

catalin.comarnescu
2021-10-29 12:31
has joined #pact-net

kiran.rudrangi
2021-10-29 16:48
has joined #pact-net

ahmed_syed
2021-11-01 20:46
has joined #pact-net

somayajulaas
2021-11-02 00:38
has joined #pact-net

john
2021-11-02 03:32
has joined #pact-net

rochitsen
2021-11-02 10:49
has joined #pact-net

finta.pl
2021-11-02 14:43
has joined #pact-net

alessandro.borraccino
2021-11-02 17:04
has joined #pact-net

rochitsen
2021-11-03 01:28
Hi I am new to pact and trying to use it to write some contract test for our microservice (.net core 3.1). I came across this issue on github and experienced the same: Trying to start the api using http://asp.net TestServer but pact verifier needs a http url to call the actual provider which does not work with TestServer. ```The problem with using WebApplicationFactory is that when you create a client via var client = _factory.CreateClient(), it seems that only that client can access the TestServer - it's not accessible to other clients such as your local browser, or the PactVerifier. Therefore I had to use WebHost.CreateDefaultBuilder() as tdshipley did in his .NET Core sample, so I don't really have any improvements to offer on his sample.``` I created a stackoverflow question - https://stackoverflow.com/questions/69748571/pact-handling-provider-service-state-and-running-actual-provider-with-mocked-o Wanted to know that if there is already an example that shows pact being used with TestServer to start an api? Also how would pact middleware provider-state have access to the db? if its an in memory dbcontext OR an instance of actual db running on local machine / docker. As we would need to add data for a test before running it. Any help in much appreciated.

matt.fellows
2021-11-03 01:29
Do you have to use a testserver?

rochitsen
2021-11-03 02:09
No. Using TestServer will not work anyway i think. As TestServer does not provide communication over http, its all in-memory. PactVerifier needs a serviceUrl (provider). I am open for options.

matt.fellows
2021-11-03 02:10
I do think I?ve seen somebody else use TestServer (probably worth searching the workspace)

rochitsen
2021-11-03 02:11
so what do people use mostly? They start the whole app. eg., If i am running tests for one controller, do i need to start the whole app?

matt.fellows
2021-11-03 02:12
yes, usually that?s the default


rochitsen
2021-11-03 02:14
So that means we need actual db as well? Cannot mock that i think. Then how we manage provider state setting the db?

matt.fellows
2021-11-03 02:15
How would you do it for a unit test?

rochitsen
2021-11-03 02:17
for unit test i believe we set-up an in-memory db. But when we start the real service so pact can access it using http.. not sure how that actual instance will connect to the in-memory db.

matt.fellows
2021-11-03 02:17
why could it not be configured to do that?

matt.fellows
2021-11-03 02:18
I don?t know .NET very well, but every other language I?ve worked with makes it pretty easy to swap dependencies as needed in a test context

matt.fellows
2021-11-03 02:18
The point I?m trying to make is to think about this like you would a unit test (although strictly speaking it?s not a unit test)

rochitsen
2021-11-03 02:19
ok i will check. Thanks a lot Matt. I will check with the devs. I am the test guy :slightly_smiling_face: . I am trying to get contract testing in our org.

matt.fellows
2021-11-03 02:29
np - thanks for advocating for the approach!

rochitsen
2021-11-03 02:33
:thumbsup:

matti.anusha
2021-11-03 02:58
has joined #pact-net

ozgurerisir
2021-11-03 10:30
has joined #pact-net

ozgurerisir
2021-11-03 10:33
Hi All, I've got a small issue in creating the pact file for a passing tests. I can see the log file is created but the contract/pact file does not get created in the specified directory in the configuration class. Any ideas what may be going wrong? See details in Stackoverflow here: https://stackoverflow.com/questions/69566538/pact-net-contract-pact-file-not-created-in-specified-directory-although-test-pa/69583404?noredirect=1#comment123212324_69583404

matt.fellows
2021-11-03 10:34
What does the `pact.log` file say?

ozgurerisir
2021-11-03 10:40
Is this the log file we specify under LogDir? ```PactBuilder = new PactBuilder(new PactConfig {     SpecificationVersion = "1.0.0",     LogDir = @"c:\temp\logs",     PactDir = @"c:\temp\pacts" });```

matt.fellows
2021-11-03 10:46
yep

ozgurerisir
2021-11-03 10:49
No errors in the log file: I, [2021-11-03T10:25:24.421918 #19048] INFO -- : Cleared interactions for example "" I, [2021-11-03T10:25:24.579920 #19048] INFO -- : Registered expected interaction POST /documents/x D, [2021-11-03T10:25:24.579920 #19048] DEBUG -- : { "description": "Post request to get document back", "providerState": "There is a document in DS", "request": { "method": "post", "path": "/documents/x", "headers": { "Accept": "application/json" } }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "id": 1, "name": "Nena" } }, "metadata": null } I, [2021-11-03T10:25:24.595911 #19048] INFO -- : Received request POST /documents/x D, [2021-11-03T10:25:24.596921 #19048] DEBUG -- : { "path": "/documents/x", "query": "", "method": "post", "headers": { "Host": "localhost:60881", "Accept": "application/json", "Version": "HTTP/1.1" } } I, [2021-11-03T10:25:24.597916 #19048] INFO -- : Found matching response for POST /documents/x D, [2021-11-03T10:25:24.597916 #19048] DEBUG -- : { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "id": 1, "name": "Nena" } } I, [2021-11-03T10:25:24.625918 #19048] INFO -- : Verifying - interactions matched for example ""

matt.fellows
2021-11-03 10:49
what does it say though

matt.fellows
2021-11-03 10:49
it?s not calling the function to write to the pact file

matt.fellows
2021-11-03 10:50
You should see something like ```I, [2021-10-29T10:53:07.618526 #98398] INFO -- : Writing pact for pactflow-example-provider to /Users/matthewfellows/development/public/example-consumer/pacts/pactflow-example-consumer-pactflow-example-provider.json```

matt.fellows
2021-11-03 10:50
that tells me a lifecycle method is not being called

matt.fellows
2021-11-03 10:50
that thing ``` PactBuilder.Build(); //NOTE: Will save the pact file once finished```

ozgurerisir
2021-11-03 10:51
In ContractPact.cs I have this function: ```public void Dispose() {     PactBuilder.Build(); }```

matt.fellows
2021-11-03 10:52
sure, I?m just saying perhaps something is not calling that

matt.fellows
2021-11-03 10:52
can you put a debug log in there to see if that is called?

ozgurerisir
2021-11-03 10:52
sure

matt.fellows
2021-11-03 10:52
thxb


matt.fellows
2021-11-03 10:52
that is the code that should be called there. But first up is `Dispose()` actually called

matt.fellows
2021-11-03 10:53
Presumably your test implements the `IDisposable` interface too?

matt.fellows
2021-11-03 10:55
Perhaps for simplicity, just move that under ``` _mockProviderService.VerifyInteractions();```

matt.fellows
2021-11-03 10:55
and see if it works then

ozgurerisir
2021-11-03 10:56
ok just trying now

ozgurerisir
2021-11-03 11:01
ok so ive put all the PactBuilder code in the same class as the test and PactBuilder.Build(); under _mockProviderService.VerifyInteractions(); and that worked and just created the contract file! so you were right, it didnt call PactBuilder.Build() before

ozgurerisir
2021-11-03 11:01
Thanks for that, that was extremely useful

matt.fellows
2021-11-03 11:03
cool, I?ll leave it with you to solve the rest of the puzzle :slightly_smiling_face:

matt.fellows
2021-11-03 11:04
Mind updating the SO question too with your solution in case somebody else stumbles on it?

ozgurerisir
2021-11-03 11:04
Sure will do, thanks!

jordan.r.stewart
2021-11-04 08:47
@jordan.r.stewart has left the channel

yann.courtel
2021-11-04 14:35
Hi Rochit, I answered your points in the stackoverflow thread.

dean.miley1
2021-11-05 11:40
has joined #pact-net

martha.nolan
2021-11-05 11:50
has joined #pact-net

eniko_kollar
2021-11-05 16:46
has joined #pact-net

ashwin
2021-11-05 17:58
has joined #pact-net

kriegster108
2021-11-05 19:43
Question, I am trying to build a POC with bi-directional contract testing for Dotnet, I was wondering if there are any dotnet alternatives to testing my provider with a tool such as https://dredd.org/en/latest/index.html? Dredd doent support dotnet right now, wondering if there are alternatives


kriegster108
2021-11-05 20:46
We dont want to do consumer driven, we want to do bi-directional contract testing due to our development teams building providers first


kriegster108
2021-11-05 20:52
Our Providers use OAS by default, we want to leverage what we have and test OAS contracts against consumer Pact Contracts

matt.fellows
2021-11-05 21:02
How are the OAS files created? By hand or generated by code?

matt.fellows
2021-11-05 21:02
If the former, you definitely need an additional test layer for it. If the latter you might not

kriegster108
2021-11-05 21:10
Yeah its some dotnet feature that auto generates it

matt.fellows
2021-11-05 21:11
It might be nice to still have some additional layer of confidence but auto generated is usually pretty good

matt.fellows
2021-11-05 21:12
Any reason you couldn't use Dredd (or another tool) even though they aren't .NET?

matt.fellows
2021-11-05 21:12
I'm not advocating for anything in particular btw

kriegster108
2021-11-05 21:24
Dredd doesnt have a dotnet implementation yet and i was wanting to find a dotnet specific tool that functions like dredd

kriegster108
2021-11-05 21:24
Unless im misinterpreting how dred is supposed to work

kriegster108
2021-11-05 21:25
I'd prefer the route that doesnt involve having to build my own implementation from scratch

kriegster108
2021-11-05 21:28
Also, I appreciate all your feedback on this @matt.fellows. If I can get a working POC implementation for my organization with what our needs are , we will definitely get pact-flow for the final implementation

matt.fellows
2021-11-05 22:03
Dress is a functional test CLI runner and can be extended with scripts (in various languages). It doesn't need to execute like a unit test so that's why I suggested that it might not be a problem

matt.fellows
2021-11-05 22:08
For whatever reason, there node JS ecosystem send the most mature for these tools

matt.fellows
2021-11-05 22:08
But the prism validation proxy might be a good option: https://github.com/stoplightio/prism#validation-proxy

d.philipp
2021-11-08 03:51
has joined #pact-net

hamzah.saleem
2021-11-08 11:22
has joined #pact-net

srividya.ece
2021-11-08 12:17
has joined #pact-net

markus.joschko
2021-11-08 13:13
has joined #pact-net

markus.joschko
2021-11-08 14:17
@markus.joschko has left the channel

belugin.v
2021-11-08 17:16
has joined #pact-net

kriegster108
2021-11-08 19:30
does the docker version of pact broker support publishing of OAS documents? or do i need to do the free trial of pactflow

kriegster108
2021-11-08 19:35
eh, i just made a free trial account

will.griffiths
2021-11-09 05:25
has joined #pact-net

navilooz
2021-11-09 08:48
has joined #pact-net

keith.hirst
2021-11-09 12:13
has joined #pact-net

rbo
2021-11-09 17:47
has joined #pact-net

harshaan.n.khan
2021-11-10 05:38
has joined #pact-net

aftab.shamim2020
2021-11-10 13:34
How to add (X-Api-Version) in consumer test as header. i want when run consumer test then it will generate pack json file with X-Api-Version as below screenshot :

esparga
2021-11-10 14:32
has joined #pact-net

thales.areis
2021-11-10 19:33
has joined #pact-net

henk.koopman
2021-11-11 08:56
has joined #pact-net

lena.lindblad
2021-11-11 09:58
has joined #pact-net

nikuplanchiwar
2021-11-11 12:51
How to add (X-Api-Version) in consumer test as header. I am also facing same issue those are shared already by Aftab Ahmad

matt.fellows
2021-11-11 13:02
What have you tried? It should just be like adding any other header

aftab.shamim2020
2021-11-11 14:34
Hi Matt, i tried to add api version(endpoint version) in consumer test, so after that run consumer test and in json need to add "X-Api-Version : 2.0". whereas these two added in json file : { "Accept", "application/json" }, { "Authorization", $"Bearer {testAuthToken}"} Consumer Test : _mockProviderService .Given("A GET request to retrieve order eligibility .UponReceiving("An order number and buid") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = "/api/OrderDetail/GetOrderEligibility/or Headers = new Dictionary<string, object> { { "Accept", "application/json" }, *{ "X-Api-Version", "2.0" },* { "Authorization", $"Bearer {testAuthToken}"} } })

aftab.shamim2020
2021-11-11 14:34
we need json file like screenshot

aftab.shamim2020
2021-11-11 14:36
when added "X-Api-Version" in header so we are getting internal server error

radekkoubsky
2021-11-11 16:24
has joined #pact-net

aditya
2021-11-11 17:20
has joined #pact-net

claire
2021-11-11 17:55
has joined #pact-net

matt.fellows
2021-11-11 20:34
Please share your verbose logs

matt.fellows
2021-11-11 20:35
Is this consumer code adding the header in the request?

matt.fellows
2021-11-11 20:36
You should definitely be able to do it

nikuplanchiwar
2021-11-12 05:45
Yes, this is the consumer code , we are trying to add in the header . but if we call the version 2 api using above code, we are getting unauthorized error

matt.fellows
2021-11-12 05:47
please share your code

matt.fellows
2021-11-12 05:48
the full test code

matt.fellows
2021-11-12 05:48
> unauthorized error ?

matt.fellows
2021-11-12 05:48
system unavailable?

gentritmm
2021-11-12 08:35
has joined #pact-net

nikuplanchiwar
2021-11-12 08:46
_Consumer Test: mockProviderService .Given("A GET request to retrieve order eligibility for APJC for V2") .UponReceiving("An order number and buid") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = "/api/OrderDetail/GetOrderEligibility/orderNumber/" + orderNumber + "/buid/" + buid + "/environment/" + environment + "", Headers = new Dictionary<string, object> { { "Accept", "application/json" }, { "X-Api-Version", $"2.0"}, { "Authorization", $"Bearer {testAuthToken}"} } }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary<string, object> { { "Content-Type", "application/json; charset=utf-8" } }, Body = new { inCreditPolicyWindow = false, doesPreviousCreditExists = true, inReturnPolicyWindow = false, doesPreviousReturnExists = DBNull.Value, inExchangePolicyWindow = DBNull.Value, doesPreviousExchangeExists = DBNull.Value } });

nikuplanchiwar
2021-11-12 08:47
Mock API public OrderEligibility GetOrderEligibilityDetails(string orderNumber, string orderBuid, string environment = "") { string reasonPhrase; var request = new HttpRequestMessage(); if (!string.IsNullOrEmpty(environment)) { request.Headers.Add("X-Api-Version", "2.0"); request = new HttpRequestMessage(HttpMethod.Get, "/api/OrderDetail/GetOrderEligibility/orderNumber/" + orderNumber + "/buid/" + orderBuid + "/environment/" + environment); } else { request = new HttpRequestMessage(HttpMethod.Get, "/api/OrderDetail/GetOrderEligibility/orderNumber/" + orderNumber + "/buid/" + orderBuid); } request.Headers.Add("Accept", "application/json"); request.Headers.Authorization = APIAuthorization.AuthenticationHeader; var response = _client.SendAsync(request); var content = response.Result.Content.ReadAsStringAsync().Result; var status = response.Result.StatusCode; reasonPhrase = response.Result.ReasonPhrase; request.Dispose(); response.Dispose(); if (status == HttpStatusCode.OK) { return !string.IsNullOrEmpty(content) ? JsonConvert.DeserializeObject<OrderEligibility>(content) : null; } throw new Exception(reasonPhrase); }

nikuplanchiwar
2021-11-12 08:48
{ "X-Api-Version", $"2.0"}, -- You can see , I have passed version here. If we passed like that Mock API will get the "Internal server error".

nikuplanchiwar
2021-11-12 08:49
If there any way to passed the version through the Consumer test

matt.fellows
2021-11-12 09:26
As requested earlier, can you please also share the full pact log?

wilson.espina
2021-11-12 09:52
has joined #pact-net

nikuplanchiwar
2021-11-12 13:30
providerState": "A GET request to retrieve order eligibility for APJC for V2", "request": { "method": "get", "path": "/api/OrderDetail/GetOrderEligibility/orderNumber/875447131/buid/1401/environment/GE2", "headers": { "Accept": "application/json", "X-Api-Version": "2.0", "Authorization": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImF0LTE2MDk1NTkzNDAiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiIwNjA2NDM0Ni04YWY0LTRlYTUtYjFlOC1lMWMxMTk5YjE2NDYiLCJzdWJ0eXBlIjoiYXBwIiwidHR5IjoiYXQiLCJqdGkiOiIyNWNiNzdhNi01MmUxLTQxZTgtODM1Yy03MWNiNGY4ZjI0YzEiLCJhdWQiOlsiU3RyZWFtbGluZXJfVmVyaWZ5UmV2aWV3X0ludGVybG9jayIsIlN0cmVhbWxpbmVyX1ZlcmlmeVJldmlld19CdXNSdWwiXSwic2NvcGUiOlsic3RyZWFtbGluZXJfdmVyaWZ5cmV2aWV3X2ludGVybG9jay51c2VyX2luZm8iLCJzdHJlYW1saW5lcl92ZXJpZnlyZXZpZXdfYnVzcnVsLnVzZXJfaW5mbyJdLCJpYXQiOjE2MzY3MjMyOTMsIm5iZiI6MTYzNjcyMzI5MywiZXhwIjoxNjM2NzI1MDkzLCJpc3MiOiJodHRwOi8vd3d3LmRlbGwuY29tL2lkZW50aXR5In0.ZFkvTK7x7rQSLxYrDMBrYJa4uS1zweT8va23nLOSNQsVtJE8CZcH0Uw66q2AqzSnbo7g8w93dEI0u2E0HOFKP9iamFCzkif25gRwtXxCzP9By-xoKxCNjKqrFAQu8s4SA2GKaitMMXeF2aLSpFRoxHyOMiPxbaU1Vvi3KppSRuV0lImLbTN_VXNg7L_tRGTR5uOeVNHfuQS6Cq57L-lrmwqTK7EZE6BqWmTYpg6bR1A98CAKR1kMdd5MBWaLDsKE0dqgugLfQx3e8WFOICpABWT4vk0uPxIHRCvR-LtTwYaf2n9JaEcxwq7ChT5PTYs_jaqYsgaNQiejqOvqinnRWQ" } }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "inCreditPolicyWindow": false, "doesPreviousCreditExists": true, "inReturnPolicyWindow": false, "doesPreviousReturnExists": null, "inExchangePolicyWindow": null, "doesPreviousExchangeExists": null } }, "metadata": null } I, [2021-11-12T18:52:27.743488 #29064] INFO -- : Received request GET /api/OrderDetail/GetOrderEligibility/orderNumber/875447131/buid/1401/environment/GE2 D, [2021-11-12T18:52:27.744463 #29064] DEBUG -- : { "path": "/api/OrderDetail/GetOrderEligibility/orderNumber/875447131/buid/1401/environment/GE2", "query": "", "method": "get", "headers": { "Host": "localhost:9224", "Accept": "application/json", "Authorization": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImF0LTE2MDk1NTkzNDAiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiIwNjA2NDM0Ni04YWY0LTRlYTUtYjFlOC1lMWMxMTk5YjE2NDYiLCJzdWJ0eXBlIjoiYXBwIiwidHR5IjoiYXQiLCJqdGkiOiIyNWNiNzdhNi01MmUxLTQxZTgtODM1Yy03MWNiNGY4ZjI0YzEiLCJhdWQiOlsiU3RyZWFtbGluZXJfVmVyaWZ5UmV2aWV3X0ludGVybG9jayIsIlN0cmVhbWxpbmVyX1ZlcmlmeVJldmlld19CdXNSdWwiXSwic2NvcGUiOlsic3RyZWFtbGluZXJfdmVyaWZ5cmV2aWV3X2ludGVybG9jay51c2VyX2luZm8iLCJzdHJlYW1saW5lcl92ZXJpZnlyZXZpZXdfYnVzcnVsLnVzZXJfaW5mbyJdLCJpYXQiOjE2MzY3MjMyOTMsIm5iZiI6MTYzNjcyMzI5MywiZXhwIjoxNjM2NzI1MDkzLCJpc3MiOiJodHRwOi8vd3d3LmRlbGwuY29tL2lkZW50aXR5In0.ZFkvTK7x7rQSLxYrDMBrYJa4uS1zweT8va23nLOSNQsVtJE8CZcH0Uw66q2AqzSnbo7g8w93dEI0u2E0HOFKP9iamFCzkif25gRwtXxCzP9By-xoKxCNjKqrFAQu8s4SA2GKaitMMXeF2aLSpFRoxHyOMiPxbaU1Vvi3KppSRuV0lImLbTN_VXNg7L_tRGTR5uOeVNHfuQS6Cq57L-lrmwqTK7EZE6BqWmTYpg6bR1A98CAKR1kMdd5MBWaLDsKE0dqgugLfQx3e8WFOICpABWT4vk0uPxIHRCvR-LtTwYaf2n9JaEcxwq7ChT5PTYs_jaqYsgaNQiejqOvqinnRWQ", "Version": "HTTP/1.1" } } E, [2021-11-12T18:52:27.745470 #29064] ERROR -- : No matching interaction found for GET /api/OrderDetail/GetOrderEligibility/orderNumber/875447131/buid/1401/environment/GE2 E, [2021-11-12T18:52:27.745470 #29064] ERROR -- : Interaction diffs for that route: E, [2021-11-12T18:52:27.746471 #29064] ERROR -- : Diff with interaction: "An order number and buid" given "A GET request to retrieve order eligibility for APJC for V2" Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown { "headers": { - "X-Api-Version": "2.0" } } Description of differences -------------------------------------- * Could not find key "X-Api-Version" (keys present are: Host, Accept, Authorization, Version) at $.headers

nikuplanchiwar
2021-11-12 13:30
this is the log

matt.fellows
2021-11-12 13:33
Please share the whole log, not just the end

matt.fellows
2021-11-12 13:33
it?s pretty clear though - you?re *not* sending through the header

matt.fellows
2021-11-12 13:34
you?ve told Pact you?re going to send it, but your code doesn?t send it

matt.fellows
2021-11-12 13:34
I suspect the guard you have around that code is resulting in the header not being added

nikuplanchiwar
2021-11-12 14:07
Ohh. Is it the wrong way that I sending through this pact?

megan.twyver
2021-11-12 18:39
has joined #pact-net

matt.fellows
2021-11-12 21:55
Pact is a mock, it validates your behaviour

matt.fellows
2021-11-12 21:56
You said your consumer sends a request with that header, but it's not sending the header

matt.fellows
2021-11-12 21:57
The Pact test is failing, and telling you that and refuses to write the contract because it doesn't represent what you expected it to do

matt.fellows
2021-11-12 21:58
To fix it, make your consumer request match what you wrote in the test itself

mischa.molhoek
2021-11-14 09:42
has joined #pact-net

69vron
2021-11-15 01:35
has joined #pact-net

james.sawle
2021-11-15 08:49
has joined #pact-net

ozgurerisir
2021-11-15 10:47
Hi All, I've got two small question regarding the example on the GitHub page, there we have the line below in class ProviderStateMiddleware, could you please let me know what this 'Empty' should be? ``` await context.Response.WriteAsync(Empty);```

pete.watts
2021-11-15 12:46
has joined #pact-net

joshua.badger
2021-11-15 17:10
has joined #pact-net

omarsaddaoui
2021-11-17 02:55
has joined #pact-net

mbyrne
2021-11-17 14:23
has joined #pact-net

matthew.drill
2021-11-18 01:08
has joined #pact-net

james.halsall
2021-11-18 12:02
has joined #pact-net

chvram
2021-11-19 14:09
has joined #pact-net

akhandalmani.malik
2021-11-19 14:17
has joined #pact-net

elias.frykholm
2021-11-19 15:17
has joined #pact-net

martin.carlin
2021-11-19 15:52
has joined #pact-net

paul.nardone
2021-11-19 16:12
has joined #pact-net

emily
2021-11-19 18:56
has joined #pact-net

pietrucha.bartosz
2021-11-20 13:47
has joined #pact-net

mastrobardo
2021-11-21 11:42
has joined #pact-net

fed
2021-11-22 04:20
has joined #pact-net

tumunshaily
2021-11-22 07:54
has joined #pact-net

yunfeng.wang
2021-11-22 09:25
has joined #pact-net

christos.litsas
2021-11-23 13:05
has joined #pact-net

walter.psjr
2021-11-23 17:39
has joined #pact-net

steveforwork2
2021-11-24 08:47
has joined #pact-net

fredrik.ostling
2021-11-24 11:56
has joined #pact-net

jorge.nunez
2021-11-24 14:28
has joined #pact-net

asradhakrishnan
2021-11-24 17:20
has joined #pact-net

edouard.lopez
2021-11-25 11:01
has joined #pact-net

maxkitzing
2021-11-25 17:49
has joined #pact-net

cristian.carrillo
2021-11-26 00:06
has joined #pact-net

christoph.oswald
2021-11-26 09:53
has joined #pact-net

gjourdanweil
2021-11-26 14:39
has joined #pact-net

sean.pike
2021-11-26 14:48
has joined #pact-net

gjourdanweil
2021-11-28 20:09
@gjourdanweil has left the channel

michael.bannister
2021-11-29 07:43
has joined #pact-net

rjadams96
2021-11-29 18:47
has joined #pact-net

pavithz
2021-11-29 23:51
has joined #pact-net

mfellows_20211130
2021-11-30 06:57
has joined #pact-net

mfellows_20211130v2
2021-11-30 10:32
has joined #pact-net

mfellows_20211130v3
2021-11-30 10:57
has joined #pact-net

mfellows_20211130v4
2021-11-30 11:16
has joined #pact-net

agittcelik
2021-11-30 18:35
has joined #pact-net

alturil
2021-11-30 20:56
has joined #pact-net

draper.joseph
2021-12-01 06:50
has joined #pact-net

abhay175
2021-12-01 07:35
has joined #pact-net

joelgrimberg
2021-12-01 11:27
has joined #pact-net

reem.alashry
2021-12-01 12:09
has joined #pact-net

beshoy.ibrahim
2021-12-01 12:09
has joined #pact-net

omar.radi
2021-12-01 12:10
has joined #pact-net

mmudassar192
2021-12-01 12:11
has joined #pact-net

eric.seipold
2021-12-01 13:40
has joined #pact-net

apselsevier
2021-12-01 16:48
has joined #pact-net

ali.korayem
2021-12-01 18:55
has joined #pact-net

luiz.filipe.abrahao
2021-12-01 21:04
has joined #pact-net

david.cummings
2021-12-02 14:13
has joined #pact-net

miccagiann
2021-12-02 14:17
has joined #pact-net

praveen.em
2021-12-03 07:40
has joined #pact-net

ally.parker
2021-12-03 11:18
has joined #pact-net

ally.parker
2021-12-03 11:24
Hey folks, I?m trying to get the ReadMe examples running in OSX on the `feature/4.0.0` branch, but I?m not seeing any of the verifier logs in the test output. It shows the cli args used with ffi, but no Pact logs. If I `Thread.Sleep` then use the new CLI and pass the same args, I do see the logs. Seems like somethings getting lost in the interop on macos. Any ideas?

rishabh.gaur
2021-12-03 11:43
has joined #pact-net

matt.fellows
2021-12-03 12:18
Yeah, there?s an issue with the logs that needs to be fixed (that?s the blocker for getting it released)

matt.fellows
2021-12-03 12:18
run it outside of your IDE in a terminal and it should work

matt.fellows
2021-12-03 12:19
(don?t need to run the verifier manually)

matt.fellows
2021-12-03 12:19
TL;DR - the verifier prints to stdout, which gets swallowed

lewis.prescott079
2021-12-03 13:27
I'm really eager for this release :smile:

ally.parker
2021-12-03 13:27
Thanks!

ally.parker
2021-12-03 13:27
Anything I can help with? I?m not super familiar with interop

lewis.prescott079
2021-12-03 13:28
Is there a tracker for the issue on github?

william.wallace
2021-12-03 15:12
has joined #pact-net

batiushkov.nik
2021-12-03 15:48
has joined #pact-net

keith.mcgrath
2021-12-03 18:28
has joined #pact-net

rchandragupthara
2021-12-03 19:32
has joined #pact-net

vinicius.cosmi
2021-12-03 20:01
has joined #pact-net

ichatterjee
2021-12-03 21:27
has joined #pact-net

ben.watts
2021-12-03 23:48
has joined #pact-net

imikhtyuk
2021-12-06 00:36
has joined #pact-net

norrischebl
2021-12-06 05:54
has joined #pact-net

smantini
2021-12-06 09:25
has joined #pact-net

gzinger
2021-12-06 11:19
has joined #pact-net

mahatmafatal
2021-12-06 13:50
has joined #pact-net

jacob.v.gardner
2021-12-06 14:59
has joined #pact-net

glebing2000
2021-12-07 07:28
has joined #pact-net

glebing2000
2021-12-07 07:34
Hello, pactflow team :slightly_smiling_face: I'm a software developer and need to create a project with pactflow contract test. The contract tests technology was investigated and understood. But there is one moment, that our team can not work through. We have to deal with a DELETE request, that contains a Json string, as a body. Please, have a look a the example of this request in Postman in attachments: Please, pay attention to the Content-Type and format of the body.  To pactflow part, the contract for this request was generated at looks like this: --------------------------------------------------------------------------------------------------------------- "consumer": {   "name": "YYYY"  },  "provider": {   "name": "ZZZZ"  },  "interactions": [   {    "description": "DELETE request",    "providerState": "YYYY",    "request": {     "method": "delete",     "path": "xxxxxxxxxxxxxxxxxxxxx",     "headers": {      "Authorization": "xxxx",      "Accept": "application/json, text/plain, */*",      "Content-Type": "application/json; charset=utf-8"     },     "body": "itemIdxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"    },    "response": {     "status": 200,     "headers": {},     "body": null    }   }  ],  "metadata": {   "pactSpecification": {    "version": "2.0.0"   }  } } ------------------------------------------------------------------------------------------------------------------ If a provider verifies this contract, it will respond with an error:  expected: 200  got: 500 In general, could the pactflow work with a DELETE request, that contains a body as a JSON string? And why a 500 error raises if the parameters of a request are the same as Postman? Please, help me to understand, how to make this contract valid Thank you in advance!

matt.fellows
2021-12-07 07:40
I'd be looking at the logs of your provider to find out what's wrong and why it returns a 500

matt.fellows
2021-12-07 07:40
We can't tell you why your provider is erroring

matt.fellows
2021-12-07 07:49
I'd also check to see if the auth token is still valid and if that's the issue (although I'd expect to see a different error code I'd that were the case)

glebing2000
2021-12-07 07:58
Hi Matt The token is valid I'm sure (if it isn't the 403 error should be instead of 500) What about the logs, please, have a look: DEBUG: Setting up provider state 'ApplicationHub is registered' for consumer 'HubAs' using provider state set up URL http://localhost:xxxxx I, [2021-12-07T09:56:13.428099 #1420] INFO -- request: POST http://localhost:xxxxx D, [2021-12-07T09:56:13.428099 #1420] DEBUG -- request: User-Agent: "Faraday v0.17.3" Content-Type: "application/json" I, [2021-12-07T09:56:27.724762 #1420] INFO -- response: Status 200 D, [2021-12-07T09:56:27.726765 #1420] DEBUG -- response: connection: "close" Failures: 1) Verifying a pact between HubAs and AppStoreAS Given ApplicationHub is registered DELETE request for unregister Hub with DELETE /xxxx/xxxxx/v1.0/xxxxx/ returns a response which has status code 200 Failure/Error: expect(response_status).to eql expected_response_status expected: 200 got: 500

matt.fellows
2021-12-07 08:08
Can you get logs from your application?

matt.fellows
2021-12-07 08:13
We need to know why your application is erroring

glebing2000
2021-12-07 08:20
One moment

glebing2000
2021-12-07 08:29
Request starting HTTP/1.1 DELETE https://localhost:48180/api/apprepository/v1.0/hubs/ application/json; charset=utf-8 46 info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[2] Successfully validated the token. warn: Waters.AspNetCore.Authentication.Certificate.CertificateAuthenticationHandler[0] No client certificate found warn: Waters.AspNetCore.Authentication.Certificate.CertificateAuthenticationHandler[0] No client certificate found. info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'xxxx.Services.Controllers.HubController.UnregisterHub (xxxxxx.Services)' info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "UnregisterHub", controller = "Hub"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] UnregisterHub(System.String) on controller xxxxxx.Services.Controllers.HubController (xxxxxx.Services). ------------------------------------------------------------------------------------------------------------------------------------------------ As far as I get it, service doesn't respond to the request at all And bellow log for the delete request, if it makes from postman: ------------------------------------------------------------------------------------------------------------------------------------------------ Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 DELETE https://xxxxxx/xxx/xxxxx/v1.0/xxxxx/ application/json; charset=utf-8 48 info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[2] Successfully validated the token. warn: Waters.AspNetCore.Authentication.Certificate.CertificateAuthenticationHandler[0] No client certificate found warn: Waters.AspNetCore.Authentication.Certificate.CertificateAuthenticationHandler[0] No client certificate found. info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'xxxxxxx.Services.Controllers.HubController.UnregisterHub (xxxxxxx.Services)' info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "UnregisterHub", controller = "Hub"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] UnregisterHub(System.String) on controller Waters.AppStoreAS.Services.Controllers.HubController (Waters.AppStoreAS.Services). info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: http://System.Net.Http.HttpClient.IAuditAccess.LogicalHandler[100] Start processing HTTP request POST https://localhost/api/v2/softwareSystem/auditLogEntries info: http://System.Net.Http.HttpClient.IAuditAccess.ClientHandler[100] Sending HTTP request POST https://localhost:48215/api/v2/softwareSystem/auditLogEntries info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET https://localhost:48180/health info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 280.4652ms 200 text/plain info: http://System.Net.Http.HttpClient.IAuditAccess.ClientHandler[101] Received HTTP response after 2512.7306ms - Created info: http://System.Net.Http.HttpClient.IAuditAccess.LogicalHandler[101] End processing HTTP request after 2613.8059ms - Created info: xxxxxxx.ClientConfiguration.IClientConfigurationManager[0] Unregistering client with id 'testClient12ad3d87-3ec3-42e7-861e-7bf37baecab5' info: Microsoft.AspNetCore.Mvc.StatusCodeResult[1] Executing HttpStatusCodeResult, setting HTTP status code 200

matt.fellows
2021-12-07 08:46
Something is different between what postman sends and what you've authored in your pact test. Could you please extract the postman request as a curl and share?

matt.fellows
2021-12-07 08:48
Perhaps you need to debug the endpoint to find out what's wrong with the request

glebing2000
2021-12-07 08:50
Matt, sorry, I did not get this :slightly_smiling_face: Request as a curl - what does it mean?

matt.fellows
2021-12-07 08:51
Postman lets you export a request. Can you please export with the `curl` format

glebing2000
2021-12-07 09:05
Yea, here there is a request


matt.fellows
2021-12-07 09:45
there is a button to extract a curl request

matt.fellows
2021-12-07 09:47
But in any case, you?re going to need to talk to somebody that runs that code to find out why the request is failing. It?s going to be one of two things: 1. The request in the pact test is not the same as what you?re doing with Postman 2. The server you are running the tests against is not the same, or is configured differently (if you?re pointing at a live server, rather than a locally running one, that seems plausible)

matt.fellows
2021-12-07 09:47
Unfortunately, we can?t tell you much more than that

sergio.freire
2021-12-07 09:52
has joined #pact-net

glebing2000
2021-12-07 09:53
I'm thankful for your help. I can share another approach for curl: curl --location --request DELETE 'https://localhost:xxxx/xxxx/xxxx/xxxx/xxxx' \ --header 'Accept: */*' \ --header 'Authorization: xxxx' \ --header 'Content-Type: application/json; charset=utf-8' \ --data-raw '"itemIdxxxxx"' maybe, it's going to bring more understanding for the issue :slightly_smiling_face:

glebing2000
2021-12-07 09:56
And one more question, please Do you know if such format can be a valid JSON?: "itemIdbmn45-ancndn-9f-statem-322eOdn"

matt.fellows
2021-12-07 09:58
Technically it is, yes


matt.fellows
2021-12-07 10:00
I?ll raise one on the .NET package now so it has some visibility


matt.fellows
2021-12-07 10:05
This looks really simple to me and it seems to match your pact test. So if this is failing, i suspect it?s because it?s an issue with the test setup or the provider API. For example, are you trying to delete an item that doesn?t exist? Do you need to make sure that item exists (by using a provider state) to handle this?

sahoo.skumar
2021-12-07 10:55
has joined #pact-net

glebing2000
2021-12-07 10:59
Yes, sure, this case was predicted and worked around. For example, if we try to delete an item, that doesn't exist, the status code will be 404. And provider states have a logic to register an item with an id as in the contract before deleting them.

glebing2000
2021-12-07 11:02
May it be an issue with some kind of pactflow implementation, in case this DELETE request is quite unusual? The body has only value, without a key. Does pactflow supports such kind of requests?

ozgurerisir
2021-12-07 11:06
Hi All, any ideas why Startup() object is not found when Owin package is included in the project. Im using the example code from the pact .net github site. ```public class TestStartup { public void Configuration(IAppBuilder app) { var apiStartup = new Startup(); //This is your standard OWIN startup object - Startup here is not found! app.Use<ProviderStateMiddleware>(); apiStartup.Configuration(app); } }```

kingyang728
2021-12-07 15:58
has joined #pact-net

jesseaantebi
2021-12-07 19:36
has joined #pact-net

rsheikh
2021-12-07 22:34
has joined #pact-net

jorgwel
2021-12-08 01:22
has joined #pact-net

rahul.anwekar23
2021-12-08 04:19
has joined #pact-net

glebing2000
2021-12-08 12:16
Hello everyone :slightly_smiling_face: I have a question about DETELE requests with a body. Does pactflow allow to verify a contract with a body without "Key -> value" format? For example: "request": {     "method": "delete",     "path": "xxxxxxxxxxxxxxxxxxxxx",     "headers": {      "Authorization": "xxxx",      "Accept": "application/json, text/plain, */*",      "Content-Type": "application/json; charset=utf-8"     },     "body": "itemIdxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"    },    "response": {     "status": 200,     "headers": {},     "body": null    }   }

matt.fellows
2021-12-08 12:21
:wave:

matt.fellows
2021-12-08 12:21
didn?t we have this chat yesterday? Did you discover that it wasn?t actually sending the payload with the DELETE request?


glebing2000
2021-12-08 12:26
Hey, Matt. Yes, you are right, we discussed this question yesterday. I had a question about, is this type of request valid in general. I have no answer, so I decided to repeat this question again:slightly_smiling_face:


matt.fellows
2021-12-08 12:27
I?d avoid it in general, like I?d avoid a GET with a body

matt.fellows
2021-12-08 12:30
It does seem to be unsupported in the upstream libraries used (Ruby)

matt.fellows
2021-12-08 12:31
you could look at using the 4.x.x branch of the .NET library, which uses Rust under the hood (this specific issue is untested though)

glebing2000
2021-12-08 12:31
Thank you, I'II investigate this link. On the other side, I'm on the same page about GET with a body, but my provider doesn't allow me to make a DELETE request in URI

matt.fellows
2021-12-08 12:32
I don?t understand why you don?t just have the id in the URL, instead of the body?

matt.fellows
2021-12-08 12:32
ah, sorry we wrote at the same time

matt.fellows
2021-12-08 12:33
Unfortunately, HTTP clients/libraries use the RFC as a guide and can interpret certain things differently. Some will take a harder or loser stance. Additionally, changing positions on that stance becomes basically impossible after it?s taken, because it could cause unintended breakages for users of the library

glebing2000
2021-12-08 12:47
I find a conversation about this issue on pact git https://github.com/pact-foundation/pact-js/issues/484. All in all, does it mean, that DELETE with a body is unsupported?

matt.fellows
2021-12-08 12:48
correct

glebing2000
2021-12-08 12:49
Thank you Matt :slightly_smiling_face:

matt.fellows
2021-12-08 12:58
no worries, and sorry. Might be worth trying the 4.x.x branch to see if it does help, otherwise, chat with your provider about doing it properly :laughing:

luanacosta05
2021-12-08 20:34
has joined #pact-net

saurabh.techiee
2021-12-09 09:41
has joined #pact-net

albertcabantog
2021-12-09 10:52
has joined #pact-net

bethskurrie
2021-12-10 00:04
I don't think the pact ruby implementation supports DELETE with a body.

bethskurrie
2021-12-10 00:05
I'm trying to do a test locally, and it's not working. I can't tell if it's my server or the pact ruby implemenation though. I keep getting `Request Timeout`

bethskurrie
2021-12-10 00:10
I think it's something to do with the content length.

bethskurrie
2021-12-10 00:11
it's automatically calculated for POST requests, but not for DELETE requests.

matt.fellows
2021-12-10 00:25
> I don?t think the pact ruby implementation supports DELETE with a body. thanks. This seems to be confirmed in at least two JS/pact-node issues it seems. I?m pretty sure it doesn?t support bodies in GET requests either, so my guess is that rack-test (or one of the upstream deps) took an early stance on this, and it?s too hard to change that behaviour after the fact

bethskurrie
2021-12-10 00:25
I have some memory of that being the case.

bethskurrie
2021-12-10 00:27
if you follow the threads through from here https://github.com/rack/rack-test/issues/200 it does suggest it should be supported.

paul.scholes
2021-12-10 10:21
has joined #pact-net

chris.sloan
2021-12-10 10:48
has joined #pact-net

leon.york
2021-12-10 12:42
has joined #pact-net

kyle.craviotto
2021-12-10 16:40
has joined #pact-net

lorenz.schumann
2021-12-10 18:33
has joined #pact-net

luispires.m
2021-12-13 12:32
has joined #pact-net

fabio.rodrigues
2021-12-13 16:22
has joined #pact-net

mbailey
2021-12-13 22:17
has joined #pact-net

dkwak
2021-12-14 03:47
has joined #pact-net

haoran.lin
2021-12-14 05:27
has joined #pact-net

glebing2000
2021-12-14 06:37
Hello there :slightly_smiling_face: I going to create contract tests for requests that use Certificates instead of a Token authorization. The Certificate is in an X509Certificate2 (C #) format and located in a folder on the local PC. To clean up an idea with the Certificate I will share a piece of code where a HttpClientHandeler initializes: ---------------------------------------------------------------------------------------------------------------------------------------------------------------- private HttpClientHandler GetHttpClientHandler() { var clientHandler = new HttpClientHandler { CheckCertificateRevocationList = false, ClientCertificateOptions = ClientCertificateOption.Manual }; var cert = LoadCertificateFromStore(ClientCertName); // here the Certificate is going to be taken from a folder if (cert != null) clientHandler.ClientCertificates.Add(cert); // add the Certificate to the clientHandler return clientHandler; } // a method that taking the Certificate by name from a store private X509Certificate2 LoadCertificateFromStore(string certificateName, StoreName storeName = http://StoreName.My, StoreLocation storeLocation = StoreLocation.LocalMachine) { if (certificateName == null) throw new ArgumentException(nameof(certificateName)); using (var store = new X509Store(storeName, storeLocation)) { store.Open(OpenFlags.ReadOnly); var certificates = store.Certificates.Find(X509FindType.FindBySubjectName, certificateName, false) .OfType<X509Certificate2>(); var certificatesWithExactName = certificates.Where(c => c.GetNameInfo(X509NameType.SimpleName, false) == certificateName); if (!certificatesWithExactName.Any()) { var errorMessage = $"No certificate with name '{certificateName}' was found in '{storeLocation}\\{storeName}'"; //I don't know if I'm on client or server here; no exception will be thrown because of that return null; } else if (certificatesWithExactName.Count() > 1) { var errorMessage = $"More than one certificate with name '{certificateName}' was found in '{storeLocation}\\{storeName}'"; return null; } return certificatesWithExactName.Single(); } } --------------------------------------------------------------------------------------------------------------------------------------------------- After that, the client handler with the Certificate uses in requests to a Provider. Could you, please, help me to understand, how to add the Certificate to a contract and after that make a valid request to a Provider? Does a Pact technology support a certificate authorization at all? :slightly_smiling_face: Thank you in advance!

tom450
2021-12-14 08:06
has joined #pact-net

pajaree.tuampitak
2021-12-14 10:00
has joined #pact-net

nitins333
2021-12-14 10:03
has joined #pact-net

jaakko.tompuri
2021-12-14 13:10
has joined #pact-net

albert.moreno
2021-12-14 17:01
has joined #pact-net

haoran.lin
2021-12-15 03:15
@haoran.lin has left the channel

himanshu
2021-12-15 06:16
has joined #pact-net

glebing2000
2021-12-15 09:22
Hello, please, have a look at the question about SSL Certificates for Pact testing :slightly_smiling_face:

matt.fellows
2021-12-15 11:12
Is the certificate sent in a header? If so, it?s just like any Pact test with headers

matt.fellows
2021-12-15 11:12
if not, i?d recommend stubbing the auth layer for this test - otherwise you?re probably going to make the test very complicated for not a lot of benefit contract wise. It?s highly likely if this layer fails that you?ll catch it elsewhere (in my experience)


diva.pant1
2021-12-15 14:21
has joined #pact-net

johnreilly100
2021-12-15 16:36
has joined #pact-net

elliot.weiser
2021-12-15 19:06
has joined #pact-net

sunit
2021-12-16 07:27
has joined #pact-net

felipe.simoes
2021-12-16 18:42
has joined #pact-net

ameadewi
2021-12-16 18:48
has joined #pact-net

michael.scheepers
2021-12-17 08:11
has joined #pact-net

dikili
2021-12-17 15:44
hello, does anyone can enlighten me with my query pls , greatly appreciated, in myh consumer test, _mockProviderService.VerifyInteractions(); ,this is called and test is passing but no contract is being generated at the folder path i specify in the consumerpact.cs class, how is this possible puzzles me ?

yanis.benekaa
2021-12-17 16:05
has joined #pact-net

dilek
2021-12-20 12:42
has joined #pact-net

sadhana.0203
2021-12-21 07:55
has joined #pact-net

adrian.ernst.lgln
2021-12-21 08:36
has joined #pact-net

dalton.pinto
2021-12-21 09:53
has joined #pact-net

roman.rutkowski.87
2021-12-21 15:42
has joined #pact-net

maxwell.xandeco
2021-12-22 21:43
has joined #pact-net

lixiaoyan68
2021-12-23 06:50
has joined #pact-net

sashaavramchik
2021-12-23 09:07
has joined #pact-net

jamie.manson
2021-12-23 10:51
has joined #pact-net

colin.ansah
2021-12-23 13:21
has joined #pact-net

colin.ansah
2021-12-23 13:43
Hi guys, I'm trying out the matchers on nested objects and have a question. If I have the following body in a response: Body = Match.Type(new { name = "Apple Macbook Pro", price = 2700, description = "this is a macbook", categories = new List<object> { categoryName = "categoryName", categoryDescription = new { categoryDescriptionName = "categoryDescriptionName" } } }) It will generate the following rule: "matchingRules": {           "$.body": {             "match": "type"           }         } This way the categories can't be dynamic. I know that I can use Match.MinType for the categories, but I was wondering if there's a way to get Match.Type to behave like Match.MinType, where it handles matching for all nested lists.

bruno855
2021-12-23 17:47
has joined #pact-net

bruno855
2021-12-23 17:54
```Hello everyone, I am new to Pact in C # and I am struggling to validate my test provider. Here is the error obtained. PactNet.PactFailureException Pact verification failed. See output for details. If the output is empty please provide a custom config.Outputters (IOutput) for your test framework, as we couldn't write to the console. at PactNet.Core.PactCoreHost`1.Start() at PactNet.PactVerifier.Verify(String description, String providerState) at ProviderTest.ProviderPactTest.EnsureProviderApiHonorsPactWithConsumer() in C:\Dev\Betclic\Pact-Learning\Pact-Introduction\code\ProviderTests\ProviderPactTest.cs:line 49 INFO: Reading pact at ../../../../../pacts/consumer-provider.json DEBUG: Filtering interactions by: {:description=>/A valid GET employee/, :provider_state=>/There is data/} Verifying a pact between Consumer and Provider Given There is data A valid GET employee with GET /employees/1 returns a response which DEBUG: Setting up provider state 'There is data' for consumer 'Consumer' using provider state set up URL http://localhost:5002/provider-states I, [2021-12-23T18:54:08.594036 #27556] INFO -- request: POST http://localhost:5002/provider-states D, [2021-12-23T18:54:08.594500 #27556] DEBUG -- request: User-Agent: "Faraday v0.17.4" Content-Type: "application/json" I, [2021-12-23T18:54:08.667125 #27556] INFO -- response: Status 200 D, [2021-12-23T18:54:08.667125 #27556] DEBUG -- response: connection: "close" date: "Thu, 23 Dec 2021 17:54:08 GMT" server: "Kestrel" transfer-encoding: "chunked" 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 Consumer and Provider Given There is data A valid GET employee with GET /employees/1 returns a response which has status code 200 Failure/Error: expect(response_status).to eql expected_response_status expected: 200 got: 307 (compared using eql?) 2) Verifying a pact between Consumer and Provider Given There is data A valid GET employee with GET /employees/1 returns a response which has a matching body Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example Actual: Diff -------------------------------------- Key: - is expected + is actual Matching keys and values are not shown -{ - "id": 1, - "name": "Stacy", - "city": "NY", - "summary": "Captain Stacy" -} Description of differences -------------------------------------- * Expected a Hash but got a String ("") at $ 3) Verifying a pact between Consumer and Provider Given There is data A valid GET employee with GET /employees/1 returns a response which includes headers "Content-Type" which equals "application/json; charset=utf-8" Failure/Error: expect(header_value).to match_header(name, expected_header_value) Expected header "Content-Type" to equal "application/json; charset=utf-8", but was nil 1 interaction, 1 failure Failed interactions: To re-run just this failing interaction, change the verify method to '.Verify(description: "A valid GET employee", providerState: "There is data")'. Please do not check in this change! # A valid get employee given There is data```

bruno855
2021-12-23 17:55
Do you any idea?


appgify
2021-12-23 20:41
has joined #pact-net

appgify
2021-12-23 20:49
I am also looking for using pactnet for message pact to test consumer and provider in my .net core services. I could not find any information on how to use PACTNET for message pact to test the asyncronous calls in my service that uses service bus. @matt.fellows @akos.csurai.4github can you please point me to right direction ?

appgify
2021-12-23 20:50
Hello , I am looking to use pactnet for message pact to test consumer and provider in my asynchronous .net core services. I could not find any documentation on how to use PACTNET for message pact to test the asynchronous calls in my service that uses service bus. can someone please point me to right direction ?

jason329
2021-12-23 22:12
has joined #pact-net

matt.fellows
2021-12-23 23:13
I?ve responded to your issue. The current stable version doesn?t have support for messages, hence the lack of examples/docs on it

matt.fellows
2021-12-23 23:14
The `type` matcher cascades, so it should also cascade to the nested lists

matt.fellows
2021-12-23 23:16
Your provider is returning an http `307` instead of a `200`

matt.fellows
2021-12-23 23:17
notinsg I responded to your issue. The currently version of PactNet doesn?t have support for it, but the new 4.x.x branch does

shaheen.d2
2021-12-24 07:55
has joined #pact-net

laura.koekenberg
2021-12-24 10:32
has joined #pact-net

bruno855
2021-12-24 17:20
Hi Matt, thank you. But I have found the problem. My provider was running with HTTPS and my Provider test on HTTP. All is fine now. Merry Chrismas!

craiganthonyrichards
2021-12-25 05:01
has joined #pact-net

craiganthonyrichards
2021-12-28 09:13
Hello, running through the demo https://github.com/DiUS/pact-workshop-dotnet-core-v3/ and am unable to get the same log output from running the Provider Test. Running Dotnet test returns the following results for me and does not give details on the specific failure. ? dotnet test Determining projects to restore... All projects are up-to-date for restore. provider -> C:\westpac-dev\pact-workshop-dotnet-core-v3\Provider\src\bin\Debug\netcoreapp3.1\provider.dll tests -> C:\westpac-dev\pact-workshop-dotnet-core-v3\Provider\tests\bin\Debug\net5.0\tests.dll Test run for C:\westpac-dev\pact-workshop-dotnet-core-v3\Provider\tests\bin\Debug\net5.0\tests.dll (.NETCoreApp,Version=v5.0) Microsoft (R) Test Execution Command Line Tool Version 16.11.0 Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... A total of 1 test files matched the specified pattern. [http://xUnit.net 00:00:00.80] tests.ProductTest.EnsureProviderApiHonoursPactWithConsumer [FAIL] Failed tests.ProductTest.EnsureProviderApiHonoursPactWithConsumer [237 ms] Error Message: PactNet.PactFailureException : The verification process failed, see output for errors Stack Trace: at PactNet.Native.NativePactVerifier.Verify(String args) in /Users/erikdanielsen/work/dius/pact-net/src/PactNet.Native/NativePactVerifier.cs:line 34 at PactNet.Native.PactVerifier.Verify() in /Users/erikdanielsen/work/dius/pact-net/src/PactNet.Native/PactVerifier.cs:line 240 at tests.ProductTest.EnsureProviderApiHonoursPactWithConsumer() in C:\westpac-dev\pact-workshop-dotnet-core-v3\Provider\tests\ProductTest.cs:line 46 Standard Output Messages: Invoking the pact verifier with args: --file C:\westpac-dev\pact-workshop-dotnet-core-v3\pacts\ApiClient-ProductService.json --state-change-url http://127.0.0.1:9001/provider-states --provider-name ProductService --hostname 127.0.0.1 --port 9001 --filter-consumer ApiClient --loglevel trace Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: < 1 ms - tests.dll (net5.0)


matt.fellows
2021-12-28 11:10
It will get fixed but is non trivial. If you can run it in a *nix terminal (e.g. cygwin or the new Linux subsystem terminal) it should work

mch
2021-12-28 12:54
has joined #pact-net

florian.becker_pact-s
2021-12-28 14:49
has joined #pact-net

oblique
2021-12-28 18:45
has joined #pact-net

smalladi
2021-12-28 19:22
has joined #pact-net

jordan.nazemi
2021-12-28 19:24
has joined #pact-net

gbhusari
2021-12-28 21:22
has joined #pact-net

pghosh
2021-12-28 21:23
has joined #pact-net

craiganthonyrichards
2021-12-28 23:52
Thanks for the suggestion. I just installed and ran the consumer tests via cygwin on Windows and could not see the Verifier Logs there either. From my understanding, you were expecting this to work. What else should I try? I'm not an expert on Docker but I could try and get the Provider running on Docker but this seams like a lot of work to get it going... Are there any Text logs written out that I could use for now? I am testing this out for a large scale Micro-service platform and would love to get a good result from my research. No pressure, but I love this solution and keen to get it going.

craiganthonyrichards
2021-12-28 23:57
I'm confused, https://github.com/pact-foundation/pact-net/issues/343 looks like it is closed? Has this been fixed or am I using an old package or something?

carlos.agullo
2021-12-29 08:46
has joined #pact-net

matt.fellows
2021-12-29 10:13
343 supercedes the closed one, which is what I think you saw as closed. The issue is definitely still open

matt.fellows
2021-12-29 10:13
The workshop was created and run on OSX but we know it doesn't print to stdout properly on Windows

matt.fellows
2021-12-29 10:15
I do think if you're using xunit you need to also use an additional formatter/outoutter (sorry I'm in holidays / mobile so don't have all of the relevant examples and links to hand, but the workshop should have it enabled. I also don't know .NET very well)

matt.fellows
2021-12-29 10:16
If you could please +1 or upvote the logging issue that will help with visibility

matt.fellows
2021-12-29 10:17
Docker should work, but I've not tested it. Hopefully that can get your POC going and then we can fix the issue before you scale out

matt.fellows
2021-12-29 10:18
I'm off until the 10th but drop us a line at if you want to setup a chat when I'm back

cyrus.devnomad
2021-12-29 14:15
has joined #pact-net

cyrus.devnomad
2021-12-29 14:18
Hello I'm new to pact. In the implementation guides for pact .net it is mentioned that PactNet is undergoing a large change in preparation for v4.0.0 major release with breaking changes. Is that major new version around the corner? Would it make sense to get introduced in the current PactNet version and go through the available workshops/examples or would it make more sense to wait for that major release at the current stage?

matt.fellows
2021-12-30 02:41
I'd start with the new v4 right away, if you can deal with the outstanding issue where verification output doesn't work very well on Windows. See the pinned issues

matt.fellows
2021-12-30 02:41
There is a new workshop for it also, you can find references in this channel if you look back at the history

cyrus.devnomad
2021-12-30 12:01
Hi Matt, thank you for your hints. Is this the workshop you are talking about? https://github.com/DiUS/pact-workshop-dotnet-core-v3/

muirandy
2021-12-30 17:57
has joined #pact-net

craiganthonyrichards
2021-12-31 01:34
I've been working through this new tutorial and it's good but no debug output certainly is a big downer. It would be good to see this tutorial cover pact broker and pact flow.

2021-12-31 22:43
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
2021-12-31 22:43
The cicd workshop is designed to teach you the pact broker/Pactflow integration. It's written in JS but the principles are the same for all languages

matt.fellows
2021-12-31 22:44
Most of the broker integration should be via CLI anyway

matt.fellows
2021-12-31 22:45
As for the debug output we'll obviously be fixing this, it won't be able to go GA without it. If you can workaround with docker in the meantime for the POC hopefully we can address before you roll it out any wider

cyrus.devnomad
2022-01-03 13:51
How is the step 10 of the workshop https://github.com/DiUS/pact-workshop-dotnet-core-v3/ supposed to work. Shoudn't the method AuthorizationMiddleware:Invoke() be called for the following interaction without token? { "description": "A valid request for a product", "providerStates": [ { "name": "No auth token is provided" } ], "request": { "method": "GET", "path": "/api/products/10" }, "response": { "status": 401 } } Because in my case this isn't happening

brocheleau
2022-01-03 21:23
@brocheleau has left the channel

craiganthonyrichards
2022-01-04 04:40
Hi All, I managed to get output from https://github.com/DiUS/pact-workshop-dotnet-core-v3.git by running in Docker Linux. It would appear that the Given statements are not being listed next to the test that they are for in the following output. Is this something that you are aware of or am I reading the output incorrectly? #9 121.0 Verifying a pact between ApiClient and ProductService #9 121.0 Given no products exist #9 121.1 Given product with ID 10 exists #9 121.2 Given product with ID 11 does not exist #9 121.2 Given product with ID 9 exists #9 121.2 Given products exist #9 121.2 A valid request for a product and none exist #9 121.2 returns a response which #9 121.2 has status code 200 (OK) #9 121.2 includes headers #9 121.2 "Content-Type" with value "application/json; charset=utf-8" (OK) #9 121.2 has a matching body (OK) #9 121.2 A valid request for product 10 #9 121.2 returns a response which #9 121.2 has status code 200 (OK) #9 121.2 includes headers #9 121.2 "Content-Type" with value "application/json; charset=utf-8" (OK) #9 121.2 has a matching body (OK) #9 121.2 A valid request for a product 11 that does not exist #9 121.2 returns a response which #9 121.2 has status code 404 (OK) #9 121.2 has a matching body (OK) #9 121.2 A valid request for product 9 #9 121.2 returns a response which #9 121.2 has status code 200 (OK) #9 121.2 includes headers #9 121.2 "Content-Type" with value "application/json; charset=utf-8" (OK) #9 121.2 has a matching body (OK) #9 121.2 A valid request for all products #9 121.2 returns a response which #9 121.2 has status code 200 (OK) #9 121.2 includes headers #9 121.2 "Content-Type" with value "application/json; charset=utf-8" (OK) #9 121.2 has a matching body (OK) #9 121.2 #9 121.2 #9 121.4 #9 121.4 Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: < 1 ms - /src/Provider/tests/bin/Debug/net5.0/tests.dll (net5.0)

matt.fellows
2022-01-04 06:07
Glad to hear output is coming back. As for those statements out of order that does seem strange. It might be that the shared core that is responsible for printing that out needs to be fixed or updated to latest

matt.fellows
2022-01-04 06:07
Cc @uglyog who may know more

uglyog
2022-01-04 06:10
:man-shrugging: It seems familiar, and may have already been fixed

uglyog
2022-01-04 06:10
Just needs to use an updated pact-ffi, I think

craiganthonyrichards
2022-01-04 06:21
Great and thanks for the fast reply, which package needs updating as I'm using the sample from GItHub

craiganthonyrichards
2022-01-04 06:25
Just looked at all my NuGet packages and there are no updates available.

uglyog
2022-01-04 06:25
Pact-Net needs to be updated

craiganthonyrichards
2022-01-04 06:32
PactNet has no updates available and I am currently on 4.0.0-beta The only other option was 4.0.0-438091 and this was a previous version.

uglyog
2022-01-04 06:40
Can you raise an issue to get the pact-ffi libs updated to the latest version?

matt.fellows
2022-01-04 14:08
Craig, Pact Net uses a shared library (pact ffi) which needs to be updated (by the maintainers), this should hopefully resolve the issue


bruno855
2022-01-05 06:04
Hi all,

bruno855
2022-01-05 06:05
I want to set a branch "master" on PactFlow for my provider side.   I use this API, but it doesn?t work   pactVerifier                .ProviderState($"{providerStateUriBase}/provider-states")                .ServiceProvider(providerName, providerUriBase)                .HonoursPactWith(consumerName)                .PactBroker(brokerBaseUri, pactUriOptions, false,                    new []{ "master", "uat" }, new [] { "master", "uat" },                    new List<VersionTagSelector>                    {                        new VersionTagSelector("uat", latest: true),                        new VersionTagSelector("test", latest: true),                        new VersionTagSelector("production")                    })                .Verify();     Have you any idea?

craiganthonyrichards
2022-01-05 06:14
~Hey Bruno, I'm newish to Pact. What is the repo you are using? I would like to test it out myself.~

craiganthonyrichards
2022-01-05 06:15
Hey Bruno, I'm newish to Pact. What is the repo you are using? I would like to test it out myself.

bruno855
2022-01-05 08:04
Hey Greig, I'm also newish, my repo is there : https://github.com/42skillz/Pact-Introduction

bruno855
2022-01-05 08:22
You have to use 'broker' branch

hocautomation
2022-01-05 09:54
has joined #pact-net


deepakdaga2007
2022-01-05 17:49
has joined #pact-net

tomas.hornak
2022-01-05 23:49
has joined #pact-net

juan.cruz
2022-01-06 02:44
has joined #pact-net

bruno855
2022-01-06 10:02
Hi Matt, I am currently using the latest version of pactnet.windows, ie 3.0.2. In this version the overload of PactBroker to pass the name of the branch is not available. Do you have any idea when a new version of the nuget package will be released with the new signature?

matt.fellows
2022-01-06 10:20
As per the link above, It looks like the change is in review. That should mean fairly soon I hope

marconota.mac
2022-01-06 10:30
has joined #pact-net

marconota.mac
2022-01-06 10:34
@marconota.mac has left the channel

bruno855
2022-01-06 11:28
Ok, thank you!

marta.rey-benito
2022-01-06 15:56
has joined #pact-net

fr4ngus
2022-01-06 16:20
has joined #pact-net

huhuang
2022-01-08 05:28
has joined #pact-net

frankfullstack
2022-01-09 20:33
has joined #pact-net

matt.fellows
2022-01-09 23:02
Hi Cyrus, I?m not sure I follow the question here. Can you please elaborate?

rochitsen
2022-01-10 06:36
Hi.. i am trying to publish my consumer pacts to pactflow. I have a basic account. Following the example on pactflow website, I run this to publish and get error: `System.UnauthorizedAccessException: 'Access to the path` which is the path on my system where the consumer pacts are generated after consumer tests are run. Has anyone else faced this issue? Any idea what am I doing wrong? ```var pactPublisher = new PactPublisher("http://<YOUR_BROKER>.http://pactflow.io", new PactUriOptions("<TOKEN>")); pactPublisher.PublishToBroker(Path.Combine(Directory.GetCurrentDirectory(), "pacts", "1.0.0");```

gkrawczyszyn
2022-01-10 06:51
has joined #pact-net

matt.fellows
2022-01-10 09:54
strange, is the directory readable?


bruno855
2022-01-10 11:47
Notice that:

bruno855
2022-01-10 11:47
var brokerUriOptions = new PactUriOptions(token).SetSslCaFilePath(AppendCodeDirBase(sslCaFile)); var pactPublisher = new PactPublisher(brokerBaseUri, brokerUriOptions);

bruno855
2022-01-10 11:49
You need to set a certificate.

tom.kelly
2022-01-10 15:05
has joined #pact-net

dave.sorenson
2022-01-10 15:51
has joined #pact-net

dikili
2022-01-10 16:46
on deciding whether something can be deployed to the environment without any issues so that no consumer contract is violated in the azure pipeline

dikili
2022-01-10 16:49
Can you help me with the easiest way possible to achieve below pls, I can set up the pipeline to execute tests but it does not really enable me to let me verify this on the pipeline at all ?

matt.fellows
2022-01-10 20:55
that?s what `can-i-deploy` is for - have you read up on that?

matt.fellows
2022-01-10 20:55
howtolearn

2022-01-10 20:55
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
2022-01-10 20:55
I?d also look at going through the CI/CD workshop in :point_up:

dikili
2022-01-10 23:07
thanks alot @matt.fellows , I have read a bit on `can-i-deploy` but found it a bit hard or confusing utilizing it but will have a look through the workshop too, thank you...

rochitsen
2022-01-10 23:50
@matt.fellows The directory is accessible and works with other code where I read the file located in that directory.

matt.fellows
2022-01-10 23:52
Shouldn?t need to set a certificate for Pactflow, our certificates are issued by AWS and are in most major SSL trust stores

matt.fellows
2022-01-10 23:52
I would personally not publish via that interface anyway, and just use our CLI tools

rochitsen
2022-01-10 23:52
@bruno855 Thanks for linking your example code. What I am trying to understand is why I need a ssl certificate to read the pacts located in my local system directory? Is that a requirement of the pact publisher?

matt.fellows
2022-01-10 23:53
no, you don?t need that

matt.fellows
2022-01-10 23:53
I think Bruno thought the problem was connecting to the broker, not reading the local file

rochitsen
2022-01-10 23:54
ah..ok. Makes sense.

matt.fellows
2022-01-10 23:54
it looks like you?re pointing to a directory, but I think it only accepts a file (looking at https://github.com/pact-foundation/pact-net/blob/master/PactNet/PactPublisher.cs)

matt.fellows
2022-01-10 23:54
the CLI lets you publish a file or a dir

matt.fellows
2022-01-10 23:55
I would avoid using that publisher altogether, and use the CLI as it supports newer features (like branches etc.)

rochitsen
2022-01-10 23:55
that could be it. Let me try that.


rochitsen
2022-01-11 01:01
@matt.fellows the file read issue is resolved. It was indeed missing the complete file uri with the file name. Regarding publishing to broker (pactflow) i guess it is a requirement to use a SSL certification? in case i am running broker locally i can publish without ssl certificate?

matt.fellows
2022-01-11 01:11
yes, so long as you?re not running the broker behind a self-signed certificate (i.e. run it on http not https).

matt.fellows
2022-01-11 01:11
why are you publishing locally?

rochitsen
2022-01-11 01:39
was just trying to run everything locally... to test out.

cyrus.devnomad
2022-01-11 09:36
Hi Matt I just wasn't able to complete step 10 of the workshop. Is there a completed version of the workshop to download and compare? I mean with the completed working source code? I suspect either I'm doing something wrong following the instructions of the workshop or the workshop is somehow outdated as compared to the version of the http://Pact.NET plugin I'm using. My problem is that my consumer generates a pact file that looks like this (I've commented out the test cases that are passing and left only the test case that is failing on provider side): { "consumer": { "name": "ApiClient" }, "interactions": [ { "description": "A valid request for a product", "providerStates": [ { "name": "No auth token is provided" } ], "request": { "method": "GET", "path": "/api/products/10" }, "response": { "status": 401 } } ], "metadata": { "pactRust": { "version": "0.9.5" }, "pactSpecification": { "version": "3.0.0" } }, "provider": { "name": "ProductService" } } When I run the provider with this pact file it fails at pactVerifier...Verfiy(). And while it is failing the method AutorizationMiddleware:Invoke() is never called which I suspect is required for the provider test to work. Thanks

cyrus.devnomad
2022-01-11 10:32
Hi, I've tried to implement an Azure DevOps based CI/CD solution with http://Pact.NET. I've tried to use the same approach as described by the Node based workshop https://docs.pactflow.io/docs/workshops/ci-cd/ My consumer-Build and my provider-Build pipelines seem to work. But my provider-Verify-changed-pact pipeline which is triggered from the PactFlow webhook runs into a PactNet.PactFailureExpection with the following error: 1) Failed to load pact - Could not load pacts from the pact broker 'https://xxxxxx.pactflow.io/pacts/provider/ProductService/consumer/ApiClient/pact-version/*************************************/metadata/*****************************************' - LinkError("Link \'pb:provider-pacts-for-verification\' was not found in the response, only the following links where found: \"curies, pb:all-pact-versions, pb:consumer, pb:consumer-version, pb:consumer-versions, pb:consumer-webhooks, pb:diff, pb:diff-previous-distinct, pb:latest-pact-version, pb:latest-tagged-pact-version, pb:latest-untagged-pact-version, pb:latest-verification-results, pb:matrix-for-consumer-version, pb:pact-version, pb:pact-webhooks, pb:previous-distinct, pb:provider, pb:publish-verification-results, pb:tag-prod-version, pb:tag-version, pb:triggered-webhooks, self\". URL: \'https://xxxxxx.pactflow.io/pacts/provider/ProductService/consumer/ApiClient/pact-version/*************************************/metadata/*****************************************\', LINK: \'pb:provider-pacts-for-verification\'") Here is how I am using the pact.Verfiy() method: //Act / Assert IPactVerifier pactVerifier = new PactVerifier(config); var tmpPactUrl = Environment.GetEnvironmentVariable("PACT_URL"); var tmpProviderVersion = Environment.GetEnvironmentVariable("GIT_COMMIT"); Console.WriteLine($"PACT_URL: {tmpPactUrl}"); Console.WriteLine($"GIT_BRANCH: {Environment.GetEnvironmentVariable("GIT_BRANCH")}"); Console.WriteLine($"GIT_COMMIT: {tmpProviderVersion}"); var tmpProviderVersionTags = (Environment.GetEnvironmentVariable("GIT_BRANCH") != null) ? new List<string> { Environment.GetEnvironmentVariable("GIT_BRANCH") } : new List<string>(); Uri brokerBaseUri = new Uri("https://xxxxxx.pactflow.io/"); PactUriOptions uriOptions = new PactUriOptions("****************"); bool enablePending = true; //the old way of specifying which pacts to verify var tmpVersionTags = new List<string>(); tmpVersionTags.Add(Environment.GetEnvironmentVariable("GIT_BRANCH")); tmpVersionTags.Add("prod"); // the new way of specifying which pacts to verify // consumerVersionSelectors:[{ tag: 'master', latest: true }, { deployed: true } ], IPactVerifier tmpPactVerifier; if (tmpPactUrl != null) { // For builds triggered by a 'contract content changed' webhook, // just verify the changed pact. The URL will bave been passed in // from the webhook to the CI job. Console.WriteLine("PACT_URL != null"); Uri tmpPactUri = new Uri(tmpPactUrl); tmpPactVerifier = pactVerifier.FromPactBroker(tmpPactUri, uriOptions); } else { // For 'normal' provider builds, fetch `master` and `prod` pacts for this provider Console.WriteLine("PACT_URL: == null"); IEnumerable<string> consumerVersionTags = tmpVersionTags; string includeWipPactSince = "2020-01-01"; tmpPactVerifier = pactVerifier.FromPactBroker(brokerBaseUri, uriOptions, enablePending, consumerVersionTags, includeWipPactSince); } tmpPactVerifier = tmpPactVerifier.WithProviderStateUrl(new Uri($"{_pactServiceUri}/provider-states")) .ServiceProvider("ProductService", new Uri(_pactServiceUri)) .HonoursPactWith("ApiClient").WithPublishedResults(tmpProviderVersion, tmpProviderVersionTags); tmpPactVerifier.Verify(); What am I doing wrong here? Thanks

cyrus.devnomad
2022-01-11 10:49
Hi Here is how I am trying to use the can-i-deploy feature in my azure devops consumer pipeline: - bash: | docker pull pactfoundation/pact-cli:latest $(PACT_CLI) broker can-i-deploy --pacticipant "ApiClient" --version ${GIT_COMMIT} --to-environment production --retry-while-unknown 0 --retry-interval 10 --broker-base-url "https://xxxxxx.pactflow.io/" --broker-token "****************" displayName: 'Can I deploy?' Beware that the pactfoundation/pact-cli docker image runs only on ubuntu-latest agent and not on windows latest agent. So you might require both in your pipeline, a windows agent for build and test and an ubuntu agent for pact-publish and can-i-deploy (which require the pact docker image) and deploy.

dikili
2022-01-11 11:08
thank you @cyrus.devnomad , this is very useful if I do have some queries or problems whilst and during the implementation of this in the azure pipeline , can I ask you ?

cyrus.devnomad
2022-01-11 12:28
Yes, you can but you have to take my answers with a grain of salt because I myself am very new to Pact and http://Pact.NET and not very confident about what I am doing with it.

matt.fellows
2022-01-11 12:36
in the first clase, you want to use the `.PactUri("http://pact-broker/pacts/provider/Something%20Api/consumer/Consumer/latest")` variant of fetching files, not the `FromPactBroker(?)` variant

matt.fellows
2022-01-11 12:37
the latter tries to discover pacts, but you have the pact to verify, so just give it the one you need to verify

matt.fellows
2022-01-11 12:37
it?s failing, because you?re giving it the URL of a *pact file* not the URL of your broker entrypoint `/`

cyrus.devnomad
2022-01-11 14:15
Message moved to the answers

cyrus.devnomad
2022-01-11 14:23
Is my first case not equivalent to the first case of the following code from the node pact workshop? I mean pactUrls: [process.env.PACT_URL] in the code below? Is process.env.PACT_URL equivalent to "http://pact-broker/pacts/provider/Something%20Api/consumer/Consumer/latest" you mentioned? And did you mean .FromPactUri() instead of FromPactBroker() ? describe("Pact Verification", () => {   it("validates the expectations of ProductService", () => {     console.log(`MyTestMessage: process.env.GIT_COMMIT: ${process.env.GIT_COMMIT}`)     console.log(`MyTestMessage: process.env.GIT_BRANCH: ${process.env.GIT_BRANCH}`)     console.log(`MyTestMessage: process.env.PACT_URL: ${process.env.PACT_URL}`)     const baseOpts = {       logLevel: "INFO",       providerBaseUrl: "http://localhost:8080",       providerVersion: process.env.GIT_COMMIT,       providerVersionTags: process.env.GIT_BRANCH ? [process.env.GIT_BRANCH] : [],       verbose: process.env.VERBOSE === 'true'     }     // For builds triggered by a 'contract content changed' webhook,     // just verify the changed pact. The URL will bave been passed in     // from the webhook to the CI job.     const pactChangedOpts = {       pactUrls: [process.env.PACT_URL]     }     console.log("MyTestMessage")     // For 'normal' provider builds, fetch `master` and `prod` pacts for this provider     const fetchPactsDynamicallyOpts = {       provider: "pactflow-example-provider",       //consumerVersionTag: ['master', 'prod'], //the old way of specifying which pacts to verify       consumerVersionSelectors: [{ tag: 'master', latest: true }, { deployed: true } ], // the new way of specifying which pacts to verify       pactBrokerUrl: process.env.PACT_BROKER_BASE_URL,       enablePending: true,       includeWipPactsSince: "2020-01-01"     }     const stateHandlers = {       "products exists": () => {         controller.repository.products = new Map([           ["10", new Product("09", "CREDIT_CARD", "Gem Visa", "v1", "green")],           ["10", new Product("10", "CREDIT_CARD", "28 Degrees", "v1", "red")]         ]);       },       "products exist": () => {         controller.repository.products = new Map([           ["10", new Product("10", "CREDIT_CARD", "28 Degrees", "v1", "red")]         ]);       },       "a product with ID 10 exists": () => {         controller.repository.products = new Map([           ["10", new Product("10", "CREDIT_CARD", "28 Degrees", "v1", "red")]         ]);       },       "a product with ID 11 does not exist": () => {         controller.repository.products = new Map();       }     }     const requestFilter = (req, res, next) => {       if (!req.headers["authorization"]) {         next();         return;       }       req.headers["authorization"] = `Bearer ${new Date().toISOString()}`;       next();     }     console.log(`MyTestMessage: process.env.PACT_URL: ${process.env.PACT_URL}`)     const opts = {       ...baseOpts,       ...(process.env.PACT_URL ? pactChangedOpts : fetchPactsDynamicallyOpts),       stateHandlers: stateHandlers,       requestFilter: requestFilter     };     return new Verifier(opts).verifyProvider()       .then(output => {         console.log("Pact Verification Complete!")         console.log(output)       })       .finally(() => {         console.log("server.close() call will publish the test results!")         server.close();       });   })

cyrus.devnomad
2022-01-11 14:29
You spoke about the two cases. Are both cases supposed to involve the URL of my broker entrypoint? I mean in the node pact workshop you have two cases, one with const pactChangedOpts = {       pactUrls: [process.env.PACT_URL]     } and the other one with // For 'normal' provider builds, fetch `master` and `prod` pacts for this provider     const fetchPactsDynamicallyOpts = {       provider: "pactflow-example-provider",       //consumerVersionTag: ['master', 'prod'], //the old way of specifying which pacts to verify       consumerVersionSelectors: [{ tag: 'master', latest: true }, { deployed: true } ], // the new way of specifying which pacts to verify       pactBrokerUrl: process.env.PACT_BROKER_BASE_URL,       enablePending: true,       includeWipPactsSince: "2020-01-01"     } Are both pactUrls: [process.env.PACT_URL] and pactBrokerUrl: process.env.PACT_BROKER_BASE_URL the entrypoints of the pact broker?

dikili
2022-01-11 14:55
no probs on the testing with pact, I have made some progress which I can also try to help and potentially we can pair on things too ,

dikili
2022-01-11 14:58
I also have .PactBroker("pactbrokerurl") in my provider tests to work, I dont see this in your code, this might help you @cyrus.devnomad

dikili
2022-01-11 14:58
this is after .HonoursPactWith("")

cyrus.devnomad
2022-01-11 15:07
Thats great thanks

cyrus.devnomad
2022-01-11 15:17
Thanks for the hit, but my PactVerifier object does not offer me any method called .PactBroker(). I have .FromPackUri(), .FromPactBroker(), .FromPactFile(), .., but no .PactBroker() method ?

dikili
2022-01-11 15:18
weird, mine does as below; `IPactVerifier pactVerifier = new PactVerifier(config);` `pactVerifier`

cyrus.devnomad
2022-01-11 15:19
Perhaps you mean .FromPactBroker() ?

dikili
2022-01-11 15:47
nope I dont mean that, I mean .PactBroker



dikili
2022-01-11 15:48
you can check the usage here as .PactBroker

dikili
2022-01-11 15:48
and not .FromPactBroker

cyrus.devnomad
2022-01-11 16:11
Aha, I think you are using the most recent stable version 3.0.2. I'm using the version 4.0.0-beta. I'm using the newer beta version because according to implementation guides PactNet is undergoing a large change in preparation for v4.0.0 major release with breaking changes. That was also the recommendation of Matt for new projects.

gianni.araco
2022-01-11 16:13
has joined #pact-net

dikili
2022-01-11 16:14
ahh, I see i wish as part of the changes hope they will make it easier to verify contracts without the cli etc.. but something which will feel more natural but this is a wish atm. :slightly_smiling_face:

cyrus.devnomad
2022-01-11 16:18
Yes, maybe they have plans in that direction. Lets wait and see...

anu.johar
2022-01-11 20:25
has joined #pact-net

matt.fellows
2022-01-12 00:02
hmm I?m not sure I?m afraid, migth be worth raising an issue against the workshop? It?s possible that it?s out of date now given it?s a beta package

matt.fellows
2022-01-12 00:05
no, in the JS code `pactUrls` accepts a list of URLs to pacts (they may be in a Pact broker or they may be hosted on any HTTP endpoint). It expects to receive a JSON object that looks like a pact file

matt.fellows
2022-01-12 00:05
`pactBrokerUrl` accepts the root API resource of a broker, which has hypermedia links the verifier can use to discover dynamically pacts

matt.fellows
2022-01-12 00:12
> Is my first case not equivalent to the first case of the following code from the node pact workshop? I mean pactUrls: [process.env.PACT_URL] in the code below? Is process.env.PACT_URL equivalent to ?http://pact-broker/pacts/provider/Something%20Api/consumer/Consumer/latest? you mentioned? It is, but you are passing through an absolute path to a pact file (which is a JSON blob containing a pact file) to a method that?s expecting the entrypoint to a hypermedia API that dynamically discovers pacts. > And did you mean .FromPactUri() instead of FromPactBroker() ? Maybe. I can?t see that method in the Pact .NET project but perhaps that?s what it is in the v4 branch? In any case, it?s a different method

cyrus.devnomad
2022-01-12 06:56
I have changed my code as follows now: IPactVerifier tmpPactVerifier; if (tmpPactUrl != null) { // For builds triggered by a 'contract content changed' webhook, // just verify the changed pact. The URL will bave been passed in // from the webhook to the CI job. Console.WriteLine("PACT_URL != null"); Console.WriteLine($"tmpPactUrl: {tmpPactUrl}"); Uri tmpPactUri = new Uri(tmpPactUrl, UriKind.Absolute); tmpPactVerifier = pactVerifier.FromPactUri(tmpPactUri); } else { // For 'normal' provider builds, fetch `master` and `prod` pacts for this provider Console.WriteLine("PACT_URL: == null"); Console.WriteLine($"brokerBaseUri: {brokerBaseUri}"); IEnumerable<string> consumerVersionTags = tmpVersionTags; string includeWipPactSince = "2020-01-01"; tmpPactVerifier = pactVerifier.FromPactBroker(brokerBaseUri, uriOptions, enablePending, consumerVersionTags, includeWipPactSince); } tmpPactVerifier = tmpPactVerifier .WithProviderStateUrl(new Uri($"{_pactServiceUri}/provider-states")) .ServiceProvider("ProductService", new Uri(_pactServiceUri)) .HonoursPactWith("ApiClient") .WithPublishedResults(tmpProviderVersion, tmpProviderVersionTags); tmpPactVerifier.Verify(); and now when the provider pipeline is running and the else path with pactVerifier.FromPactBroker() is executed the following URL is passed and everything works fine: https://xxxxx.pactflow.io/ But if the verify pact changed pipeline is triggered from PactFlow webhook and the if path with pactVerifier.FromPactUri() is executed the following URL is passed to Uri tmpPactUri = new Uri(tmpPactUrl, UriKind.Absolute) and I get the error message further down bellow: https://xxxxx.pactflow.io/pacts/provider/ProductService/consumer/ApiClient/pact-version/xxxxxxxxxx/metadata/xxxxxxxxxxxxxxxxxxxxxx I get the following error message: PactNet.PactFailureException : Invalid arguments were provided to the verification process Stack Trace: at PactNet.Native.NativePactVerifier.Verify(String args) in /Users/erikdanielsen/work/dius/pact-net/src/PactNet.Native/NativePactVerifier.cs:line 42 at PactNet.Native.PactVerifier.Verify() in /Users/erikdanielsen/work/dius/pact-net/src/PactNet.Native/PactVerifier.cs:line 240 at tests.ProductTest.EnsureProviderApiHonoursPactWithConsumer() in D:\a\1\s\tests\ProductTest.cs:line 98 Standard Output Messages: Invoking the pact verifier with args: --url https://xxxxxx.pactflow.io/pacts/provider/ProductService/consumer/ApiClient/pact-version/xxxxxxxxxxxxxxxxxxxxxxxxx/metadata/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --state-change-url http://127.0.0.1:9001/provider-states --provider-name ProductService --hostname 127.0.0.1 --port 9001 --filter-consumer ApiClient --publish --provider-version a007431a90c7ad8228ab861d49d247ae291c8aaf --provider-tags master --loglevel trace Is this again a problem with the URLs and methods used here or something else? Do you have any hints?

matt.fellows
2022-01-12 07:09
Ah, I see you?re using the native. Sorry, lots of conversations and hard to keep track

matt.fellows
2022-01-12 07:10
Because it?s windows and is swalling the errors, I?ve tried punching those arguments into the verifier CLI directly. it _looks_ like it still needs the `--broker-url` argument, even if a `--url` is provided. This seems like a bug in the verifier

matt.fellows
2022-01-12 07:10
Could you please raise a bug at https://github.com/pact-foundation/pact-reference/ to get that fixed?

matt.fellows
2022-01-12 07:11
in the meantime, you might be able to somehow specify the broker URL in addition to the URI

cyrus.devnomad
2022-01-12 07:41
Ok, it seems to work now. I've changed my code as follows to provide the --broker-url argument as you mentioned above and now it seems to work and no exception is thrown when the if path is executed: IPactVerifier tmpPactVerifier; if (tmpPactUrl != null) { // For builds triggered by a 'contract content changed' webhook, // just verify the changed pact. The URL will bave been passed in // from the webhook to the CI job. Console.WriteLine("PACT_URL != null"); Console.WriteLine($"tmpPactUrl: {tmpPactUrl}"); Uri tmpPactUri = new Uri(tmpPactUrl, UriKind.Absolute); tmpPactVerifier = pactVerifier.FromPactUri(tmpPactUri); *// This method has to still be called because of the bug xxxxx* *tmpPactVerifier = pactVerifier.FromPactBroker(brokerBaseUri, uriOptions);* } else { // For 'normal' provider builds, fetch `master` and `prod` pacts for this provider Console.WriteLine("PACT_URL: == null"); Console.WriteLine($"brokerBaseUri: {brokerBaseUri}"); IEnumerable<string> consumerVersionTags = tmpVersionTags; string includeWipPactSince = "2020-01-01"; tmpPactVerifier = pactVerifier.FromPactBroker(brokerBaseUri, uriOptions, enablePending, consumerVersionTags, includeWipPactSince); } tmpPactVerifier = tmpPactVerifier .WithProviderStateUrl(new Uri($"{_pactServiceUri}/provider-states")) .ServiceProvider("ProductService", new Uri(_pactServiceUri)) .HonoursPactWith("ApiClient") .WithPublishedResults(tmpProviderVersion, tmpProviderVersionTags); tmpPactVerifier.Verify(); I'll raise a bug as you asked. Thanks a lot

yann.danot
2022-01-12 10:15
has joined #pact-net

cyrus.devnomad
2022-01-12 11:11
Hi I'm able to have a successful verification with my code below but the pact on Pactflow server is not updated despite setting the environment variable PACT_BROKER_PUBLISH_VERIFICATION_RESULTS to true. ... Uri tmpPactUri = new Uri(tmpPactUrl, UriKind.Absolute); tmpPactVerifier = pactVerifier.FromPactUri(tmpPactUri); // This method has to still be called because of the issue https://github.com/pact-foundation/pact-reference/issues/169 tmpPactVerifier = pactVerifier.FromPactBroker(brokerBaseUri, uriOptions); ... tmpPactVerifier = tmpPactVerifier .WithProviderStateUrl(new Uri($"{_pactServiceUri}/provider-states")) .ServiceProvider("ProductService", new Uri(_pactServiceUri)) .HonoursPactWith("ApiClient") .WithPublishedResults(tmpProviderVersion, tmpProviderVersionTags); tmpPactVerifier.Verify(); Is something more required for the .Verfiy() method to publish the result of the verification to Pactflow server?

matt.fellows
2022-01-12 11:15
That environment variable has no effect at this moment, the underlying library needs the `--publish` argument

matt.fellows
2022-01-12 11:16
is there a method to enable that?


matt.fellows
2022-01-12 11:17
:point_up:

gianni.araco
2022-01-12 11:46
Hi! I'm trying to set up a test, following the guidelines. The test passes, and the `PactBuilder.Build();` method is hit, but no contract is generated in the `D:\Temp\Pacts` folder, while the log is. Any insight? It's configured as follows: ``` public ConsumerPactFixture() { // Using Spec version 2.0.0 more details at https://goo.gl/UrBSRc var pactConfig = new PactConfig { SpecificationVersion = "2.0.0", PactDir = @"d:\temp\pacts", LogDir = @"d:\temp\pact_logs" }; PactBuilder = new PactBuilder(pactConfig); PactBuilder.ServiceConsumer("OperatorClient") .HasPactWith("DcpCoreApi"); MockProviderService = PactBuilder.MockService(MockServerPort); }```

matt.fellows
2022-01-12 11:52
what does the log say?

gianni.araco
2022-01-12 11:54
```I, [2022-01-12T11:53:45.876971 #42320] INFO -- : Cleared interactions for example "" I, [2022-01-12T11:53:46.016019 #42320] INFO -- : Registered expected interaction GET v1/operator/{operatorGuid} D, [2022-01-12T11:53:46.016019 #42320] DEBUG -- : { "description": "A request to GET an operator", "providerState": "An operator exist", "request": { "method": "get", "path": "v1/operator/{operatorGuid}" }, "response": { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "profile": { "name": "LHQ George Admin" } } }, "metadata": null } I, [2022-01-12T11:53:46.062018 #42320] INFO -- : Cleared interactions for example ""```

matt.fellows
2022-01-12 11:55
looks like you?re missing the lifecycle hook that writes the pact itself

gianni.araco
2022-01-12 11:56
This is the fixture class: ```using System; using Xunit; using PactNet; using PactNet.Mocks.MockHttpService; using Moq; using Microsoft.Extensions.Options; using DcpFormService.Configuration; using System.Collections.Generic; using Newtonsoft.Json.Linq; namespace DcpFormService.ContractTests { // This class is responsible for setting up a shared // mock server for Pact used by all the tests. // XUnit can use a Class Fixture for this. // See: https://goo.gl/hSq4nv public class ConsumerPactFixture : IDisposable { public IPactBuilder PactBuilder { get; private set; } public IMockProviderService MockProviderService { get; private set; } public int MockServerPort { get { return 5005; } } public ConsumerPactFixture() { // Using Spec version 2.0.0 more details at https://goo.gl/UrBSRc var pactConfig = new PactConfig { SpecificationVersion = "2.0.0", PactDir = @"d:\temp\pacts", LogDir = @"d:\temp\pact_logs" }; PactBuilder = new PactBuilder(pactConfig); PactBuilder.ServiceConsumer("OperatorClient") .HasPactWith("DcpCoreApi"); MockProviderService = PactBuilder.MockService(MockServerPort); } private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // This will save the pact file once finished. PactBuilder.Build(); } disposedValue = true; } } // This code added to correctly implement the disposable pattern. public void Dispose() { // Do not change this code. Put cleanup code in Dispose(bool disposing) above. Dispose(true); } } }```

matt.fellows
2022-01-12 11:56
I?d add some logging in that dispose function to see if it?s called, my guess is that it?s not (I don?t know .NET, but I?ve seen this problem before, and it?s because that function is not called)

gianni.araco
2022-01-12 11:57
I put a breakpoint, and it's hit

gianni.araco
2022-01-12 11:59
Might it depend on the definition of the body, in the test itself? ``` Body = new { profile = new { name = "LHQ George Admin" } }``` Because the call it's actually returning a much more complex JSON, though I'm only interested in that specific field

matt.fellows
2022-01-12 12:52
I'd enable debug level logging in your test process so we can see the output of the mock service that it's communicating too. It should print out what's happening. I don't know how to do that in Pact NET but should be doable

matt.fellows
2022-01-12 12:52
It shouldn't, so long as the test passes

gianni.araco
2022-01-12 13:35
Thanks Matt, I'll do some research in that direction

cyrus.devnomad
2022-01-12 14:56
Isn't .WithPublishedResults() the method you mean? If yes, I'm already using it (see code below), but my pact on Pactflow ist not updated with verification results: ```pactVerifier = pactVerifier.FromPactUri(tmpPactUri); ... // This method has to still be called because of the bug https://github.com/pact-foundation/pact-reference/issues/169 pactVerifier = pactVerifier.FromPactBroker(brokerBaseUri, uriOptions); ... pactVerifier.WithProviderStateUrl(new Uri($"{_pactServiceUri}/provider-states")) .ServiceProvider("ProductService", new Uri(_pactServiceUri)) .HonoursPactWith("ApiClient") .WithPublishedResults(tmpProviderVersion, tmpProviderVersionTags) .Verify();```

matt.fellows
2022-01-12 21:45
I think the workshop is running an old version, hence why the methods don't align. I'd be sticking to the latest in the v4 branch as I linked earlier just in case

hsanghavi
2022-01-13 00:57
has joined #pact-net

vejeta
2022-01-13 03:19
has joined #pact-net

cyrus.devnomad
2022-01-13 07:16
Do I understand it correctly: I am trying to use the PactNet V4.0.0Beta master version which is available as nuget package and I should be using the PactNet V4.0.0Beta feature branch version from the GitHub link you referred instead? Should I donwload that project from your GitHub link and try to include it in my project instead of the Nuget package I am using?

gianni.araco
2022-01-13 11:20
Hi Matt. I've done a bit of progress. I added `mockProviderService.VerifyInteractions();` and it's now complaining with this error: ```Message:? PactNet.PactFailureException : Actual interactions do not match expected interactions for mock MockService. Missing requests: GET /v1/operator/4ca901bb-b1f2-406a-b51a-d4369b11a6ce``` The test is defined as follows: ``` using System; using System.Collections.Generic; using http://System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Cera.Framework.Core.Hosting.Abstractions; using FluentAssertions; using Moq; using Moq.Protected; using Newtonsoft.Json.Linq; using PactNet.Mocks.MockHttpService; using PactNet.Mocks.MockHttpService.Models; using Xunit; namespace DcpFormService.ContractTests.Business { public class OperatorClientTests : IClassFixture<ConsumerPactFixture> { private readonly Mock<IScopedCancellationToken> scopedCancellationTokenMock; private readonly Mock<IHttpClientFactory> httpClientFactoryMock; private readonly Uri baseUri; private readonly IMockProviderService mockProviderService; private readonly Guid operatorGuid = new Guid("4ca901bb-b1f2-406a-b51a-d4369b11a6ce"); public OperatorClientTests(ConsumerPactFixture fixture) { mockProviderService = fixture.MockProviderService; mockProviderService.ClearInteractions(); //NOTE: Clears any previously registered interactions before the test is run scopedCancellationTokenMock = new Mock<IScopedCancellationToken>(); scopedCancellationTokenMock .Setup(x => x.Token) .Returns(null); var mockHttpMessageHandler = new Mock<HttpMessageHandler>(); mockHttpMessageHandler.Protected() .Setup<Task<HttpResponseMessage>>("SendAsync", ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>()) .ReturnsAsync(new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(GetContentString()), }); httpClientFactoryMock = new Mock<IHttpClientFactory>(); var client = new HttpClient(mockHttpMessageHandler.Object); httpClientFactoryMock.Setup(_ => _.CreateClient(It.IsAny<string>())).Returns(client); baseUri = new Uri($"http://localhost:{fixture.MockServerPort}"); } [Fact] [Trait("Category", "Contract Test")] [Trait("Category", "OperatorClient")] public async void GetOperatorFromDCP() { // Arrange mockProviderService .Given("An operator exist") .UponReceiving("A request to GET an operator") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = $"/v1/operator/{operatorGuid}", Query = "" }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary<string, object>() { { "Content-Type", "text/plain; charset=utf-8" } }, Body = GetContentString() //Body = new //{ // profile = new // { // name = "LHQ George Admin" // } //} }); // Act using var client = httpClientFactoryMock.Object.CreateM2MClient(); client.BaseAddress = baseUri; var requestUri = new Uri($"v1/operator/{operatorGuid}", UriKind.Relative); var response = await client.GetAsync(requestUri, scopedCancellationTokenMock.Object.Token); var resultBodyText = await response.Content.ReadAsStringAsync(); // Assert var jObj = JObject.Parse(resultBodyText); var name = (string)jObj["profile"]["name"]; resultBodyText.Should().NotBeNull(); name.Should().Be("LHQ George Admin"); mockProviderService.VerifyInteractions(); } private string GetContentString() { OMITTED FOR SECURITY REASONS return @"{...}"; } } }``` I've tried several combinations of the `Path` parameter, but without any success. Any idea?

matt.fellows
2022-01-13 11:20
I think that Nuget package for the workshop was a point in time package, not the latest. I suspect (but don?t know for sure) that anybody using the beta at the moment is producing their own artifacts until we start publishing them

matt.fellows
2022-01-13 11:21
If you can point at github directly, then even easier

cyrus.devnomad
2022-01-13 11:58
I managed to integrate the github version from your reference into my test project, but the code for provider verification using pact broker is so different that I cannot figure out how to implement it. Is there any example showing how the provider verification involving pact broker could look like? I can't find any example for this.

gianni.araco
2022-01-13 13:37
Just FYI, I got to the bottom of this. The issue was the mocked HTTP client. Now I have my contract file! :slightly_smiling_face:

sweeneyrichard2
2022-01-13 15:43
has joined #pact-net

thuvu.se
2022-01-14 05:51
has joined #pact-net

thuvu.se
2022-01-14 06:03
Happy New Year to all, thanks Matt for guiding me here. I am using Pact Net with TeamCity, add a separated build step for Pact Test, but not sure which command should be use? (the existing command msbuild works for other NUnit test but it ignore the Pact Test with Xunit) Please let me know if you have any experience with this??? Thank you :slightly_smiling_face:

rahul.meher
2022-01-14 09:02
has joined #pact-net

gavin.campbell
2022-01-14 17:31
has joined #pact-net

davideliu
2022-01-14 17:52
has joined #pact-net

cyrus.devnomad
2022-01-14 18:49
Hi I'm trying to get http://Pact.NET 4.0.0 beta (October 2021 version) working on Azure Devops CI/CD. I'm stuck in trying to publish the verification results for provider. Here is my code: ``` var pactVerifierProvider = pactVerifier.ServiceProvider("ProductService", new Uri(_pactServiceUri)); IPactVerifierSource pactVerifierSource; if (tmpPactUrl != null) { // For builds triggered by a 'contract content changed' webhook, // just verify the changed pact. The URL will bave been passed in // from the webhook to the CI job. Uri tmpPactUri = new Uri(tmpPactUrl, UriKind.Absolute); pactVerifierSource = pactVerifierProvider.WithUriSource(tmpPactUri); } else { // For 'normal' provider builds, fetch `master` and `prod` pacts for this provider pactVerifierSource = pactVerifierProvider.WithPactBrokerSource(brokerBaseUri, inOption => { inOption.TokenAuthentication("GHnhHELr_NDGjfDPfjLlCg"); if (enablePending) { inOption.EnablePending(); } inOption.ConsumerTags(tmpConsumerVersionTags); inOption.IncludeWipPactsSince(DateTime.Parse("2020-01-01")); inOption.PublishResults(tmpProviderVersion, tmpProviderVersionTags); }); } pactVerifierSource.Verify();``` The if path should be executed when the test was started by the webhook pipeline (pact change verification pipeline). The else path should be executed by the provider pipeline. The if path does not work because I have no idea on how to provide the token without using .WithPactBrokerSource() The else path works as far as the tests are concerned but the results are not published to Pactflw. What is wrong/missing with my code?

pavlo.sprogis
2022-01-16 17:15
has joined #pact-net

dikili
2022-01-16 20:35
For provider projectf and for earlier versions there is a property named 'PublishVerificationResults' which you set it up like; PublishVerificationResults = true, (inside a pactVerifierConfig class) for it to publish the verification results, I could not see this in your code and wonder if it is something not needed in v4 any more or you unknowingly did not include this which might be the root cause of your issue ?

dikili
2022-01-16 20:36
another approach you can follow temporarily as a last resort and until you find the solution for v4, for provider project only you can downgrade to 3.2.0 .net ?

jbrady
2022-01-16 21:54
has joined #pact-net

johnathan
2022-01-17 04:42
has joined #pact-net

cyrus.devnomad
2022-01-17 07:23
Thank you for your inputs. The closest thing I can find in the 4.0.0 Code to the code "PublishVerificationResults = true, (inside a pactVerifierConfig class)" for the older version you mentioned, is the method "inOption.PublishResults(tmpProviderVersion, tmpProviderVersionTags)" which I'm using to no effect. In the new version there is a PactVerifierConfig class but it is pretty empty and has no property comparable to the property PublishVerificationResults you mentioned. The idea to downgrade to 3.2.0 is something I might have to consider, if there is no further information on how to implement an example for 4.0.0.

dimakos.neoklis
2022-01-17 15:04
has joined #pact-net

gueorgui
2022-01-17 16:43
has joined #pact-net

marcbetts
2022-01-17 22:35
has joined #pact-net

lambat.ishanya
2022-01-18 05:10
has joined #pact-net

sprathi
2022-01-18 13:40
has joined #pact-net

emanuela.ceuta
2022-01-18 16:25
has joined #pact-net

chaugule.sandeep
2022-01-19 05:00
has joined #pact-net

ajay.kawde
2022-01-19 13:34
has joined #pact-net

christopher.mcewen
2022-01-19 15:47
Hi :wave: I work for a fintech in London and looking to adopt PACT and utilize Pactflow into our development process. I've noticed that you're currently working on releasing version 4 for dotnet which brings some changes we are really excited about! Do you have an eta on the `feature/4.0.0` changes?

mch
2022-01-19 21:08
Hello, I'm trying to use 4.0.0-beta version. I added the source https://pactfoundation.jfrog.io/artifactory/api/nuget/v3/default-nuget-local, but the package from there has no PactVerifier class, only IPactVerifier interface. Could you please help?

liam.chen
2022-01-19 21:19
has joined #pact-net

matt.fellows
2022-01-19 21:20
Hi! That package was uploaded specifically for the dotnet workshop the version is pinned to, so yes it?s out of date (also, sadly, JFrog doesn?t seem to offer free hosting for OSS projects anymore)

matt.fellows
2022-01-19 21:21
I really think we should be publishing beta packages to the nuget gallery alongside the current project

matt.fellows
2022-01-19 21:21
@pact544 @yann.courtel any reason why we shouldn?t be doing that?

pact544
2022-01-19 21:22
I think once we've moved the verifier over to the new handles approach and got the logging working, we should release a beta to http://nuget.org, yes.

mch
2022-01-19 21:33
Ok, thanks for the info. Any ETA?

taylor.phillips01
2022-01-19 21:45
has joined #pact-net

sandeepa.kv
2022-01-20 06:46
has joined #pact-net

bruno855
2022-01-20 08:31
Do you plan PACT support for AWS Simple Queue Service (SQS) and, more specifically, in .NET?

matt.fellows
2022-01-20 10:10
@bethskurrie see the 4.x.x branch referenced above (and the working branch in the Pact .NET repository). Support for _message pac_t _(_async) would cover testing services like SQS/SNS/Kinesis/Kafka/Rabbit/?

matt.fellows
2022-01-20 10:10
I don?t believe there is an ETA, but the remaining outstanding issue regarding logging now has a solution (see https://github.com/pact-foundation/pact-net/issues/343)

matt.fellows
2022-01-20 10:11
> I think once we?ve moved the verifier over to the new handles approach and got the logging working, we should release a beta to http://nuget.org, yes. Personally I see no reason to wait, so long as people are aware of the logging issue

matt.fellows
2022-01-20 10:11
it?s a beta, people expect it to be a little bumpy

matt.fellows
2022-01-20 10:12
But that?s my view, and we must understand that buggy software also creates confusion and can increase the burden on maintainers - so it?s the Pact .NET maintainers call for these things

bruno855
2022-01-20 10:15
Thank you very much for all this information @matt.fellows. Have you a coarse estimate for the first release of PACT V4.0?

matt.fellows
2022-01-20 11:52
It looks pretty close to my eye, there is just one outstanding bug. I?d say in the next couple of months seems likely

matt.fellows
2022-01-20 11:53
You should be able to use it now, but (and I don?t know .NET very well) you?ll probably need to build it yourself and deploy to your own package manager, until it is officially released to the Nuget gallery

matt.fellows
2022-01-20 11:53
that workable?

pact544
2022-01-20 12:40
It's whether we need to break the API. I get the feeling the handle approach for the verifier may require some decent breaking changes, and upgrading between betas shouldn't really break that bad

shane.dombowsky
2022-01-20 14:08
has joined #pact-net

jlbrown
2022-01-20 15:29
has joined #pact-net

bruno855
2022-01-20 17:29
I have clone the http://Pact.NET repo then checkout the branch "feature/4.0.0"

bruno855
2022-01-20 17:30
But when I compile the solution, I get this error: Severity Code Description Project File Line Suppression State Error MSB3030 Could not copy the file "C:\pact-net\build\windows\x86_64\pact_ffi.dll" because it was not found. PactNet C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 5100

bruno855
2022-01-20 17:31
Who is producing pact_ffi.dll?

gabriel.fatori
2022-01-20 18:36
has joined #pact-net

petersonbtah
2022-01-20 20:16
has joined #pact-net

llast
2022-01-20 21:44
has joined #pact-net

matt.fellows
2022-01-20 23:28
The dll is an external library that contains shared functionality for all pact libraries - we call this the shared core

matt.fellows
2022-01-20 23:28
It looks like you need to run this script (not sure if manually or otherwise) to fetch it: https://github.com/pact-foundation/pact-net/blob/feature/4.0.0/build/download-native-libs.sh

matt.fellows
2022-01-20 23:29
as a consumer of the library, you wouldn?t need it when distributed via Nuget etc., but for building it locally you will

tjones
2022-01-21 00:10
I think the logging should be a priority - the developer experience without the logging is going to be much worse, and we have many people who need the features from the rust core

tjones
2022-01-21 00:10
same with pact-js

matt.fellows
2022-01-21 01:05
The handle based verifier is what fixes the output issue, which is the current blocker for .NET

matt.fellows
2022-01-21 01:05
I?m not sure if that?s what you?re also referring to? (i.e. the stdout issue)

matt.fellows
2022-01-21 01:05
cleaning up the logging itself is a separate, albeit important task

devesh.mishra
2022-01-21 04:26
has joined #pact-net

bruno855
2022-01-21 08:10
It works.

mch
2022-01-21 08:46
Are there any github issues for the features/fixes mentioned above? Maybe I could help develop them?

matt.fellows
2022-01-21 08:52
Awesome!

tjones
2022-01-21 09:13
I think there are, but you can also join #pact-net-development , which is used for coordination

bruno855
2022-01-21 09:14
But, when I try to build the nuget package then I get that: C:\Program Files\dotnet\sdk\6.0.101\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(221,5): error : Could not find a part of the path 'C:\pact-net\build\linux\x86_64'.

bruno855
2022-01-21 09:16
Do I have to compile with linux to get this distribution?

viveksingh.kiit
2022-01-21 09:29
has joined #pact-net


bruno855
2022-01-21 09:33
I finally modify the download-native-libs.sh file to run the build for each os.

viveksingh.kiit
2022-01-21 09:58
@viveksingh.kiit has left the channel

james.demaine
2022-01-21 10:02
has joined #pact-net

bruno855
2022-01-21 11:18
When I push the package on nuget then I get this: The specified API key is invalid, has expired, or does not have permission to access the specified package.

bruno855
2022-01-21 11:21
But the real owner of http://Pact.NET is https://www.nuget.org/profiles/neilcampbell. Why neil didn't push it as a version 4.0.0 beta?

tjones
2022-01-21 15:58
(someone there will be able to tell you more - I don't know)

pact544
2022-01-21 19:18
The new verifier handles approach is something I'm going to implement next week. I only found out about it yesterday! :joy:

theferryatbuckland
2022-01-21 20:24
has joined #pact-net

david.kormushoff
2022-01-22 00:54
has joined #pact-net

matt.fellows
2022-01-23 23:41
Hi Bruno - you can?t publish to our nuget gallery, you?ll need to publish to your own (or do whatever is normal in the .NET space.). We?ll publish to the gallery in due course, as described above

matt.fellows
2022-01-23 23:41
In case it?s not obvious, only the pact foundation can push assets to the gallery, otherwise that would be a huge security / supply chain risk :wink:

pact544
2022-01-24 10:57
#350 is failing because it needs the feature from #351 :smile:

tom.tantisalidchai
2022-01-25 05:43
has joined #pact-net

pact544
2022-01-25 08:54
I could do with reviews on those 2 PRs because I need the FFI upgrade in order to do the verifier handles work

matt.fellows
2022-01-25 09:41
as a not .NET person, they looked rather straigtforward :white_check_mark:

pact544
2022-01-25 14:57
^^^ that's an easy one to allow the log level to be configured. Previously it was hard-coded as DEBUG

cedric.spengler
2022-01-25 15:08
has joined #pact-net

austin.reifsteck
2022-01-25 15:20
has joined #pact-net

hsd999
2022-01-25 19:06
has joined #pact-net

parasonbe
2022-01-25 20:31
has joined #pact-net

alex.diaz
2022-01-26 09:05
has joined #pact-net

kskowron
2022-01-26 11:30
has joined #pact-net

gianni.araco
2022-01-26 11:34
Hi everyone! I'm having some issues with a provider test. The API endpoint is running locally and it's reachable. Tested with Postman where I get the expected result. But when the test runs, I get a 404. I was expecting the breakpoint in the controller to be hit, but it's not. The provider uri is defined as `providerUri = "https://localhost:5013";` and the route is taken from then contract: `/clients/e3e55ece-8433-447d-8d93-b07653a7f102/preferred-carers` which is correct. Is there anything I can inspect to understand what's failing? ``` Failures: 1) Verifying a pact between fe-client-carer-preference and client-service-api [PENDING] Given preferred carers exist get all preferred carers with GET /clients/e3e55ece-8433-447d-8d93-b07653a7f102/preferred-carers returns a response which has status code 200 Failure/Error: expect(response_status).to eql expected_response_status expected: 200 got: 404 (compared using eql?)```

pact544
2022-01-26 12:00
If you've got the logDir set then you can go and check exactly what the verifier did by inspecting those logs. Hopefully there's something obvious in there

gianni.araco
2022-01-26 12:25
Hi Adam. I cannot find any logDir parameter in the `PactVerifierConfig` nor in `PactVerifier`. Does it have to be configured as an environment variable?

spencerm
2022-01-26 14:33
has joined #pact-net

cristiano.cunha
2022-01-26 14:55
has joined #pact-net

nish063
2022-01-27 02:42
has joined #pact-net

ingcmurcia
2022-01-27 04:41
has joined #pact-net

weijian.duan
2022-01-27 08:58
has joined #pact-net

abraham.gonzalez93
2022-01-27 10:39
has joined #pact-net

demna
2022-01-27 15:29
has joined #pact-net

mircea.ungureanu
2022-01-27 15:48
has joined #pact-net

nikhilwa84
2022-01-27 17:43
has joined #pact-net

bogdanm.rusu
2022-01-27 18:04
has joined #pact-net

cventcport
2022-01-27 22:29
has joined #pact-net

mayuri.khemani
2022-01-28 09:43
has joined #pact-net

fabio.rodrigues
2022-01-28 11:44
HI, in current pact-net how one should setup the pact verify to get only the latest by tag version of a specific contract between consumer and producer , instead of all the contracts I know that URL should be something like http://your-pact-broker/pacts/provider/PROVIDER/consumer/CONSUMER/latest/TAG but i need something in : ```if (pactVerifierConfig == null) pactVerifierConfig = new PactVerifierConfig(); IPactVerifier pactVerifier = (IPactVerifier) new PactVerifier(pactVerifierConfig); pactVerifier.ProviderState(this.PactServiceUri + "/provider-states") .ServiceProvider(providerName, providerUri) .HonoursPactWith(consumerName);``` Because at the moment it's getting all the contracts for that provider, and thus it fails because the provider setup for another service is loaded in another test class

fabio.rodrigues
2022-01-28 12:19
Basically how to only get a specific contract between consumer-provider with tag without being all of them (for a provider)

sujith.nair2
2022-01-28 12:33
has joined #pact-net

pact544
2022-01-28 13:03
I think you can use a URL source in PactNet 3.x to do that, using the URL you've specified there

fabio.rodrigues
2022-01-28 14:28
thank you, that solved the issue. I had to do something like this ```PactBrokerProperties pactBrokerProperties = new() { ConsumerVersionTags = new List<string>() {consumerTag}, //pact is searched by this tag ProviderVersionTags = new List<string>() {providerTag}, //this tag is set after pact is verified SpecificPactUrl = $"/pacts/provider/{Participant.TenantService}/consumer/{Participant.PublishService}/latest" };```

rob
2022-01-28 16:36
has joined #pact-net

radovan
2022-01-29 00:20
has joined #pact-net

matt.fellows
2022-01-29 22:57
For future reference, you can copy the latest tag URL from the Pactflow UI. Head to the pact you want, and click on the tag you?re interested in. Then you can choose ?Copy Pact URL? which will give you the URL to the latest pact with that tag

mongeyc
2022-01-31 14:03
has joined #pact-net

mike.bernard
2022-01-31 21:14
has joined #pact-net

tjoy
2022-02-01 02:06
has joined #pact-net

max.tilford
2022-02-01 03:17
has joined #pact-net

toanshukumar
2022-02-01 14:15
has joined #pact-net

juanquis419
2022-02-01 15:01
has joined #pact-net

matt.murray
2022-02-01 19:40
has joined #pact-net

frederic.gendebien
2022-02-02 08:54
has joined #pact-net

dougie.robertson
2022-02-02 11:15
has joined #pact-net

fabio.rodrigues
2022-02-02 13:13
Hey ppl, hope all is well. Quick question, when the new version of pact-net launches, how one can specify the branch and environments in consumer and provider tests?

juan.avendano
2022-02-02 13:36
has joined #pact-net

ausachov
2022-02-03 13:15
has joined #pact-net

pact544
2022-02-03 14:01
Can I get an approval on this one? Once that's in I can raise the PR for adding proper provider output support https://github.com/pact-foundation/pact-net/pull/353

aaron.kibbie
2022-02-03 15:59
has joined #pact-net

williangldzn
2022-02-03 20:23
has joined #pact-net

ricardo.gonzaga
2022-02-04 09:35
has joined #pact-net

robin.jacques
2022-02-04 10:51
has joined #pact-net

pact544
2022-02-04 11:37
Some good news - just migrated one of our many APIs to use PactNet v4 and the consumer tests are all passing :+1: I've compiled it with: ? the PR above which fixes the mintype matcher ? a custom Rust core build which uses the `native-tls` feature of reqwest instead of the `rustls` version I'm gonna try out the provider tests now and see what happens

matt.fellows
2022-02-04 11:53
popcorn

pact544
2022-02-04 12:06
Holy crap, it works

matt.fellows
2022-02-04 12:07
I mean, don?t act surprised :stuck_out_tongue:

pact544
2022-02-04 12:08
Hey, this is "rubber meets road" territory :smile:

matt.fellows
2022-02-04 12:23
@pact544 just enquiring about branch / environment suport in the new 4.x.x release. @fabio.rodrigues was asking me before, and based on https://github.com/pact-foundation/pact-net/blob/feature/4.0.0/src/PactNet/Verifier/PactBrokerOptions.cs#L155 it looks like we support selectors now but not the branch matching yet.

matt.fellows
2022-02-04 12:24
Can take you through what is needed for that property, if needed. But basically, it?s a user-defined input, that should be the name of the current branch :laughing:

pact544
2022-02-04 12:49
Yeah I'm pretty sure I put a TODO in the code for that when we moved to the verifier handles, just in an attempt to keep the PR size down a bit. Should be an easy first issue because all the FFI is already plumbed in, it's just not exposed via the PactNet API

matt.fellows
2022-02-04 12:51
#goodfirstissue

pact544
2022-02-04 12:58
There we go, 10mins work :smile: Dunno why I didn't just do it in the first place

pact544
2022-02-04 13:07
Worth noting that I'm not 100% what those flags actually do though. I assume they only consider provider pacts with a matching branch/tag?

joaomiguel.rocha
2022-02-04 17:40
has joined #pact-net

matt.fellows
2022-02-04 21:45
Those flags basically just extra information about the provider doing the verification. Similar to the version e.g. ?version 1234? in ?branch X? of ?Provider? verified <dynamic set of pacts>.

pact544
2022-02-04 21:46
Oh. Shouldn't they be on the publish options method instead of the pact broker method then?

matt.fellows
2022-02-04 21:49
mmm yes, but now I can?t remember where I am

matt.fellows
2022-02-04 21:49
let me finish this coffee before I confuse myself further :laughing:

matt.fellows
2022-02-04 21:50
oh, no, I?m wrong

pact544
2022-02-04 21:50
When I split those options out I don't remember them being referenced in the publishing code, but I didn't look in much depth

matt.fellows
2022-02-04 21:50
this is the verification

matt.fellows
2022-02-04 21:50
there is a consumer selecting that says ?matching_branch? (or similar) so it?s about selecting the pacts that match

pact544
2022-02-04 21:51
Ah good, because that's pretty much what I said in the PactNet docs :joy:


matt.fellows
2022-02-04 21:52
That was the issue for the reference that requested the support

matt.fellows
2022-02-04 21:52
(Only the first 2 bullet points are relevant, because we recommend using the CLI for publishing etc.)

jacek.sienniak
2022-02-07 08:45
has joined #pact-net

jamie.weatherby
2022-02-07 15:25
has joined #pact-net

joaobrandao.rodrigues
2022-02-07 16:30
has joined #pact-net

extra
2022-02-07 21:31
has joined #pact-net

elenatuzel
2022-02-08 08:27
has joined #pact-net

vadim
2022-02-08 09:19
has joined #pact-net

anna.khv
2022-02-08 12:19
has joined #pact-net

dhospital
2022-02-08 16:15
has joined #pact-net

jcabrera
2022-02-08 18:26
has joined #pact-net

pact544
2022-02-08 19:29
I'm just trying to think of what's outstanding for `4.0.0-beta.1` and I can't think of much. I'm not sure if any of them are particularly blockers, but still to do off the top of my head: ? GitHub Action for publishing to NuGet when you create a tag (easy, 10mins work) ? A new FFI version with `reqwest` updated to fix the panic related to invalid certificates ? I'm not sure this is a blocker for a beta, but it totally breaks on my machine and I imagine others will have the same problem. I think it's a blocker for a proper release though because it literally just crashes and there's no real way to work around it. ? I'm not quite sure where messaging pacts are up to, but if they do work then we definitely don't have any documentation for them. I'm not entirely sure they're finished at the moment though ? Again, I don't think this is a blocker as there would be no breaking API changes for request/response interactions So I think what I'm saying is the only thing needed for a beta is writing the GitHub Action.... :open_mouth: I'll do that now

matt.fellows
2022-02-09 00:50
I wouldn?t block the beta release because of the above, but certainly agree for mainline

matt.fellows
2022-02-09 00:50
With events, my view would be getting it into the hands of the community (even in main) wouldn?t be a bad thing, because they currently don?t have it now anyway (even if undocumented)

matt.fellows
2022-02-09 00:51
Obviously, we?d want the documentation to follow, hopefully when Yann is back he can contribute that with his deeper knowledge of it all

matt.fellows
2022-02-09 00:52
Documentation for new matchers would probably help as well

ardiel.fuentes
2022-02-09 07:14
has joined #pact-net

pact544
2022-02-09 08:00
Ignore those alpha releases up there btw, I just had to create them to test out the GitHub Actions change was correct. I did it with the actual `dotnet nuget push` commented outso it didn't actually create anything on http://nuget.org, and then I deleted the tags/releases afterwards

ruud.von.faber
2022-02-09 09:11
has joined #pact-net

lewis.prescott079
2022-02-09 10:03
I'm so excited for this release :smile:

lewis.prescott079
2022-02-09 10:03
Thanks so much for your hard work!

pact544
2022-02-09 10:46
OK I've merged the CI changes to trigger a http://nuget.org release. I think we go for a beta 1 now :open_mouth: Thoughts?

pact544
2022-02-09 10:50
Might be worth merging the `feature/4.0.0` branch to `master` if we do a release, otherwise people will turn up at the repo and be very confused :smile:

matt.fellows
2022-02-09 10:58
Yes, I was going to suggest the master branch should be forked into a 3.x.x in case of patches etc.

matt.fellows
2022-02-09 10:59
and then a note in the main README about the two versions

pact544
2022-02-09 11:09
I've created a `release/3.x` branch which is just pointing at current `master`

pact544
2022-02-09 11:21
Can we un-protect the `feature/4.0.0` branch so that I can push up the merge from `master`, then I can raise the PR to merge that back into `master` (because there are merge conflicts)

matt.fellows
2022-02-09 11:33
Wondering if we should merge it into master, or simply _replace_ master (and then branch 3.x.x from master and have a separate line)?

matt.fellows
2022-02-09 11:34
Happy either way

matt.fellows
2022-02-09 11:34
Gimme a few hours, just looking it line by line????

agustin.gomes
2022-02-09 13:23
has joined #pact-net

thijme.langelaar
2022-02-09 13:29
has joined #pact-net

pact544
2022-02-09 13:31
Hmmmm yeah, we could just `git reset --hard origin/feature/4.0.0` now that there's a `release/3.x` branch pointing at the head of where `master` is now. It would all be easier if `master` hadn't moved to fix that cert thing :smile:

pact544
2022-02-09 13:32
_Technically_ that's a bad thing to do because `master` will 'lose' commits, so if people have forked it then they may get in a mess. I think maybe we stick with the merge, although it makes the history a bit messier, but just because it's the 'right' thing to do. It's either that or rebase the entire 4.x branch onto latest `master` and that sounds even worse

dharmesh.kumar
2022-02-09 13:52
has joined #pact-net

pact544
2022-02-09 13:55
Wait, what? I didn't close this

athaper
2022-02-09 14:14
has joined #pact-net

svranyes
2022-02-09 20:16
has joined #pact-net

pact544
2022-02-09 20:42
It is done :smile: Published beta.1 and made sure it's listed on http://nuget.org. I'll be looking for early feedback - not necessarily expecting this to be the final finished version and so breaking changes are still possible up until a full release, but please try it out and let me know what you find. It's taken an awful lot of effort to get to this point and there's still plenty more to go I'm sure, but that's a milestone that feels good :tada:

lewis.prescott079
2022-02-09 21:57
This is fantastic news. Great job!!!

nouri.tawfik
2022-02-09 22:34
Thanks @pact544! Great job!

samuel.whittaker
2022-02-09 23:40
has joined #pact-net

matt.fellows
2022-02-09 23:40
This is massive, amazing work @pact544 and @yann.courtel!! :clap:

fabio.rodrigues
2022-02-10 10:03
:party_parrot:

david.hvilava
2022-02-10 10:53
has joined #pact-net

carlos.ferrao
2022-02-10 15:46
has joined #pact-net

cyrus.devnomad
2022-02-10 18:11
Hello I'm trying to implement the A->B->C scenario using the suggestion here: https://gist.github.com/bethesque/43eef1bf47afea4445c8b8bdebf28df0#file-index-md I would like to implement the solution 1 involving "shared artifacts or fixtures" to tie upstream and downstream pacts together. But I'm not sure how this "tying" of pacts can be achieved? Is there any code example or workshop where this method is used? Any ideas, hints? Thanks

mike.geeves064
2022-02-10 18:16
I started on an example in python but it needed more work, the gist of it was making sure that all of the responses you stub as responses from B to A get used as the request from B to C to make sure they tie up. Someone else was also having a look and I think nearly had some shareable examples :thinking_face: (python again)

mike.geeves064
2022-02-10 18:18
There was a strong recommendation of not stubbing/mocking too low level, so this was patching the method used to make the request rather than intercepting the actual http request


mike.geeves064
2022-02-10 19:13
Yeah, so the conclusion from that one was it's probably too tightly coupled, because it's going down to the http level rather than higher up

cyrus.devnomad
2022-02-10 19:18
But the overall concept of tying pacts and using shared artifacts/fixtures would be still valid yes?

mike.geeves064
2022-02-10 19:22
I believe so, yes (disclaimer: not a maintainer). The discussion was over here that we were having about it, might be helpful: https://pact-foundation.slack.com/archives/C9VECUP6E/p1637360662056400?thread_ts=1637360662.056400&cid=C9VECUP6E

cyrus.devnomad
2022-02-10 19:57
Thank you very much, I have to go through that discussion. Is the usage of shared artifacts/fixtures with these python example(s) the same usage as described here for ruby: https://app.slack.com/client/T5F60FXSQ/search/search-5a77dc0f-9b22-4ce3-af37-b49ebf47ae73/thread/C5F4KFKR8-1556263639.004900?cdn_fallback=1 "Beth (http://pactflow.io/Pact Broker/pact-ruby) In the ruby code, you can create a pact request or response object outside of the dsl that is used to set up the mock. You make a fixture (not sure if the same term is used in python). Then, you use the same fixture to generate the downstream pact, and response to the upstream pact." So, on the A-B-provider side, you mock the downstream calls and then with the help of some pact method you can create an object, store that as shared artifact/fixture and then on the B-C-consumer side you use that shared object to create a matching/tied pact?

mike.geeves064
2022-02-10 20:05
I think so yes, the question has been going on for some time it seems! There was some good input from Tim on where the Pact part should wrap around (which was where the python example needs to be changed to follow instead of the low level http). I liked the idea of those fixtures working at a higher level because then the same pattern works regardless of if you're using http or, somewhere A-B-C becomes even more relevant: message!

rios.martinivan
2022-02-10 20:18
has joined #pact-net

charles.kuo
2022-02-10 21:42
has joined #pact-net

cgoodison
2022-02-11 00:08
Hello, I?m looking at adding some new consumer and provider examples for .NET to show how bi-directional contract testing can be implemented in Pactflow. In deciding what to use for the examples I would love any insights on the following questions: 1. What do you prefer to use to mock APIs? e.g Wiremock 2. What have you used to generate Open API specs for .net APIs in the past? 3. What tool have you used previously to verify that the APIs match OAS spec?  thanks :)

sudhanshu.testing
2022-02-11 05:12
has joined #pact-net

alessandro.polidori
2022-02-11 15:02
has joined #pact-net

krisakins
2022-02-12 20:19
has joined #pact-net

krisakins
2022-02-13 03:11
Looking at this comment on the github issue for new co-maintainer > ? Introducing message support into the framework Does "message" support here refer to messaging, e.g. queues, etc? And does "framework" refer to just the .NET implementation or pact as a whole?

ian.cervantez
2022-02-13 03:32
has joined #pact-net

yanis.benekaa
2022-02-13 15:05
@yanis.benekaa has left the channel

pact544
2022-02-13 21:30
Massing support has been added to Pactnet v4.0.0. We should probably update that issue now as it's probably pretty out of date

matt.fellows
2022-02-13 22:15
I?m sure we could do with more help? e.g. updating this https://github.com/dius/pact-workshop-dotnet-core-v3 to the latest beta would go a long way to helping newcomers pickup Pact with .NET?

antonio.gamiz
2022-02-14 06:51
has joined #pact-net

cyrus.devnomad
2022-02-14 11:15
To be sure whether I understand you correctly, let's consider the following example: Let's assume that if A would send 11 to B that B would have to return with x, y & z, where x and y were independent of C but z were dependent on C. I could manage x and y by setting the state of B. During the setting of the state of B I could prepare an entry 11 --> x, y in a lookup list or something. So the x and y part of the expected response would be cared for. Then I would have to stub CClient (the part of B which is calling C API) in such a way, that if it received 11 it would have to return z yes? And then someone would also have to make sure that the case 11 --> z would be included in the BC-consumer tests where the real CClient is being tested yes? But what is the role of the shared artifact here? Which information is in the artifact? The information 11 --> z ? For whom? For the stubbed CClient during AB-provider-verification or for the BC-consumer tests of the real CClient?

zish.gatrad
2022-02-14 16:01
has joined #pact-net

james.troughton
2022-02-14 16:08
has joined #pact-net

manuelam20
2022-02-15 00:41
has joined #pact-net

dchen
2022-02-15 08:03
has joined #pact-net

aristides.suarez
2022-02-15 08:14
has joined #pact-net

marcelino.garcia
2022-02-15 08:22
has joined #pact-net

varnika.singh
2022-02-15 09:11
has joined #pact-net

david.hvilava
2022-02-15 15:08
Hello guys. I'm exploring https://github.com/pact-foundation/pact-net/releases/tag/4.0.0-beta.1. Couldn't find a way to define provider states on consumer side. How can I do this?

fabio.rodrigues
2022-02-15 15:09
In regard to what my colleague (@david.hvilava)is talking in the previous version we have the Given clause. When doing the consumer contract test now the pact doesn't have it anymore

bernard
2022-02-15 16:22
has joined #pact-net

david.uzumaki
2022-02-15 16:33
has joined #pact-net

abhishekc.jh
2022-02-15 17:21
has joined #pact-net

nuno.frias
2022-02-15 19:28
has joined #pact-net

nouri.tawfik
2022-02-15 20:20
Hi David, I think you can use the "Given" to define the provider states pact.UponReceiving("A valid request for all products") .Given("products exist") .WithRequest(HttpMethod.Get, "/api/products") .WillRespond( .........

faran
2022-02-15 22:31
has joined #pact-net

andy
2022-02-16 00:35
has joined #pact-net

fushinoryuu
2022-02-16 01:40
has joined #pact-net

abdelior
2022-02-16 08:48
has joined #pact-net

pact544
2022-02-16 09:46
It's after you've done the UponReceiving call

fabio.rodrigues
2022-02-16 10:27
there is no given when using intellisense. the others appears (WIthRquest, UponReceiving)

david.hvilava
2022-02-16 10:40
@nouri.tawfik, thank you. It indeed appears after "UponReceiving"

misterjkl
2022-02-16 13:12
has joined #pact-net

pact544
2022-02-16 13:14
Not sure if/how I get #368 and #369 reviewed. I think I'm just gonna have to merge them and the proof will be in the beta testing I guess :shrug: The API is definitely much better now and the built-in messaging server removes a big headache for users. We're also at 91% test coverage :tada:

pact544
2022-02-16 13:15
And then I can start writing up the messaging docs

fabio.rodrigues
2022-02-16 13:17
Hey good people, i have a consumer contract that that has a regex matcher in expectations (for a pre-signed url). What the consumer is expecting is a pre-signed s3 url. Before it was in a format like: ```http://s3:9000/tenantdata/tenants/00000000-0000-0000-0000-000000000001/applications/dda8be6e-e132-4892-a441-63b3a30bfaff/s``` but recent architectural changes have made us to change the url format to a new one ```http://s3:9000/plat-t00000000000000000000000000000001/applications/dda8be6e-e132-4892-a441-63b3a30bfaff/sourcecode-d281f084-1666-3fa4-06ce-1a1214d3692c?X-Amz-Expires=600&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=accessKey1/20220216/us-east-1/s3/aws4_request&X-Amz-Date=20220216T123217Z&X-Amz-SignedHeaders=host&X-Amz-Signature=fb7b255661baa9ebeb991a8a2f16a7f8e93f9a978eeca129a534c89255bca838``` Now the consumer side already changed the matcher in code and published the new contract in CI to pact-broker but is still giving up the old matcher and thus our provider test fails. We are already asking for the latest version by the way. Does the mechanism that pact-broker uses to check if it's a new version of the contract take in account the matchers or it just takes in account changes in keys

fabio.rodrigues
2022-02-16 13:18
thx, it worked

pact544
2022-02-16 13:21
@bethskurrie may correct me here, but I think it detects a new version based upon the pact contract itself, so if you've changed the consumer tests and published a new contract then that should be the latest version. You can use the HAL browser on Pact Broker to explore and find what different versions it thinks exist.

fabio.rodrigues
2022-02-16 13:25
ok, thanls

brian.azizi
2022-02-16 14:05
has joined #pact-net

fabio.rodrigues
2022-02-16 14:29
found the issue, a previous pr (before the contract change) has run *after* the PR for the change, and thus pactflow thought the previous version was the latest

fabio.rodrigues
2022-02-16 14:29
lol

richelle.raaphorst
2022-02-16 15:17
has joined #pact-net

pact544
2022-02-16 17:36
Apologies for lots of pull requests and breaking changes around message pacts, but the more I'm trying to use them the more I'm realising holes in the API that I'm trying to fix

matt.fellows
2022-02-16 20:48
Are you using tags or other ways to differentiate pacts? Using only latest will lead to these problems because builds run all the time across different branches etc

aforeman
2022-02-16 22:34
has joined #pact-net

david.hvilava
2022-02-17 09:39
Helllo guys! One question. Was a PactPublisher deprecated in version 4?

matt.fellows
2022-02-17 09:54
I think so. We recommend using the CLI directly

david.hvilava
2022-02-17 09:54
Got it. Thanks!

matt.fellows
2022-02-17 09:55
Probably worth adding this to the migration guide @pact544

david.hvilava
2022-02-17 09:55
Yes, please

pact544
2022-02-17 09:55
Ah, yeah good point. Yeah it's deprecated

pact544
2022-02-17 09:56
I did have a quick go at adding one back in but just wasn't happy with it at all

matt.fellows
2022-02-17 10:07
I don?t see the point in keeping it

matt.fellows
2022-02-17 10:07
anything that the CLI can do I think should stay in the CLI. It just means more API surface area to maintain

pact544
2022-02-17 10:08
Yeah for sure. We've always used the CLI even when PactNet V3 had a publisher anyway.

matt.fellows
2022-02-17 10:10
Java people are the ones who complain the most ?If it?s not in Maven it doesn?t exist?. Forgetting that the shell environment is much safer than Maven?

matt.fellows
2022-02-17 10:10
(when you read the above, it was intended to be read in a whiney voice)

fabio.rodrigues
2022-02-17 13:43
yep, that wa what happened. Another PR rewrote (with the old definition ) the contract, and thus the fail

guillermo.aguirre
2022-02-17 20:06
has joined #pact-net

fabio.rodrigues
2022-02-18 10:52
Hello all, we have a service that we're contract testing and in it we have an end-point that returns an indeterminate amount of values in a array. Part of the consumer contrat is as follows ```"response": { "status": 200, "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "revisionBaseline": 1, "baseProperties": [ { "dataType": "", "defaultValue": "", "value": "", "valueOrigin": "", "key": "" } ] }, "matchingRules": { "$.body.baseProperties[0].dataType": { "match": "regex", "regex": ".*" }, "$.body.baseProperties[0].defaultValue": { "match": "regex", "regex": ".*" }, "$.body.baseProperties[0].value": { "match": "regex", "regex": ".*" }, "$.body.baseProperties[0].valueOrigin": { "match": "regex", "regex": ".*" }, "$.body.baseProperties[0].key": { "match": "regex", "regex": ".*" } } } } ],``` The problem is that it's just not 1 element but a array of them (at least 10+ of them) How can we setup an expectation on consumer side that would check this (that it receives an array of objects like this). Is it possible, and if it is, how can we set it up?

fabio.rodrigues
2022-02-18 10:55
btw, the error in pactflow is: ```Actual array is too long and should not contain a Hash at $.baseProperties[1] Actual array is too long and should not contain a Hash at $.baseProperties[2] Actual array is too long and should not contain a Hash at $.baseProperties[3] ... Actual array is too long and should not contain a Hash at $.baseProperties[34] Actual array is too long and should not contain a Hash at $.baseProperties[35]```

fabio.rodrigues
2022-02-18 12:11
Also another question. Currently in pact-net 3.X.X we can provide a change in header with the CustomHeader property in PactVerifierConfig. This is useful for example in micro-services that needs a authorization token or some mechanism like that , and that token as a expiration time (normaly measured in minutes). For example: ```var config = new PactVerifierConfig() { CustomHeaders = new Dictionary<string, string>() {{"Authorization", "Bearer " + authToken}}, }``` I cannot see such mechanism in the new pact-net 4.x.x

fabio.rodrigues
2022-02-18 12:11
is that by design?

fabio.rodrigues
2022-02-18 14:59
found the solution with Min Type matcher

pact544
2022-02-18 15:49
The Rust core doesn't (currently) support custom headers as far as I know

fabio.rodrigues
2022-02-18 15:51
so, for those tests for microservices that in contract have the need to pass a valid auth token, we can't upgrade then

pact544
2022-02-18 15:55
I tend to run the provider service with auth disabled when verifying pacts, for exactly that reason

adamslack
2022-02-18 15:55
has joined #pact-net

pact544
2022-02-18 15:55
I've checked the https://github.com/pact-foundation/pact-reference/blob/master/rust/pact_ffi/src/verifier/mod.rs and confirmed there's no custom header support when verifying

fabio.rodrigues
2022-02-18 16:04
so basically updating to pact-net 4.0.0 removes functionality that already existed

pact544
2022-02-18 16:20
You're very welcome to raise a feature request, or even better a PR, to add that functionality if it's something you require and can't work around.

pact544
2022-02-18 16:22
You could also https://github.com/pact-foundation/pact-net/tree/master/samples/EventApi/Provider.Tests which uses authentication during provider tests

fabio.rodrigues
2022-02-18 16:58
well at least you should have that removed feature in documentation and how to workaround it

pact544
2022-02-18 17:13
Done

darwin.cahyadi
2022-02-18 18:00
has joined #pact-net

mickfagan
2022-02-19 05:03
Hi crew. Great work on 4.0.0. I?m having some trouble getting verification results to output to console. I know that output is occurring because pointing the verifier to a bad pact file location spits out a bunch of output. Has anyone reported this? I?ve tried xunit and nunit. Same results. Makes it very hard to know where verification fails.

matt.fellows
2022-02-19 10:12
A colleague of mine was putting together an example yesterday, and I noticed the consumer logging seemed to be missing some items. I?m going to take a little look now

matt.fellows
2022-02-19 10:12
(I?m on a Mac though - what OS are you running Mick?)

matt.fellows
2022-02-19 10:24
I don?t know .NET all that well, but I can see in the examples Adam has added an `XUnitOutput` added to the `Outputters` attribute. If I leave that in, I?m assuming the output is redirected to the xunit tool (which I don?t use, so in the terminal it?s empty)

matt.fellows
2022-02-19 10:25
``` Outputters = new List<IOutput> { new XUnitOutput(this.output), new ConsoleOutput() }``` Presumably will write to both stdout and xunit

jkdihenkar
2022-02-19 10:51
@jkdihenkar has left the channel

pact544
2022-02-19 11:06
Yeah if you use both outputs then you'll get the logging twice

pact544
2022-02-19 11:08
As in, once on the console and once inside xUnit. However, xUnit 'steals' the console, so generally speaking that won't work inside an IDE or with `dotnet test`. In that case just using the xUnit output is enough though

pact544
2022-02-19 11:09
I'm gonna release a `PactNet.Output.Xunit` package I think, because it's just something you always need. It's annoying that it's literally one class with one line of code though

pact544
2022-02-19 11:10
@mickfagan it's worth making sure you're on beta 2 as well, just to be sure. I think logging worked fine in beta 1 as well though

mickfagan
2022-02-19 11:18
I?m on windows and have beta 2. I?ve followed the example and still can?t get any output. Definitely used to work in an earlier build

pact544
2022-02-19 11:19
The output definitely works in the samples. Could you maybe clone the repo and try to run those?

matt.fellows
2022-02-19 12:16
How are you running the tests, via `dotnet test` in the terminal or clicky in VS (or VS code)? Just gave the clicky clicky a go in VS code, and pretty impressed it ?just worked?

matt.fellows
2022-02-19 12:17
That being said, the verifier logs being dumped out after the verifier output seems strange. I?d mostly ignore those logs I think, unless something went wrong.

matt.fellows
2022-02-19 12:17
I think it makes more sense swapped around, what do you think? Or do most people not using the terminal and therefore that would be hidden?

pact544
2022-02-19 12:18
Yeah I put the output first since that generally tells you what went wrong, then included the logs just in case you want further detail. I can't really do much other than that because those are two separate FFI calls. Output and logs are collected separately in the Rust core

pact544
2022-02-19 12:19
For example, the logs contain the full message (at debug level) whereas the output just tells you about mismatches

matt.fellows
2022-02-19 12:20
oh yeah, I was more thinking the Verifier Output is what most people want to see, and having to scroll up (above the noise) is not ideal

matt.fellows
2022-02-19 12:21
My point being, that a terminal is LIFO in terms of consuming the information, so you probably want the most pertinent information at the bottom

pact544
2022-02-19 13:39
Iirc, in VS the test output window (either the one built into VS or the R# one) starts at the top though :joy: That's probably the primary platform for .Net instead of a terminal. You've also got the actual logs from PactNet above all of that as well. That's just the downside of the shared core approach. You can't interleave any of the output in a consistent and satisfying way, you just need to ask the core for the output after it's finished.

rishi.speets
2022-02-19 14:43
has joined #pact-net

rishi.speets
2022-02-19 14:50
Hi all. I'm having some issues getting the Messaging example to work. When I try to implement it, the IMessagePactBuilderV3.WithJsonContent() is not returning an IConfiguredMessageVerifier, but an IMessagePactBuilderV3. So the .Verify() method cannot be resolved in the ReceiveSomeStockEvents() test, because it thinks it's the wrong type. I created a minimal repo that shows the issue here: https://github.com/rishispeets/pact-net-messaging-example-test/blob/master/TestProject1/StockEventProcessorTests.cs. I get the same behaviour in a non-trivial project. It's the exact same copied code from the PactNet repo, but I must be doing something wrong, because it works when I clone the PactNet repo and run that. Does anybody know what the issue might be? (I'm pretty new to dotnet btw)

krisakins
2022-02-19 15:34
When I cloned down some of the samples I was opening a project/folder individually instead of the entire collection of samples. When I did that, I realized I was missing some project references to the latest version of Pact (4.0). I had to install the 4.0 (preview I think) Nuget package of Pact, and then some of the interfaces, etc started working for me. Not sure if this is your case or not.

mickfagan
2022-02-19 20:32
I'm running the tests via the terminal with dotnet test. Here's a gist of what I see when I force an error by providing a bad pact file. https://gist.github.com/mkzer0/480ee0fa6bc3e7abc5a8da04b6cb398f Would this suggest that my Xunit output is indeed configured and setup correctly? I'll try the samples too.

pact544
2022-02-19 21:09
Yeah that's working. It's telling you the file you've specified wasn't found

pact544
2022-02-19 21:17
The API just changed after the beta 2 release, so the latest version won't match it. Using beta 2, the Verify method is on the builder

pact544
2022-02-19 21:19
So the docs and sample are correct and will be the API for the next release, but they're not correct for beta 2. If you check the samples from a few commits back you'll see the Verify method in a separate call

mickfagan
2022-02-19 21:51
I get a very similar error running the ReadMe Provider tests to what I see in my own project. https://gist.github.com/mkzer0/60a31fdff3e1dc0eeb7669a1691c0c7c Some notes: I'm using visual studio 2022 Was prompted to install framework 4.6.1 replicated from clicky vs command line build On windows 10 I'm not a .net guy

pact544
2022-02-19 21:58
Those tests are all working locally for me and in CI, so it does appear to be something on your machine. That's telling you a directory wasn't found

mickfagan
2022-02-19 22:01
Ok. I'll keep digging. Thanks!

mickfagan
2022-02-19 22:44
Pulled out another machine, works as expected. Something about the setup of the other machine. Anyway, thanks for the help and keep up the great work on PactNet!

matt.fellows
2022-02-19 23:16
Would love to know what the difference is

rishi.speets
2022-02-20 11:03
Awesome, that did the trick :slightly_smiling_face:. Thanks both!

pact544
2022-02-20 11:04
It could be the certificate issue that I have on my work laptop. It causes a panic that crashes the entire thing with no logging

pact544
2022-02-20 11:05
That's definitely a blocker to a full release

pact544
2022-02-20 11:05
I think I made a little app that can detect the problem, but it was in Rust, not C#


mickfagan
2022-02-20 23:23
I debugged it as far as the rust native lib call. I could send you some logs if you tell me what you need?

mickfagan
2022-02-20 23:24
We?re champing at the bit to get 4.0.0 , so if we can help.

matt.fellows
2022-02-21 03:08
That?d be great, thanks Michael

matt.fellows
2022-02-21 03:08
Sounds like it might be a seg fault.

ybergstrom
2022-02-21 03:24
has joined #pact-net

pact544
2022-02-21 07:56
It'll be the certs panic no doubt. @mickfagan could you run my little sample app I've shared above? That'll indicate if it's the invalid certs issue: https://github.com/pact-foundation/pact-reference/issues/156

gyuvaraj10
2022-02-21 08:03
has joined #pact-net

athissen
2022-02-21 08:09
has joined #pact-net

athissen
2022-02-21 08:10
Hi!

fabio.rodrigues
2022-02-21 09:51
hey there, in pact-net do we have the requestFilter option for headers?

fabio.rodrigues
2022-02-21 09:51
like in pact-js?

matt.fellows
2022-02-21 09:52
I don?t think so yet, but now that all of the middleware is available (e.g. for provider states) it should be trivial to add (I say that without knowing much about the framework and nuances, so take it with a grain of salt)

matt.fellows
2022-02-21 09:52
It would be preferable as a replacement of the `customHeaders` option, if that?s what you?re looking at it for?

pact544
2022-02-21 10:13
As far as I know we can't do the request filter thing because the request comes from the Rust side, not the C# side

matt.fellows
2022-02-21 10:16
yes, the filter would go like this `[rust]` -> `[Pact .NET Request filter]` -> `[provider app]`

matt.fellows
2022-02-21 10:17
It?s a lot like the provider state middleware. You register a function that can act on the request coming in

matt.fellows
2022-02-21 10:17
That fancy new HTTP server you added would need to act as a proxy in front of the provider app, and if a request filter is registered, could alter the request (so yes, it?s an advanced move)

andrefcsousa
2022-02-21 10:19
has joined #pact-net

fabio.rodrigues
2022-02-21 10:40
ok, thanks

matt.fellows
2022-02-21 10:49
If you'd like it though, please raise a feature request on the GH repo to track it. Not all languages have this feature (it's technically not in the spec) but is handy

pact544
2022-02-21 10:55
There's been an open feature request for it for about 3 years :smile:

pact544
2022-02-21 10:57
Trying to do it in C# would be problematic in a number of instances because the request has to have already 'arrived' at the API in order for the middleware to modify it. If you were in a situation where there's something else sitting in front of that API (e.g. an API Gateway), it may need the request to have those headers before it'll even pass on the request to you. Really it needs to have been configured prior to being sent at all, rather than trying to modify it after it arrives.

pact544
2022-02-21 11:01
The proxy is specifically for message pacts and just acts as a little driver for them. At the moment it's 100% the user's responsibility to stand up the API for running verification tests for request/response pacts. That's not really something we can change given we can't support every version of http://ASP.Net Core all at once, which we'd have to do if we tried to make something that stood up people's APIs for them. Not to mention people have their own weird and wonderful requirements, so we'd never fulfill all the required use cases. It's def better to let people just control their own API hosting, and at that point they could add their own middleware if that's sufficient for them. If that's not sufficient (as with my API Gateway scenario) then the request has to be modified in Rust, not C#, anyway

pact544
2022-02-21 11:02
If the middleware approach is suitable, the samples show you how to do that

matt.fellows
2022-02-21 11:21
> Trying to do it in C# would be problematic in a number of instances because the request has to have already ?arrived? at the API in order for the middleware to modify it. If you were in a situation where there?s something else sitting in front of that API (e.g. an API Gateway), it may need the request to have those headers before it?ll even pass on the request to you. Really it needs to have been configured prior to being sent at all, rather than trying to modify it after it arrives. how is this different to other languages though? I?m not sure I?m following

pact544
2022-02-21 11:39
It's not, that's why there's an open issue on PactJS about it also :smile: https://github.com/pact-foundation/pact-js/issues/304

pact544
2022-02-21 11:40
So there are 2 use cases: ? Modify the request after it arrives ? The solution to this is the user can write whatever middleware they want as part of hosting their API, and there's an example in PactNet of how to do this ? Modify the request before it's sent ? You can't do this from PactNet, it would have to be done in Rust

fabio.rodrigues
2022-02-21 11:41
I think seriously that for Pact testing we should standardize a mechanism for header authentication, since almost microservices that uses this type of testing now have some kind of auth scheme.

fabio.rodrigues
2022-02-21 11:42
in all of the implementations (@matt.fellows)

matt.fellows
2022-02-21 11:42
Touche, but really, that?s a bit of an edge case (and also a bug in the current pact framework proxy layer)

pact544
2022-02-21 11:42
I disagree. Since you're hosting the API as part of the provider tests then it's within your power to disable authentication (that's what I do), or to add some middleware that adds a dummy Authorization header (as the samples do). It's not really for PactNet to dictate that to users in my opinion, as different people will want to do different things

matt.fellows
2022-02-21 11:43
:point_up: I usually do the same.

fabio.rodrigues
2022-02-21 11:43
well it can be part of the contract that a certain request for a service must come authenticated and if not a error code given

matt.fellows
2022-02-21 11:43
yes, definitely

fabio.rodrigues
2022-02-21 11:43
specially for some kind of api requests that handle sensitive data

pact544
2022-02-21 11:44
Yep - in which case you do `WithRequestHeader("Authorizarion", "my-known-value")` in the consumer test, and then you can do whatever you want on the provider side to handle that. That's exactly what the samples do

fabio.rodrigues
2022-02-21 11:44
i know

fabio.rodrigues
2022-02-21 11:44
that's was what we were using the customHeaders for

fabio.rodrigues
2022-02-21 11:45
consumer would send the header and in provider we would change the value with a valid one

fabio.rodrigues
2022-02-21 11:45
and all was okay

pact544
2022-02-21 11:47
Custom headers support would be my second use case - modifying the request before it's sent, to add extra headers - and therefore something that would have to be implemented on the Rust side (and made available via FFI to Pactnet). It's definitely something that _can_ be done, so as I said when we originally discussed it we're perfectly willing to accept feature requests and pull requests for that

fabio.rodrigues
2022-02-21 11:47
ok

fabio.rodrigues
2022-02-21 11:47
how would i do such a request

fabio.rodrigues
2022-02-21 11:48
i would 2 request one for rust and another for .net?

fabio.rodrigues
2022-02-21 11:48
one to implement it on rust side and in .net to handle the new ffi?



katharina.pavic
2022-02-21 12:37
has joined #pact-net

nouri.tawfik
2022-02-21 14:37
Hello, @pact544 Can you please share with us the release strategy ? Do you publish new release every week ? Thanks

pact544
2022-02-21 14:38
I publish a new version just when it seems sensible to do so

nouri.tawfik
2022-02-21 14:42
To get more feedback for beta versions I think it will be great if you can publish for every successful improvement bug fixes Anyway thanks for your response

ipoe
2022-02-21 14:54
has joined #pact-net

jeroen.vandijk
2022-02-21 16:40
has joined #pact-net

ondikumana
2022-02-21 22:13
has joined #pact-net

nithyag.ganesan
2022-02-22 10:01
has joined #pact-net

ntiwari
2022-02-22 11:48
has joined #pact-net

fabio.rodrigues
2022-02-22 17:53
Hi there

fabio.rodrigues
2022-02-22 17:54
```public static IMatcher MatchNonEmptyString = Match.Regex("an non empty string", @".+"); public static IMatcher MatchAnyString = Match.Type("abcdef"); public static IMatcher MatchInteger = Match.Type("10"); public static IMatcher MatchDateTime = Match.Type(DateTime.Now); public static IMatcher MatchGuid = Match.Type(Guid.NewGuid());``` Would this match a normal datetime format, or a valid guid? i don't care for the values but if the value is for that type

mickfagan
2022-02-22 20:15
Ran the cert checking tool. It reports an error: ```[2022-02-22T20:12:57Z ERROR rustls_native_test] Failed to parse cert [2022-02-22T20:12:57Z ERROR rustls_native_test] Subject: CN=127.0.0.1 [2022-02-22T20:12:57Z ERROR rustls_native_test] Error: MissingOrMalformedExtensions```

matt.fellows
2022-02-22 20:34
Thanks for confirming!

matt.fellows
2022-02-22 20:35
There is an upstream issue in an HTTP lib we use that tracks this. I'll see where it's at today as I believe it was fixed. if released I'll get a new release out

pact544
2022-02-22 21:55
Problem is that rustls was fixed but we've not had a reqwest release to upgrade to that version yet

pact544
2022-02-22 21:57
That cert is a localhost development cert, likely the one that http://ASP.Net Core installs by default. Given we're expecting pretty much all our users to have a cert like that, that makes this a huge issue :astonished:

matt.fellows
2022-02-22 23:37
As always, Windows users causing problems for us *nix folks :stuck_out_tongue:

matt.fellows
2022-02-22 23:43
Confirmed, latest version is `0.11.9` which doesn?t have the https://github.com/seanmonstar/reqwest/commit/d92d2aa3ce4667faa38454c8dae4fa9f72b91b71

mickfagan
2022-02-23 01:08
Haha. You don?t want things to be easy, where?s the fun in that?

matt.fellows
2022-02-23 02:50
Bring back the good old days - write everything yourself. The problem with that, is you can?t point the blame at somebody else :stuck_out_tongue: I?ll follow up the maintainer to get an idea as to when the next release is likely to go out

mickfagan
2022-02-23 03:08
Sounds great. Let me know if you testing done. I?ll monitor this group

matt.fellows
2022-02-23 03:20
thanks Mick - much appreciated

matt.fellows
2022-02-23 03:20
did you manage to find the certificate at fault? Removing/moving it out of the way (whilst not ideal) would be a workaround for the time being

ingcmurcia
2022-02-23 04:34
@ingcmurcia has left the channel

mickfagan
2022-02-23 06:15
I?ll give that a go. Happy with a workaround tbh

pact544
2022-02-23 07:54
Those will just match strings

pact544
2022-02-23 07:55
If it's an http://ASP.Net Core dev cert (which it looks like to me) then it'll just get reinstalled if you remove it

pact544
2022-02-23 07:55
I still don't really get why we're not just using the native certs support in reqwest instead of the rustls version. I compiled it locally with the default TLS feature and it worked absolutely fine, even with the 'invalid' cert

matt.fellows
2022-02-23 10:23
> I still don?t really get why we?re not just using the native certs support in reqwest instead of the rustls version. I compiled it locally with the default TLS feature and it worked absolutely fine, even with the ?invalid? cert If you look at the PR that removed it, you?ll see why. Essentially, it doesn?t support the standard open ssl environment variables that everybody is used to on the current version.

matt.fellows
2022-02-23 10:23
Whilst openssl isn?t the only implementation, it?s essentially a standard

matt.fellows
2022-02-23 10:24
also, from memory, it properly discovered certificates x-platform that the native one didn?t

phil.vint
2022-02-23 11:01
has joined #pact-net

phongthornk
2022-02-23 11:04
has joined #pact-net

lukasz
2022-02-23 14:55
has joined #pact-net

ezequiel.uhrig
2022-02-25 13:46
has joined #pact-net

emin.sahin
2022-02-26 13:53
has joined #pact-net

ihassin
2022-02-27 21:20
has joined #pact-net

yumiihuang
2022-02-28 09:55
has joined #pact-net

yousaf
2022-02-28 11:57
has joined #pact-net

gerry
2022-02-28 12:56
has joined #pact-net

agustina.bosso
2022-02-28 16:04
has joined #pact-net

deactivateduser320370
2022-03-01 11:41
has joined #pact-net

luke.bickell
2022-03-01 14:46
has joined #pact-net

james.williams
2022-03-01 16:29
has joined #pact-net

cyrus.devnomad
2022-03-01 18:18
Hi I have a http://Pact.NET consumer unit test using .NET 6.0 which works normally on two different local Windows developer machines but it fails if the same code is built and executed in the linux docker image http://mcr.microsoft.com/dotnet/sdk:6.0-alpine. I get the following error: System.TypeInitializationException : The type initializer for 'PactNet.Native.Interop.NativeInterop' threw an exception. ---- System.DllNotFoundException : Unable to load shared library 'pact_ffi' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library libpact_ffi: No such file or directory Any ideas?

luke.bickell
2022-03-01 18:22
@luke.bickell has left the channel

matt.fellows
2022-03-01 21:22
hmmm I can?t remember if we support alpine linux. Any chance you could please try a vanilla linux container first? If that works, it?s either that we need an alpine specific shared library built, or there is some OS dependency that is needed

matt.fellows
2022-03-01 21:23
Before you do tho can you please set `LD_DEBUG=all` into the environment, and try again?

matt.fellows
2022-03-01 21:23
that will help

qluck
2022-03-01 22:15
has joined #pact-net

peter.pinda
2022-03-01 23:37
has joined #pact-net

pact544
2022-03-02 07:30
Yeah I'm pretty sure MUSL targets won't work. I think the Rust library is built for libc x64

pact544
2022-03-02 07:34
Yes - this has the `linux-x64` runtime identifier, and there's no entry for `linux-musl-x64` The supported runtime IDs for .Net are here, so MUSL is possible, just not currently supported: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#linux-rids

pact544
2022-03-02 07:35
And that's because the FFI library doesn't compile for MUSL https://github.com/pact-foundation/pact-reference/releases/tag/libpact_ffi-v0.2.2

matt.fellows
2022-03-02 08:00
We should be able to add it. I recall we did have something for it a while back for JS.

matt.fellows
2022-03-02 08:01
Can you please check if an issue has been raised and if not, raise one @cyrus.devnomad https://github.com/pact-foundation/pact-reference/releases

cyrus.devnomad
2022-03-02 13:51
Ok, I've tested the same consumer unit test on the correspondig *non*-alpine image (http://mcr.microsoft.com/dotnet/sdk:6.0) from microsoft and that pact_ffi related error mentioned above no longer appears. So the issue is indeed related to the alpine version as you both have suggested. https://pact-foundation.slack.com/archives/C9UTHV2AD/p1646169769668719?thread_ts=1646158689.612079&cid=C9UTHV2AD

pact544
2022-03-02 13:59
Yeah, thanks for confirming. libpact doesn't compile MUSL targets (needed for Alpine) and therefore PactNet doesn't ship them

pact544
2022-03-02 14:01
Created an issue here, and will link to a request in libpact: https://github.com/pact-foundation/pact-net/issues/374

omer.bilgin
2022-03-02 15:51
has joined #pact-net

banolik
2022-03-02 18:35
has joined #pact-net

ancyaziz
2022-03-02 22:26
has joined #pact-net

timothyg
2022-03-02 23:40
has joined #pact-net

harihararaj.lk
2022-03-03 09:44
has joined #pact-net

mircea.ungureanu
2022-03-03 11:40
@mircea.ungureanu has left the channel

matt.fellows
2022-03-03 11:54
awesome, thanks!

toyamarinyon
2022-03-03 13:25
has joined #pact-net

david342
2022-03-03 13:26
has joined #pact-net

yesilmenadil
2022-03-03 16:14
has joined #pact-net

dajaman1
2022-03-03 20:30
has joined #pact-net

waqif
2022-03-03 23:32
has joined #pact-net

dmitry.matveev
2022-03-03 23:44
has joined #pact-net

dmitry.matveev
2022-03-04 00:35
Hello o/ we have pact net running in necoreapp2.1, (tested with PactNet 3.0.2 and 2.6.1). The main problem that we are facing is that pacts show up in pact-flow as unverified, (with the contents of the pact indicating that verification on the individual contracts did in fact ran), while pactnet runner (xunit) pact verifier DOES NOT assert the test and does not mark a unit test as failed when in fact pacts did not verify successfully. Can someone please advise me on what could be the cause of this behavior. Thanks

matt.fellows
2022-03-04 03:02
is pending pacts enabled?

matt.fellows
2022-03-04 03:02
can you please share your test setup

tomas.sakinis
2022-03-04 06:39
has joined #pact-net

pact544
2022-03-04 07:37
Worth noting that .Net Core 2.1 has been deprecated and unsupported since August 2021

matt.fellows
2022-03-04 07:38
Only 6 months ago? that?s just a small item on a risk register in a large org :wink:

akke.luukkonen
2022-03-04 10:42
It was also removed a couple weeks ago from `windows-latest` aka `windows-2022` image in Azure DevOps pipelines.

matt.fellows
2022-03-04 10:47
I like that, that will force teams to upgrade

akke.luukkonen
2022-03-04 11:45
Yeah, although it's pretty awkward to suddenly notice some of your pipelines have been using such old versions without you remembering about it :eyes:. But I agree, it's good that it forces the upgrades even if people forget.

reuben.tonna
2022-03-04 14:32
has joined #pact-net

negrolyze
2022-03-04 15:34
has joined #pact-net

42amehmeto
2022-03-04 19:17
has joined #pact-net

rawatankit90
2022-03-04 22:33
has joined #pact-net

dmitry.matveev
2022-03-06 20:05
@matt.fellows Hi o/ thanks for getting back. I have followed the tutorial on the pact net website and pretty sure it logically matches the example. will share the project here shortly

dmitry.matveev
2022-03-06 22:48
I got our pactnet project isolated from the internal sources so you can check it out in https://github.com/dmitrymatveev/pact-test.

dmitry.matveev
2022-03-06 22:54
```https://nibnz.pactflow.io/pacts/provider/nibnz-nib-api/consumer/nz-provider-portal/version/0.1.0-13-g8dbc98b?verification=%2Fpacts%2Fprovider%2Fnibnz-nib-api%2Fconsumer%2Fnz-provider-portal%2Fversion%2F0.1.0-13-g8dbc98b%2Fverification-results%2Flatest``` as an example this interaction. all interactions failed, which I do expect at this stage. however PactVerifier in PactVerifyTests does not fail a unit test. I did observe the same behavior on dotnet 3.1 too btw.

matt.fellows
2022-03-06 22:57
Thanks for this Dmitry

matt.fellows
2022-03-06 22:58
It looks OK to me, one guess is that `enablePending: false` is not set, and perhaps .NET is defaulting it to true or empty, which might be interpreted as enabled by default

matt.fellows
2022-03-06 22:59
If you could please share a debug log output (terminal and verifier logs) that might help confirm that

matt.fellows
2022-03-06 22:59
Given it may have sensitive info, please send to if you?re uncomfortable sharing here


dmitry.matveev
2022-03-06 23:48
running locally I can only find verification logs of some sort

matt.fellows
2022-03-06 23:56
Ah, it should print out in your terminal also what is going on. When you integrate with Pactflow/Pact Broker, it should print out notices of what pact is being verified and why (and if it?s pending etc.)

matt.fellows
2022-03-06 23:56
nothing coming out?

matt.fellows
2022-03-06 23:57
It looks like you have a `MessageSink` setup (so it?s probably in there, wherever there is :slightly_smiling_face: )

dmitry.matveev
2022-03-06 23:59
am ye OK makes sense I will get back to you once I get hold of these thanks

dmitry.matveev
2022-03-07 00:57
git it

dmitry.matveev
2022-03-07 01:04
~oh right I see this is something that pact consumers control~

dmitry.matveev
2022-03-07 01:17
how do I disable pending in pactnet? I can't see a reference to corresponding API anywhere

matt.fellows
2022-03-07 01:48
It?s an option on the verifier config (see link I posted above)


matt.fellows
2022-03-07 01:49
but yes, thanks for providing - that definitely shows it?s using Pending pacts

dmitry.matveev
2022-03-07 01:55
turning this on or off does not seem to make any difference

dmitry.matveev
2022-03-07 01:57
I know we are using an older version of pact, I don't think I can go higher then 2.6.1 because of our netcore2.1 issue. I wonder if it might be contributing to the problem

matt.fellows
2022-03-07 03:07
hmm interesting, could be

matt.fellows
2022-03-07 03:08
at DEBUG level, we should be able to see the calls to the pacts for verification endpoint

matt.fellows
2022-03-07 03:08
it might be that setting it to `false` ignores the property, but we need it to be sent to Pactflow for it to be disabled

matt.fellows
2022-03-07 03:10
ok yes, it looks to be quite old version of the verification call


tom.daley
2022-03-07 09:09
has joined #pact-net

leon.brown
2022-03-07 09:26
has joined #pact-net

aurelia.rochat
2022-03-07 10:16
has joined #pact-net

dmitry.matveev
2022-03-07 20:22
morning Matt o/ yes, unfortunately I had to downgrade because I had issues with missing assemblies when using pactnet with netcore2.1

dmitry.matveev
2022-03-07 20:56
I made a case in business to block this work until we upgrade notcore version of our API. if that does not fix it we will be in touch, not sure when, hopefully wont have to. Thank you for your time o7

bheemreddy181
2022-03-08 00:23
has joined #pact-net

kabhatiya
2022-03-08 00:51
has joined #pact-net

luis.garelli
2022-03-08 09:29
has joined #pact-net

andrevdrodrigues
2022-03-08 12:50
has joined #pact-net

tobias
2022-03-08 13:11
has joined #pact-net

mutharaju.kk
2022-03-08 14:34
has joined #pact-net

gerry
2022-03-08 14:48
@gerry has left the channel

will.robinson
2022-03-08 14:54
has joined #pact-net

fragonib
2022-03-08 16:22
has joined #pact-net

jason.wang
2022-03-08 19:05
has joined #pact-net

sam680
2022-03-09 05:12
has joined #pact-net

annette.reid
2022-03-09 07:43
has joined #pact-net

victor.lau
2022-03-09 20:46
has joined #pact-net

kenneth.krause
2022-03-10 16:41
has joined #pact-net

mickfagan
2022-03-10 22:52
Interested to know if anyone here is using pact to test azure function apps? I've created an example, maybe an opportunity to compare notes?

bergner
2022-03-11 06:19
has joined #pact-net

gotax80534
2022-03-11 06:55
has joined #pact-net

akke.luukkonen
2022-03-11 08:06
I'm testing a case where the provider is a Function App, but haven't yet had a consumer as one. Although, I'd guess the consumer would be easier in general since you can just create the contracts with Pact .NET? :thinking_face: My main problems so far with contract testing Function Apps have been the Durable instances (Functions & Entities). In my provider state setup I always try to cleanup all of the existing Durable instances and Azure SDK might randomly throw StorageExceptions for unknown reasons when attempting to perform `PurgeInstanceHistoryAsync`:

akke.luukkonen
2022-03-11 08:08
I haven't yet reported this to Azure since this occurs fairly infrequently and I have no idea what's causing it exactly in order to reproduce it reliably. It suddenly started occurring as part of a pull request where we added one Service Bus connection and a couple additional Event Grid Triggers to the Function App which in my eyes had no relevance in any way to this actual issue :man-shrugging:

mathias
2022-03-11 10:17
has joined #pact-net

jtcsek
2022-03-11 13:02
has joined #pact-net

mickfagan
2022-03-13 02:36
Interesting @akke.luukkonen. We're testing with a function app provider and a consumer (android java) The provider function app has provider state from another function app which we fake with a dot net core mvc api controller. Are you starting your function app with: Func start?

matt.fellows
2022-03-14 02:44
Is it possible to run these functions locally without actually running on Azure itself? With AWS for example that have SAM and serverless framework, both of which have options to run locally/offline. This is how I typically do it

matt.fellows
2022-03-14 02:44
Are these for serving web applications (i.e. HTTP) or running as async functions?

akke.luukkonen
2022-03-14 07:12
> Are you starting your function app with: > Func start? Technically yes if I'm developing locally, but our CI performs a test deployment. Not all of the resource types have local emulators (e.g. Service Bus) so you need to deploy at least some of them for the pipeline agents to be able to run tests. So I figured that I might as well then do a full deployment for testing. Also, Azurite (Storage Account emulator) had a bug until the recent release that you couldn't even purge Durable instances *at all* (related to this GH https://github.com/Azure/Azurite/issues/1264 if I remember correctly). > Are these for serving web applications (i.e. HTTP) or running as async functions? Not directly serving the site itself, but working as the backend for me. Both synchronous requests, e.g. typical resource CRUD stuff, and long-running asynchronous actions which are related to the concept of these Durable Functions in Azure.

mickfagan
2022-03-14 07:24
You can start locally and verify the contract although we haven't run into @akke.luukkonen ?s problem yet. Sucks that you need to do a full deployment, I for sure would like to avoid that.

joachim005
2022-03-14 08:16
has joined #pact-net

alexstout009
2022-03-14 14:32
has joined #pact-net

paul.richards
2022-03-14 14:38
has joined #pact-net

akif.tahir
2022-03-14 15:00
has joined #pact-net

lramos
2022-03-14 16:29
has joined #pact-net

michael036
2022-03-14 18:31
has joined #pact-net

lauren.coggin
2022-03-14 19:27
has joined #pact-net

mkanika1811
2022-03-15 09:22
has joined #pact-net

ian.pringle
2022-03-15 11:02
has joined #pact-net

karl.wagner
2022-03-15 12:25
has joined #pact-net

chaitasi.patel988
2022-03-16 04:04
has joined #pact-net

mathias
2022-03-16 08:05
@mathias has left the channel

jose.iglesias
2022-03-16 09:23
has joined #pact-net

alegab0710
2022-03-16 10:20
has joined #pact-net

cyrus.devnomad
2022-03-16 11:47
Hi, I was successful to implement a consumer unit test involving a method sending a HttpMethod.Delete request and a parameter. The request works if the request path is without the name of the parameter as follows: ```.WithRequest(HttpMethod.Delete, "/api/products/13")``` But if I change the path to include the parameter name as follows, the request fails: ```.WithRequest(HttpMethod.Delete, "/api/products?id=13")``` In this case the HttpClient.DelectAsnyc() method returns the following error: ```{StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers: { Access-Control-Allow-Origin: * x-pact: Unexpected-Request Date: Wed, 16 Mar 2022 11:23:47 GMT Content-Type: application/json; charset=utf-8 Content-Length: 329 }}``` Does http://Pact.NET mock provider not support named parameters in the request query?

matt.fellows
2022-03-16 11:48
In other languages, the query string is a separate part of the DSL

matt.fellows
2022-03-16 11:48
so it shouldn?t be part of the path (the path doesn?t include the query string)


serghei.pogodin
2022-03-16 12:31
has joined #pact-net

jeremy.vincent
2022-03-16 14:29
has joined #pact-net

1.g10squad
2022-03-16 16:01
has joined #pact-net

alistair.c.kung
2022-03-16 18:44
has joined #pact-net

adam.howard
2022-03-17 02:05
has joined #pact-net

jonatan.jaworski
2022-03-17 02:32
has joined #pact-net

cyrus.devnomad
2022-03-17 08:30
Thank you very much, as you suggested the mock provider responds as expected after using .WithRequest() in combination with .WithQuery(): .WithRequest(HttpMethod.Delete, "/api/products") .WithQuery("id", "13")

lewis.greenway-jones
2022-03-17 08:52
has joined #pact-net

cyrus.devnomad
2022-03-17 08:56
Hi, my application sends the parameter productName as a request body parameter to the mock provider as follows: {"productName":"ProductX"} I try to configure the Pact builder as follows, so that it would verify the parameter in the request body: ```var productNameObj = new { productName = "ProductX" }; var productNameJson = JsonConvert.SerializeObject(productNameObj); ... .WithJsonBody(productNameJson)``` But the mock provider responds with error 500. How can I make the mock provider to accept the parameter in the request body?

matt.fellows
2022-03-17 09:05
what do the logs say?

matt.fellows
2022-03-17 09:05
I?m not a .NET person, but do you need to explictly serialise the JSON there? I think you can pass the object directly into `WithJsonBody`

cyrus.devnomad
2022-03-17 09:32
Thank you very much, indeed passing the actual object instead of the serialized object did i! Now the mock provider accepts and verifies the parameter in the request body: ```var productNameObj = new { productName = "ProductX" }; ... .WithJsonBody(productNameObj)```

pierre.gerard
2022-03-17 11:59
has joined #pact-net

viswanathan.sarma
2022-03-17 22:39
has joined #pact-net

madhulika.mitra
2022-03-18 15:56
has joined #pact-net

madhulika.mitra
2022-03-18 15:58
Hi Team. I need to add a request signature to my request before testing from provider side. While i was able to add couple of headers using CustomHeaders, how do i get the entire request so i can add signature and send it

madhulika.mitra
2022-03-18 16:00
In java - @TargetRequestFilter is being used.. do we have something for c#?

fabio.rodrigues
2022-03-18 16:00
best way is to register a middleware that changes your request like they do

madhulika.mitra
2022-03-18 16:01
you mean change the provider side.. so that it does not validate the signature at all?

madhulika.mitra
2022-03-18 16:04
I need to sign it.. in any case.. to test it correctly. Any way i could get the request which will be used for pact testing, so i can generate signature, add the header and send it..?

mch
2022-03-19 19:08
Hi, I have following code ``` options.PublishResults(_providerVersion, publishOptions => { publishOptions.BuildUri(new Uri("http://example.com")); publishOptions.ProviderBranch(_providerBranch); });``` Unless build uri is set, verify throws NullReferenceException. Version is `4.0.0-beta.3` . Should I create an issue on github?

rupam.saha
2022-03-21 09:26
has joined #pact-net

christian.jeppesen
2022-03-21 10:10
has joined #pact-net

anand.kannan
2022-03-21 10:10
has joined #pact-net

mikhail.yartsev
2022-03-21 10:10
has joined #pact-net

bblechman
2022-03-21 16:36
has joined #pact-net

jeffrey2011998
2022-03-22 09:22
has joined #pact-net

xavier.arque
2022-03-22 11:33
has joined #pact-net

aubrey
2022-03-22 14:32
has joined #pact-net

balazs
2022-03-22 15:51
has joined #pact-net

mch
2022-03-22 20:53
Hi, how can I pass auth token when using `WithUriSource` ? My webhook pipeline fails with 401 Unauthorized

seasharp37
2022-03-22 22:17
has joined #pact-net

saritacutinha
2022-03-23 07:09
has joined #pact-net

rachelb
2022-03-23 10:16
has joined #pact-net


shaheen
2022-03-23 23:11
has joined #pact-net

sentyaev
2022-03-24 12:36
has joined #pact-net

altan.demirkiran
2022-03-24 14:06
has joined #pact-net

jonathan.fortunati
2022-03-24 21:53
has joined #pact-net

simon.dicola
2022-03-25 10:25
has joined #pact-net

mrooschuz
2022-03-25 14:52
has joined #pact-net

ashok.pathak
2022-03-25 15:17
has joined #pact-net

rdanthuluri
2022-03-27 03:28
has joined #pact-net

cudi.unal
2022-03-28 11:25
has joined #pact-net

ashraf.anwar.iw
2022-03-28 13:12
has joined #pact-net

b.costa
2022-03-28 13:15
has joined #pact-net

fabio.rodrigues
2022-03-28 14:32
Hi there, anyone using the new pact-net nugget (pact-net 4.x.x) got a timeout when doing provider state request? ```[INFO][pact_verifier] Running provider state change handler 'There exists 1 application revision 1' for 'A GET request to fetch application detail' [DEBUG][pact_verifier::provider_client] Sending HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(129 bytes, application/json) ) to state change handler [DEBUG][reqwest::connect] starting new connection: http://localhost:9001/ [DEBUG][hyper::client::connect::http] connecting to [::1]:9001 [DEBUG][hyper::client::connect::http] connected to [::1]:9001 [DEBUG][pact_verifier::provider_client] State change request failed with error error sending request for url (http://localhost:9001/provider-states): operation timed out [DEBUG][pact_verifier] State Change: "ProviderState { name: "There exists 1 application revision 1", params: {} }" -> Err(Provider state failed: (interaction_id: a64ddfb75ada4126584b9646620cc01271e1d3c3) Invalid response: error sending request for url (http://localhost:9001/provider-states): operation timed out) [ERROR][pact_verifier] Provider state change for 'There exists 1 application revision 1' has failed - MismatchResult::Error("Invalid response: error sending request for url (http://localhost:9001/provider-states): operation timed out", Some("a64ddfb75ada4126584b9646620cc01271e1d3c3")) [INFO][pact_verifier] Running provider state change handler 'There exists 1 application revision 1 with 2 producers' for 'A GET request to fetch the producers' [DEBUG][pact_verifier::provider_client] Sending HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(225 bytes, application/json) ) to state change handler [DEBUG][reqwest::connect] starting new connection: http://localhost:9001/ [DEBUG][hyper::client::connect::http] connecting to [::1]:9001 [DEBUG][hyper::client::connect::http] connected to [::1]:9001 [DEBUG][reqwest::async_impl::client] response '200 OK' for http://localhost:9001/provider-states``` It's just 1 interaction. Other that use the same provider state passes. Before the upgrade, it worked fine.

mark.hopper
2022-03-28 14:53
has joined #pact-net

fabio.rodrigues
2022-03-28 15:03
I've seen in the logs. It's a concurrency issue. It's trying to do all the setups at the same time. It tries to do the first provider state, then cleanup, then the second, then cleanup

ashraf.anwar
2022-03-28 15:08
has joined #pact-net

damianruizdev
2022-03-28 18:44
has joined #pact-net

matthew.churcher
2022-03-29 08:48
has joined #pact-net

fabio.rodrigues
2022-03-29 09:33
anything that can be done about that?

fabio.rodrigues
2022-03-29 13:12
Hi there, i saw that we can test messaging (we have a example with Kafka in https://docs.pact.io/recipes). It's possible to currently use also this approach with NATS (https://nats.io/) ? I'm using the new pact-net 4.x with V3 spec.

ben.brugman
2022-03-29 14:32
has joined #pact-net

hassan.shaikley
2022-03-29 16:14
has joined #pact-net

oakkub.1995
2022-03-30 07:10
has joined #pact-net

fabio.rodrigues
2022-03-30 09:53
@here why does the new pact-net nugget is calling all provider state in parallel before even 1 test starts to run? This give sproblem when you have state that have completely competitive states

fabio.rodrigues
2022-03-30 10:11
ignore this. It needed a withRequestTImeout for the verify

hiqbal
2022-03-30 15:16
has joined #pact-net

sstenhouse
2022-03-30 15:16
has joined #pact-net

bmeyres
2022-03-30 17:37
has joined #pact-net

alejandro.velez
2022-03-30 18:42
has joined #pact-net

justin
2022-03-30 20:07
has joined #pact-net

leo.adriano1994
2022-03-31 00:00
has joined #pact-net

hitesh.patadia
2022-03-31 04:27
has joined #pact-net

matt.cockayne
2022-03-31 11:02
has joined #pact-net

jimmy
2022-03-31 15:39
has joined #pact-net

bret.mcclory538
2022-04-01 01:10
has joined #pact-net

michael.d
2022-04-01 04:40
has joined #pact-net

yash.deole
2022-04-01 07:07
has joined #pact-net

alan.alie
2022-04-01 08:10
has joined #pact-net

jimmy
2022-04-01 08:11
@jimmy has left the channel

ricardo.cruz
2022-04-01 11:54
has joined #pact-net

lauren.corderoy
2022-04-01 12:24
has joined #pact-net

jiayao.xu
2022-04-01 12:24
has joined #pact-net

shiva.velde0413
2022-04-01 14:44
has joined #pact-net

npc1222
2022-04-04 04:37
has joined #pact-net

arthur
2022-04-04 14:28
has joined #pact-net

agastiya.mohammad
2022-04-05 01:19
has joined #pact-net

paul.stapleton
2022-04-05 07:33
has joined #pact-net

iurisoares1012
2022-04-05 09:53
has joined #pact-net

gocool9996
2022-04-05 10:04
has joined #pact-net

fabio.rodrigues
2022-04-05 15:03
Hey there, i'm trying to use minType matcher with pact-net i have a service that returns a key: [{object1},{object2},{object3}] json, and when i try to match it i get a eroor with : ```1) Verifying a pact between ConsumerPactBrokerTestIdentity and Provider - A valid GET request for configuration value 1.1) has a matching body $.baseProperties[0] -> Type mismatch: Expected Map {"dataType":"Text","defaultValue":"","isSecret":false,"key":"OutSystems:Application:Key","secretKey":null,"value":"","valueOrigin":"EnvironmentLevelOverride"} but received List [[[]],[[]],[[]],[[]],[[]],[[]],[[]]] $.baseProperties[1] -> Type mismatch: Expected Map {"dataType":"Text","defaultValue":"","isSecret":false,"key":"OutSystems:Application:Key","secretKey":null,"value":"","valueOrigin":"EnvironmentLevelOverride"} but received List [[[]],[[]],[[]],[[]],[[]],[[]],[[]]] $.baseProperties[2] -> Type mismatch: Expected Map {"dataType":"Text","defaultValue":"","isSecret":false,"key":"OutSystems:Application:Key","secretKey":null,"value":"","valueOrigin":"EnvironmentLevelOverride"} but received List [[[]],[[]],[[]],[[]],[[]],[[]],[[]]] There were 1 pact failures``` the pact definition i got is the following: ```{ "description": "A valid GET request for configuration value", "request": { "method": "GET", "headers": { "Content-Type": "application/json; charset=utf-8" }, "path": "/api/configuration" }, "response": { "body": { "baseProperties": [ { "dataType": "Text", "defaultValue": "", "value": "", "valueOrigin": "EnvironmentLevelOverride", "isSecret": false, "secretKey": null, "key": "OutSystems:Application:Key" }, { "dataType": "Text", "defaultValue": "", "value": "", "valueOrigin": "EnvironmentLevelOverride", "isSecret": false, "secretKey": null, "key": "OutSystems:Application:Key" }, { "dataType": "Text", "defaultValue": "", "value": "", "valueOrigin": "EnvironmentLevelOverride", "isSecret": false, "secretKey": null, "key": "OutSystems:Application:Key" } ] } }, "matchingRules": { "body": { "$.baseProperties": { "combine": "AND", "matchers": [ { "match": "type", "min": 2 } ] }, "$.baseProperties[*].dataType": { "combine": "AND", "matchers": [ { "match": "type" } ] } }, "status": 200 } }],```

fabio.rodrigues
2022-04-05 15:09
the request response i got: ```{"baseProperties":[{"dataType":"Text","defaultValue":"","value":"","valueOrigin":"EnvironmentLevelOverride","isSecret":false,"secretKey":null,"key":"OutSystems:Application:Key"},{"dataType":"Text","defaultValue":"","value":"My Test","valueOrigin":"EnvironmentLevelOverride","isSecret":false,"secretKey":null,"key":"OutSystems:Application:Name"},{"dataType":"Text","defaultValue":"","value":"","valueOrigin":"EnvironmentLevelOverride","isSecret":false,"secretKey":null,"key":"OutSystems:Application:Description"}]}```

simrat.sidhu
2022-04-05 16:07
has joined #pact-net

gabriel.brazao
2022-04-05 17:42
has joined #pact-net

jhonataok01
2022-04-05 17:43
has joined #pact-net

gabriel.brazao
2022-04-05 17:48
Hello everyone, my team is currently working on PoC to evaluate the usage of the PactFlow in our APIs. We have a lot of questions that the documentation itself its not very clear how to implement. How can we find some support for this tool?

andre.mariano
2022-04-05 19:10
has joined #pact-net

alex.zuliqiaer
2022-04-05 20:31
has joined #pact-net

lflores
2022-04-05 20:33
has joined #pact-net

keoma4
2022-04-05 21:17
has joined #pact-net

erick.belf
2022-04-05 21:46
has joined #pact-net

michaele
2022-04-06 03:40
has joined #pact-net

lewis.prescott079
2022-04-06 07:23
@yousafn @matt.fellows Feel free to ask me any questions here as well

matt.fellows
2022-04-06 07:41
Thanks Lewis!

jhonataok01
2022-04-06 12:28
Hi there. I work with @gabriel.brazao and I would like to follow this conversation. Currently, we are having a little difficulty understanding the way Pactflow is configured. Would it be possible for us to have a meeting to clear up some doubts?

guillaume.camus
2022-04-06 12:47
has joined #pact-net

fabio.rodrigues
2022-04-06 12:48
nobody that can help me?

matt.fellows
2022-04-06 13:22
Perhaps you could elaborate a bit further on your issues and we can see about getting you on track? We have a lot of documentation, tutorials, workshops and examples - so perhaps it?s just not obvious where to begin.

jhonataok01
2022-04-06 13:27
Okay. I will send the questions here in the chat.

jhonataok01
2022-04-06 13:28
1. We saw that in the tests the integration is only published by the Consumer, is this configurable, or does the tool always require a Consumer driven contract testing? 2. We analyzed the Pactflow sample projects and noticed some differences between the JavaScript and DotNet samples. For DotNet the data of "PROVIDER VERSION" is not filled. Is this configurable or is it a limitation of the tool? 3. Is there some sort of "strict" or "loose" validation for the tests? Note: - Strict: Ensures that each definition for the API under test is equivalent to the API code. Can be used to test each existing endpoint. - Loose: The loose validation mode ensures that every information set in the contract test is equal, but if there are more endpoints or properties, the contract is not broken. 4. How exactly should Middleware work in the Provider scenario?

mickfagan
2022-04-06 16:41
Wondering if there are before and after pact verify options like in pact-js?

danielglazer123
2022-04-06 19:06
has joined #pact-net

ricardo.cruz
2022-04-06 22:03
We have also a question about the implementation with a body... I'm facing this "ParserError" but when I call directly my API the request is ok.

ashish.goyal
2022-04-06 23:14
has joined #pact-net

pennellbeth
2022-04-07 08:04
has joined #pact-net

dominic.gara
2022-04-07 08:57
has joined #pact-net

ivan.cheung
2022-04-07 08:58
has joined #pact-net

omrieyal
2022-04-07 08:58
has joined #pact-net

drakulavich
2022-04-07 08:58
has joined #pact-net

jonoar22
2022-04-07 09:06
has joined #pact-net

josh.king
2022-04-07 09:06
has joined #pact-net

pitas01_lope
2022-04-07 09:35
has joined #pact-net

rarestomos
2022-04-07 09:40
has joined #pact-net

shuba.paripoornam
2022-04-07 09:59
has joined #pact-net

jhonataok01
2022-04-07 10:46
@yousafn @matt.fellows @lewis.prescott079 Hi there. We send our questions in the chat. Please give us an answer when possible.

shivam.kumar
2022-04-07 11:00
has joined #pact-net

dgupta2
2022-04-07 13:26
has joined #pact-net

matt.fellows
2022-04-07 21:17
I don't think so Mick. There might be setup and teardown good hooks for the provider states though

pankajarora512
2022-04-07 22:50
has joined #pact-net

aruncontacts
2022-04-07 22:54
has joined #pact-net

mira.kim
2022-04-07 23:59
has joined #pact-net

matt.fellows
2022-04-08 03:55
Hi Jhonata! Apologies, we have had a busy week and just hadn?t had a moment to answer all of your slack questions. > 1. We saw that in the tests the integration is only published by the Consumer, is this configurable, or does the tool always require a Consumer driven contract testing? Pact is only a consumer driven contract testing tool. The docs at http://docs.pact.io/ primarily talk about consumer driven contract testing with Pact. Pactflow has a feature called https://docs.pactflow.io/docs/bi-directional-contract-testing, which supports provider driven and other workflows. Both are explained over here at Pactflow University: https://docs.pactflow.io/docs/workshops > > > 2. We analyzed the Pactflow sample projects and noticed some differences between the JavaScript and DotNet samples. For DotNet the data of ?PROVIDER VERSION? is not filled. Is this configurable or is it a limitation of the tool? I?m not sure what this means sorry. Could you please elaborate? Pact JS and Pact .NET will have differences to reflect the various languages, so it?s possible they set the version in slightly different ways. The provider version is an important concept though, and is critical to CI/CD workflows and tools like can-i-deploy. > 3. Is there some sort of ?strict? or ?loose? validation for the tests? > > Note: > > - Strict: Ensures that each definition for the API under test is equivalent to the API code. Can be used to test each existing endpoint. > > - Loose: The loose validation mode ensures that every information set in the contract test is equal, but if there are more endpoints or properties, the contract is not broken. I?d suggest watching the introductory videos in the docs shared above, this migth help clarify. But regarding ?strict? or ?loose? - that depends on the perspective. In BDCT and CDC a consumer can?t request something the provider doesn?t have - that will always fail. If the consumer only uses a subset of the provider, that will be fine also. This is down to the field level. With Pact, you can be strict or loose based on data types - you can match only exact values, or use matchers. With BDCT it only ever does a schema comparison (so it?s ?loose? by a different definition) > > 4. How exactly should Middleware work in the Provider scenario? I?m not sure what you?re asking here. The provider should run locally, and if it has middleware, it should run also. > > > 5. About body. I?m facing this ?ParserError? but when I call directly my API the request is ok (As shown in the example in the attached images or in the images below). This looks like a specific problem with your test. At a glance, I can?t see why, My suggestion is to create a reproducible example and raise on the Pact .NET github issues so the maintainers of that project can assist you. This being said, if you?re new to Pact, you should use the latest 4.x.x library (currently in beta). It will save you re-work in the future. Cheers, Matt


alphonse.bendt
2022-04-08 11:44
has joined #pact-net

wim.dupont
2022-04-08 11:49
has joined #pact-net

wilsonmar
2022-04-08 13:41
has joined #pact-net

henit.laxmicant
2022-04-08 14:19
has joined #pact-net

mateustalles
2022-04-08 17:35
has joined #pact-net

jonatan.jaworski
2022-04-11 05:35
Hi team - Does anyone know when is PactNet 4 coming out of beta?

bioflash1
2022-04-11 09:21
has joined #pact-net

matt.fellows
2022-04-11 13:09
hmm that pact contents looks correct to my eyes

stambolaolya
2022-04-11 13:20
has joined #pact-net

matt.fellows
2022-04-11 13:34
Are you saying your actual response is what?s above? Could you please set the log level to debug and share (as a file here) what the verifier is seeing?

fabio.rodrigues
2022-04-11 13:53
ok

souravmalhotra007
2022-04-11 15:56
has joined #pact-net

akshay.nm92
2022-04-11 17:48
has joined #pact-net

luxfactaest
2022-04-11 18:25
has joined #pact-net

cameron.allan
2022-04-12 00:15
has joined #pact-net

kendrickbong1996
2022-04-12 04:12
has joined #pact-net

timothy.osm
2022-04-12 05:16
has joined #pact-net

pact270
2022-04-12 08:53
has joined #pact-net

oytun
2022-04-12 13:12
has joined #pact-net

alessandrovermeulen
2022-04-12 14:00
has joined #pact-net

lucka
2022-04-12 15:25
has joined #pact-net

damon_walker
2022-04-12 15:26
has joined #pact-net

anusha_matti
2022-04-12 18:24
has joined #pact-net

albert.pincevic
2022-04-12 21:48
has joined #pact-net

marcello.rigan335
2022-04-13 12:07
has joined #pact-net

koel.misra
2022-04-13 13:31
has joined #pact-net

fabio.rodrigues
2022-04-13 13:59
quick questions: does pact-net 4.x supports pact specification 4.0? or just until 3.0?

johnmichael.bullen
2022-04-13 15:04
has joined #pact-net

wng
2022-04-13 17:54
has joined #pact-net

connor.mcneil
2022-04-13 19:45
has joined #pact-net

henrry.salinas
2022-04-13 20:10
has joined #pact-net

matt.fellows
2022-04-13 21:53
I think just 3 for the moment

danielflieger
2022-04-14 06:37
has joined #pact-net

elyas.najafizada
2022-04-14 11:01
has joined #pact-net

tasaki
2022-04-14 14:46
has joined #pact-net

zhoutianli1234
2022-04-14 15:08
Hi, I am trying to upgrade pactnet from 3.0.x to 4.0.x. I want to specify the port but it seems that PactConfig doesn't have the option anymore. However, the documentation does say that it is possible. How do I specify the port ?

fabio.rodrigues
2022-04-14 15:09
you don't need anymore the port for the consumer side, since it gets a new valid one. Why do you want to specify it?

zhoutianli1234
2022-04-14 15:13
I would like to create my client beforehand, therefor I want to specify the url. Is it still possible to do it ?

fabio.rodrigues
2022-04-14 15:14
create a Http Client Factory and then use it to create you own client class.

fabio.rodrigues
2022-04-14 15:17
```var dummyHttpClientFactory = new DummyHttpClientFactory(ctx.MockServerUri); var consumer = new ServiceClient(dummyHttpClientFactory);```

zhoutianli1234
2022-04-14 15:19
So I suppose that specifying the port is really not possible anymore? But thanks for the suggestion, we'll make it work.

fabio.rodrigues
2022-04-14 15:19
yeah

fabio.rodrigues
2022-04-14 15:19
but in the ServiceClient you can then point it there, or to a mocked service

fabio.rodrigues
2022-04-14 15:20
it's now on your hands

zhoutianli1234
2022-04-14 15:20
alright thank you

fabio.rodrigues
2022-04-14 15:20
You're welcome

pennellbeth
2022-04-18 01:36
@pennellbeth has left the channel

jithinjacob2011
2022-04-18 02:43
has joined #pact-net

bkapadia
2022-04-18 17:25
has joined #pact-net

lewiscowles
2022-04-18 19:10
has joined #pact-net

lewis.prescott079
2022-04-19 14:16
Anyone using PactNet with .Net 6 yet? Interested in understanding how you are dealing with the absence of Startup Class

fabio.rodrigues
2022-04-19 15:31
I'm using it with no problem? Maybe i didn't understood the issue?

lewis.prescott079
2022-04-19 15:37
.net 6 doesn't have startup class by default. Does the service come with or without a startup class?

fabio.rodrigues
2022-04-19 15:37
we run it with a dotnet test and a add a startup class indeed

fabio.rodrigues
2022-04-19 15:38
but for the service onlu

fabio.rodrigues
2022-04-19 15:39
and we have a test startup class

fabio.rodrigues
2022-04-19 15:39
a very simple one

lewis.prescott079
2022-04-19 15:39
Yes our service doesn't have a startup class. Looking for examples like this

fabio.rodrigues
2022-04-19 15:40
just create a test startup class and in the provider test class use it

fabio.rodrigues
2022-04-19 15:40
you create a startup class that maps the controlers only

fabio.rodrigues
2022-04-19 15:41
and then in the provider you add a webhost that uses it

lewis.prescott079
2022-04-19 15:41
Okay I'll give this a try! Thanks

florent
2022-04-19 16:02
has joined #pact-net

b.1.alpha
2022-04-19 18:57
@b.1.alpha has left the channel

testingterrasoft
2022-04-19 19:19
has joined #pact-net

olivia.c
2022-04-19 23:27
has joined #pact-net

testingterrasoft
2022-04-20 14:30
@testingterrasoft has left the channel

ysuei.ygui
2022-04-20 20:42
has joined #pact-net

bret.mcclory538
2022-04-21 17:06
You might also get some inspiration from http://ASP.NET's guidance for integration tests for applications that don't use Startup: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0#basic-tests-with-the-default-webapplicationfactory

zhoutianli1234
2022-04-21 20:42
Hi, is there any documentation on how to properly use pactnet v4.x on .net framework projects ? (ex: .net framework 4.6.1).

giuseppe.torchia
2022-04-22 08:25
has joined #pact-net

fabio.rodrigues
2022-04-22 09:00
Hey there, Has anyone used so far pact-net 4.x to test NATS messaging?

thadamski
2022-04-22 14:00
has joined #pact-net

druiz
2022-04-22 15:02
has joined #pact-net

tord.brokvist
2022-04-22 15:08
has joined #pact-net

gnanasekar69
2022-04-22 17:23
has joined #pact-net

himanshu.1046
2022-04-24 18:25
has joined #pact-net

chris196
2022-04-25 09:51
has joined #pact-net

manu.vereecken
2022-04-25 11:06
has joined #pact-net

maltechristian.neuman
2022-04-25 11:52
has joined #pact-net

prashanth.ramadass
2022-04-25 14:04
has joined #pact-net

janarthanan.rajendras
2022-04-25 22:35
has joined #pact-net

shreyas.gowda
2022-04-26 02:14
has joined #pact-net

marxjo
2022-04-26 07:09
has joined #pact-net

andrew.fraser
2022-04-26 07:19
has joined #pact-net

lei.shi
2022-04-26 07:46
has joined #pact-net

akash.sharma5253
2022-04-26 11:50
has joined #pact-net

kannan.jai
2022-04-27 07:49
has joined #pact-net

c.giannakopoulos
2022-04-27 10:47
has joined #pact-net

sebastian.spiess
2022-04-27 11:43
has joined #pact-net

oury.diallo
2022-04-27 13:46
has joined #pact-net

jean.paiva42
2022-04-27 18:58
has joined #pact-net

christoffer.vig
2022-04-28 06:09
has joined #pact-net

andrea.sangiorgio
2022-04-28 13:01
has joined #pact-net

jason.mcinerney
2022-04-28 19:14
has joined #pact-net

psnyder
2022-04-28 19:22
has joined #pact-net

dominique.cote
2022-04-29 01:17
has joined #pact-net

laura.walsh
2022-04-29 13:40
has joined #pact-net

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

mailtoadnan.ahmed
2022-04-30 08:56
has joined #pact-net

prasanna.mallisetty
2022-04-30 12:11
has joined #pact-net

marcelo.jaeggi
2022-05-02 16:26
has joined #pact-net

jaswanth.ooty
2022-05-03 00:26
has joined #pact-net

james.weng
2022-05-03 05:13
has joined #pact-net

jochen.kraushaar
2022-05-03 09:16
has joined #pact-net

anurag.soni1984
2022-05-03 10:58
has joined #pact-net

stephen.taylor
2022-05-03 14:26
has joined #pact-net

conrad
2022-05-03 18:41
has joined #pact-net

qamarlonalmeida
2022-05-05 05:24
has joined #pact-net

ben.pilgrim
2022-05-05 10:19
has joined #pact-net

lredpath
2022-05-05 11:21
has joined #pact-net

alex834
2022-05-05 11:26
has joined #pact-net

nachogonzalez
2022-05-05 15:51
has joined #pact-net

mounaouar
2022-05-05 18:00
has joined #pact-net

joanna.schloss
2022-05-06 04:45
has joined #pact-net

frank.kilcommins
2022-05-06 04:46
has joined #pact-net

douglas.clark
2022-05-06 04:46
has joined #pact-net

aaron.m.williams24
2022-05-06 07:50
has joined #pact-net

joanna.janiec
2022-05-06 08:14
has joined #pact-net

nicholas.simons
2022-05-06 11:02
has joined #pact-net

matias.cardenas
2022-05-06 13:44
has joined #pact-net

akash.srivastava.1911
2022-05-08 09:38
has joined #pact-net

gustavs.slutins
2022-05-09 11:51
has joined #pact-net

yhiamdan
2022-05-09 13:51
has joined #pact-net

thomas.cederholm
2022-05-09 14:48
has joined #pact-net

rakesh.arrepu
2022-05-09 15:22
has joined #pact-net

abhinavsharma333
2022-05-09 17:44
has joined #pact-net

orbit
2022-05-09 18:00
has joined #pact-net

madhulika.mitra
2022-05-09 22:28
Hi Team - Could anyone working on this combination suggest? My consumer is JVM pact version 4.1.7 and my provider is DotNet pact version 3.0.2. The matchers and generators made from consumer is being ignored at provider layer. Does the provider need to upgrade to 4.0.0-beta.3 to get this supported?

matt.fellows
2022-05-09 23:02
You can set the pact specification to version 2 in Pact JVM so it only serialises a compatible contract

matt.fellows
2022-05-09 23:03
You can't use v3 matchers of generators

matt.fellows
2022-05-09 23:03
Or you can upgrade to the beta .NET which supports up to be spec contracts

eric.barrow
2022-05-10 03:50
has joined #pact-net

madhulika.mitra
2022-05-10 07:47
Thanks @matt.fellows. Will try both options. Bending a bit towards the beta .Net :)

oprisor.cata24
2022-05-10 09:42
has joined #pact-net

jonathan.rice
2022-05-10 10:50
has joined #pact-net

madhulika.mitra
2022-05-10 13:39
hello dear friends - i saw the IPactVerifierSource WithCustomHeader(string name, string value); in https://github.com/pact-foundation/pact-net/blob/cb7693dd4e8dcc4dee301d1a7617b8ed54c93425/src/PactNet.Abstractions/Verifier/IPactVerifierSource.cs#L46 , i am unable to use it IPactVerifierSource in .4.0.0-beta.3 does not have this . Could anyone who has used it throw light on how this is done with 4.0.0-beta.3 version? @pact544 :superhero: some guidance here

vijayasaratha.v
2022-05-10 14:28
has joined #pact-net

pact544
2022-05-10 17:19
It'll be available from beta 4

madhulika.mitra
2022-05-10 17:29
*Kindly guide on this error -*for publish of verification results - [DEBUG][reqwest::async_impl::client] response '403 Forbidden' [ERROR][pact_verifier::pact_broker] Failed to push branch pact-test for provider version 0.0.1 ```[ERROR][pact_verifier] Publishing of verification results failed with an error: Error with the content of a HAL resource - Request to pact broker URL. .PublishResults("0.0.1", results => { results.ProviderBranch("pact-test") .BuildUri(pactServiceUri) .ProviderTags("first-test");; })``` What should build uri refer to? Note - we are able to read pact from same broker for verification but fails at publish. Version used for reference below. ```<PackageReference Include="PactNet" Version="4.0.0-beta.3" /> <PackageReference Include="PactNet.Abstractions" Version="4.0.0-beta.3" /> <PackageReference Include="PactNet.OSX" Version="3.0.2" />```

radhika.madala
2022-05-10 18:10
has joined #pact-net

oscar.lopez
2022-05-10 20:39
has joined #pact-net

johnathan.pestano
2022-05-11 00:43
has joined #pact-net

milda.abromaviciute
2022-05-11 12:47
has joined #pact-net

matiasleandronunez
2022-05-11 13:22
has joined #pact-net

croudet
2022-05-11 14:07
has joined #pact-net

alex.bonstrom
2022-05-11 16:19
has joined #pact-net

cody.sims
2022-05-11 16:45
has joined #pact-net

harii.ravii
2022-05-11 22:02
has joined #pact-net

josh.kilazoglou
2022-05-12 04:17
has joined #pact-net

poojakunder1997
2022-05-12 07:25
has joined #pact-net

pekka.kiviniemi
2022-05-12 10:46
has joined #pact-net

sophie.bosse2
2022-05-12 12:45
has joined #pact-net

sophie.bosse2
2022-05-12 12:46
I'm trying to write contract tests for an object that contains a dictionary of objects. I want to verify the entries respect my contract. The keys are changing between the consumer and provider. Right now, the matching rules of my contract are trying to find specific keys in the body of my message such as `"$.properties.desired.deploymentsRemovals['4JgEA5GCeqwVsu6Qada9XS'].appId"` Is it possible to write contract tests in my situation? I'm using the PactNet nuget version 4.0.0-beta.3. Using a matcher on the key such as ```deployments = new Dictionary<object, object> { {Match.Type("6XKISmGMWynbwM52mxov6S"), new {...``` produces a contract searching for "pactNet.Matchers.TypeMatcher" as the key ```"deployments": { "pactNet.Matchers.TypeMatcher": {```

dimitris.schizas
2022-05-12 16:04
has joined #pact-net

j.shankarnath
2022-05-12 16:37
has joined #pact-net

yesh.veera
2022-05-12 17:35
has joined #pact-net

fabio.been
2022-05-12 18:04
has joined #pact-net

aliboztemir
2022-05-12 19:47
has joined #pact-net

luis.garcia
2022-05-13 09:06
has joined #pact-net

yousafn
2022-05-13 11:21
Hi @sophie.bosse2 thanks for making it along and thanks for the really good example. I'm not overly familiar with .NET, but will look across our demo/examples and see if I we have an example of correct use, or spin up an example to try. Will promise to look into it today, but if you were able to provide an repro repository that would be amazing.

yousafn
2022-05-13 11:25
Not sure if you've seen our dotnet example workshop? But it pre the v4 beta, so https://github.com/DiUS/pact-workshop-dotnet-core-v3 This is a decent upgrade guide for v4 https://github.com/pact-foundation/pact-net/blob/master/docs/upgrading-to-4.mdhttps://github.com/pact-foundation/pact-net/blob/master/docs/upgrading-to-4.mdso this will be my first port of call :)

andreas.wiig
2022-05-13 14:18
has joined #pact-net

ocalderin14
2022-05-13 15:20
has joined #pact-net


sophie.bosse2
2022-05-13 17:11
great idea, I'm doing that right away

jyoti.yennam
2022-05-13 17:28
has joined #pact-net



yousafn
2022-05-13 17:46
Calling calling any .NET wizards who are online, are you able to help kindly with @sophie.bosse2?s question. She has been kind enough provide a perfect reproducible example so hopefully it should be something simple for someone more familiar than me doing some googling and fumbling in the dark :slightly_smiling_face: https://pact-foundation.slack.com/archives/C9UTHV2AD/p1652359561598679 You will earn yourself many kudos points :slightly_smiling_face: If not, no worries, we will see how we got and report back if we find a solution.

yousafn
2022-05-13 17:48
Awesome, thank you so much, I can see the issue, I am just about to sign off for the weekend (its nearly 7pm here), so I will hope to get some OSS time. I've pinged a message in here, and we will get you sorted

sophie.bosse2
2022-05-13 18:00
thank you very much. I'm about to sign off for the weekend too anyway

rberger
2022-05-13 21:06
has joined #pact-net

jsb0545
2022-05-15 18:55
has joined #pact-net

leon.luu2
2022-05-16 06:43
has joined #pact-net

samikshaphulzele
2022-05-16 09:53
has joined #pact-net

shiva.idc
2022-05-17 00:33
has joined #pact-net

joseph.joyce
2022-05-17 12:15
has joined #pact-net

vasanth.s
2022-05-17 13:36
has joined #pact-net

sri.kasturi
2022-05-17 14:21
has joined #pact-net

carlosh.carmo2
2022-05-17 22:43
has joined #pact-net

gchursov
2022-05-18 09:43
has joined #pact-net

berk.safranbolulu
2022-05-18 10:18
has joined #pact-net

larshoogma
2022-05-18 11:34
has joined #pact-net

malvika0810
2022-05-18 12:17
has joined #pact-net

nishant.shah
2022-05-18 13:38
has joined #pact-net

sophie.bosse2
2022-05-18 16:53
Any news on your side?

yousafn
2022-05-19 09:27
Apologies for the delay, I have been fighting the tide this week. Friday is looking pretty clear so will start poking around and see where I get too!

vorashil.farzaliyev
2022-05-19 10:59
has joined #pact-net

cgoodison
2022-05-19 11:32
Hi Sophie, as you are using the PactNet nuget version 4.0.0-beta.3 the upgrade guide may be a more helpful example for you, as a lot of aspects are different from the examples you would have seen written with PactNet v3: https://github.com/pact-foundation/pact-net/blob/master/docs/upgrading-to-4.md V4 is still considered beta and the documentation and examples need some improvement to support it, as such you could also try downgrading to the latest v3 PactNet package which will be what the other examples are using.

jlcrazzy
2022-05-19 13:38
has joined #pact-net

galveznairon
2022-05-19 13:40
has joined #pact-net

sunny.cheung
2022-05-19 20:43
has joined #pact-net

chantalnitz
2022-05-20 07:22
has joined #pact-net

robert
2022-05-20 08:47
has joined #pact-net

baris.kucuk.atilim
2022-05-20 09:47
has joined #pact-net

rajnavakoti
2022-05-20 12:42
has joined #pact-net

pact544
2022-05-20 19:04
#pact-net Version 4.0.0-beta.4 is available now with some key fixes to issues found in the previous beta releases. You can find release notes https://github.com/pact-foundation/pact-net/releases/tag/4.0.0-beta.4 and upgrade to the latest version on https://www.nuget.org/packages/PactNet/4.0.0-beta.4 One particularly important fix was getting an upgraded FFI library to fix a hard blocker on Windows where verification panicked if you had an http://ASP.Net Core development cert installed, i.e. essentially our core audience :smile: This involved requesting and waiting for changes in upstream projects like `reqwest` and `rustls-native` so it's unfortunately taken quite a while. Thanks to those that have tried it out and submitted issues. I'm really hoping this is the last beta and we can go forward with a proper release now that the above is fixed. If you find any issues then please raise them on GitHub and I'll take a look :+1:

mlund
2022-05-20 21:04
has joined #pact-net

mlund
2022-05-20 21:08
With apologies for asking something that I see has been asked before... I'm evaluating http://pact.io and I'm a microservices / .net software engineer. I ran into the issue where TestServer doesn't appear to work with the provider test side because it doesn't expose a real TCP socket. I saw a lot of talk about it but I'm still not clear on whether it's a no-go or whether it can be done. If I could get some clarification that'd be helpful!

pavi.dealwis
2022-05-21 03:28
has joined #pact-net

lewis.prescott079
2022-05-21 09:23
@yousafn I think we need to get some examples around this! Could you co-ordinate!

endika2
2022-05-21 10:52
has joined #pact-net

matt.fellows
2022-05-21 11:12
You need to start your actual provider, if that?s what you?re asking?

6eo2ge
2022-05-22 13:17
has joined #pact-net

eugene.baranovsky
2022-05-22 23:25
has joined #pact-net

eddie
2022-05-22 23:27
@bret.mcclory538 > You might also get some inspiration from http://ASP.NET's guidance for integration tests for applications that don't use Startup: FYI - suggesting to look at the http://ASP.NET guidance for integration tests is a bit of a bum steer, as the HTTP client returned by WebApplicationFactory can't be used by the Pact Verifier - see this issue: https://github.com/pact-foundation/pact-net/issues/283 @matt.fellows

eddie
2022-05-22 23:27
@lewis.prescott079 what did you end up doing?


eugene.baranovsky
2022-05-22 23:33
TestServer relies on special http clients (WebApplicationFactory:CreateClient) that know how to talk to it without going to network

eugene.baranovsky
2022-05-22 23:37
You can't pass httpclient to the pact verifier but you can expose a proxy network address if you really want to, as mentioned in the issue https://github.com/pact-foundation/pact-net/issues/283#issuecomment-810561663. (I don't think this is ideal workaround, and I'd rather suggest following the https://github.com/pact-foundation/pact-net/blob/master/samples/EventApi/Provider.Tests/EventApiFixture.cs)

bret.mcclory538
2022-05-23 02:10
"inspiration" != literally use the same web application factory -- which replaces Kestrel with an in-memory TestServer and returns an HTTP client that shoots requests directly into that server. Those pieces certainly won't work with a Pact verifier that runs out-of-process. But you could examine Microsoft's source to see how they solved the problem of resolving a SUT's host when it uses WebApplication API for building a host. There may be public bits you can borrow from that, e.g. the HostFactoryResolver they're using in there. https://github.com/dotnet/aspnetcore/blob/a5bb3e8761dcfc21d3a31f3c85d4d31779ef4f4f/src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs#L390 I'm sure there's a solution somewhere there; We haven't moved to .NET 6 yet so I haven't personally had to solve this yet. Good luck!

harris
2022-05-23 03:04
has joined #pact-net

lewis.prescott079
2022-05-23 06:02
In the same situation as Bret, haven't moved yet. Just working out whether it's possible

abhiattipra
2022-05-23 06:04
has joined #pact-net

max.bruns
2022-05-23 07:13
has joined #pact-net

hello560
2022-05-23 12:23
has joined #pact-net

yousafn
2022-05-23 12:42
Hi @mlund, Could you point to these discussions and it may help provide additional context for discussion, and we may need to clarify in the docs. > With apologies for asking something that I see has been asked before.. > I saw a lot of talk about it but I?m still not clear on whether it?s a no-go or whether it can be done You are reliant on real network calls being replayed by the client (in this case the Pact verifier) in order to issue calls to your provider application under test which has been started. Thanks for the additional context and links @eugene.baranovsky . as I have not tickled .NET for many many moons, and have very little language specific advice to provide

venky.hodigere
2022-05-23 14:54
has joined #pact-net

bret.mcclory538
2022-05-23 15:22
Also worth pointing out: You aren't _required_ to use the WebApplication API for http://ASP.NET Core 6.0 projects. You continue to use Generic Host (Builder) APIs directly. That's probably what we'll be doing as we upgrade projects to .NET 6. For projects with any complexity, I personally like the separation of concerns having Host and Application configuration in different places. I also like how it makes things consistent with Worker (non- web) applications. YMMV.

mlund
2022-05-23 16:16
Thanks for the clarification. TestServer = no go. It's not our only option but it would have been the preferred option.

prerit.jain
2022-05-23 16:27
has joined #pact-net

evan
2022-05-23 16:48
has joined #pact-net

yousafn
2022-05-23 17:13
@mlund This may be worth a read if you haven?t already seen it. I assume yourself and @lewis.prescott079 have been chatting about this

lewis.prescott079
2022-05-23 17:49
I referred Matt to this channel. Need to spend some time investigating the proposals in this thread

manuel.porto
2022-05-23 17:56
has joined #pact-net

abhishek.lamba
2022-05-24 09:25
has joined #pact-net

stefan.friese
2022-05-24 09:32
has joined #pact-net

bharath.shetty
2022-05-24 09:33
has joined #pact-net

rivanitskiy
2022-05-24 14:23
has joined #pact-net

pact544
2022-05-24 19:01
Yeah this keeps coming up. You can't use the `TestServer`. It runs in memory and thus the Rust core has no way of calling it. You have to start the host properly, like all the samples do.

pact544
2022-05-24 19:02
I'm going to put a note about that in the README now, although I imagine this won't be the last we hear of this :smile:


marti92
2022-05-24 21:40
has joined #pact-net

bret.mcclory538
2022-05-24 22:48
> Yeah this keeps coming up. You can't use the `TestServer`. It runs in memory and thus the Rust core has no way of calling it. True, but it's understandable why .NET developers familiar with WebApplicationFactory reach for it when trying to implement Pact. WebApplicationFactory does more than just mock out the HTTP stack; it also provides a convenient/familiar API for customizing the SUT (Provider) in various ways that are useful in the context of Pact testing. E.g. replacing out-of-process dependencies with mocks, disabling authn, etc. Pact-Net doesn't have a polished story to tell around that** -- kind of an exercise for the implementer to roll their own WebApplicationFactory-like solution. ** as far as I can tell. Would be very happy to shown otherwise!

bret.mcclory538
2022-05-24 23:07
I'd add that in our case, this has been a difficult barrier to acceptance with Pact-Net. We're a small shop with a large investment in WebApplicationFactory- based "Integration tests". We use a lot of in-memory mocks (Moq) to support those tests -- very similar to the examples in the Microsoft documentation: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0#inject-mock-services We need to do same/similar setup in Pact Provider tests, but without WebApplicationFactory to do that heavy lifting, it's a real burden. I'm hopeful there's some way to steal the "useful bits" from WebApplicationFactory (e.g. host factory resolver) and share the common setup code between the different test projects, but I haven't dug into it very deeply yet.

yasarenver
2022-05-25 05:22
has joined #pact-net

brian.quinn
2022-05-25 08:53
has joined #pact-net

david.hvilava
2022-05-25 09:05
Hi guys! I'm adopting Pact on my project. Maybe I misunderstood it. Considering http://Pact.Net v4, shouldn't `IPactUriOptions` provide an ability to publish verification results similar to `IPactBrokerOptions`? Example: a contract is changed and published to PactFlow, then a webhook triggers a provider CI to check the contract, then we need to publish verification results back to PactFlow

akke.luukkonen
2022-05-25 10:42
Since the recommended way is to use the CLI tools (based on this https://docs.pact.io/pact_broker/publishing_and_retrieving_pacts) I would expect that publishing contracts would eventually get removed from the libraries, but that's literally just my own guess. I haven't seen anything mentioned about it here in Slack.

david.hvilava
2022-05-25 10:46
You're right regarding publish a contract itself. But I'm concerned more about publishing a contract verification result by provider. Not sure if it's possible to do via CLI

akke.luukkonen
2022-05-25 10:49
Ahh, sorry I misread a bit. _Technically_, it is possible depending on how you do the verifications. I personally run the verification of contracts using the Rust based `pact_verifier_cli` tool in my pipelines to verify the contracts for a provider. But that's a bit different case. But indeed I'm not aware if you could just publish some verification results from a verification run made with the libraries. I doubt that since it probably doesn't produce any files?

david.hvilava
2022-05-25 10:57
Here is an excerpt of my code for provider

david.hvilava
2022-05-25 10:59
The 'else' part works fine. A pact is fetched from PactFlow, verified and the result is sent back. But for case when "PactUrl" is provided the verification result is not sent to PactFlow

matt.fellows
2022-05-25 11:38
That?s a good question. I think it is supported, I?ll search back up the slack threads, I?m sure this has been asked before but I can?t recall the answer

jarekrzdbk
2022-05-25 12:45
has joined #pact-net

shaun.mendham
2022-05-25 16:32
has joined #pact-net

pact544
2022-05-25 17:40
The URI option doesn't support publishing results, no. A pact can come from any URI, so it doesn't make sense to publish verification results. It could be a random repo on GitHub, or a CI artefact from TeamCity or Jenkins. Publishing results might make no sense at all. Results are something you publish to a broker, so you'd use the broker source for that. It would be weird to get the pact from a broker via URI instead of the broker source, but then to also want to publish results back to the broker. It's also weird to grab pacts from somewhere other than the broker but then publish the results of that to a broker.

pact544
2022-05-25 17:42
@david.hvilava take your example above - the URI source is used when you don't have a broker URL. That means you couldn't publish results back anywhere anyway, because you don't have the broker URL for publishing. If you do have the broker URL, then you use the broker source to both get the pact and publish the results, so there's no problem.

david.hvilava
2022-05-25 18:58
Adam, thank you very much for detailed answer! I asked about that following https://docs.pact.io/provider/recommended_configuration#:~:text=Copy-,Verification%20triggered%20by%20pact,-change%E2%80%8B documentation. "When a pact has changed, a webhook in the Pact Broker will kick off a build of the provider, passing through the URL of the pact that has changed". I understood it in a way that we can provide a link to a changed pact (from some feature branch) in Pact broker to a provider CI that will build 'main' branch and then return verification result back to the Broker. Or if it's not correct then I believe we can pass a branch name via webhook request to a provider CI to use `ConsumerVersionSelector` as for regular pact verification

pact544
2022-05-25 19:01
Interesting! Yeah I'm not sure I agree with that documentation. It's certainly not how I've ever used it in practice. I just kick off the entire provider run again and verify everything. I'm not sure if the FFI supports publishing verification results with URI sources either. I'll check.

pact544
2022-05-25 19:06
I can't even tell from the FFI code if it's supported or not. You set the publish options but you never pass a broker URL, so how would it know where to publish the results to? In theory you could use that with any source, even a file or directory, if you could pass the broker details through. Since you can't, I can only assume it only works with the broker source so that it has the correct details on where to publish. https://github.com/pact-foundation/pact-reference/blob/e32caf8defd399029dcdf09c5d9298a1fe71d75a/rust/pact_ffi/src/verifier/mod.rs#L260

pact544
2022-05-25 19:07
So yeah, I'd recommend just redoing the entire provider run. Publishing duplicate verification options isn't a problem.

david.hvilava
2022-05-25 19:19
Thanks!

plourded
2022-05-25 19:43
has joined #pact-net

matt.fellows
2022-05-26 01:55
> So yeah, I?d recommend just redoing the entire provider run. Publishing duplicate verification options isn?t a problem. No, that?s not the recommended flow. In step 6 of the CI/CD setup guide, you can verify a specific pact version with the webhook: https://docs.pact.io/pact_nirvana/step_6#add-can-i-deploy-to-consumer-pr-pipeline. This is how you ensure there are no ?gaps? in coverage, meaning no surprises for use of `can-i-deploy` I believe this is what David is talking about. You can re-run the verification, but it does mean that the verification options are broad enough to verify the specific pact that was changed which is not always the case. > It?s also weird to grab pacts from somewhere other than the broker but then publish the results of that to a broker. In this case, the URI _is_ a broker URL. It?s just a path to the contract, not a hypermedia relation to discover the pacts to verify. > I can?t even tell from the FFI code if it?s supported or not. You set the publish options but you never pass a broker URL, so how would it know where to publish the results to? It should be possible, but I can see why you can?t infer that from the APIs. If the URI is a pact broker URL, it should have the correct relations in it to publish a result In this case, I believe you can set the values of `pactffi_verifier_set_publish_options` . @uglyog is my understanding correct?

emirhan.emmez
2022-05-26 06:31
has joined #pact-net

david.hvilava
2022-05-26 08:46
Matt, you got me right :+1: More over I have a feeling that this code path (with PactUrl) worked fine in http://Pact.Net v3. Meaning it sent verification results back to Pact Broker. While exploring Pact framework a year ago in my team we created a POC based on V3. And as I remember it worked back then. So maybe current implementation (v4) works differently

matt.fellows
2022-05-26 08:48
Yeah. Adam has re-written the guts of it to use a new core module written in Rust (much faster, new features, fixes Ruby long path issue etc. etc.). But it?s still new-ish and is not well documented for how to sequence the calls for all of the use cases. So based on the FFI interfaces it?s not obvious this is a thing that can be done

sophie.bosse2
2022-05-26 12:33
I need to do contract test for a messaging system, not an API, that's why I want to use the new version.

pact544
2022-05-26 13:25
#pact-net Release Announcement :tada: Now that we've been in beta for a good while I think we're ready for a proper release of PactNet 4.0.0. I think we've ironed out any teething issues now, so thank you to all those that have participated in the beta and raised issues for me to fix :tada: I've got the current latest beta running in production at my employer and everything appears to be working OK. Of course there will be more features and things to add in the future, but I think the core functionality is all there and the API can be considered stable. So, assuming there are no more big issues before then, I'm planning to release *PactNet 4.0.0 on 6th June 2022.* I'd do it sooner but I'm on holiday next week :smile:

pact544
2022-05-26 15:54
I'm still not sure from the API that it can be done? The function for setting publish options doesn't have an argument for passing a broker URL. Do the FFI internals magically extract the host if you use the URI source and use it as a broker source? That sounds dangerous to me. There's nothing to validate that the host of a URI source even is a broker, or that it's the correct broker. And what happens if you set the publish options but use a file source? Where would it get the broker URL from? That either doesn't work or at best it's all very opaque, and not something I really want to try and build a sensible API around as it stands today.

jarekrzdbk
2022-05-26 17:31
Hello, is there something for .net like wiremock-pact-generator? https://docs.pactflow.io/docs/bi-directional-contract-testing/tools/wiremock I tried contract tests, now want to try bi directional approach with wiremock, since I already have it thank you.


yousafn
2022-05-26 17:40
Epic work, and also extending my thanks to those who have participated and worked with Adam on this. Enjoy the well deserved holiday my friend

jarekrzdbk
2022-05-26 17:40
Thank you!

yasir27uk
2022-05-26 17:56
has joined #pact-net

yousafn
2022-05-26 18:18
Not to detract from Adam?s epic https://pact-foundation.slack.com/archives/C9UTHV2AD/p1653571533957449 about a Planned release of *PactNet 4.0.0 on 6th June 2022* :rocket: but this one almost slipped me by, so want to make sure it doesn?t slip you by.:heavy_heart_exclamation_mark_ornament: :rotating_light: Using Wiremock & .NET. :fire: Now you can generate Pact :link: contracts from your Wiremock Server :point_right: Check it out here https://lnkd.in/eKagaDHn :book: Background https://lnkd.in/egczVAex :heart_eyes: Thanks https://www.linkedin.com/in/ACoAAAClHlsBdpo1lJc1LiT8eM46fN2RNMYfVVo for the work, https://www.linkedin.com/in/ACoAAADmglABDVNkyn_h48naeMwHtnYba_BLJS0 for the connection and https://www.linkedin.com/in/ACoAAAGfQhkBIYiiqrmKygbE75ndHlnirYXf2xc for creating wiremock in the first place

pact544
2022-05-26 20:03
@david.hvilava I've raised an enhancement ticket for this, but unfortunately it won't be q quick turnaround because it requires FFI changes: https://github.com/pact-foundation/pact-net/issues/392 I was right that the FFI doesn't support this, for the reasons I said above. You don't know the broker URL, and it's not safe/robust to just assume it's the same as the host from the URI source. @matt.fellows I've started a discussion thread for it on the FFI channel

cgoodison
2022-05-26 23:29
Ah yeah, that makes sense. It is just about to be released officially anyway so there shouldn't be many functional issues at this stage. Let me know how you go following the upgrading guide to v4 :slightly_smiling_face:

lcs2019022
2022-05-27 05:27
has joined #pact-net

wieslaw.bondyra
2022-05-27 08:09
has joined #pact-net

david.hvilava
2022-05-27 08:22
Thank you, Adam :+1:

rafaelcebulla
2022-05-27 15:20
has joined #pact-net

orbit.mjs
2022-05-27 17:45
has joined #pact-net

msparks
2022-05-27 19:56
has joined #pact-net

matt.fellows
2022-05-28 01:00
this is cool!

pact544
2022-05-28 21:13
I've had a chance to quickly review this and I'm not sure how useful it really is. It doesn't support matchers, which is the real key thing you need. They've also confused some terminology, because they use Given to specify the request, whereas in the Pact DSL that's actually used for configuring provider states.

yousafn
2022-05-28 23:15
Hey Adam, thanks for taking a look. this would be used in the bi-directional flow only, whereby matchers, and providers states are not supported, as the verification would be performed against an OAS, rather than using a Pact verifier against the running provider. So they wouldn't get as strong guarantees as CDCT but enables them to reuse existing Wiremock implementations. Feedback on the DSL is good though :thumbsup: I can see how that could cause additional confusion. I've already seen a couple of cases of people using the alternate modes of Pact file generation (adapters, not native Pact implementations) with CDCT, and they've seen the issues that matchers/provider states were designed to prevent. Will make sure when we get this added to the docs, that we get some additional notes around that.

falvarez
2022-05-30 14:17
has joined #pact-net

yousafn
2022-05-30 18:08
Hey @pact544, sorry for the direct tag, but wondering if you might be able to help out when you have a moment, I imagine this might hopefully be a quick one for you to answer, and there is a direct repo against the Pact-net repo as well, so hopefully shouldn't take too much of your time. Thank you :pray:

pact544
2022-05-30 18:53
I'm on holiday this week, but having a very quick look through that on my phone I'm not sure you can really get that to work. The key needs to just be a string, not a matcher.

ruslan.ponomarev
2022-05-31 06:28
has joined #pact-net

alexander.maiburg
2022-05-31 07:31
has joined #pact-net

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-net

vipul.pachauri
2022-06-01 08:02
has joined #pact-net

komal.sharma1
2022-06-01 08:02
has joined #pact-net

chris169
2022-06-01 11:53
has joined #pact-net

sophie.bosse2
2022-06-01 11:54
Essentially, my messages contain dictionaries of objects, I want to validate the objects structures. But I can't produce a contract that doesn't require my key to always be the same.

m.shi
2022-06-01 19:07
has joined #pact-net

asa.anudeep4
2022-06-02 04:33
has joined #pact-net

diede
2022-06-02 10:01
has joined #pact-net

mateusz.zaborowski
2022-06-02 17:54
has joined #pact-net

rchord23
2022-06-05 19:30
has joined #pact-net

divya.parameswaran
2022-06-05 20:16
has joined #pact-net

pact544
2022-06-06 11:36
:tada: :tada: :tada: PactNet 4.0.0 is now released and pushed here: https://www.nuget.org/packages/PactNet/ See the upgrade guide for details of the rewrite and how to upgrade from 3.x to 4.x: https://github.com/pact-foundation/pact-net/blob/4.0.0/docs/upgrading-to-4.md

alexey.shchukin
2022-06-06 11:46
has joined #pact-net

afang
2022-06-06 22:17
has joined #pact-net

matt.fellows
2022-06-07 00:29
Amazing work Adam - what an awesome milestone!

pratish.mp
2022-06-07 00:58
has joined #pact-net

dasarih
2022-06-08 00:20
has joined #pact-net

benjamhawk
2022-06-08 02:37
has joined #pact-net

sclaros
2022-06-08 13:07
has joined #pact-net

daniel.tjondro
2022-06-08 15:25
has joined #pact-net

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

sandro
2022-06-08 18:26
has joined #pact-net

hazem
2022-06-08 23:14
has joined #pact-net

leonardo.lanni
2022-06-09 14:51
has joined #pact-net

jcamilovasquezm
2022-06-10 02:47
has joined #pact-net

markrkell
2022-06-10 08:13
has joined #pact-net

eva-maria.schaller
2022-06-10 08:24
has joined #pact-net

michel.kaporin
2022-06-10 14:43
has joined #pact-net

pooja.sharma4099
2022-06-11 08:39
has joined #pact-net

srinivas.vaddi
2022-06-11 16:31
has joined #pact-net

igor.sharfman
2022-06-12 11:25
has joined #pact-net

pooja.sharma4099
2022-06-12 15:00
hello, I am trying to publish pact file created locally to my pactflow account. But looks like I need "pactfoundation/pact-cli:latest" docker image running to talk to broker for Pact Net 4.x.x onwards, is there any documentation or code example on how to do that? Any help will be greatly appreciated, thanks

yousafn
2022-06-12 17:28
Hey here is 4 ways you can publish to the pactflow broker https://docs.pactflow.io/docs/bi-directional-contract-testing/contracts/oas#publishing-the-provider-contract--results-to-pactflow The command will be pact-broker publish :)


pooja.sharma4099
2022-06-12 17:44
thanks for replying Yousaf, so i did pull the pact cli docker and tried the below, it keeps failing for me ```C:\Users\<myUserName>\source\repos\PACT\pacts> docker run --rm pactfoundation/pact-cli:latest broker publish "ApiClient-EmployeeList.json" -b="https://<org_name>.http://pactflow.io" -k="<tokenValue>" -a="1.0.0" Specified pact file 'ApiClient-EmployeeList.json' does not exist. This sometimes indicates one of the arguments has been specified with the wrong name and has been incorrectly identified as a file path.```

pooja.sharma4099
2022-06-12 17:45
I keep getting the same, note that i am already in the directory where this contract json exists.

pooja.sharma4099
2022-06-12 17:45
any ideas here, i am sure i am doing something silly here

yousafn
2022-06-12 18:23
You need to load your pacts into your docker image with a volume mount. You will probably find the pact ruby standalone easiest to use that will pick up the file or a folder of pact files.


pooja.sharma4099
2022-06-12 22:35
many thanks Yousaf, I am now able to upload the file through the cli, for others benefit, I ran the below command after pulling the docker image ```> docker run --rm -v c:/Users/<MyUser>/source/repos/PACT/pacts:/var/lib/pacts pactfoundation/pact-cli:latest publish "/var/lib/pacts/ApiClient-EmployeeList.json" -b="https://<MyOrgName>.http://pactflow.io" -k="<tokenValue>" -a="1.0.0"```

pooja.sharma4099
2022-06-12 22:39
But the issue now is, contract uploaded is NOT being verified after I run the test below, what am I doing wrong, any ideas please? ``` var config = new PactVerifierConfig { LogLevel = PactLogLevel.Information, Outputters = new List<IOutput> { new XUnitOutput(_output) } }; IPactVerifier verifier = new PactVerifier(config); verifier.ServiceProvider("EmployeeList", new Uri("http://localhost:5008")) .WithPactBrokerSource(new Uri("https://<MyOrg>.http://pactflow.io"), options => { options .TokenAuthentication("<TokenValue>") .ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true, Latest = true }) .PublishResults("1.0.0", results => { results .ProviderBranch("master") .BuildUri(new Uri("https://<MyOrg>.http://pactflow.io/pacts/provider/EmployeeList/consumer/ApiClient/latest%22)); }); }) .WithProviderStateUrl(new Uri("http://localhost:5008"+ "/employees")) .Verify(); ```

pooja.sharma4099
2022-06-12 22:42
the broker UI on the link i have used

pooja.sharma4099
2022-06-12 22:49
and the logs from run (copied from Rider) ```PactNet.Exceptions.PactFailureException: Pact verification failed PactNet.Exceptions.PactFailureException Pact verification failed at PactNet.Verifier.InteropVerifierProvider.Execute() at PactNet.Verifier.PactVerifierSource.Verify() at ContractTestV2.Tests.ProviderPactTests.VerifyLatestPacts() in C:\Users\<>\source\repos\ContractTest\ContractTestV2\Tests\ProviderPactTests.cs:line 34 Starting verification... Pact verification failed Verifier Output --------------- Failures: 1) Failed to load pact - Could not load pacts from the pact broker 'https://<>.http://pactflow.io/' - ContentError("Request to pact broker URL 'https://<>.http://pactflow.io/pacts/provider/EmployeeList/for-verification' failed - HTTP status client error (400 Bad Request) for url (https://<>.http://pactflow.io/pacts/provider/EmployeeList/for-verification)") There were 1 pact failures Verifier Logs ------------- [INFO][pact_verifier::pact_broker] Fetching path '/' from pact broker [WARN][rustls::check] Received a ServerHelloDone handshake message while expecting [CertificateRequest] [INFO][pact_verifier::pact_broker] Fetching path '/pacts/provider/EmployeeList/for-verification' from pact broker [ERROR][pact_verifier] Failed to load pact - \x1b[31mCould not load pacts from the pact broker 'https://<>.http://pactflow.io/' - ContentError("Request to pact broker URL 'https://<>.http://pactflow.io/pacts/provider/EmployeeList/for-verification' failed - HTTP status client error (400 Bad Request) for url (https://<>.http://pactflow.io/pacts/provider/EmployeeList/for-verification)")\x1b[0m [WARN][pact_matching::metrics] Please note: We are tracking events anonymously to gather important usage statistics like Pact version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'.```

pooja.sharma4099
2022-06-13 08:37
any help on above will be greatly appreciated @yousafn thanks

chituru.chinwah
2022-06-13 08:48
has joined #pact-net

cchinwah1
2022-06-13 09:45
has joined #pact-net

matt.fellows
2022-06-13 10:36
Can you please enable debug level logging and share?

pooja.sharma4099
2022-06-13 10:37
where can i do that? sorry i have just started using it

matt.fellows
2022-06-13 10:38
I don?t know Pact .NET very well, but a search of the pact net docs at http://docs.pact.io or the project repo should yield results.

pooja.sharma4099
2022-06-13 10:38
ah got it, is that right? ```var config = new PactVerifierConfig { LogLevel = PactLogLevel.Debug,```

matt.fellows
2022-06-13 10:38
looks about right!

matt.fellows
2022-06-13 10:40
also `BuildUri` is meant to point to the URL of your _build_ (e.g. Github or jenkins build) not the pact file

matt.fellows
2022-06-13 10:40
```.ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true, Latest = true })``` I could be wrong, but it doesn?t look like there are any pacts marked as the main branch, so perhaps it?s not finding any pacts (using your screenshot)

pooja.sharma4099
2022-06-13 10:41
I dont have the integration from a pipeline yet, I created pact locally from consumer, uploaded it using pact cli and now running the provider test to verify the interaction, so what should this value be?


matt.fellows
2022-06-13 10:42
In your case, you haven?t tagged, deployed or marked the contract with a tag/branch

matt.fellows
2022-06-13 10:42
So `latest` is about the only option available to you

matt.fellows
2022-06-13 10:43
see the CI/CD workshop in :point_down: (howtolearn) for an ideal setup

2022-06-13 10:43
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

pooja.sharma4099
2022-06-13 12:21
Hi Matt, with all the suggested changes it works (I literally deleted buildUri & other info bits for now). Many thanks for all the support! :100:

yousafn
2022-06-13 12:27
Woohoo glad you are sorted @pooja.sharma4099 :raised_hands:

pooja.sharma4099
2022-06-13 12:29
@yousafn work in progress .. but for now Indeed :slightly_smiling_face: hope not to bother too much in near future :zany_face:

yousafn
2022-06-13 12:32
Well, glad you are sorted for now, and don't worry about bothering us, it is what we are here for

yousafn
2022-06-13 12:32
Would love feedback over the course of your experience with Pact/Pactflow and look to improve ares where we can. Thanks @pooja.sharma4099

pooja.sharma4099
2022-06-13 12:34
on the note of feedback, just something I observed, (but its not blocking me right now)

yousafn
2022-06-13 12:35
it should be `broker can-i-deploy` or `pact-broker can-i-deploy` (to align the docker version with the ruby and standalone CLI)

pooja.sharma4099
2022-06-13 12:36
so silly of me, thanks so much :slightly_smiling_face:

julian.alvarezv
2022-06-13 17:10
has joined #pact-net

eugene.baranovsky
2022-06-14 02:11
Hey team, is there a way to make verifier (broker source) to fail the verification when results publishing bit failed? I am getting :white_check_mark: tests with error message in logs ```[ERROR][pact_verifier] Publishing of verification results failed with an error```

matt.fellows
2022-06-14 03:04
Might be a question for @uglyog / #libpact_ffi-users

matt.fellows
2022-06-14 03:04
Do you know what the error is?

eugene.baranovsky
2022-06-14 03:05
Yes, I've got the error on multiple occasions for multiple reasons (readonly token is one example) but that error only manifests itself in logs

malukenho.dev
2022-06-14 14:33
has joined #pact-net

vikki.read
2022-06-14 18:58
has joined #pact-net

omer.khalil
2022-06-14 19:33
has joined #pact-net

rxiao
2022-06-15 04:29
has joined #pact-net

james.demaine373
2022-06-15 10:22
has joined #pact-net

dmoll
2022-06-15 21:10
has joined #pact-net

kurt3402
2022-06-16 04:29
has joined #pact-net

kyo.tang
2022-06-16 06:03
has joined #pact-net

prasadsolanki
2022-06-16 10:58
has joined #pact-net

mairtin.conneely
2022-06-16 12:02
has joined #pact-net

laura.kennedy
2022-06-16 14:32
has joined #pact-net

prasadsolanki
2022-06-16 15:36
Hello All, I am new to Pact and about to start implementing contract testing using PactNet.

prasadsolanki
2022-06-16 15:42
The first thing I am trying to add dependency in my `.Net Core 6` project is for `PactNet`. I can see that there are OS specific packages as well. Shall I use only `'PactNet`' as this looks to be from *'PactNet foundation'*? I tried `PactNet.Windows` for time being and it looks like it has different implementation than `PactNet`


rxiao
2022-06-16 18:24
@rxiao has left the channel

eugene.baranovsky
2022-06-17 03:04
I guess the answer is "No there is no way" Could we add this request to a list of potential improvements?

eugene.baranovsky
2022-06-17 03:08
Hey team, while working with Provider Verifier from pact-net 4 I noticed that there is a built in way to publish verification results back to the broker if you use `WithPactBrokerSource` . My question is are there any plans to have similar verification result publishing capability when using `WithUriSource` ?

gaurav.bajpai
2022-06-17 03:41
has joined #pact-net


matt.fellows
2022-06-17 04:35
can you please raise a request on the Pact .NET Github?

matt.fellows
2022-06-17 04:48
I think the support was added to the core now, just needs wiring back in to .NET

matt.fellows
2022-06-17 04:48
I?m sure Adam would appreciate a PR if you?re willing!


salmanjamali
2022-06-17 06:49
has joined #pact-net

alansimonalie
2022-06-17 12:57
has joined #pact-net

ben.a.hubbard
2022-06-17 13:47
has joined #pact-net

lafriakh.rachid
2022-06-18 14:24
has joined #pact-net

courtney.lum
2022-06-20 04:02
has joined #pact-net

woojos
2022-06-20 09:58
has joined #pact-net

abdou.ahzab
2022-06-20 10:08
has joined #pact-net

dstekanov.tech
2022-06-20 15:28
has joined #pact-net

rohit.thadhani
2022-06-21 04:39
has joined #pact-net

jvieira
2022-06-21 22:28
has joined #pact-net

marcus.james
2022-06-22 15:28
has joined #pact-net

jonas.pena
2022-06-22 15:50
has joined #pact-net

abudi.hijazi.01
2022-06-22 16:44
has joined #pact-net

vaddisrinivas170497
2022-06-22 18:57
has joined #pact-net

adam.anderson
2022-06-23 03:46
has joined #pact-net

yegorisa
2022-06-23 03:47
has joined #pact-net


eugene.baranovsky
2022-06-23 04:34
pact-net side https://github.com/pact-foundation/pact-net/pull/393/files is waiting for ffi to be released

eugene.baranovsky
2022-06-23 04:37
btw, what does FFI stand for?


swapnil.jagdale
2022-06-23 05:19
has joined #pact-net

matt.fellows
2022-06-23 06:26
FFI = foreign function interface

matt.fellows
2022-06-23 06:26
we have a shared library that provides core functionality across our projects.

matt.fellows
2022-06-23 06:26
it exposes an API via a FFI


mark.mcmurray
2022-06-23 08:33
has joined #pact-net

jacek.maciag
2022-06-23 09:15
has joined #pact-net

sandor.arpa
2022-06-24 09:30
has joined #pact-net

mwilso29
2022-06-24 11:19
has joined #pact-net

renaud.meurisse
2022-06-24 12:47
has joined #pact-net

prasadsolanki
2022-06-25 15:09
I am writing a contract test for a post method where I need to pass a file in request Body as 'form-data'. How do I write this in pact interaction. I have tried this but it doesn't work.

prasadsolanki
2022-06-25 15:11
This is the mock method I have written

prasadsolanki
2022-06-25 15:35
This is the error I get

matt.fellows
2022-06-25 23:02
Is it a multipart json body or something else?

rk8085858
2022-06-26 08:12
has joined #pact-net

alex.savage
2022-06-27 08:26
has joined #pact-net

simon.selvadurai
2022-06-27 08:28
has joined #pact-net

yasir.khan
2022-06-27 11:21
has joined #pact-net

willem.basson
2022-06-27 11:25
has joined #pact-net

edward.francis
2022-06-27 11:32
has joined #pact-net

laura.cabantous
2022-06-27 11:35
has joined #pact-net

ruslan.charuh
2022-06-27 12:18
has joined #pact-net

pramod-arjun.bhalerao
2022-06-27 12:54
has joined #pact-net

prasadsolanki
2022-06-27 13:55
It is supposed to be a file, e.g. .txt, .csv etc.

prasadsolanki
2022-06-27 13:58
In postman it works when I send the file as form-data

prasadsolanki
2022-06-27 14:01
When I select 'form-data' type under body, it automatically adds 'multipart/form-data' header. But the request works even if I remove this header. So I guess its just a question of setting file upload with 'form-data' in pact interaction

ssomepalli
2022-06-27 14:30
has joined #pact-net

owen.oclee.old
2022-06-27 16:13
has joined #pact-net

pooja.sharma4099
2022-06-27 16:14
Hello, what does the ".WithProviderStateUrl" method do on the provider-verify tests?

oherescu
2022-06-27 19:21
has joined #pact-net

matt.fellows
2022-06-27 22:25
I ask because you add the body in the JSON method. Is there a different multipart method that can be used as an alternative?

matt.fellows
2022-06-27 23:17
This is the HTTP endpoint that will receive state change requests before each test is run on the provider side


nathan.tejuco
2022-06-28 03:50
has joined #pact-net

jun.ito
2022-06-28 07:47
has joined #pact-net

daniel.shamaeli
2022-06-28 09:01
has joined #pact-net

michael.oloyede
2022-06-28 09:55
has joined #pact-net

prasadsolanki
2022-06-28 22:15
you mean in mocked client? I haven't tried anything other than mutlipart yet. I will give it a try

matt.fellows
2022-06-29 01:07
yes, I?m saying that you used the JSON body method for a multi-part post. I?m assuming there is (or should be) a specific multi-part content function

matt.fellows
2022-06-29 01:07
the JSON body is unlikely to work properly, because it won?t add the correct multipart request bits

eugene.baranovsky
2022-06-29 02:39
:fingerscrossed:

lucas.azzola
2022-06-29 04:18
has joined #pact-net

jens.suhr
2022-06-29 09:25
has joined #pact-net

jens.suhr
2022-06-29 09:26
@jens.suhr has left the channel

thammarith.likittheer
2022-06-29 10:46
has joined #pact-net

prasadsolanki
2022-06-29 11:02
Hello, In pactNet V4, I don't see an option to set log file path within PactConfig. What's the default location for log file path then? Also Is it possible to change the path for log files? This is my PactConfig but I dont see any log file generated

matt.fellows
2022-06-29 11:43
I don?t believe there is an option to log to file, it should go to stdout


prasadsolanki
2022-06-29 12:15
:+1: Thanks

andrevpuc
2022-06-29 14:24
has joined #pact-net

mylesjj
2022-06-29 16:26
has joined #pact-net

mylesjj
2022-06-29 16:31
Hi team, Does anyone have a good example of a Azure ADO yml build pipeline that meets the requirements of the gold nirvana stage (https://docs.pact.io/pact_nirvana/step_5)? Regards MJJ

matt.fellows
2022-06-30 01:01
I guess we need to see a version of https://docs.pact.io/pact_broker/webhooks/template_library#azure-devops---trigger-build that accepts the pact url being verified

mylesjj
2022-06-30 08:59
I was looking more for examples of how to publish the pact from a Azure ADO CI pipeline

matt.fellows
2022-06-30 09:35
What's the difference? Doesn't seem like we have an example, hopefully you can extrapolate from the other examples to the specific needs of ADO CI

matt.fellows
2022-06-30 09:37
Oh you mean publish, sorry

matt.fellows
2022-06-30 09:37
There was an area sample project somewhere. If you can call the CLI docker that'd be the easiest way to go

oliviawalsh1
2022-06-30 09:49
has joined #pact-net

mylesjj
2022-06-30 12:16
OK, thanks for your help anyway. Can't find the area sample project anywhere

prasadsolanki
2022-06-30 14:15
I didn't see any multipart content specific function in PactNet4. That would have been really Great. This is all what I see

matt.fellows
2022-07-01 00:47
Could you please raise a feature request? I know the core supports multiple and binary payloads, so ideally we support those

matt.fellows
2022-07-01 01:37
I don?t have a consumer example, but here was a working provider side that also had an azure devops build: https://github.com/pactflow/example-provider-dotnet/blob/master/azure-pipelines.yml

matt.fellows
2022-07-01 01:38
To publish a pact, simply replace one of the docker calls with a docker publish


hiepluong2205
2022-07-01 06:40
has joined #pact-net

mylesjj
2022-07-01 08:27
That's really useful. Thanks for your help

prasadsolanki
2022-07-01 09:27
Oh OK. Can you please direct me where to do that? TA


matt.fellows
2022-07-01 09:47
Sorry, on the pact Net GitHub repo pls

thammarith.likittheer
2022-07-01 10:27
Hi, I see there is an ability to create an auto matcher for Go (https://docs.pact.io/implementation_guides/go/readme#auto-generate-matchers-from-struct-tags), can we do the same in .NET? I can't find it in the documentation. Any guide/example would be really appreciated. :pray:

matt.fellows
2022-07-01 10:30
Personally, I?ve found that feature not very helpful - it really is only useful in happy path scenarios, and is not at all helpful in situations where you have some fields you expect to come back and others not. I?ve just found it leaks test data into the domain model definitions, which I?m not sure is a good thing

matt.fellows
2022-07-01 10:30
that being said, I don?t believe it exists

thammarith.likittheer
2022-07-01 10:37
We have a use case that we trust everything from master/main branch (as we tested and deployed before we merged into master/main), so we want to use the master/main branch to generate the matcher, and match the mock data that we have created.

matt.fellows
2022-07-01 10:52
I don?t believe one exists, although I suppose you could spike it?

matt.fellows
2022-07-01 10:54
The reason why I think it?s fraught, is that it?s unusual that any domain model is always an all-or-nothing version of itself. e.g. with a Product, you might have some fields that are populated for certain classes of products and different ones for others. There may be other fields that have enum types and the type of that field can change which required/optional fields come back. This can?t be easily done in the way the Golang struct tags work, because they are either there or not - so it means you can only every use those matchers for the ?happy path? or default scenarios.

saleh.elnagar
2022-07-01 13:20
has joined #pact-net

animesh.kumar
2022-07-03 16:54
has joined #pact-net

omri.benyair
2022-07-04 03:14
has joined #pact-net

chriswilliamsef
2022-07-04 13:11
has joined #pact-net

rioka68
2022-07-04 13:32
has joined #pact-net

heinenm
2022-07-04 14:01
has joined #pact-net

omri.eyal
2022-07-05 06:22
has joined #pact-net

shen-yu
2022-07-05 15:35
has joined #pact-net

ben.foster
2022-07-05 15:42
has joined #pact-net

maarten.gryp
2022-07-05 16:20
has joined #pact-net

megha.t
2022-07-06 06:56
has joined #pact-net

ravindra.dhaka
2022-07-06 07:08
has joined #pact-net

mrigendra.ranjan
2022-07-06 07:08
has joined #pact-net

deepak.bhoria
2022-07-06 07:11
has joined #pact-net

cjenkins
2022-07-06 07:17
has joined #pact-net

gustavo.chain
2022-07-06 08:04
has joined #pact-net

tobias.friedrich
2022-07-06 08:31
has joined #pact-net

ganesh.panchagnula-no
2022-07-06 11:50
has joined #pact-net

morten.gejl
2022-07-06 13:02
has joined #pact-net

varunthaper
2022-07-06 15:17
has joined #pact-net

jwheatley
2022-07-06 17:12
has joined #pact-net

noor.hashem
2022-07-06 20:23
has joined #pact-net

dormeiri
2022-07-07 09:41
has joined #pact-net

andreaschung1
2022-07-07 12:28
has joined #pact-net

parvatshiva
2022-07-07 22:05
has joined #pact-net

jonathan.dowling
2022-07-08 11:37
has joined #pact-net

alex423
2022-07-08 13:59
has joined #pact-net

francis.williams
2022-07-08 19:52
has joined #pact-net

dmitry.sarkisov
2022-07-08 20:07
has joined #pact-net

neokree
2022-07-09 10:50
has joined #pact-net

lynn.alhaimy
2022-07-10 18:20
has joined #pact-net

mylesjj
2022-07-11 12:36
The pact cli docker image stops straight away when we try and run in locally within Docker desktop

eirikval
2022-07-11 15:08
has joined #pact-net

mylesjj
2022-07-11 17:27
Hi. I'm trying to integrate the pact-cli into my ADO pipeline via a docker image. I can't get the pubish command to work. The problem seems to be that the volume mapped pact file cannot be seen by the publish command. I know the file is mapped correctly as I have used the following to prove this: *docker run --rm -v $(Build.SourcesDirectory):/var/lib/pacts http://xyz.azurecr.io/pact-cli:v1 ls /var/lib/pacts/createdcontracts* However, whenever I use the same path in my publish command I see a message about the files been missing e.g. _*"Specified pact file '/var/lib/pacts/createdcontacts' does not exist. This sometimes indicates one of the arguments has been specified with the wrong name and has been incorrectly identified as a file path."*_ _My publish command in the pipeline looks like this:_ _*docker run --rm -v $(Build.SourcesDirectory):/var/lib/pacts http://xyz.azurecr.io/pact-cli:v1 publish /var/lib/pacts/createdcontacts/ConsumerService-ProviderService.json -b="https://cfc.pactflow.io" -k="**" -a="1.0.0 -v"*_

matt.fellows
2022-07-12 03:34
> The pact cli docker image stops straight away when we try and run in locally within Docker desktop Can you please elaborate what you mean by that?

matt.fellows
2022-07-12 04:04
Are you sure that `ls` command works? The default entry point is not bash it's a pact executable so I'd expect that to fail as it's not a valid subcommand

mylesjj
2022-07-12 08:37
Yes, 100% certain. I can see the ls output in the ADO build pipeline output

akke.luukkonen
2022-07-12 09:18
Is there a reason you're trying to mount the volume in general to `/var/lib`? I have a simpler version where I just mount it directly to root as `/pacts`. For comparison, I'm publishing contracts using Docker in ADO with: ```steps: - task: DownloadPipelineArtifact@2 displayName: Download artifact containing pacts inputs: artifactName: ${{ parameters.pactsArtifactName }} targetPath: $(Agent.TempDirectory)/pacts - script: > docker run -e PACT_BROKER_TOKEN -v $(Agent.TempDirectory)/pacts:/pacts pactfoundation/pact-cli@sha256:ddefe0e43c3706884635a2642f2be366274679d7055f300ed92c4e384639ba0a broker publish /pacts --consumer-app-version ${{ parameters.version }} --branch ${{ parameters.branch }} --broker-base-url https://<company>.http://pactflow.io displayName: Publish to Pactflow env: PACT_BROKER_TOKEN: $(SecretPactBrokerToken)```

sahil.jain
2022-07-12 10:21
has joined #pact-net

mylesjj
2022-07-12 10:28
I've just tried using _/pacts_ rather than _/var/lib_. Unfortunately it's still not working. I'm getting PactBroker::Client::Error - No pact files found

akke.luukkonen
2022-07-12 10:30
Your example showed an exact path to `/var/lib/pacts/createdcontacts/ConsumerService-ProviderService.json`, but have you tried just passing in the directory itself like I've done so that it basically would publish all contracts from the directory? So just pass in `/var/lib/pacts` without the filename. No idea if it would help, but that's at least one difference I spot between our solutions :eyes:

akke.luukkonen
2022-07-12 10:31
Since the error also says in plural "No pact *files* found" I was thinking if it expects the directory instead of the full path to a file.

mylesjj
2022-07-12 10:39
I have tried just using the just the directory and the explicit file name. No luck. I am now trying the command on my local docker image and I am seeing the same error messages. I'm baffled. docker run --rm -v createdcontracts:/pacts http://xyz.azurecr.io/pact-cli:v1 broker publish /pacts -b="https://xyz.pactflow.io" -k="***" -a="1.0.0"

akke.luukkonen
2022-07-12 10:42
Can you try with the same image I've been using out of curiosity: `pactfoundation/pact-cli@sha256:ddefe0e43c3706884635a2642f2be366274679d7055f300ed92c4e384639ba0a` it's the 0.50.0.26 one from here (that I probably should update since there's newer ones available): https://hub.docker.com/r/pactfoundation/pact-cli/tags

mylesjj
2022-07-12 10:52
Ok, will give it a try. Thanks

mylesjj
2022-07-12 10:54
Same on 0.50.0.26 PactBroker::Client::Error - No pact files found

mylesjj
2022-07-12 10:55
When running the publish command locally, should the volume arg -v be a full path or relative?

akke.luukkonen
2022-07-12 10:58
No idea, I'd assume both would work though :thinking_face:. I don't currently even have Docker on my personal work laptop. I just threw that together that template I pasted and ran it directly in ADO to see that the pipelines work. I've been running the Pact tools just locally in WSL where I have both the Ruby & Rust CLIs installed.

mylesjj
2022-07-12 14:48
OK, finally got it to work. I had to add additional tasks to my yml pipeline to pass the pact artifact between stages

kyriacos.elia
2022-07-12 15:43
has joined #pact-net

fabricio.mendes.ti
2022-07-12 16:33
has joined #pact-net

cameron.allan853
2022-07-12 23:18
has joined #pact-net

jeroen.lamain
2022-07-13 08:49
has joined #pact-net

eugene.baranovsky
2022-07-13 09:49
Closed and merged, waiting for it to be released


david.hvilava
2022-07-13 12:15
Awesome) Thanks!

programmingwithbangal
2022-07-13 12:48
has joined #pact-net

rohitkeshwani07
2022-07-13 13:28
has joined #pact-net

gjvengelen
2022-07-13 18:18
has joined #pact-net

gjvengelen
2022-07-14 04:22
Hi team, Could you point me to more documentation on publishing verification results? I've been it this way but I can't seem to get it to work. For most because I'm not sure what this options part is doing. I'm on PactNet v.4.0.0. ```string version = Environment.GetEnvironmentVariable("VERSION"); string branch = Environment.GetEnvironmentVariable("BRANCH"); string buildUri = Environment.GetEnvironmentVariable("BUILD_URL"); verifier.ServiceProvider("My Provider", _fixture.ServerUri) .WithPactBrokerSource(new Uri("https://broker.example.org"), options => { options.ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true, Latest = true }) .PublishResults(version, results => { results.ProviderBranch(branch) .BuildUri(new Uri(buildUri)); }); .PublishResults(version, results => { results.ProviderBranch(branch);}); }) .Verify();``` This was my latest error: ```Failures: 1) Failed to load pact - Could not load pacts from the pact broker 'https://broker.pact.engineering.crxt.io/' - ContentError("Request to pact broker URL 'https://broker.pact.engineering.crxt.io/pacts/provider/Vehicle%20Financing/for-verification' failed - HTTP status server error (500 Internal Server Error) for url (https://broker.pact.engineering.crxt.io/pacts/provider/Vehicle%20Financing/for-verification)") There were 1 pact failures [91m[http://xUnit.net 00:00:02.82] Financing.Api.ContractTests.FinanceOptionsContractTests.EnsureSomethingApiHonoursPactWithConsumer [FAIL][0m[91m [0m Failed Financing.Api.ContractTests.FinanceOptionsContractTests.EnsureSomethingApiHonoursPactWithConsumer [1 s] Error Message: PactNet.Exceptions.PactFailureException : Pact verification failed Stack Trace: at PactNet.Verifier.InteropVerifierProvider.Execute() at PactNet.Verifier.PactVerifierSource.Verify() at Financing.Api.ContractTests.FinanceOptionsContractTests.EnsureSomethingApiHonoursPactWithConsumer() in /src/test/Financing.Api.ContractTests/FinanceContractTests.cs:line 43 Standard Output Messages: Starting verification... Pact verification failed```

tjones
2022-07-14 05:24
Looks like the broker is failing. What version is it running?

tjones
2022-07-14 05:26
I've previously run into issues with provider names that contain spaces - although that was to do with the Ruby CLI, not the broker.

gjvengelen
2022-07-14 06:36
Im running: ```image: pactImageRepository: pactfoundation/pact-broker pactImageTag: 2.102.1.0```

gjvengelen
2022-07-14 07:44
Maybe a good addition is that If I open the url in the error message I get this response in the browser:

lorenz.ammon
2022-07-14 08:52
has joined #pact-net

remigijus.mazulis
2022-07-14 08:53
has joined #pact-net

ganesh.panchagnula-no
2022-07-14 09:35
I see two things missing for options in .WithPactBrokerSource options. Try this: ```options => { options.ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true, Latest = true } .EnablePending() .ToeknAuthentication("<your pact broker authentication token>")```

gjvengelen
2022-07-14 09:44
Like this: ```verifier.ServiceProvider("VehicleFinancingService", _fixture.ServerUri) .WithPactBrokerSource(new Uri("https://broker.pact.business.crxt.io"), options => { options.ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true, Latest = true }) .EnablePending() .PublishResults(version, results => { results.ProviderBranch(branch); }); }) .Verify();```

ganesh.panchagnula-no
2022-07-14 10:54
yes, and are you not providing TokenAuthentication to your https://broker.pact.business.crxt.io?

gjvengelen
2022-07-14 11:00
No it's ip restricted. But this setup returns the same error. When I remove the `, options =>...` part completely it works and verifies the contract but it doesn't publish the results.

ganesh.panchagnula-no
2022-07-14 11:11
you need to provide `options =>...` part to tell to publish the results. this is the code I have, and it works for me. I also have PactNet V 4.0.0 ``` pactVerifier .ServiceProvider("ProductService", new Uri(_pactServiceUri)) .WithPactBrokerSource(new Uri("https://domain.pactflow.io"), options => { options.EnablePending() .ConsumerVersionSelectors(new ConsumerVersionSelector { Latest=true }) .PublishResults("1.0.0", publish => publish.ProviderBranch("main")) .TokenAuthentication("<<authtoken>>"); }) .WithProviderStateUrl(new Uri($"{_pactServiceUri}/provider-states")) .WithRequestTimeout(TimeSpan.FromMinutes(5)) .WithSslVerificationDisabled() .Verify() ```

gjvengelen
2022-07-14 11:27
@ganesh.panchagnula-no you're a legend. This was it, it works.

tjones
2022-07-14 12:52
:taco: for @ganesh.panchagnula-no!

gjvengelen
2022-07-14 12:57
Can I help by adding something to the documentation? I've been looking for three days but the documentation on http://docs.pact.io mention nothing about publishing verification results

seanruffatti
2022-07-14 14:40
has joined #pact-net

cgoodison
2022-07-14 15:03
Hi Gerard, glad you were able to get things working :tada:. It would be amazing if you would contribute to the docs. The best place to do so in this case would be in the pact net repo, verify provider section looks like the relevant area: https://github.com/pact-foundation/pact-net#verifying-a-provider This is because the notes on publishing verification results are typically located in each of the language specific library's readmes.


tjones
2022-07-14 15:04
Oh, cross-posted. Yes, in the .net docs would also be helpful

cgoodison
2022-07-14 15:05
There's is a spot on there where the other ones seem to link through, would be great to connect the dots back to pact-net :)

gjvengelen
2022-07-14 17:07
Cool, I'll try to get to it later this week.

nico.neirinck
2022-07-15 06:10
has joined #pact-net

k.bangarusamy
2022-07-15 14:36
has joined #pact-net

harinder.kaur
2022-07-15 17:19
has joined #pact-net

mahidasp
2022-07-16 17:30
has joined #pact-net

juan.aa.espiritu
2022-07-17 08:39
has joined #pact-net

thomas.loudon
2022-07-18 11:05
has joined #pact-net

david.hayden
2022-07-18 11:12
has joined #pact-net

ganesh.panchagnula-no
2022-07-18 11:22
hi all, I am getting HTTP 500 error for a Post request with a body in my consumer test Here is my request object in C# ``` var exposureRequest = new ExposuresRequest { PortfolioId = "10000000-0000-0000-0000-000000000000", PortfolioNamespace = "MaceConsumerTests/GBP Holdings portfolio", PortfolioClassificationNamespace = "namespace_PortfolioA", EffectDate = new DateTime(2021, 05, 05), Currency = "USD", PortfolioDataDates = new Dictionary<string, DateTime> { { "10000000-0000-0000-0000-000000000000", new DateTime(2021, 05, 06) } }, UseStorage = true, ClassificationHierarchy = new string[][] { new string[] { "industry" } }, OutputType = ExposuresOutputType.GroupLevel, Path = null };``` and here is my Pact consumer request: ``` pact.UponReceiving("A valid request") .Given("A valid request for get exposures") .WithRequest(http://HttpMethod.Post, "/api/exposures") .WithHeader("content-type", "application/json; charset=utf-8") .WithJsonBody(exposureRequest,new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }) .WillRespond() .WithStatus(HttpStatusCode.OK) .WithHeader("content-type", "application/json") .WithJsonBody(new TypeMatcher(new ExposuresResponse())); await pact.VerifyAsync(async ctx => { var response = await ApiClient.GetExposures(exposureRequest); Assert.NotNull(response); });``` and this the ApiClient that is actually making http request ``` public async Task<ExposuresResponse> GetExposures(ExposuresRequest request) { var requestContent = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json"); var httpResponse = await httpClient.PostAsync("api/exposures", requestContent); var exposuresResponse = await TryGetResponse<ExposuresResponse>(httpResponse); return exposuresResponse; }``` I am getting HTTP Status code 500, Internal server error because the actual request does not meet expected request. Here is the Log output ``` Standard Output Messages: Mock server logs: [DEBUG][pact_mock_server::hyper_server] Creating pact request from hyper request [DEBUG][pact_mock_server::hyper_server] Extracting query from uri /api/exposures [INFO][pact_mock_server::hyper_server] Received request Request ( method: POST, path: /api/exposures, query: None, headers: Some({"host": ["localhost:8197"], "content-type": ["application/json; charset=utf-8"], "content-length": ["501"]}), body: Present(501 bytes, application/json;charset=utf-8) ) [DEBUG][pact_mock_server::hyper_server] body: '{"ClassificationHierarchy":[["industry"]],"UseStorage":true,"OutputType":1,"Path":null,"EffectDate":"2021-05-05T00:00:00","PortfolioDataDates":{"10000000-0000-0000-0000-000000000000":"2021-05-06T00:00:00"},"Currency":"USD","PortfolioId":"10000000-0000-0000-0000-000000000000","PortfolioNamespace":"MaceConsumerTests/GBP Holdings portfolio","PortfolioClassificationNamespace":"namespace_PortfolioA","BenchmarkPortfolioId":null,"BenchmarkPortfolioNamespace":null,"BenchmarkClassificationNamespace":null}' [INFO][pact_matching] comparing to expected Request ( method: POST, path: /api/exposures, query: None, headers: Some({"content-type": ["application/json; charset=utf-8"]}), body: Present(501 bytes) ) [DEBUG][pact_matching] body: '{"benchmarkClassificationNamespace":null,"benchmarkPortfolioId":null,"benchmarkPortfolioNamespace":null,"classificationHierarchy":[["industry"]],"currency":"USD","effectDate":"2021-05-05T00:00:00","outputType":1,"path":null,"portfolioClassificationNamespace":"namespace_PortfolioA","portfolioDataDates":{"10000000-0000-0000-0000-000000000000":"2021-05-06T00:00:00"},"portfolioId":"10000000-0000-0000-0000-000000000000","portfolioNamespace":"MaceConsumerTests/GBP Holdings portfolio","useStorage":true}' [DEBUG][pact_matching] matching_rules: MatchingRules { rules: {HEADER: MatchingRuleCategory { name: HEADER, rules: {} }, PATH: MatchingRuleCategory { name: PATH, rules: {} }, BODY: MatchingRuleCategory { name: BODY, rules: {} }} } [DEBUG][pact_matching] generators: Generators { categories: {} } [DEBUG][pact_matching::matchers] String -> String: comparing '/api/exposures' to '/api/exposures' using Equality [DEBUG][pact_matching] expected content type = 'application/json;charset=utf-8', actual content type = 'application/json;charset=utf-8' [DEBUG][pact_matching] content type header matcher = 'None' [DEBUG][pact_matching] Using body matcher for content type 'application/json;charset=utf-8' [DEBUG][pact_matching::json] compare: Comparing path $ [DEBUG][pact_matching::json] compare_maps: Comparing maps at $: {"benchmarkClassificationNamespace": Null, "benchmarkPortfolioId": Null, "benchmarkPortfolioNamespace": Null, "classificationHierarchy": Array([Array([String("industry")])]), "currency": String("USD"), "effectDate": String("2021-05-05T00:00:00"), "outputType": Number(1), "path": Null, "portfolioClassificationNamespace": String("namespace_PortfolioA"), "portfolioDataDates": Object({"10000000-0000-0000-0000-000000000000": String("2021-05-06T00:00:00")}), "portfolioId": String("10000000-0000-0000-0000-000000000000"), "portfolioNamespace": String("MaceConsumerTests/GBP Holdings portfolio"), "useStorage": Bool(true)} -> {"BenchmarkClassificationNamespace": Null, "BenchmarkPortfolioId": Null, "BenchmarkPortfolioNamespace": Null, "ClassificationHierarchy": Array([Array([String("industry")])]), "Currency": String("USD"), "EffectDate": String("2021-05-05T00:00:00"), "OutputType": Number(1), "Path": Null, "PortfolioClassificationNamespace": String("namespace_PortfolioA"), "PortfolioDataDates": Object({"10000000-0000-0000-0000-000000000000": String("2021-05-06T00:00:00")}), "PortfolioId": String("10000000-0000-0000-0000-000000000000"), "PortfolioNamespace": String("MaceConsumerTests/GBP Holdings portfolio"), "UseStorage": Bool(true)} [DEBUG][pact_matching] --> Mismatches: [BodyMismatch { path: "$", expected: Some(b"{\"benchmarkClassificationNamespace\":\"null\",\"benchmarkPortfolioId\":\"null\",\"benchmarkPortfolioNamespace\":\"null\",\"classificationHierarchy\":\"[[\\\"industry\\\"]]\",\"currency\":\"\\\"USD\\\"\",\"effectDate\":\"\\\"2021-05-05T00:00:00\\\"\",\"outputType\":\"1\",\"path\":\"null\",\"portfolioClassificationNamespace\":\"\\\"namespace_PortfolioA\\\"\",\"portfolioDataDates\":\"{\\\"10000000-0000-0000-0000-000000000000\\\":\\\"2021-05-06T00:00:00\\\"}\",\"portfolioId\":\"\\\"10000000-0000-0000-0000-000000000000\\\"\",\"portfolioNamespace\":\"\\\"MaceConsumerTests/GBP Holdings portfolio\\\"\",\"useStorage\":\"true\"}"), actual: Some(b"{\"BenchmarkClassificationNamespace\":\"null\",\"BenchmarkPortfolioId\":\"null\",\"BenchmarkPortfolioNamespace\":\"null\",\"ClassificationHierarchy\":\"[[\\\"industry\\\"]]\",\"Currency\":\"\\\"USD\\\"\",\"EffectDate\":\"\\\"2021-05-05T00:00:00\\\"\",\"OutputType\":\"1\",\"Path\":\"null\",\"PortfolioClassificationNamespace\":\"\\\"namespace_PortfolioA\\\"\",\"PortfolioDataDates\":\"{\\\"10000000-0000-0000-0000-000000000000\\\":\\\"2021-05-06T00:00:00\\\"}\",\"PortfolioId\":\"\\\"10000000-0000-0000-0000-000000000000\\\"\",\"PortfolioNamespace\":\"\\\"MaceConsumerTests/GBP Holdings portfolio\\\"\",\"UseStorage\":\"true\"}"), mismatch: "Expected a Map with keys benchmarkClassificationNamespace, benchmarkPortfolioId, benchmarkPortfolioNamespace, classificationHierarchy, currency, effectDate, outputType, path, portfolioClassificationNamespace, portfolioDataDates, portfolioId, portfolioNamespace, useStorage but received one with keys BenchmarkClassificationNamespace, BenchmarkPortfolioId, BenchmarkPortfolioNamespace, ClassificationHierarchy, Currency, EffectDate, OutputType, Path, PortfolioClassificationNamespace, PortfolioDataDates, PortfolioId, PortfolioNamespace, UseStorage" }] [DEBUG][pact_mock_server::hyper_server] Request did not match: Request did not match - Request ( method: POST, path: /api/exposures, query: None, headers: Some({"content-type": ["application/json; charset=utf-8"]}), body: Present(501 bytes) ) 0) $ -> Expected a Map with keys benchmarkClassificationNamespace, benchmarkPortfolioId, benchmarkPortfolioNamespace, classificationHierarchy, currency, effectDate, outputType, path, portfolioClassificationNamespace, portfolioDataDates, portfolioId, portfolioNamespace, useStorage but received one with keys BenchmarkClassificationNamespace, BenchmarkPortfolioId, BenchmarkPortfolioNamespace, ClassificationHierarchy, Currency, EffectDate, OutputType, Path, PortfolioClassificationNamespace, PortfolioDataDates, PortfolioId, PortfolioNamespace, UseStorage``` I am not able to find out why Pact complains request did not match. Can someone please help here. I have already spent 1 day on this and blocked here. Thank you

matt.fellows
2022-07-18 12:36
It looks like came casing: *expected*: benchmarkClassificationNamespace, benchmarkPortfolioId, benchmarkPortfolioNamespace, classificationHierarchy, currency, effectDate, outputType, path, portfolioClassificationNamespace, portfolioDataDates, portfolioId, portfolioNamespace, useStorage *got*: BenchmarkClassificationNamespace, BenchmarkPortfolioId, BenchmarkPortfolioNamespace, ClassificationHierarchy, Currency, EffectDate, OutputType, Path, PortfolioClassificationNamespace, PortfolioDataDates, PortfolioId, PortfolioNamespace, UseStorage

matt.fellows
2022-07-18 12:36
You?re expecting lowercase, but the request is uppercase

ganesh.panchagnula-no
2022-07-18 13:18
right, I did also specify to use CamelCase in my pact request: ```.WithJsonBody(product,new JsonSerializerSettings { ContractResolver=new CamelCasePropertyNamesContractResolver()})``` It's still complaining about case mismatch. how do I tell Pact to send the json in Camcelcase

matt.fellows
2022-07-18 13:22
I don't know for sure, is there an option/method on that class to say lower or upper camel case?

hakan.b.jansson
2022-07-18 14:04
has joined #pact-net

jakehowden
2022-07-18 15:54
has joined #pact-net

jakehowden
2022-07-18 16:00
Hi, @lewis.prescott079 I am running into the same issue. Did you manage to solve this with a test startup which maps your provider controllers?

lewis.prescott079
2022-07-18 16:02
Unfortunately not. Bit blocked by internal politics

ganesh.panchagnula-no
2022-07-18 16:28
this issue was resolve when I used custom Json Serializer settings in the ApiClient class ``` public class ApiClient { private readonly HttpClient httpClient; private readonly JsonSerializerSettings jsonSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), }; }```

ganesh.panchagnula-no
2022-07-18 16:30
and use custom Json Serializer settings when searializing the request ```var requestContent = new StringContent(JsonConvert.SerializeObject(request,jsonSettings), Encoding.UTF8, "application/json"); var httpResponse = await httpClient.PostAsync("api/create", requestContent);```

jakehowden
2022-07-18 17:27
Ah sorry to hear that, thank you for the response.

jakehowden
2022-07-18 17:28
Hi @fabio.rodrigues, are you able to share a code snippet of your Test Startup please? I'm having trouble replicating it from the your earlier comments :)

jakehowden
2022-07-19 08:04
For those looking for a Test Startup so they can run their Pact tests while having their actual Web API project using the .net 6 minimal hosting model, here is my test startup which works. Where Controller is the controller you want to Pact test: ```public class TestStartup { public TestStartup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { var controllerAssembly = Assembly.GetAssembly(typeof(Controller))!; services.AddMvc().AddApplicationPart(controllerAssembly) .AddControllersAsServices(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseRouting(); app.UseEndpoints(e => e.MapControllers()); } }```

lewis.prescott079
2022-07-19 08:53
Thanks @jakehowden for sharing. @yousafn @matt.fellows could we get this in the examples please?

remigijus.mazulis
2022-07-19 09:18
@remigijus.mazulis has left the channel

chrstnklb
2022-07-19 10:58
has joined #pact-net

matt.fellows
2022-07-19 13:30
Thanks folks! @pact544 what do you think about the above suggestion? Perhaps we could update the Pactflow examples to use the 4.x.x code base (it?s still on 3.x.x) and use this strategy? I?m not a .NET expert so will take guidance. cc: @yousafn

yousafn
2022-07-19 15:36
Sounds like a sensible idea, thanks @jakehowden for sharing, we have a few example/sample repos for .NET and there was some work tracked for be performed on these so this is a good opportunity, also to help bring in more contributors. Related .NET pact workshop issue tracking the upgrade to use the 4.x.x codebase https://github.com/DiUS/pact-workshop-dotnet-core-v3/issues/6 pact-foundation workshop https://github.com/pact-foundation/pact-workshop-dotnet-core-v1 pactflow .net example consumer https://github.com/pactflow/example-consumer-dotnet pactflow .net example provider https://github.com/pactflow/example-provider-dotnet

andrew.favaloro
2022-07-19 19:36
has joined #pact-net

tarun.gulati1988
2022-07-19 19:41
has joined #pact-net

boweixu
2022-07-19 20:39
has joined #pact-net

juanalvarezarquillos
2022-07-20 05:46
has joined #pact-net

jkaur
2022-07-20 06:32
has joined #pact-net

steve.heasman
2022-07-20 09:08
has joined #pact-net

je.alvinez
2022-07-20 11:17
has joined #pact-net

matkruse
2022-07-20 14:53
has joined #pact-net

2billy
2022-07-20 16:56
has joined #pact-net

christopher.forbes
2022-07-21 09:27
has joined #pact-net

jakehowden
2022-07-21 13:47
I am experiencing an issue with the Provider State setup, whenever my .NET middleware tries to deserialize the body of the provider state request I receive an exception (see image). Creating a http client and running a POST request with the body "test" is deserialized correctly, this only occurs when using the PactVerifier extension method `WithProviderStateUrl()` Consumer pact generation test: ```[Fact] public async Task Consumer_WhenConsumingItem_ContainsCorrectValues() { _itemId = new Guid("abeca00e-74bc-4de9-b9e7-c1cf61f68b64"); _pactBuilder .UponReceiving("An Item ItemNumber") .Given("An item with the correct Guid ID exists") .WithRequest(HttpMethod.Get, $"/Item/{_itemId}") .WillRespond() .WithStatus(HttpStatusCode.OK) .WithHeader("Content-Type", "application/json; charset=utf-8") .WithJsonBody(new { id = _itemId, description = "Winter Coat" }); await _pactBuilder.VerifyAsync(async _ => { var response = await _consumerClient.GetItem(_itemId); response.StatusCode.Should().Be(HttpStatusCode.OK); var item = JsonConvert.DeserializeObject<Item>(await response.Content.ReadAsStringAsync()); item!.Id.Should().Be(_itemId); }); }``` Provider verification test: ```[Fact] public void Provider_WhenChallenged_HonoursPactWithConsumers() { // Arrange var config = new PactVerifierConfig { Outputters = new List<IOutput> { new XUnitOutput(_outputHelper) } }; var pactPath = Path.Join("..", "..", "..", "..", "Pacts", "Item Consumer-Item Producer.json"); IPactVerifier pactVerifier = new PactVerifier(config); pactVerifier .ServiceProvider("Item Producer", _providerApiFixture.ServerUri) .WithFileSource(new FileInfo(pactPath)) .WithProviderStateUrl(new Uri("http://localhost:9001/provider-states")) .Verify(); }``` Provider state middleware: ```private readonly RequestDelegate _next; private readonly IItemRepository _repository; private readonly IDictionary<string, Action> _providerStates; public ProviderStateMiddleware(RequestDelegate next, IItemRepository repository) { _next = next; _repository = repository; _providerStates = new Dictionary<string, Action> { { "An item with the correct Guid ID exists", ProductWithIdExists } }; } private void ProductWithIdExists() { var itemId = new Guid("abeca00e-74bc-4de9-b9e7-c1cf61f68b64"); _repository.GetAsync(itemId) .Returns(new Item { Id = itemId, Description = "Winter Coat" }); } public async Task Invoke(HttpContext context) { if (context.Request.Path.StartsWithSegments("/provider-states")) { await HandleProviderStatesRequest(context); await context.Response.WriteAsync(string.Empty); } else { await _next(context); } } private async Task HandleProviderStatesRequest(HttpContext context) { context.Response.StatusCode = (int)HttpStatusCode.OK; if (string.Equals(context.Request.Method, HttpMethod.Post.ToString(), StringComparison.CurrentCultureIgnoreCase)) { string jsonRequestBody; context.Request.EnableBuffering(); using (var reader = new StreamReader(context.Request.Body, Encoding.UTF8)) { jsonRequestBody = await reader.ReadToEndAsync(); } var providerState = JsonConvert.DeserializeObject<ProviderState>(jsonRequestBody); //A null or empty provider state key must be handled if (providerState != null && !string.IsNullOrEmpty(providerState.State)) { _providerStates[providerState.State].Invoke(); } } }```

sandy.oberoi
2022-07-21 18:57
has joined #pact-net

adelamarre
2022-07-21 19:37
has joined #pact-net

husamhindustani
2022-07-22 06:52
has joined #pact-net

harley
2022-07-23 02:15
has joined #pact-net

japlavaren
2022-07-25 09:21
has joined #pact-net

alasdair.ryan
2022-07-25 10:45
has joined #pact-net

alasdair.ryan
2022-07-25 11:00
Hello we are attempting to use http://pact.net for investigation into creating some contract testing of some of our apis, we managed to create a couple tests with out authentication with no real issue. Now we are attempting to create tests with NTLM authentication and we are having some issues. Unfortunately I have been unable to add a custom header with a token to be recognized by the api (tried Negotiate and Authorization headers) - I just get end up getting a 401 error. I am currently using "IPactBuilderV3" from http://pact.net - is there any other ways to add NTLM authentication to our pact tests which pact supports?

matt.fellows
2022-07-25 12:48
howtoauth

2022-07-25 12:48
Approaches to handling authentication in Pact tests: https://docs.pact.io/provider/handling_auth

matt.fellows
2022-07-25 12:48
:point_up: hopefully this helps?

alasdair.ryan
2022-07-25 13:21
Unfortunately that does not seem to work - I have been told its using Kerberos. I can authenticate fine with c# and using cached credentials the issues is validating the pact file as in order to validate it needs to authenticate with the server

hui.supat
2022-07-25 13:22
has joined #pact-net

balaramvineethvenugop
2022-07-25 17:06
has joined #pact-net

alan.still
2022-07-25 18:18
has joined #pact-net

yshkedi
2022-07-25 21:16
has joined #pact-net

tjones
2022-07-26 00:32
I personally completely stub the auth, as I don't really think it's part of the contract (other than you should have a token). This means my pact tests look like "with a valid token `"AUTH_TOKEN"`" and then I stub the auth parts of the provider to expect `"AUTH_TOKEN"`

tjones
2022-07-26 00:32
That approach might work for you

apapia
2022-07-26 02:27
has joined #pact-net

alasdair.ryan
2022-07-26 10:08
Thanks for the suggestions. @tjones The only criticism for this approach is that you lose accurately of the api's test . If I under stood you correct it becomes a stub testing another stub (The pact file)? Yes you could perhaps stub it out like you suggest but what if the api's body changes with no updates to the contract testing - then your tests would still pass when they sould not?

rziembicki
2022-07-26 10:47
has joined #pact-net

dpal
2022-07-26 10:58
has joined #pact-net

dgrace
2022-07-26 11:02
has joined #pact-net

dgowdappa
2022-07-26 11:02
has joined #pact-net

matt.fellows
2022-07-26 12:10
There are two things here, the contract test from system A to B, and a contract between B to the auth server. For the A to B test, the need to include auth is debatable and I generally exclude it. NTLM is also a standard so there are further questions to the value of testing that. There are also the practical issues we're discussing. I don't know how feasible it is to do with pact having never tried it. One option could be to setup a middleware on the provider that intercepts and enriches the request with the correct auth headers. Not ideal but might allow you to include it

sascha_pactflow
2022-07-26 20:29
has joined #pact-net

hunsolitude
2022-07-26 22:34
has joined #pact-net

tjones
2022-07-27 01:07
To be clear, I'm not proposing stubbing the whole endpoint, just the auth validation. I don't consider the auth token to be part of the contract

tjones
2022-07-27 01:07
so, if the API body changes, the test should fail

tjones
2022-07-27 01:11
The provider workflow might look like: ```receive request -> validate auth token -> unmarshal request -> do something with it -> marshal response``` What I do is: ```real receive request -> stub that checks the token is "AUTH_TOKEN" -> real unmarshal request -> real do something with it -> real marshal response```

matt.fellows
2022-07-27 01:12
> To be clear, I?m not proposing stubbing the whole endpoint, just the auth validation. I don?t consider the auth token to be part of the contract Ah, that?s a good point. I didn?t consider that might be how the suggestion was interpreted

tjones
2022-07-27 01:12
this works really well if your auth token is a JWT from OpenID, since you usually outsource the validation of those to code/services that you didn't write anyway

tjones
2022-07-27 01:18
You wouldn't catch things like the client using the wrong auth token, but most of the time you only have one auth token, so a misconfiguration like that that would be a catastrophic failure that you can catch with your light touch e2e / smoke tests

tjones
2022-07-27 01:18
pact tests the contract, smoke tests test the config

maksym_odanets
2022-07-27 08:07
has joined #pact-net

andrew.january
2022-07-27 09:03
has joined #pact-net

davidf
2022-07-27 09:17
has joined #pact-net

juan.aa.espiritu
2022-07-27 11:50
Hi all. Contract testing newbie here. Hoping someone can help me with starting pact. My company is using aws resources. Is there an example i can follow or tutorial i can watch to start pact? Most of the tutorials i?ve watched spin up local environment with ports. Whereas with my current situation we deploy directly to aws which we can be accessed by api endpoints. Im mainly interested with sqs, sns and lambda testing (for now at least). Any help would be appreciative. Thanks in advance!

matt.fellows
2022-07-27 12:53
Welcome!

matt.fellows
2022-07-27 12:53
Just because you deploy to AWS doesn?t mean you _should_ wait until you deploy to AWS to test it

matt.fellows
2022-07-27 12:54
You can definitely test contracts for aws sernices such as lambda, kinesis, sns etc. locally with good coding practices

matt.fellows
2022-07-27 12:54
See a few examples over here :point_down: (howtoexamples)


fabio.rodrigues
2022-07-27 16:32
quick tip, try to check if you can use localstack to emulate aws

fabio.rodrigues
2022-07-27 16:32
so you can run tests locally


fabio.rodrigues
2022-07-27 16:34
with this you can mock the majority os aws services, like s3 buckets, dynamodb, kinesis, etc..

matt.fellows
2022-07-27 22:35
Except when you can't, because AWS has a lot of services (e.g. IOT support). But I do use it for common items like dynamo

juan.aa.espiritu
2022-07-28 08:27
Thanks everyone. I will check out local stack and the links you guys provided. Appreciate the help! Excited to play with this bad boy :smile:

ankit.mittal
2022-07-28 10:00
has joined #pact-net

vishal.kukreja
2022-07-28 10:22
has joined #pact-net

robert.henzel
2022-07-28 19:50
has joined #pact-net

adrianminnock123
2022-07-29 08:53
has joined #pact-net

adam.witko
2022-07-29 09:38
@adam.witko has left the channel

massimiliano.devivo
2022-07-29 12:12
has joined #pact-net

hareesh.dj
2022-07-30 12:01
has joined #pact-net

heera
2022-07-31 08:00
has joined #pact-net

adam.redlisiak
2022-08-01 10:18
has joined #pact-net

altan.demirkiran846
2022-08-01 14:38
has joined #pact-net

nick080
2022-08-01 14:44
has joined #pact-net

ali.ustek
2022-08-01 15:09
has joined #pact-net

adam.redlisiak
2022-08-01 15:56
@adam.redlisiak has left the channel

momarquez
2022-08-01 19:37
has joined #pact-net

rubemfsv15
2022-08-02 20:13
has joined #pact-net

rene.klatt
2022-08-03 06:13
has joined #pact-net

imayat
2022-08-03 09:42
has joined #pact-net

mark.shand
2022-08-03 10:15
has joined #pact-net

gunjan.titiya
2022-08-03 11:51
has joined #pact-net

chaitanya.guttula
2022-08-03 12:43
has joined #pact-net

deb.kimnach
2022-08-03 12:48
has joined #pact-net

kaiquan.shi
2022-08-04 03:38
has joined #pact-net

aalexandrumihai
2022-08-04 10:15
has joined #pact-net

alex.makdessi
2022-08-04 13:03
has joined #pact-net

ynechaieva
2022-08-04 14:11
has joined #pact-net

dineshh.wot2021
2022-08-05 10:17
has joined #pact-net

fernandapontual5
2022-08-05 11:34
has joined #pact-net

sridhar140895
2022-08-05 11:58
has joined #pact-net

andrevdrodrigues
2022-08-05 16:59
Hi Everyone! Where can I get some simple example of pact implemented in c# using the broker as docker image to publish contracts ? Thanks a lot :)

andrevdrodrigues
2022-08-05 17:00
I just found some examples without pact-broker storing pacts locally...

matt.fellows
2022-08-05 22:59
Howtoexamples


glenn
2022-08-06 18:13
has joined #pact-net

sandy.mechie
2022-08-07 21:46
has joined #pact-net

prapurna.manda3
2022-08-08 07:38
has joined #pact-net

andrevdrodrigues
2022-08-08 09:49
Ok, @matt.fellows but these cases appearly is just with pactflow... Do you have some example directly with pact broker instance?

matt.fellows
2022-08-08 09:54
There are plenty around, but the process is the same. The only difference is that you use basic auth instead of a bearer token

andrevdrodrigues
2022-08-08 09:54
Ah ok, Im gonna check. Thank you.

matt.fellows
2022-08-08 09:55
The basic broker experience is the same, Pactflow just adds enterprise features, a new UI and some other types of contract testing

matt.fellows
2022-08-08 09:56
...says the product manager :rolling_on_the_floor_laughing:. Not the best pitch for Pactflow right there! But hopefully you get the point I'm trying to make

andrevdrodrigues
2022-08-08 09:57
yeah yeah... I know... Initially we will try to implement pactBroker opensource and if the team realize some value we will check the possibility to upgrade for pactflow (entire solution) :wink:

jaroslavburi
2022-08-08 14:44
has joined #pact-net

manumahendran
2022-08-08 16:14
has joined #pact-net

lmendonca
2022-08-08 22:18
has joined #pact-net

jbrauchler
2022-08-08 22:44
has joined #pact-net

cristideacc
2022-08-09 09:05
has joined #pact-net

thanuxxxx
2022-08-09 15:15
@thanuxxxx has left the channel

alison.stuart.contrac
2022-08-09 20:41
has joined #pact-net

matt.fellows
2022-08-09 21:07
Hi @alasdair.ryan, as discussed? > After looking at the response from Timothy Jones - what does he mean by ?Unmarshal / Marshal?? is he suggesting to compare a real request response and a pact contract manually? is there a better example you can share or create? Thanks What Tim is saying is that he just stubs the auth part of your provider code base, so when the Pact verifier sends the request to the Provider, only the auth is stubbed out. The rest of the interaction with your Provider talks to the real controllers, models etc. You will also want to stub out any 3rd party systems so that you have a level of determinism and speed in your tests. This means you have a higher level of confidence in your Pact tests because they actually test a broader set of layers and act as a good form of integration test. eg. https://docs.pact.io/provider#stub-calls-to-downstream-systems

jaroslavburi
2022-08-10 06:08
@jaroslavburi has left the channel

tischnerd
2022-08-11 06:49
has joined #pact-net

joel.wochele
2022-08-11 12:53
has joined #pact-net

evert.vanloo
2022-08-12 12:16
has joined #pact-net

jors.matthys
2022-08-12 13:27
has joined #pact-net

ricardo.maury
2022-08-12 18:34
has joined #pact-net

prateekm33
2022-08-15 00:46
has joined #pact-net

ahmed.fahmy
2022-08-15 09:10
has joined #pact-net

tpaktopsp
2022-08-15 18:47
has joined #pact-net

julian.schmidt
2022-08-16 09:03
has joined #pact-net

jack340
2022-08-16 09:11
has joined #pact-net

g.varga
2022-08-16 11:55
has joined #pact-net

lnthai2002
2022-08-16 15:02
has joined #pact-net

sarunas.kavaliauskas
2022-08-16 19:15
has joined #pact-net

sarunas.kavaliauskas
2022-08-16 19:33
Hi, im am implementing contract testing in .net. The documentation strongly suggests separating tests that generate contracts and tests that run against the stubs. So my question is - what is best way to start stub api server from contract files and ask for specific state before each test ? I want test A to run against provider with state ?ABC? and test B run against same provider with state ?DEF?, etc? I know i can start stub api with docker container with specific state, but to change the state for the next test i would have to restart docker container. Not convenient. I know there is a library seek.automation, that launches stub api from the code and allows to filter state for each test. But it seems it is no longer supported and breaks for .net 6. Is there a better way ? Have i missed something in http://Pact.NET ? It can?t be that this hasn?t been needed before :)

tjones
2022-08-17 02:32
I don't know about .NET, but Pact handles this for you. You specify the state as part of the test, and it starts the server with the right expectations

sarunas.kavaliauskas
2022-08-17 09:54
This is the mock server you are talking about ? When you do .UponReceiving, .Given, etc. My question is about STUB server

tbansal
2022-08-17 10:30
has joined #pact-net

tjones
2022-08-17 12:31
I think there might be a bit of confusion - the mock server is the stub server, but with the methods you are asking about > what is best way to start stub api server from contract files and ask for specific state before each test The best way is to use the DSL that surrounds the mock server. The stub server (alone) doesn?t have many use cases

dekkofilms
2022-08-17 21:14
has joined #pact-net

sarunas.kavaliauskas
2022-08-18 08:02
This is recommendation from documentation: _Ideally, your Pact tests be scoped to cover as little consumer code as possible while still being a useful exercise (ie. don?t just test a raw HTTP client call), and use as few mocked interactions at a time as possible._ _A better approach than using Pact for UI tests is to use shared fixtures, or the generated pact itself, to provide HTTP stubs for tests that cover all layers of your consumer._

sarunas.kavaliauskas
2022-08-18 08:03
And another: _*Local API stubs*_ _Pact contracts are easily turned into locally running API stubs. Pact contracts lack advanced features such as predicates that you might find in tools like http://www.mbtest.org/, however they are useful for many situations - such as e2e tests with tools like Protractor and Karma_

tjones
2022-08-18 08:57
Yes that's right

tjones
2022-08-18 09:07
The first two quote is about 1) Not mocking several interactions at once - each interaction should be independent (you use provider states to achieve this) and 2) not using UI tests to drive pact - just test the API layer of your client. > to provide HTTP stubs for tests that cover all layers of your consumer. This means that if you absolutely must have an API available at the time of your UI tests, you _can_ use the stubs, which will be generated from the pact contract file that you got from your pact tests. This has the advantage that you will be using the same responses that will later be verified against the real server. The second quote just says that you can totally use the contract for stubs, but it's not the right tool for mocking complex behaviour over several requests. > is to use shared fixtures, or the generated pact itself For what it's worth, I don't use the stubs - I use shared fixtures - I talked about this somewhere around the 40 minute mark here: https://www.youtube.com/watch?v=wkld_wRsTDE

tjones
2022-08-18 09:08
(The example is in JS, but the same principle will apply to .NET)

nirajlalr
2022-08-18 09:46
has joined #pact-net

jon669
2022-08-18 11:14
has joined #pact-net

michael.birchmeier
2022-08-18 19:27
has joined #pact-net

jwang
2022-08-18 21:07
has joined #pact-net

msiyaj1
2022-08-18 22:03
has joined #pact-net

ben.hansen
2022-08-19 00:44
has joined #pact-net

lottie.kett
2022-08-19 12:08
has joined #pact-net

paul.lynn
2022-08-19 14:18
has joined #pact-net

sarunas.kavaliauskas
2022-08-20 03:37
Yes, thank you for the answer. It seems that the recommended route is to use something like mountebank with the same fixtures. That would of course work and will keep in line with whats written in documentation. It?s just that current stub server would be sufficient if i could just ask for specific state in each test (arrange part) and i wouldn?t need additional tool :slightly_smiling_face: but as you say probably stub server has limited use cases at this point

sarunas.kavaliauskas
2022-08-20 03:40
Anyone encountered this error ? Running http://Pact.NET on macOS (Apple Silicon): Unable to load shared library ?pact_ffi? or one of its dependencies. In order to help diagnose loading problems, consider... System.DllNotFoundException Unable to load shared library ?pact_ffi? or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libpact_ffi, 0x0001): tried: ?libpact_ffi? (no such file), ?/usr/local/lib/libpact_ffi? (no such file), ?/usr/lib/libpact_ffi? (no such file), ?/Users/sarunask/Projects/mobile-bff-mirror/Tests.API/bin/Debug/net6.0/libpact_ffi? (no such file) at PactNet.Interop.NativeInterop.LogToBuffer(LevelFilter levelFilter) at PactNet.PactExtensions.InitialiseLogging(PactLogLevel level) at PactNet.PactExtensions.InitialiseServer(MockServer server, IPact pact, PactSpecification version) at PactNet.PactExtensions.UsingNativeBackend(IPactV3 pact, Nullable`1 port, IPAddress host) at Tests.API.PrivateAccounts.GetAccounts..ctor(WebApplicationFactory`1 factory, ITestOutputHelper output) in /Users/sarunask/Projects/mobile-bff-mirror/Tests.API/PrivateAccounts/GetAccounts.cs:line 56

matt.fellows
2022-08-20 04:04
I don't recall if support for apple was merged into .NET just yet, but I believe it should run under Rosetta. We definitely publish apple silicon shared libraries but I'm not sure the .NET bindings use them because there was no way to run builds to test them


duynguyenptithcm
2022-08-20 07:22
has joined #pact-net

gaudenz.halter
2022-08-22 07:52
has joined #pact-net

harold.robson
2022-08-22 13:07
has joined #pact-net

bentzion.schochet
2022-08-22 13:27
has joined #pact-net

mat.delong
2022-08-22 14:03
has joined #pact-net

jaswanth.ooty
2022-08-23 09:36
@jaswanth.ooty has left the channel

volker.wengert
2022-08-23 10:59
has joined #pact-net

sathish.sundararajan
2022-08-23 19:32
has joined #pact-net

patrick.lu
2022-08-24 02:12
has joined #pact-net

krishna.cv
2022-08-24 04:38
has joined #pact-net

ravishankar.emc
2022-08-24 06:00
has joined #pact-net

alan.zhu
2022-08-24 08:54
has joined #pact-net

nabil.bourenane
2022-08-24 14:19
has joined #pact-net

ami.ta
2022-08-25 06:05
has joined #pact-net

me1001
2022-08-25 07:24
has joined #pact-net

nidzgorskiadrian
2022-08-25 08:05
has joined #pact-net

dealandi
2022-08-25 11:50
has joined #pact-net

jreynolds
2022-08-25 12:44
has joined #pact-net

josh.steffensmeier
2022-08-25 13:18
has joined #pact-net

mhtkandpal10
2022-08-26 11:29
has joined #pact-net

dwalleck
2022-08-26 20:51
has joined #pact-net

lijinze01
2022-08-26 22:20
has joined #pact-net

mhaller
2022-08-27 00:19
has joined #pact-net

mvliannoi
2022-08-29 03:41
has joined #pact-net

haobei.ma
2022-08-29 06:06
has joined #pact-net

maram.elsayed
2022-08-29 08:52
has joined #pact-net

siddharth.gupta
2022-08-29 09:15
Hi , I have an array in response . The structure of array elements is different from one another . Not able to write expected body match of consumer test and it is giving error " No best type found for implicitly typed array " : Following is the response

siddharth.gupta
2022-08-29 09:15
"extension": [ { "url": "http://xyz.com/fhir/v1/StructureDefinition/schedulable", "valueBoolean": true }, { "url": "http://xyz.com/fhir/v1/StructureDefinition/serviceOrganization", "valueReference": { "reference": "Organization/Organization-Dept-1", "display": "myDepartment" } } ]

siddharth.gupta
2022-08-29 09:16
How do i verify an array having different structure of elements

siddharth.gupta
2022-08-29 09:57
i tried using valueBoolean = MinType( true,0) but 0 is not allowed and throwing exception

matt.fellows
2022-08-29 10:06
They are different shaped objects. You could potentially use the `arrayContaining` matcher that is available since v3, albeit I don?t believe it has been exposed in Pact .NET


matt.fellows
2022-08-29 10:07
you could potentially raise a feature request for that

matt.fellows
2022-08-29 10:07
howtooptional


matt.fellows
2022-08-29 10:08
for the same reason as above, we can?t have a min of 0. If in all of the tests an empty array was returned, we have no confidence that your consumer can handle any of the objects that come back

siddharth.gupta
2022-08-29 10:14
ok thanks , let me go through the link

siddharth.gupta
2022-08-29 10:30
did not help much ,

siddharth.gupta
2022-08-29 10:30
"extension": [ { "url": "http://xyz.com/fhir/v1/StructureDefinition/schedulable", "valueBoolean": true }, { "url": "http://xyz.com/fhir/v1/StructureDefinition/serviceOrganization", "valueReference": { "reference": "Organization/Organization-Dept-1", "display": "myDepartment" } } ]

siddharth.gupta
2022-08-29 10:31
this standard FHIR data and i need to verify valueReference attribute , i can ignore valueBoolean, but how to achieve

matt.fellows
2022-08-29 13:08
Each item in the array must be the same shape. So with the current marchers in .NET you can't achieve this without using provider states, and only ensuring an object with the right shape matches each scenario. Alternatively, raise a feature request for the `arrayContaining` matcher

helloitsdave
2022-08-29 14:51
has joined #pact-net

mberkowitz
2022-08-29 16:16
has joined #pact-net

matt.bremer
2022-08-29 20:10
has joined #pact-net

tjones
2022-08-30 00:28
usually when you want to say "this array may contain X or Y" you're suffering from the optional problem - pact doesn't let you say that fields are optional, on purpose - because your consumer either needs them or it doesn't. If you need this, be careful that you're not testing two response types at once. Pretty much the only use case I'm aware of for `arrayContaining` is where you want to treat an array as an unordered set.

tjones
2022-08-30 00:30
The reason you can't say `eachLike(X or Y)` is that the array `[X,X]` or `[Y,Y]` would both pass the test. Usually you want to be explicit - and expect exactly `[X, Y]`

matt.fellows
2022-08-30 00:34
I think the issue here is Tim that some APIs must return a list of heterogenous objects - in this case, because it?s an API standard it doesn?t make sense for the provider to be able to send either X or Y during test based on a state, because the standard doesn?t allow for it.

matt.fellows
2022-08-30 00:35
The `arrayContaining` feature says ?you can send me a bunch of objects, but I only care about X and Y shaped ones?. When the verification runs, the provider can return a bunch of objects, but _must_ have at least X and Y in it, with the appropriate matching rules.

matt.fellows
2022-08-30 00:35
A good example of this are hypermedia APIs such as HAL or Siren, that can have different links and relations in them.

matt.fellows
2022-08-30 00:38
> The reason you can?t say `eachLike(X or Y)` is that the array `[X,X]` or `[Y,Y]` would both pass the test. Usually you want to be explicit - and expect exactly `[X, Y]` On this, I was thinking last night that theoretically we could cover this situation. Currently, each interaction is stateless as far as the framework is concerned (sort of). But could we not wait until the end of the test run and say ?wait, you only covered the `X` scenario but haven?t covered the `Y` one - we?re not confident your code can do that? type thing? It?s a departure from the model, but I think would allow for this and the other optional field problem to be solved

siddharth.gupta
2022-08-30 04:08
extension = new[] { Match.Type( new { url = "http://xyz.com/fhir/v1/StructureDefinition/schedulable", valueBoolean = true, }), Match.Type(new { url = "http://xyz.com/fhir/v1/StructureDefinition/serviceOrganization", // valueBoolean = Match.MinType("true",0), valueReference = new { reference = "Organization/Organization-Dept-1", display = "myDepartment", } }) },

siddharth.gupta
2022-08-30 04:08
this worked for me

siddharth.gupta
2022-08-30 04:28
verified it as well by failing it by changing valueReference to valueReferences

siddharth.gupta
2022-08-30 04:29
atleast it is verifying the structure

tjones
2022-08-30 04:41
Yes, this is verifying exactly that structure. So, if the provider is returning exactly an array with the payload you mentioned here https://pact-foundation.slack.com/archives/C9UTHV2AD/p1661769041018449?thread_ts=1661767040.580199&cid=C9UTHV2AD , then your test will pass.

tjones
2022-08-30 04:41
This is a common pattern for pact, and usually you control the response with provider state

siddharth.gupta
2022-08-30 04:45
yes , these are complex medical\healthcare data , which is hard to create using provider state (requires multiple tools and technologies to create data automatically ) , so we use actual deployment (we have it all automated) and create actual clinical data (production like ) using automation

lennart.querter
2022-08-30 09:24
has joined #pact-net

veaceslav.gaidarji
2022-08-30 15:29
has joined #pact-net

sharonw
2022-08-30 15:29
has joined #pact-net

grace.quek
2022-08-30 15:32
has joined #pact-net

s.kadium1
2022-08-30 16:12
has joined #pact-net

sumanta.roy
2022-08-31 01:33
has joined #pact-net

shuying.lin
2022-08-31 05:45
has joined #pact-net

lijinze01
2022-08-31 09:17
hi, my team is planning to use Kafka event driven, I could not find any useful document about how to use PactNet to do the contract test for this Kafka event driven microservice, anyone can give me some clue?

victor.lopez
2022-08-31 10:08
has joined #pact-net

nfinley
2022-08-31 15:52
has joined #pact-net


matt.fellows
2022-08-31 23:53
we also have some kafka examples here: https://docs.pactflow.io/docs/examples/kafka/js/consumer

matt.fellows
2022-08-31 23:53
Hopefully you can extrapolate to .NET?

lijinze01
2022-09-01 00:18
thank you so much, I will have a look

lijinze01
2022-09-01 03:57
@matt.fellows it is not released right? I cannot see the wthMessageInteraction extension in 4.10

matt.fellows
2022-09-01 04:02
I think it should be released, the code appears to be in the main branch :thinking_face:


matt.fellows
2022-09-01 04:03
@pact544 might be able to point you in the right direction

lijinze01
2022-09-01 04:04
Oh cool, let me try this, thank you :)

hartror
2022-09-01 06:26
has joined #pact-net

uralsmh
2022-09-01 10:37
has joined #pact-net

krystof.sykora
2022-09-01 12:34
has joined #pact-net

lesa
2022-09-01 14:34
has joined #pact-net

gunesmes
2022-09-01 15:31
has joined #pact-net

siddharth.gupta
2022-09-02 06:56
Hi Folks any idea how to push multiple data values in query parameters while writing a consumer side interaction with mock provider

siddharth.gupta
2022-09-02 06:56
Query = new Dictionary<string, object> { { "actor",String.Format("Device/Device-{0},Device/Device-{1}",Device1,Device2) }, { "_format","json" }, { "_pretty","true" }, { "_lastUpdated",String.Format("ge{0}",LastUpdated) }, { "date","le2022-02-09" }, }

siddharth.gupta
2022-09-02 06:56
Query = new Dictionary<string, object> { { "actor",String.Format("Device/Device-{0},Device/Device-{1}",Device1,Device2) }, { "_format","json" }, { "_pretty","true" }, { "_lastUpdated",String.Format("ge{0}",LastUpdated) }, { "date","le2022-02-09" }, { "date","ge2022-02-09" }, }

siddharth.gupta
2022-09-02 06:57
this gives me error saying date key is already added

siddharth.gupta
2022-09-02 06:57
in the dictonary

david.hvilava
2022-09-02 07:53
Hi guys, I use PactNet 4.1.0. When I run a Provider test using a path to particular Pact (WithUriSource method) verification result is not sent to Pact Broker (we use PactFlow) due to an error: `Publishing of verification results failed with an error: Link/Resource was not found - Request to pact broker path '/pacticipants/Provider1' failed: 404 Not Found. URL: 'https://outsystems-cfl.pactflow.io/pacts/provider/Provider1/consumer/Consumer2/version/1.0.1'` Although a pact is available by that url. This problem was described several months ago in this https://github.com/pact-foundation/pact-net/issues/392#issuecomment-1185570535. But it didn't get any attention. Back then I just explored a new functionality. But now it becomes critical for our team, since we move forward to can-i-deploy and add webhooks in PactFlow. Maybe someone can help me with that

siddharth.gupta
2022-09-02 08:12
Query = new Dictionary<string, object> { { "actor",String.Format("Device/Device-{0},Device/Device-{1}",Device1,Device2) }, { "_format","json" }, { "_pretty","true" }, { "_lastUpdated",String.Format("ge{0}",LastUpdated) }, { "date",new[]{"le2022-02-09","ge2022-02-07" } } } this worked for me

mvliannoi
2022-09-02 09:49
Hello! I have three questions about the global Pact conception. 1. Please, tell me, should I separate pact files demands on provider features? For example, I have an API for the Task Manager application and implemented API by feature architecture on the C# language. Such as TaskCrud (CRUD operations on tasks), TaskFilter (filtering tasks) etc. And SPA React application, where I write contact tests. So my question is, should I have a single pact file (e.g. `task-api-consumer-task-api-provider.json`) for checking responses to all features from the provider side or better split generating pact files depending on provider features (e.g. `task-api-consumer-task-api-provider-crud.json` and `task-api-consumer-task-api-provider-filter.json`) and after that writing two verification test methods on the provider side for each coming pact files? 2. Where should I save the pact file path? Is reading from a configuration file (such as launchSettings.json) for a test project better than C# constant? 3. If a consumer has many providers, which algorithm is better to use if I need to publish one pact file to a specific provider? Depend on the pact file prefix, or save the pact file in a particular folder during generation on the consumer side on passing tests? Thanks, Maksym

matt.fellows
2022-09-02 10:19
1. Per provider 2. Doesn't matter, lock an ephemeral dir in the project, you should use a pact broker 3. Publish all of the contracts for each build to the broker. The broker will determine if things have changed

matt.fellows
2022-09-02 10:19
See howtonirvana

2022-09-02 10:19
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/)

mvliannoi
2022-09-02 10:27
Got it, thanks a lot!

alanwallaceross
2022-09-02 16:27
has joined #pact-net

wdridi1
2022-09-02 18:59
has joined #pact-net

daviseago
2022-09-03 02:16
has joined #pact-net

lijinze01
2022-09-05 02:44
Hi team, This is the example of message pact consumer test, my understanding is that it defined the expected message from the MQ, but do we have code to define the message/data that consumer put onto the MQ?

matt.fellows
2022-09-05 02:46
Is this a req/response message?

matt.fellows
2022-09-05 02:46
If so, that?s a new thing in the Pact V4 spec, I don?t think Pact .NET supports it yet

lijinze01
2022-09-05 03:43
@matt.fellows@matt.fellows@matt.fellows it is for event driven, message pact not for request/response

lijinze01
2022-09-05 03:43
@matt.fellows@matt.fellows@matt.fellows I think Pact Net supports it, the code I got is from master branch sample

matt.fellows
2022-09-05 03:44
> but do we have code to define the message/data that consumer put onto the MQ are you putting something onto a queue and then expecting a response?

lijinze01
2022-09-05 03:45
@matt.fellows@matt.fellows@matt.fellows but the sample code only defined the expected incoming message from provider, I don't know how to define the message coming from consumer side

lijinze01
2022-09-05 03:46
Yes, that?s what I want to do

matt.fellows
2022-09-05 03:46
Currently, if you want to do that, you need to write a similar test from the perspective of the other side of the queue (i.e. you?re a message producer in this case)

matt.fellows
2022-09-05 03:46
the V3 message support is async only (fire and forget)

matt.fellows
2022-09-05 03:46
You want req/response, which is a V4 feature and only just starting to be rolled out in other languages.

lijinze01
2022-09-05 03:48
But this sample code is from V4+, and it is for message pact

matt.fellows
2022-09-05 03:49
Apologies for the confusion. It just so happens that the latest Pact NET is 4.x.x

matt.fellows
2022-09-05 03:49
I?m referring to the Pact Specification (currently at V4)

matt.fellows
2022-09-05 03:50
The Pact specification is an ecosystem wide spec

lijinze01
2022-09-05 03:53
No worries mate, so back to my question, how could my consumer test simulate putting message on to the queue?

matt.fellows
2022-09-05 03:53
> Currently, if you want to do that, you need to write a similar test from the perspective of the other side of the queue (i.e. you?re a message producer in this case)

matt.fellows
2022-09-05 03:54
But realistically, that won?t quite do it because it?s not properly paired

lijinze01
2022-09-05 03:56
Hmm, my understand is that the sample consumer test only defined the response from queue (event consumer)

matt.fellows
2022-09-05 03:56
correct

matt.fellows
2022-09-05 03:56
so you?d need to write the test from the perspective of the other side of the queue (they are now the consumer, and you the provider)

lijinze01
2022-09-05 03:58
Ok, I will try, not sure how the contract would be?still from consumer side (event producer)?

matt.fellows
2022-09-05 03:59
Both sides would need to be a consumer and provider in this scenario.

matt.fellows
2022-09-05 04:00
In the request cycle, `A` is the message provider, and `B` is the consumer: `A` -> `MQ` -> `B` In the response cycle, `B` is the message provider and `A` is the consumer `A` <- `MQ` <- `B`

matt.fellows
2022-09-05 04:01
(As I said, not ideal, req/response messages is _coming soon_)

lijinze01
2022-09-05 04:27
Cool, thanks very much for your explanation, I think I will wait for the incoming feature :smile: do you know when? Or how could I know the new feature is released?

matt.fellows
2022-09-05 06:11
I don?t think there is a feature request raised yet on the Pact .NET issues register. I?ll aim to get that up. But you can follow our (Pactflow?s) commitment to it here: https://github.com/pactflow/roadmap/projects/1

lijinze01
2022-09-05 08:25
Excellent, thank you so much for your help, do appreciate :)

matt.fellows
2022-09-05 08:44
:raised_hands:

tjones
2022-09-06 02:00
I really like how shiny this screen is

hsanghavi538
2022-09-06 02:33
has joined #pact-net

thibaut.bodart
2022-09-06 10:41
has joined #pact-net

bastien.decroix
2022-09-06 11:45
has joined #pact-net

pabcagi
2022-09-06 12:28
has joined #pact-net

patrickbadley
2022-09-06 13:25
has joined #pact-net

james.grubb
2022-09-06 19:19
has joined #pact-net

snehasingh291506
2022-09-06 19:42
has joined #pact-net

patrickbadley
2022-09-06 19:55
@patrickbadley has left the channel

senchu.pampoorickal
2022-09-06 20:15
has joined #pact-net

nagasrinivas.thota
2022-09-07 06:56
has joined #pact-net

mahinsyeda99
2022-09-07 09:40
has joined #pact-net

andrevdrodrigues
2022-09-07 13:20
Hi all! Is there any parameter to publish results in pact broker after the provider verification?

andrevdrodrigues
2022-09-07 13:22
For now, I could perform the following code without problem: pactVerifier .ServiceProvider(ProviderName, _httpClient) .HonoursPactWith(ClientName) .PactUri(string.Format("http://localhost:9851/padcts/provider/Userservice/consumer/Userclient/latest", ClientName, ProviderName)) .Verify();

andrevdrodrigues
2022-09-07 13:23
The verification is begin performed, but I would like to publish the results in pact-broker. Any tips? thanks.

matt.fellows
2022-09-07 13:41
There is, I couldn't tell you off the top of my head. I think there's a bug in the latest version. Check the recent GitHub issues and you'll see an example

matt.fellows
2022-09-07 13:41
(sorry on mobile rn)

sashaavramchik
2022-09-07 13:44
Hello! Does .net client supports branches and enviroments? I can't find an info how to filter pacts to verify like it was with tags (PactNet v3)

andrevdrodrigues
2022-09-07 13:52
:disappointed: So, for now... The unique way for that is calling pact-broker by command line?

andrevdrodrigues
2022-09-07 13:55
And... in the last versions, did it work well? or not too?

lisnychyis
2022-09-07 14:00
has joined #pact-net

marek.czerwinski
2022-09-07 16:07
has joined #pact-net

glenn
2022-09-07 16:39
@glenn has left the channel



matt.fellows
2022-09-08 00:59
A fix in the core went out yesterday, so should be resolved soon.

matt.fellows
2022-09-08 00:59
> And... in the last versions, did it work well? or not too? I don?t know when the regression appeared in Pact .NET sorry

xiaofeng02111
2022-09-08 03:20
has joined #pact-net

jayvdb
2022-09-08 06:22
has joined #pact-net

andrevdrodrigues
2022-09-08 08:43
@matt.fellows could you share this github issue to me? Just to check and share with my team . I cant find it :/


andrevdrodrigues
2022-09-08 09:05
Appearly none of these can solve the problem to publish results to broker in .net code...

matt.fellows
2022-09-08 11:02
I didn?t say they resolved it

matt.fellows
2022-09-08 11:02
417 has some code in there that shows how to publish

vvarunbajpai1988
2022-09-08 12:13
has joined #pact-net

andrevdrodrigues
2022-09-08 12:54
Ah ok @matt.fellows great! I'll wait looking forward to it because is the unique thing that I still need to show one poc in my company... Without it, its impossible to use... because we need to use pactbroker to verify all results. So, please if you have any news or any workaround to publish results to broker in .net.. let me know in this thread :pray:

zakir
2022-09-08 12:55
has joined #pact-net

gregory.hanson
2022-09-08 12:56
has joined #pact-net


andrevdrodrigues
2022-09-08 14:42
Ok, I did some adjustments in my POC and I can to publish results for pactBroker normally by code in .net: verifier.ServiceProvider("Something-API", this.fixture.ServerUri) .WithPactBrokerSource(new Uri("http://localhost:9851"), options => { options.ConsumerVersionSelectors(new ConsumerVersionSelector { Latest = true }) .PublishResults(version); }) .WithProviderStateUrl(new Uri(this.fixture.ServerUri, "/provider-states")) .Verify();

andrevdrodrigues
2022-09-08 14:43
@matt.fellows I donīt know if this issue is related to this same problem but I could solve and results have being published to broker :slightly_smiling_face: .:

ashishmerani
2022-09-08 21:54
has joined #pact-net

matt.fellows
2022-09-08 23:05
I think the issue was when publishing the branch details as well (or something similar) so if you're not using branches and environments you might be ok

ramesh.ambastha
2022-09-09 11:06
has joined #pact-net

oak155online
2022-09-11 19:24
@oak155online has left the channel

andrevdrodrigues
2022-09-12 08:42
Yes, not for now :wink: But at some moment I will need... therefore, Im gonna follow this issue :slightly_smiling_face:

nickm
2022-09-12 17:15
has joined #pact-net

uzma_khan
2022-09-12 18:13
has joined #pact-net

stefan.tertan
2022-09-13 15:28
has joined #pact-net

fabio.rodrigues
2022-09-13 17:10
Hey there, I'm getting this error when attempting to verify a previously published contract: ```[INFO][pact_verifier::pact_broker] Fetching path '/pacts/provider/publish-service/consumer/alm-app/pact-version/6bc3dee5de1ea718ef23d4dab94fa32536ecf014/metadata/c1tdW2N2XT0xMTI2MiZwPXRydWU' from pact broker [DEBUG][hyper::client::pool] reuse idle connection for ("https", http://outsystems.pactflow.io) [DEBUG][reqwest::async_impl::client] response '200 OK' for https://outsystems.pactflow.io/pacts/provider/publish-service/consumer/alm-app/pact-version/6bc3dee5de1ea718ef23d4dab94fa32536ecf014/metadata/c1tdW2N2XT0xMTI2MiZwPXRydWU [ERROR][pact_verifier] Failed to load pact - Failed to load pact from 'https://outsystems.pactflow.io/' - ContentError("Expected a \".\" or \"[\" instead of \"r\" in path expression \"$results[*].deploymentOperations[*].applicationKey\" at index 1") [WARN][pact_matching::metrics]``` The part i'm not understanding is why it's failing on parsing the matcher locator: ```"matchingRules": { "body": { "$results[*].deploymentOperations[*].applicationKey": { "combine": "AND", "matchers": [ { "match": "regex", "regex": "^$|[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$" } ] },```

david.hvilava
2022-09-13 17:14
Hey) Was the pact successfully fetched before verification? Judging by the logs it failed right there

fabio.rodrigues
2022-09-13 17:15
It fails when it gets the contract, and then tries to parse it

david.hvilava
2022-09-13 17:17
Does it mean that the contract was eventually fetched after retry or so? Otherwise I don't understand what it tries to parse

fabio.rodrigues
2022-09-13 17:18
It fetched the contract, but when it tries to parse the json, it fails on that matcher

fabio.rodrigues
2022-09-13 17:18
It got a 200 okay in the response to getting the contract

david.hvilava
2022-09-13 17:18
ok

matt.fellows
2022-09-13 22:38
@uglyog any ideas? Looks like maybe a badly generated contract?

uglyog
2022-09-13 22:42
`$results[*].deploymentOperations[*].applicationKey` is not correct. It is missing the period after the dollar (as the error is saying). I.e `$.results[*].deploymentOperations[*].applicationKey`

tjones
2022-09-14 00:49
What generated the contract?

konitzert
2022-09-14 07:11
has joined #pact-net

fabio.rodrigues
2022-09-14 08:02
i see thanks

fabio.rodrigues
2022-09-14 08:04
it was generated via a internal low code tool

fabio.rodrigues
2022-09-14 08:05
i will report this error to them, so they can fix the contract generation

fabio.rodrigues
2022-09-14 08:05
again, thanks for the help in diagnosing this issue

tjones
2022-09-14 08:09
Interesting. What's the use case for an internal tool for generating pact files?

fabio.rodrigues
2022-09-14 08:10
we have a lot of low code applications that are the consumers for services that are high code. Thus, since they're the consumers, they need a way to create the consumer contract

fabio.rodrigues
2022-09-14 08:10
for example a low code app would call a rest api to get some kind of result from a service

tjones
2022-09-14 08:13
Interesting. Well, as long as whatever generates the pact file is ensuring that the consumer sends that request and understands things that match that response you should be fine

daniel.puiu
2022-09-14 13:43
has joined #pact-net

l.heluszko
2022-09-15 13:12
has joined #pact-net

andrevdrodrigues
2022-09-15 15:35
Hello @matt.fellows. I saw some examples related to pactnet in official github but I still have some doubts regarding the recommendation to create pact files. The best practice is to publish (create a contract) unique pact file between 2 services (provider and consumer, with all interactions and endpoints) or is more recommended to create one pact file by each interaction? In my opinion, I think that the best is to create a unique file between 2 services... However, this doubt appeared me when I saw some examples in .net publishing pact by each test case.

andrevdrodrigues
2022-09-15 16:05
Example pactnet in official github repo: ```[Fact] public async Task GetSomething_WhenTheTesterSomethingExists_ReturnsTheSomething() { // Arrange this.pactBuilder .UponReceiving("A GET request to retrieve the something") .Given("There is a something with id 'tester'") .WithRequest(HttpMethod.Get, "/somethings/tester") .WithHeader("Accept", "application/json") .WillRespond() .WithStatus(HttpStatusCode.OK) .WithHeader("Content-Type", "application/json; charset=utf-8") .WithJsonBody(new { id = "tester", firstName = "Totally", lastName = "Awesome" }); await this.pactBuilder.VerifyAsync(async ctx => { // Act var client = new SomethingApiClient(ctx.MockServerUri); var something = await client.GetSomething("tester"); // Assert Assert.Equal("tester", something.Id); }); }```

alecat88
2022-09-16 10:25
has joined #pact-net

chris.armbrester
2022-09-16 11:45
has joined #pact-net

zohaibse011
2022-09-16 13:28
has joined #pact-net

nvenkataraman
2022-09-16 17:17
has joined #pact-net

zach.davis
2022-09-16 20:18
has joined #pact-net

jorbraken
2022-09-16 20:29
has joined #pact-net

paul.ologeh
2022-09-16 23:25
has joined #pact-net

purushothamv02
2022-09-19 14:19
has joined #pact-net

lcruz
2022-09-19 23:05
has joined #pact-net

sweiba
2022-09-20 07:26
has joined #pact-net

adam910
2022-09-20 12:32
has joined #pact-net

p.pommerencke
2022-09-20 14:00
has joined #pact-net

anhtvuong
2022-09-21 01:39
has joined #pact-net

timothee.ville
2022-09-21 08:09
has joined #pact-net

andrevdrodrigues
2022-09-21 09:04
Hello everyone! Im trying to publish results in pactbroker after provider verification. Locally it was really possible and its everything ok. However, in my company, we have our broker using https and I'm cant to publish results (tests fails in C#.Net and results arent being published to broker) Anyone can help me to solve it?

fabio.rodrigues
2022-09-21 09:16
Hi there, does pact-net support message contract with NATS?

matt.fellows
2022-09-21 09:31
What's different about the setup? Are there failures or is it just disabled?

matt.fellows
2022-09-21 09:31
Debug level logs might help too

matt.fellows
2022-09-21 09:32
Not directly but I'm imagining the basic Async support could work? Is NATS req/res or just fire and forget?

andrevdrodrigues
2022-09-21 09:33
@matt.fellows

yousafn
2022-09-21 10:05
the broker url looks odd https://test/pactbroker

andrevdrodrigues
2022-09-21 10:06
yes, rs... is just one example. our real url is available in our internal network.

fabio.rodrigues
2022-09-21 11:01
response is required

fabio.rodrigues
2022-09-21 11:01
so the consumer sends a nats request and waits for a response

fabio.rodrigues
2022-09-21 11:01
we have some service that communicates extensively by NATS

matt.fellows
2022-09-21 11:05
got it. That will be what we would class as a request/response (synchronous) message. That?s available in the V4 Pact Spec which was released into the core a few months ago, but is not yet in Pact .NET. We?ll need to card it up for the OSS maintainer (Adam) to review etc. Aspirationally, we?d like to see that in Q4 this year (in fact, across all of the key languages we support)

matt.fellows
2022-09-21 11:06
Could you please add `trace` level logs and share with us? I?d like to know why no pacts were found

andrevdrodrigues
2022-09-21 11:14
when I make this request to localhost, I dont have any problem and can to load pacts.

matt.fellows
2022-09-21 11:16
Can you please set the log level to `trace` and share?

tymoschuk.jane
2022-09-21 12:38
has joined #pact-net

tony.nguyen
2022-09-21 13:41
has joined #pact-net

sashi.kandru
2022-09-21 13:45
has joined #pact-net

khaled.bali
2022-09-21 18:01
has joined #pact-net

m.mertens
2022-09-21 18:41
has joined #pact-net

andrevdrodrigues
2022-09-22 08:43
Hi @matt.fellows sorry for my delay. Sure, follow the log containing the trace log level.

mforsman
2022-09-22 09:13
has joined #pact-net

shivendra.singh1
2022-09-22 10:04
has joined #pact-net

vaibhav.tiwari
2022-09-22 10:04
has joined #pact-net

akshaythakur2905
2022-09-22 10:06
has joined #pact-net

sukriti.kumari
2022-09-22 10:07
has joined #pact-net

andrevdrodrigues
2022-09-22 10:27
@matt.fellows we are almost finishing our internal pilot... This point will be crucial. Is there anything that I need to do in my side to solve it or it will necessary some issue to be opened? :pray:

p.kowalska
2022-09-22 10:35
has joined #pact-net

mazin.inaad
2022-09-22 13:21
has joined #pact-net

matt.fellows
2022-09-22 13:59
Hi andre, sorry I'm just on my phone at the moment so can't read the logs. I reckon there are two possibilities: 1. The core has a big and is appending the base URL with the additional path to subsequent requests to the broker 2. Your broker is behind a reverse proxy and is incorrectly setting the reverse proxy x-forwarded-for and related headerw

matt.fellows
2022-09-22 13:59
Could you please share the result of an authenticated curl to the pact broker? That should help me

andrevdrodrigues
2022-09-22 14:23
The results were:

andrevdrodrigues
2022-09-22 14:24
Is it enough?

mastahfreak
2022-09-23 09:47
has joined #pact-net

matt.fellows
2022-09-23 14:04
Thanks that helps. I'm guessing a bug somewhere, I'll have to take a look Monday though

kellie.persson
2022-09-23 17:50
has joined #pact-net

andrevdrodrigues
2022-09-26 13:54
Ok @matt.fellows thanks a lot again :slightly_smiling_face:

kbon
2022-09-26 13:58
has joined #pact-net

tanyaryzhova93
2022-09-26 18:53
has joined #pact-net

anand.krishnan
2022-09-27 10:45
has joined #pact-net

estelle.margoutin
2022-09-27 12:00
has joined #pact-net

andrevdrodrigues
2022-09-27 12:21
Please, change by this log... I already changed all our urls and ip's.

matt.fellows
2022-09-27 12:27
ok can do. Note that this forum is also public, so next time probably best to redact before posting here :wink: Will update next time i?m at the desk!

andrevdrodrigues
2022-09-27 12:28
OK @matt.fellows many thanks. I also changed here in our thread :wink: Thanks a lot!!!

andrevdrodrigues
2022-09-27 13:55
@matt.fellows I had sent it wrong here in our thread... the idea was really to have already sent it with masked data. But thanks a lot again for this fix :slightly_smiling_face:

andrevdrodrigues
2022-09-27 16:21
@matt.fellows if you prefer, delete totally this github issue and I create the issue with the correct masked log. I apologize again for that, I didn't realize I sent the log without mask.

matt.fellows
2022-09-28 02:46
np

matt.fellows
2022-09-28 02:46
I?ll redact it now

matt.fellows
2022-09-28 02:47
done :white_check_mark:

matt.fellows
2022-09-28 02:47
(I also deleted the revision from history so it?s not there too)

criss.trifan
2022-09-28 05:36
has joined #pact-net

andrevdrodrigues
2022-09-28 08:40
Hello @matt.fellows thanks a lot again! We are with our poc in progress with some teams in our company. I will share with you our results and feedbacks :facepunch:


vipatel
2022-09-28 15:29
has joined #pact-net

olaoluphilip
2022-09-28 15:51
has joined #pact-net

vieira.jluiz
2022-09-28 17:20
has joined #pact-net

shuo.yang.2006
2022-09-28 19:48
has joined #pact-net

andrevdrodrigues
2022-09-29 11:35
Hello there! When I use PactVerifier, my provider checks all consumers that it has the latest published contract. However, is possible to set this verification only to one specific consumer instead verify all consumers? Is there any parameter, field? In some cases, I just would like to check the verification for one consumer. My code: ```IPactVerifier verifier = new PactVerifier(config); verifier.ServiceProvider("test-provider", this.fixture.ServerUri) .WithPactBrokerSource(new Uri("https://test-broker/"), options => { options.ConsumerVersionSelectors(new ConsumerVersionSelector { Latest = true }) .PublishResults(version); }) .WithProviderStateUrl(new Uri(this.fixture.ServerUri, "/provider-states")) .Verify();```


matt.fellows
2022-09-29 11:57
You can also pass a URL to the exact pact you want to verify if known

andrevdrodrigues
2022-09-29 14:18
Ok @matt.fellows amazing!! I will test it. However, another point that we are needed is related to the use of some regex to matcher in c#.net For example: I want that my provider don't need to verify exactly the same value contained in the contract field definition... I just would like to verify that the field is integer (for example). Previously, I could implement it in Java successfully but in .Net I still cant to do it. Do you have some specific example about that?

nirmalcbaral
2022-09-29 15:27
has joined #pact-net

andrevdrodrigues
2022-09-29 16:29
Now I could use this method Match.Type of using PactNet.Matchers; :wink: For now, I think that is enough.

ruppel.julian
2022-09-29 20:03
has joined #pact-net

alipala.ist
2022-09-29 20:28
has joined #pact-net

andrevdrodrigues
2022-09-29 20:49
Hello there! Me again!! We are closer to finishing our pilots with PactNet in my company. I'm very confident that we will have success! :pray: However, one big issue that we are facing is related to the way that the .net apps are built on a provider side. In many cases, the apps expose one "API in memory" and appears the verification on a provider side needs to have a real instance with a specific port running the provider app. Is it a mandatory requirement? Is there any workaround for that? Thanks a lot :wink:

matt.fellows
2022-09-30 01:52
Yes, that is a current requirement. I do think somebody in the community did find a workaround though, I?m not sure if that?s documented


matt.fellows
2022-09-30 01:54
You can?t regex a number, if that?s what you?re asking? You can regex a number encoded as a string though

educationextended
2022-09-30 05:00
has joined #pact-net

andrevdrodrigues
2022-09-30 09:01
Wow!!! It would be amazing, I'll look for it... but if I remember something, let me know too :wink:

andrevdrodrigues
2022-09-30 09:03
Not for number, I know... Only regex, but I saw that this matcher already give this possibility to use regex for many cases :slightly_smiling_face:

andrevdrodrigues
2022-09-30 09:06
The idea for now it was only use one matcher to check the type... This method Match.Type was enough :slightly_smiling_face:

andrevdrodrigues
2022-09-30 11:13
@matt.fellows related the example provided in pact-net... we realized that the data is injected in controller of providers... for example in this attached image. However, it's little intrusive in the apps. Correct? Is it mandatory? Is there any another way..? Or always the teams will need to adjust tests and also inject data in controllers? Thanks again and sorry for this quantity of questions.

ross.butler
2022-09-30 11:22
has joined #pact-net

andrevdrodrigues
2022-09-30 11:22
Or is it only an example to set up a data provider during the execution and experiment with the solution?

matt.fellows
2022-09-30 12:42
This is a general question about provider states. Pact is agnostic to how you setup your test cases and data - you could seed a database, use stubs etc.

matt.fellows
2022-09-30 12:42
Sorry just on mobile, but perhaps it's worth looking at a few non .NET examples to get a feel for it

andrevdrodrigues
2022-09-30 13:26
Yes @matt.fellows, I already saw other examples in languages such as python and java too... And I really understand provider-states, my question is specially related to the possibility of setup data, states, and the requests to providers only in a test project, without the need to inject code in a provider side (e.g controller).

koen.jans
2022-09-30 15:06
has joined #pact-net

ksawery.karwacki
2022-10-01 13:12
has joined #pact-net

jesper.nilsson
2022-10-01 13:59
has joined #pact-net

mansillamarcelo90
2022-10-02 22:06
has joined #pact-net

yulia.tekin.86
2022-10-02 22:55
has joined #pact-net

rachel.anderson
2022-10-02 23:39
has joined #pact-net

matt.fellows
2022-10-03 01:38
I don?t think you should be changing your application architecture for the tests, if that?s what you?re asking?

matt.fellows
2022-10-03 01:39
You just need to ensure there is data for the tests, and if you need to setup data for states - then do that too. However you do that is really up to you. Pact is deliberately agnostic as to how this happens

jason.stahl
2022-10-03 22:19
has joined #pact-net

sreeragsa
2022-10-04 03:03
has joined #pact-net

sarunas.kavaliauskas
2022-10-04 08:52
Hi, getting excpetion when running http://Pact.NET on UBI8 image (redhat/ubi8:8.5-226) x64, executed as runner in GitHub Actions Enterprise environment. Any ideas ?System.DllNotFoundException : Unable to load shared library ?pact_ffi? or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libpact_ffi: cannot open shared object file: No such file or directory

tara.costin
2022-10-04 14:45
has joined #pact-net

oscar.barbamanzano
2022-10-05 14:18
has joined #pact-net

yanov.alexander
2022-10-06 08:39
has joined #pact-net

bxbivc
2022-10-06 10:05
has joined #pact-net

curtis.scott
2022-10-06 11:27
has joined #pact-net

riley.lee
2022-10-06 11:30
has joined #pact-net

oliver.smyth
2022-10-06 11:34
has joined #pact-net

kevin.campos
2022-10-06 11:35
has joined #pact-net

pstrnad
2022-10-06 12:04
has joined #pact-net

rachelxelizabethh
2022-10-06 13:20
has joined #pact-net

pratish
2022-10-06 21:08
has joined #pact-net

ilia
2022-10-06 22:18
has joined #pact-net

edudelta
2022-10-07 15:57
has joined #pact-net

olsen.lee.r
2022-10-07 18:29
has joined #pact-net

johndunning
2022-10-08 18:05
has joined #pact-net

kentooooo.1230
2022-10-09 17:49
has joined #pact-net

andrevdrodrigues
2022-10-10 07:00
@matt.fellows Sorry for my delay! Thanks a lot for your explanation... Yes, my idea is not to change the architecture... its not make sense! In this week, me and my team will try to finish this poc :wink:

andrevdrodrigues
2022-10-10 07:25
For now, we have just the problem with api in memory... We will try to expose the app using docker e redirect for one port to run the verification in a provider side....

gpapadakis84
2022-10-10 12:32
has joined #pact-net

daftpunkapi
2022-10-11 09:22
has joined #pact-net

matteo.demasi
2022-10-11 12:08
has joined #pact-net

raul.romitan.ext
2022-10-11 12:17
has joined #pact-net

dominikdieter.krichba
2022-10-11 13:23
has joined #pact-net

ulrich.keil
2022-10-11 13:26
has joined #pact-net

mitchell.l.cooper
2022-10-11 13:45
has joined #pact-net

torsten.wiederkehr
2022-10-11 14:24
has joined #pact-net

mikey214
2022-10-11 22:32
has joined #pact-net

xi.luo
2022-10-12 05:11
has joined #pact-net

kim.crowe
2022-10-12 10:15
has joined #pact-net

andrevdrodrigues
2022-10-12 15:35
Hello @matt.fellows, how are you? In our context, we have several ways to inject data for many databases in multiple projects... However, it has been a little complicated to guide the teams around it. So, we were thinking about proposing that the teams just create database mocks (not the entire provider app, of course.) and inject data mocks in providers databases to surpass these issues. Is something wrong from your perspective? Did you see some projects implemented in this way? I was thinking about it, due to the data can stay outdated in real databases as well as in a mocked database (and this option can be easier to setup).

suganyamuthukumar03
2022-10-13 11:01
has joined #pact-net

francis.bonneau
2022-10-13 18:30
has joined #pact-net

naf
2022-10-14 10:55
has joined #pact-net

werner.lauterfeld
2022-10-14 11:09
has joined #pact-net

jharms
2022-10-14 15:04
has joined #pact-net

daniel.cronin
2022-10-14 16:15
has joined #pact-net

txomin.sirera
2022-10-14 18:57
has joined #pact-net

jr
2022-10-15 20:48
has joined #pact-net

sasankdts
2022-10-16 08:48
has joined #pact-net

wil.pannell
2022-10-16 16:56
has joined #pact-net

sirisha.kunaparaju
2022-10-17 11:01
has joined #pact-net

gardeepti
2022-10-17 11:02
has joined #pact-net

vedant3620
2022-10-17 11:08
has joined #pact-net

priyanka.bbit
2022-10-17 11:11
has joined #pact-net

nvourlakis
2022-10-17 11:21
has joined #pact-net

oliwia.koch
2022-10-17 13:51
has joined #pact-net

bluediamondpc
2022-10-17 14:18
has joined #pact-net

nicholas.difelice
2022-10-17 15:16
has joined #pact-net

remington.otoole
2022-10-17 15:20
has joined #pact-net

matt.lucido
2022-10-17 15:23
has joined #pact-net

molly.mccarthy
2022-10-17 15:28
has joined #pact-net

slack1211
2022-10-18 07:24
has joined #pact-net

bluediamondpc
2022-10-18 10:52
Hi, reading the documentation I have found a matcher for Authorization that looks like following: `.WithHeader("Authorization", Match.Regex("Bearer 2022-10-14T11:34:18.045Z", "Bearer \\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z"))` Although, when using it like the example, it's throwing a 500 internal server error. Any clues?

matt.fellows
2022-10-18 11:41
Is it the double escaping? Set the log level to debug, you should be able to see why it?s not happy

bluediamondpc
2022-10-18 12:42
Created an issue, seems that is not using the regex at all since the logs says that is comparing by equality the 2 strings

bluediamondpc
2022-10-18 12:43
I thought that it would take the regex and use it to validate (same way as Regex.Test / Regex.Matches)

mekala.kalyan
2022-10-18 12:49
has joined #pact-net

jpullifrone
2022-10-18 17:05
has joined #pact-net

jorge.bo
2022-10-18 18:42
has joined #pact-net

orhun
2022-10-18 19:42
has joined #pact-net

kwo.ding
2022-10-19 08:24
has joined #pact-net

ankit.jain
2022-10-19 10:41
has joined #pact-net

edeandre
2022-10-19 12:09
has joined #pact-net

stanlisaus
2022-10-19 12:11
has joined #pact-net

nikolaasrondon
2022-10-19 17:29
has joined #pact-net

fquijada
2022-10-19 21:25
has joined #pact-net

kkalan
2022-10-20 03:52
has joined #pact-net

dyptorden
2022-10-20 10:24
has joined #pact-net

olawale.akande
2022-10-20 11:52
has joined #pact-net

olawale92.tech
2022-10-20 11:56
has joined #pact-net

calen.pennington
2022-10-20 13:43
has joined #pact-net

muhammud.naseeruddin
2022-10-20 16:04
has joined #pact-net

xuw
2022-10-20 16:38
has joined #pact-net

matt.johnson
2022-10-20 17:25
has joined #pact-net

bhavyashree.r
2022-10-22 06:10
has joined #pact-net

mosesgwenne
2022-10-24 06:10
has joined #pact-net

andrevdrodrigues
2022-10-24 09:15
Hi all! I'm using pact verify with pact-net inside my code... I know that is possible to use the command cli to perform the verify on the provider side and I follow the examples in pact-net github. However, in what situation is it better to use cli for this verification? Or for .net the recommendation is to use by code? Thanks a lot :)

matt.fellows
2022-10-24 10:19
I prefer to work in code, because you can properly stub things and you get more fine grained control. The CLI will work of course, but I find it less targeted and harder to get a reliable setup

andrevdrodrigues
2022-10-24 10:27
Ok... @matt.fellows. About the setup, you mean about the provider states... Correct? Because, at this moment we are thinking to use the CLI to give the same guideline for all languages that use pact in our company. However, I cant find any example using verify CLI for .net solution... Do you have some idea how can we make it?

matt.fellows
2022-10-24 11:10
Not just provider states but that is part of it. It's harder to use mocks etc when running in a black box way. Why would we provide an example for using the .NET and cli when we have a proper language? The point of the CLI is to make it available to other languages that don't have this.

andrevdrodrigues
2022-10-24 11:14
Ok, I understand... I saw some examples in other languages such as python (for example) and for us, it seems easier and fittable to use the command cli in pipelines. However, I will guide the teams to try to use .directly in code. Thanks again @matt.fellows

matt.fellows
2022-10-24 12:39
I would go with whatever works best for your team Andre - you can always change later!

andrevdrodrigues
2022-10-24 12:43
Great @matt.fellows, thank you again for all support. Honestly, this initial onboarding with the teams has not been easy but we are trying to follow with a standardized way as much as we can.

matt.fellows
2022-10-24 12:48
Feel free to brain dump on that onboarding experience here, so we can share and review as a maintainer community - appreciate your persistence!

andrevdrodrigues
2022-10-24 12:49
Great!! I really trust in this solution :wink:

j.watkins12
2022-10-24 21:13
has joined #pact-net

tony.odonnell
2022-10-25 07:56
has joined #pact-net

martin.schlegel
2022-10-25 11:24
has joined #pact-net

stefan.zivkovic
2022-10-25 12:35
has joined #pact-net

alexander.friesen
2022-10-25 14:07
has joined #pact-net

mspector
2022-10-25 14:45
has joined #pact-net

thomas.peyregne
2022-10-25 14:53
has joined #pact-net

jsirju
2022-10-25 20:22
has joined #pact-net

a.emmanuelmendoza
2022-10-25 23:42
has joined #pact-net

emma.colleran
2022-10-26 13:05
has joined #pact-net

aaron.swerlein
2022-10-26 15:10
has joined #pact-net

stefan.zivkovic
2022-10-26 16:32
@stefan.zivkovic has left the channel

jeronimo
2022-10-26 17:50
has joined #pact-net

matthew.beattie
2022-10-26 20:14
has joined #pact-net

harrison.le
2022-10-26 21:47
has joined #pact-net

amandasstecz
2022-10-26 21:57
has joined #pact-net

christianoliver.table
2022-10-27 06:15
has joined #pact-net

zehra.lichtenberg
2022-10-27 08:08
has joined #pact-net

vzviaruha
2022-10-27 11:29
has joined #pact-net

michael.laird
2022-10-27 13:38
has joined #pact-net

pedropho18
2022-10-27 21:33
has joined #pact-net

juancesarvillalba
2022-10-27 21:43
has joined #pact-net

stanlisaus
2022-10-28 07:05
Has anyone experienced an issue where firing a request using the native backend runs forever, doesnt timeout, and doesnt return a response?

angad.singh
2022-10-28 11:07
has joined #pact-net

jeronimo
2022-10-28 18:20
@jeronimo has left the channel

oroceo.ian
2022-10-28 20:04
has joined #pact-net

benjamin
2022-10-28 21:09
has joined #pact-net

emailpankaj.agarwal
2022-10-29 13:26
has joined #pact-net

krishnakanth219
2022-10-30 22:59
has joined #pact-net

joshua.mclatchie
2022-10-31 02:21
has joined #pact-net

jason.taylor2
2022-10-31 13:55
has joined #pact-net

kedar.ghate
2022-10-31 14:02
has joined #pact-net

jason.taylor2
2022-10-31 16:38
@jason.taylor2 has left the channel

usama.mumtaz
2022-11-02 09:45
has joined #pact-net

gsouza
2022-11-02 14:29
has joined #pact-net

zhangjingqiang
2022-11-02 23:49
has joined #pact-net

bmorton
2022-11-02 23:58
has joined #pact-net

andrew.brindle
2022-11-03 10:44
has joined #pact-net

vladislav.ledniov
2022-11-03 14:13
has joined #pact-net

jonathan
2022-11-03 16:43
has joined #pact-net

ldicesaro.scvsoft
2022-11-03 20:55
has joined #pact-net

carlosmarange
2022-11-04 06:09
has joined #pact-net

stevet
2022-11-04 06:31
has joined #pact-net

seikyo.cho
2022-11-04 08:58
has joined #pact-net

poornimakrishnarajan
2022-11-04 13:56
has joined #pact-net

michalkras
2022-11-05 01:05
has joined #pact-net

maria.botnari
2022-11-07 12:07
has joined #pact-net

tomasz.sosnowski
2022-11-07 13:52
has joined #pact-net

bpadhalni
2022-11-07 15:26
has joined #pact-net

ajay.chinnam
2022-11-08 10:08
has joined #pact-net

sprengo
2022-11-08 10:57
has joined #pact-net

james.ferguson
2022-11-08 12:33
has joined #pact-net

gururaghavendrar98
2022-11-08 13:04
has joined #pact-net

steven
2022-11-08 23:09
has joined #pact-net

alan.barr
2022-11-09 03:14
has joined #pact-net

wojciech.bachur
2022-11-09 13:55
has joined #pact-net

arek92
2022-11-09 13:58
has joined #pact-net

dariusz.duleba
2022-11-09 14:00
has joined #pact-net

cgodsey
2022-11-10 19:45
has joined #pact-net

saweniger
2022-11-14 17:29
has joined #pact-net

miguel.roldan
2022-11-15 11:06
has joined #pact-net

robin.lungwitz
2022-11-15 13:32
has joined #pact-net

laith
2022-11-15 16:15
has joined #pact-net

elluru.kri.mohan
2022-11-15 18:14
has joined #pact-net

rmartine
2022-11-15 20:35
has joined #pact-net

sameena9010
2022-11-16 06:49
has joined #pact-net

ryanthomas840310
2022-11-16 20:52
has joined #pact-net

mike.hideaki
2022-11-16 21:48
has joined #pact-net

vwaters
2022-11-16 22:31
has joined #pact-net

juergen.unfried
2022-11-17 20:43
has joined #pact-net

jose.anastacio
2022-11-18 13:34
has joined #pact-net

shawn305
2022-11-18 13:42
has joined #pact-net

tronghuy
2022-11-19 01:38
has joined #pact-net

steven
2022-11-21 12:44
Hello there, I would like to implement Pact Verifier on Azure In-Process Functions. I'm wondering if anyone could recommend what is the best way to ? Host Azure Functions for testing ? Configure ProviderMiddleware when In-Process Functions do not support middleware. Thanks!

glauco.carvalho
2022-11-21 15:47
has joined #pact-net

sprengo
2022-11-21 16:06
Hi, why is the PactVerfier trying to get the pacts from the wrong path here? My PactBroker is running at "https://foo.bar.cloudapp.azure.com/pactiobroker" and I configured the brokerBaseUri in my pact-net test to that exact path. Why is it doubling the "/pactiobroker" part in the request?

soner.ay
2022-11-21 16:57
has joined #pact-net


sprengo
2022-11-22 08:28
Thanks for the hint. I guess there is nothing I can do in the .NET-Library at least?

matt.fellows
2022-11-22 08:46
Not yet. My advice is to not use a context path for now (but my guess is that?s not an option?)

matt.fellows
2022-11-22 08:47
Or, if you?re up for fixing the bug - we?d appreciate a PR!

flafla.mattos
2022-11-22 19:10
has joined #pact-net

chrisjburnscg
2022-11-22 22:11
has joined #pact-net

matt.fellows
2022-11-23 00:25
Unfortunately the slack history has been lost as it?s older than 90 days

matt.fellows
2022-11-23 00:25
You might find some inspiration in the digest here: https://docs.pact.io/slack/pact-net.html#1612896088.045200

sprengo
2022-11-23 09:49
OK, I got rid of the context path. Fixing the bug would be in the PactBroker internals (Rust)?

matt.fellows
2022-11-23 10:56
It?s in the client, which is a shared library written in Rust (not the broker, which is Ruby)

matt.fellows
2022-11-23 10:56
If you?re up for a small PR to a rust lib, we?d appreciate it!

steven
2022-11-24 02:00
Thanks @matt.fellows for sharing the link. For hosting the Azure Functions locally or in PR (pre-deployment), I notices a number of people recommend using Azure Functions Core Tools per https://docs.pact.io/slack/pact-net.html#1625682537.054900. I will give this a go. For ProviderStateMiddleware with In-Process Functions, I came across https://docs.pact.io/slack/pact-net.html#1591037668.069200 and https://docs.pact.io/slack/pact-net.html#1566204067.061100. I will try writing up a "/provider-states endpoint"

imer.muhovic
2022-11-24 08:57
has joined #pact-net

mohitsoni
2022-11-24 10:19
has joined #pact-net

celia
2022-11-24 14:32
has joined #pact-net

harald.bittermann
2022-11-25 10:01
has joined #pact-net

ad
2022-11-25 13:23
has joined #pact-net

sree
2022-11-25 14:22
has joined #pact-net

soumya.aithal
2022-11-27 17:15
has joined #pact-net

nathan.pine
2022-11-28 09:19
has joined #pact-net

sanmicad
2022-11-28 12:20
has joined #pact-net

marcin.nawrocki
2022-11-29 09:25
has joined #pact-net

sameena9010
2022-11-30 07:29
Hi im trying to implement pact net for our project, for publish pact im using docker cli n pact broker docker image but it always throwing me the file doesnt exist eventhough the pact file exists. could someone please help me what i am missing here *I am using CLI as below* ```docker run --rm -e PACT_BROKER_BASE_URL pactfoundation/pact-cli:latest publish C:\Users\sasye\RiderProjects\pact-workshop-dotnet-core-v3\pacts\ApiClient-ProductService.json --consumer-app-version 1.0.0 Specified pact file 'C:/Users/sasye/RiderProjects/pact-workshop-dotnet-core-v3/pacts/ApiClient-ProductService.json' does not exist. This sometimes indicates one of the arguments has been specified with the wrong name and has been incorrectly identified as a file path.```

matt.fellows
2022-11-30 07:46
You need to volume mount your local file system into docker. Remember that command is running inside the container, which has its own file system.

sameena9010
2022-11-30 07:49
Thanks Matt

sergewar
2022-11-30 08:54
has joined #pact-net

diego
2022-11-30 09:50
has joined #pact-net

surya.sidharthan
2022-11-30 11:13
has joined #pact-net

nicolas.chara
2022-11-30 13:16
has joined #pact-net

sameena9010
2022-11-30 14:27
when i try to publish my pact file its giving me a TCP error, can someone help me understand why its looking at 443 port ```I am publishing as below docker run --rm -v C:/Users/sasye/RiderProjects/pact-workshop-dotnet-core-v3/pacts:/data pactfoundation/pact-cli:latest pact-broker publish /data --broker-base-url http://172.21.106.96:9292 --consumer-app-version 1.0.0 Error /usr/lib/ruby/3.0.0/net/http.rb:987:in `initialize': Failed to open TCP connection to localhost:443 (Address not available - connect(2) for "localhost" port 443) (Errno::EADDRNOTAVAIL)```

daniel
2022-11-30 18:30
has joined #pact-net

denis
2022-11-30 22:07
has joined #pact-net

matt.fellows
2022-11-30 23:22
try adding the `--verbose` flag to it, and see what it?s printing out

matt.fellows
2022-11-30 23:25
My guess is that there is a proxy or something in the middle, or a redirect to a secure endpoint happening

dbarne24
2022-12-01 11:35
has joined #pact-net

min.zaw.mra
2022-12-01 11:36
has joined #pact-net

kevin.lau
2022-12-01 11:41
has joined #pact-net

bojanmarjanovic1980
2022-12-01 13:09
has joined #pact-net

ivona.sovic
2022-12-01 13:13
has joined #pact-net

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

david.dudley
2022-12-01 19:55
has joined #pact-net

brian.coan
2022-12-01 20:22
has joined #pact-net

manishmitraba
2022-12-02 02:16
has joined #pact-net

lepdiana01
2022-12-02 03:53
has joined #pact-net

arpan.agr
2022-12-02 08:06
has joined #pact-net

goksel00
2022-12-02 17:41
has joined #pact-net

aibosun900614
2022-12-04 02:18
has joined #pact-net

mayank.mahajan04
2022-12-05 10:51
has joined #pact-net

krisakins
2022-12-05 22:03
Hm, I just pulled a branch of mine that had one very simple contract test working. Now I'm getting this when running the Producer test ``` Message:? System.Net.HttpListenerException : The process cannot access the file because it is being used by another process. Stack Trace:? HttpListener.AddPrefixCore(String registeredPrefix) HttpListener.AddAllPrefixes() HttpListener.Start() MessagingProvider.Start(JsonSerializerSettings settings) PactVerifier.MessagingProvider(String providerName, JsonSerializerSettings settings)``` I originally thought that the access error is related to my pact file being used by some other process, but I don't know what that'd be. Also, I don't know why this is just now failing :thinking_face: ```.WithFileSource(new FileInfo(pactPath))```

krisakins
2022-12-05 22:04
I was on version 4.0, upgraded to 4.3 just now with no difference.


krisakins
2022-12-05 22:20
I'm checking used ports on my machine to see if that's the reason.

krisakins
2022-12-05 22:55
Ran all the netstat commands, couldn't see anything listening. I read somewhere about some ghost-like connections that could remain open. Perhaps my consumer side of the contract opened the message provider and hung onto the port or something.

krisakins
2022-12-05 22:56
Anyways, I closed down everything and kept trying the test but had no luck. Eventually restarted my machine and now we're good.

mailtoshinu
2022-12-06 07:42
has joined #pact-net

youri.thielen
2022-12-07 07:52
has joined #pact-net

cpopovici
2022-12-07 09:02
has joined #pact-net

hendrik916
2022-12-07 12:07
has joined #pact-net

matcheckep
2022-12-07 13:55
has joined #pact-net

wesley.nutley
2022-12-07 19:48
has joined #pact-net

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-net

bethskurrie
2022-12-08 00:34
/github subscribe pact-foundation/pact-net

2022-12-08 00:34
:white_check_mark: Subscribed to https://github.com/pact-foundation/pact-net. This channel will receive notifications for `issues`, `pulls`, `commits`, `releases`, `deployments`

dagmara.krent
2022-12-08 10:19
has joined #pact-net

komathypriya
2022-12-08 11:35
has joined #pact-net

neethu.santhosh
2022-12-08 14:22
has joined #pact-net

janga.nagamallika
2022-12-08 17:49
has joined #pact-net

jampala_1988
2022-12-08 23:47
has joined #pact-net

krishnaraj.pk
2022-12-09 05:35
has joined #pact-net

rajavadootha04
2022-12-09 07:56
has joined #pact-net

tomaszrdzak
2022-12-09 11:54
has joined #pact-net

sameena9010
2022-12-12 07:47
Hi Im trying to do events pact with pactNet when I run on mac no issues its working but when I try to run the same code on windows its giving error with some HTTPListener exception but when i check for the port where the server is started there are no process running on it. can someone let me know whats going wrong ```System.Net.HttpListenerException: The process cannot access the file because it is being used by another process. System.Net.HttpListenerException The process cannot access the file because it is being used by another process. at System.Net.HttpListener.AddPrefixCore(String registeredPrefix) at System.Net.HttpListener.AddAllPrefixes() at System.Net.HttpListener.Start() at PactNet.Verifier.Messaging.MessagingProvider.Start(JsonSerializerSettings settings) at PactNet.Verifier.PactVerifier.MessagingProvider(String providerName, JsonSerializerSettings settings) at Provider.Tests.StockEventGeneratorTests.EnsureEventApiHonoursPactWithConsumer() in C:\Users\sasye\Downloads\pactnetevents\Provider.Tests\StockEventGeneratorTests.cs:line 52 at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) Starting messaging provider at http://localhost:49152/pact-messages/```

maxime.raverdy
2022-12-12 09:22
has joined #pact-net

sambhavi.chinnu
2022-12-13 04:11
has joined #pact-net

david.turner
2022-12-13 09:01
has joined #pact-net

mateusz.dudek03
2022-12-13 14:10
has joined #pact-net

mateusz.dudek
2022-12-13 14:22
has joined #pact-net

dmitrij.bogomyakov
2022-12-13 16:09
has joined #pact-net

victor.lau841
2022-12-13 16:30
has joined #pact-net

roblesjm
2022-12-14 11:40
has joined #pact-net

ahmidat
2022-12-14 12:44
has joined #pact-net

sergey.ledniov
2022-12-14 16:46
has joined #pact-net

abhimanu.sehgal
2022-12-14 20:40
has joined #pact-net

abraham.gonzalez93
2022-12-14 21:38
@abraham.gonzalez93 has left the channel

enrique.decoss
2022-12-15 02:25
has joined #pact-net

kirankishore4
2022-12-15 06:12
has joined #pact-net

maxime.raverdy
2022-12-15 09:57
@maxime.raverdy has left the channel

alvaro.navarroiborra
2022-12-15 10:47
has joined #pact-net

leelavathi.sundaram
2022-12-15 10:55
has joined #pact-net

paula.muldoon
2022-12-15 11:40
has joined #pact-net

james.sun
2022-12-15 22:42
has joined #pact-net

dominic.matabilas
2022-12-15 22:42
has joined #pact-net

jonatan.jaworski
2022-12-15 23:43
Hi - Does anyone know if Pactnet can be used for provider tests with old Dotnet Framework (i.e: not core, or dotnet5/6/7)? Especially considering the hosting aspect of the verification. I'm sure this question might have been asked before, if so it'd be good to add this as a requirement in the readme file in Github.

tlemmonds
2022-12-16 19:55
has joined #pact-net

vejeta
2022-12-18 02:27
@vejeta has left the channel

dimundo
2022-12-18 08:16
@dimundo has left the channel

samuel.woodbridge
2022-12-19 09:44
has joined #pact-net

paula.muldoon
2022-12-19 12:19
@paula.muldoon has left the channel

mwojcik
2022-12-19 13:43
has joined #pact-net

robinsmit
2022-12-19 15:08
has joined #pact-net

jungjae.lim
2022-12-19 16:24
has joined #pact-net

saurwein
2022-12-21 14:48
has joined #pact-net

ssharma
2022-12-21 15:17
has joined #pact-net

alejandro.depablos
2022-12-21 18:56
has joined #pact-net

tomas.cerkasas
2022-12-21 23:14
has joined #pact-net

priyanka.soni
2022-12-22 08:24
has joined #pact-net

zijian.wang1
2022-12-22 10:51
has joined #pact-net

anyi.huang
2022-12-22 11:02
has joined #pact-net

stepik02
2022-12-23 10:36
has joined #pact-net

prajwalg
2022-12-25 14:28
has joined #pact-net

raksha.baskaran
2022-12-27 06:01
has joined #pact-net

venkatesh.madas
2022-12-27 06:36
has joined #pact-net

anthony.bennett
2022-12-27 20:15
has joined #pact-net

livinglogic.nl
2022-12-28 10:50
has joined #pact-net

pawel.szczerbicki
2022-12-29 13:22
has joined #pact-net

anandhiemail
2022-12-29 17:37
has joined #pact-net

anandhiemail
2022-12-29 18:24
@anandhiemail has left the channel

arika.goyal
2022-12-30 12:18
has joined #pact-net

m.marquez
2022-12-31 16:05
has joined #pact-net

guoxin.rick33
2023-01-03 08:45
has joined #pact-net

will
2023-01-03 09:59
has joined #pact-net

mario.pires
2023-01-03 11:42
has joined #pact-net

vtft1988
2023-01-03 16:38
has joined #pact-net

fabio.rodrigues
2023-01-03 16:54
Hello all, does pact-net currently allows us to call a pact-plugin. For example, imagine that for whatever reason i wanted to use the csv example plugin with pact-net. Would i be able to define that the plugin is necessary and the test (both consumer and provider) be able to use that plugin?

matt.thompson
2023-01-04 10:54
has joined #pact-net

rytis.lisauskas
2023-01-04 14:20
has joined #pact-net

morin.td
2023-01-04 16:54
has joined #pact-net

afernandez
2023-01-04 22:22
has joined #pact-net

vkaramoff
2023-01-05 10:00
has joined #pact-net

morin.td
2023-01-05 10:17
@morin.td has left the channel

vika.karman
2023-01-05 10:32
has joined #pact-net

nickzakirov
2023-01-05 15:01
has joined #pact-net

andrevdrodrigues
2023-01-05 15:59
Hello Im looking for the use the specific pact version to verify my contract... In PACT URL for example, I have it: https://pactbroker/pacts/provider/my-provider/consumer/my-consumer/version/01001 However, in the consumer selectors I dont see any selector related to version... Can anyone help me to get the specific version directly in code?

vkaramoff
2023-01-06 07:56
@vkaramoff has left the channel

yousafn
2023-01-06 13:27
It doesn't look possible via consumer version selectors https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors#properties Here are the ruby and rust core selectors pulled out https://github.com/pact-foundation/docs.pact.io/issues/171

yousafn
2023-01-06 13:27
if it doesn't have a tag, and a branch, and isn't the latest, why does it need to be verified by the consumer version selectors

yousafn
2023-01-06 13:29
enabling WIP pacts should pick up the verification if it hasn't run before, on a provider change ci run or via pact url on a consumer contract requiring verification event being published, and picked up by a provider verification build

nam.nguyen
2023-01-07 04:00
has joined #pact-net

dale.wells
2023-01-08 15:18
has joined #pact-net

matt.fellows
2023-01-09 01:39
> It doesn?t look possible via consumer version selectors selectors are all about dynamically discovering the pacts to verify. You don?t need to discover them, because you have the URL.

matt.fellows
2023-01-09 01:39
In Pact NET, there should be an option to simply specific the URL, file or folder as a source


manohar.adepu
2023-01-09 02:58
has joined #pact-net

hsyogesh12
2023-01-09 05:54
has joined #pact-net

sowmya.bhg
2023-01-09 10:32
has joined #pact-net

ivan.mikhalka
2023-01-09 13:21
has joined #pact-net

klaudijus.rulys
2023-01-09 13:32
has joined #pact-net

boer.k
2023-01-09 15:10
has joined #pact-net

chris.aguirre11
2023-01-09 16:45
has joined #pact-net

nicolas.barbey
2023-01-09 17:06
has joined #pact-net

simon.petty
2023-01-09 21:11
has joined #pact-net

edisonjen13
2023-01-09 22:25
has joined #pact-net

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

lijinze01
2023-01-11 01:19
Anyone tried provider test on .net6? New .net6 removed startup how can we spin up the local service? Need help :joy:

artem.z
2023-01-11 13:18
has joined #pact-net

jrede
2023-01-11 17:57
has joined #pact-net

vanitha.annamalai
2023-01-12 05:27
has joined #pact-net

jessy.li
2023-01-12 17:29
has joined #pact-net

aronlmin
2023-01-13 02:13
has joined #pact-net

buckley
2023-01-13 20:01
has joined #pact-net

komathypriya
2023-01-16 08:19
How do we publish the Pact to Pact IO using pactnet 4.3.0

komathypriya
2023-01-16 08:28
Can anyone help me understanding Kafka Testing with Pactnet

komathypriya
2023-01-16 08:29
I am not able to publish the Pact to broker. I dont see PactPublisher in Pactnet4.30.0

komathypriya
2023-01-16 08:29
how do we publish Pacts with the latest Pactnet

sashizen
2023-01-16 09:09
has joined #pact-net

matt.fellows
2023-01-16 11:18
You should just use the Pact CLI


matt.fellows
2023-01-16 11:19
What are you confused about? FYI there is an example here if helpful: https://github.com/pact-foundation/pact-net/tree/master/samples/Messaging

richardmccann
2023-01-16 15:37
has joined #pact-net

eugene.malihins
2023-01-17 11:08
has joined #pact-net

yusufjamalazam
2023-01-17 12:24
has joined #pact-net

jbosca
2023-01-17 13:10
has joined #pact-net

komathypriya
2023-01-17 17:42
Hi Team, using Pact 3.x for CDT, and i use below code to publish the pact to pact io.PactPublisher pactPublisher = new PactPublisher("PactURL",pactUriOptions); pactPublisher.PublishToBroker(pactPath, "3.0",list);

komathypriya
2023-01-17 17:43
This works fine, PACT is published

komathypriya
2023-01-17 17:43
But with Version 4.x, where i am using PACT to test Messaging, i would like to publish the PACT to Pact io, but i dont see the Pact Publisher class

komathypriya
2023-01-17 17:44
Can anyone help me on how to publish the pACT to pact io, with version 4.x

yousafn
2023-01-17 17:45
TL;DR use the pact cli tools, the publisher class doesn't exist in version 4.x of Pact NET https://docs.pact.io/implementation_guides/cli#pact-broker-cli

matt.fellows
2023-01-17 20:02
I responded your questions above, did you miss it?

hehecx
2023-01-17 22:16
has joined #pact-net

jawaharsurapaneni
2023-01-18 00:36
has joined #pact-net

kerrypmckeever
2023-01-18 02:12
has joined #pact-net

jayeshguru81
2023-01-18 15:12
@yousafn I am trying to verify pact but `consumer_version_selectors` does not seem to work. Below is the code snippet I used to select only the consumer I want to verify ```success, logs = verifier.verify_with_broker( **broker_opts, verbose=True, provider_states_setup_url="http://127.0.0.1:8000/_pact/provider_states", enable_pending=False, headers=headers, consumer_version_selectors=[ {"consumer": "cmedia-adf-management-api"}, ], log_dir="/tmp", )```

paul
2023-01-18 16:56
has joined #pact-net

yousafn
2023-01-18 20:36
How doesn't it work?

yousafn
2023-01-18 20:39
I can't see anywhere in the docs that suggest you can only provide the consumer name


yousafn
2023-01-18 20:40
> ? `consumer`: allows a selector to only be applied to a certain consumer. Can be specified with any of the above properties. so it a filter based on the other CVS's you provide

dbarne24
2023-01-19 09:32
@dbarne24 has left the channel

basma.eldesouky
2023-01-19 10:24
has joined #pact-net

alex.strizhak
2023-01-19 13:12
has joined #pact-net

laura.porpiglia
2023-01-19 13:56
has joined #pact-net

chimein.1234
2023-01-19 16:13
has joined #pact-net

john295
2023-01-19 23:12
has joined #pact-net

dominik.lukac.96
2023-01-20 10:33
has joined #pact-net

luca.narbone
2023-01-20 16:39
has joined #pact-net

komathypriya
2023-01-21 18:34
Hi Team, i am trying to setup CI/CD pipeline for my consumer and provider in Gitlab. With the example here https://docs.pactflow.io/docs/workshops/ci-cd/set-up-ci i am not able to configure. Is there a way from Pact team we can have a working session to help me and run the pipeline

bram.hautekiet
2023-01-22 22:32
has joined #pact-net

matt.fellows
2023-01-23 00:53
What problem are you running into? We have many videos, tutorials and workshops to help you leran the tool

komathypriya
2023-01-23 13:43
I am using Gitlab and while running the pipeline i am getting below error

komathypriya
2023-01-23 13:44
Not sure how to rectify this error and what is this cross env?

komathypriya
2023-01-23 13:45
Is it possible to have a working session to solve these issues?

benjamin.hess
2023-01-23 23:55
has joined #pact-net

benjamin.hess
2023-01-24 00:06
Is it still the case that Pact-net can't use V4 Pact files in Provider tests? Or is that inaccurate?

benjamin.hess
2023-01-24 00:09
Did a quick search and it seems like it is that way still.

matt.fellows
2023-01-24 00:40
It can verify Pact V4, but can?t generate them (at the present moment, to my knowledge)

matt.fellows
2023-01-24 00:40
As long as you only have HTTP interactions, or message interactions it should be OK

matt.fellows
2023-01-24 02:23
(i.e. you can?t have plugin interactions just yet)

matt.fellows
2023-01-24 02:26
If you are a Pactflow customer, you could talk to your account manager. I think you can appreciate that it?s not tenable to be able to provide 1:1 support for every Pact user! If it works locally, and not on GitLab i?d look at what?s different about your GitLab environment. The error above is not so helpful, but it looks like it can?t find a file (possibly react-scripts) - are you running `npm i` first?

steve.jefferies
2023-01-24 09:47
has joined #pact-net

aoife.drury
2023-01-24 14:36
has joined #pact-net

perger1984
2023-01-24 21:04
has joined #pact-net

ajaytaneja
2023-01-25 13:18
has joined #pact-net

petr.sebek
2023-01-25 14:20
has joined #pact-net

sean.mccann
2023-01-25 15:25
has joined #pact-net

victor.lau841
2023-01-26 00:04
Does anyone have suggestions on how to debug my issue better? I keep getting a `500` request mismatch from Pact. I'm aware that my expected request is not the same, but I am trying to write an SDK contract as a demo and reverse-engineering the request for my test setup. Deleted some actual data for privacy purposes. ```"{\"error\":\"Request-Mismatch : HttpRequest { method: \\\"POST\\\", path: \\\"/\\\", query: Some({\\\"api-version\\\": [\\\"1.0\\\"]}), headers: Some({\\\"user-agent\\\": [\\\"\\\"], \\\"content-length\\\": [\\\"848\\\"], \\\"connection\\\": [\\\"Keep-Alive\\\"], \\\"authorization\\\": [\\\"Bearer Access-Token\\\"], \\\"host\\\": [\\\"127.0.0.1:59176\\\"], \\\"expect\\\": [\\\"100-continue\\\"], \\\"content-type\\\": [\\\"application/json\\\"], \\\"x-mt-secondaryid\\\": [\\\"\\\"]}), body: Present", Some(ContentType { main_type: \\\"application\\\", sub_type: \\\"json\\\", attributes: {}, suffix: None }), None), matching_rules: MatchingRules { rules: {} }, generators: Generators { categories: {} } }\"}"```

victor.lau841
2023-01-26 00:04
It's hard to figure out what's not matching

nirob726
2023-01-26 12:25
has joined #pact-net

giuseppe.aina
2023-01-26 17:45
has joined #pact-net

victor.lau841
2023-01-26 21:52
For future people who aren't idiots like me :sweat_smile: . Debug mode is the best :smile:

boris.pogrebitskiy
2023-01-26 23:00
has joined #pact-net

matt.fellows
2023-01-26 23:25
The errors should really be formatted. Sounds like we need to improve the output messages in Pact .Net. @pact544 do you just print the errors verbatim in Pact .NET or take the JSON errors from the core and format them? I can raise a feature request if the former

victor.lau841
2023-01-26 23:33
Do you know of how to do a body partial matcher? I figured out my issue, but now I'm trying to say all these key-values should match except for this one key (which I don't necessarily care).

victor.lau841
2023-01-26 23:35
E.g. ```Expected '{\"eventMessageId\":{\"pact:matcher:type\":\"type\",\"value\":\"string\"},```

victor.lau841
2023-01-26 23:35
The actual is ```"eventMessageId\":\"d5f8868f-baa1-4f6c-9166-2056c374d6f5\"``` I'm assuming that it works, but the error just says my entire body doesn't match

matt.fellows
2023-01-26 23:44
What does your test setup look like? That?s probably going to be easier to share how to correct than from the output logs

victor.lau841
2023-01-26 23:45
```_pact.UponReceiving("a POST request to create an Audit record"). Given("Transformed Audit Request Model"). WithRequest(http://HttpMethod.Post, "/auditing/emitter/api/audit"). WithQuery("api-version", "1.0"). WithHeader("user-agent", "UserAgent"). WithHeader("authorization", "Bearer Access-Token"). WithHeader("content-length", "848"). WithHeader("content-type", "application/json"). WithHeader("x-mt-secondaryid", Guid.Empty.ToString()). WithHeader("expect", "100-continue"). WithHeader("connection","Keep-Alive"). WithJsonBody(new { EventMessageId = Match.Type("string"), SessionId = auditRequestModel.SessionId, SourceId = auditRequestModel.SourceId, SecretId = auditRequestModel.SecretId, UserId = auditRequestModel.UserId, UserName = auditRequestModel.UserName, AssetId = auditRequestModel.AssetId, EventTypeId = auditRequestModel.EventTypeId, EventDateTime = auditRequestModel.EventDateTime, RawMessage = auditRequestModel.RawMessage, Tags = auditRequestModel.Tags, AnalyticData = auditRequestModel.AnalyticData }). WillRespond().WithStatus(HttpStatusCode.Accepted);```

victor.lau841
2023-01-26 23:46
``` _pact = Pact.V3("Secret Server API", "Auditing Platform Service", new PactConfig() { PactDir = $"{Directory.GetParent(Directory.GetCurrentDirectory())}", LogLevel = PactLogLevel.Debug }).WithHttpInteractions(); var auditRequestModel = _auditTransformer.TransformIEventQueueToAuditModel(displayItem);``` Then I have some substitutes in-between but they're just to make the class instantiate properly

victor.lau841
2023-01-26 23:47
I'm fairly certain its the `EventMessageId` because my TransformIEventQueueToAuditModel adds a random Guid to the object before sending. Hence the mocked and the actual differ on that specific field

rafael.luiz-cavalcant
2023-01-27 00:00
has joined #pact-net

victor.lau841
2023-01-27 05:43
In Go there's a Pact.Like (if I recall), and in Ruby. I can't seem to find the equivalent in C#

victor.lau841
2023-01-27 06:27
This is the weird mismatch: ```[BodyMismatch { path: "$", expected: Some(b"[\"analyticData\",\"assetId\",\"eventDateTime\",\"eventMessageId\",\"eventTypeId\",\"rawMessage\",\"secretId\",\"sessionId\",\"sourceId\",\"tags\",\"userId\",\"userName\"]"), actual: Some(b"[\"assetId\",\"eventDateTime\",\"eventMessageId\",\"eventTypeId\",\"rawMessage\",\"secretId\",\"sourceId\",\"tags\",\"userId\",\"userName\"]"), mismatch: "Expected a Map with keys analyticData, assetId, eventDateTime, eventMessageId, eventTypeId, rawMessage, secretId, sessionId, sourceId, tags, userId, userName but received one with keys assetId, eventDateTime, eventMessageId, eventTypeId, rawMessage, secretId, sourceId, tags, userId, userName" }]```

victor.lau841
2023-01-27 06:28
All the debug logs say my fields match but my keys don't match?

zkocsihorvath
2023-01-27 13:47
has joined #pact-net

jorgen.x.andersson
2023-01-27 14:56
has joined #pact-net

mlapis
2023-01-29 10:56
has joined #pact-net

matt.fellows
2023-01-30 00:17
It seems your request is missing the following keys: `analyticData` and `sessionId`

victor.lau841
2023-01-30 04:32
Awesome. Another set of eyes helped. I should match each one carefully next time

victor.lau841
2023-01-30 04:32
It caught something I was missing too :slightly_smiling_face: .

matt.fellows
2023-01-30 04:46
No worries! I think it should be printing out more human friendly errors

matt.fellows
2023-01-30 04:46
Might be worth raising a feature request on Pact .NET to print them out better

tim.malseed
2023-01-30 04:52
has joined #pact-net

matt.corby-eaglen
2023-01-30 11:47
has joined #pact-net

ulises.cervino
2023-01-30 12:38
has joined #pact-net

m.gruehn
2023-01-30 13:04
has joined #pact-net

martin.ineichen
2023-01-30 15:07
has joined #pact-net

ch.pascucci
2023-01-30 15:22
has joined #pact-net

grace.tree
2023-01-30 16:03
has joined #pact-net

pryan
2023-01-30 21:25
has joined #pact-net

andy.jenness
2023-01-30 21:29
has joined #pact-net

jcarlos.anast
2023-01-31 12:24
has joined #pact-net

leonardo.saragiotto
2023-01-31 12:32
has joined #pact-net

barry.irvine
2023-02-01 15:52
has joined #pact-net

marcin.slowiak.007
2023-02-01 18:28
has joined #pact-net

eddie
2023-02-01 22:43
When we call `Verify` on our `IPactVerifierSource` , we interop into the Rust code which actually verifies the interations. *When verifying a given interaction, what is the sequence of events*? _Specfically_, my question is *what happens if the interaction is missing the `providerState` key* - *will it still call the provider states endpoint or will it skip that and go directly to making the request*? We're on version 4.1.0 of PactNet if it's relevant.

hoon.jung
2023-02-01 23:53
has joined #pact-net

matt.fellows
2023-02-02 01:33
I think the behaviour previously was not to send a request at all. It is possible that it now always sends a request, whether or not there is a state to handle

eddie
2023-02-02 01:34
hmm, so falls into the realm of undefined behavoiur?

matt.fellows
2023-02-02 01:35
possibly. I?d need to look at the implementation

matt.fellows
2023-02-02 01:35
what are you hoping for?

eddie
2023-02-02 01:40
Previously, we had middleware which checked to see if the incoming request was to the provider-state endpoint - if so, it reset all our stubs and then applied the desired state (and completed the request). If not, processing of the resquest continues as normal. The issue was that for interactions that didn't have a `providerState` key, the verifier was never calling the provider-state endpoint so our stubs didn't get reset - hence stubbing from checking the previous interaction could leak into the next interaction if the next interaction didn't set state itself. We've fixed it for us by changing our middleware to reset the stubs at the end of executing a request that *wasn't* set-provider-state. It might be better if the verifier always called the provider-state endpoint, even if the interaction doesn't specify a providerState key? It makes the reset/cleanup/set-state more explicit (rather than being done implicitly as a clean-up / `finally`)

matt.fellows
2023-02-02 02:06

matt.fellows
2023-02-02 02:07
I asked for a similar thing for Pact JS: https://github.com/pact-foundation/pact-js/issues/924

matt.fellows
2023-02-02 02:09
Tl;DR - .NET is not yet on this core, but I believe Adam was looking into it (there was an issue with verbose logging when he upgraded that should now be resolved)

eddie
2023-02-02 02:09
@hoon.jung FYI

andhika.hasiholan06
2023-02-02 03:51
has joined #pact-net

jhordies
2023-02-02 09:59
has joined #pact-net

amanda.santos
2023-02-02 14:19
has joined #pact-net

keith.w
2023-02-02 15:57
has joined #pact-net

gazal.gafoor
2023-02-03 00:13
has joined #pact-net

eschroeder
2023-02-03 17:15
has joined #pact-net

gazal.gafoor
2023-02-04 01:00
@gazal.gafoor has left the channel

marunachalam1
2023-02-04 02:16
has joined #pact-net

steven
2023-02-06 05:00
Hi #pact-net, It seems that "branch" and "tags" does not get populated in Pactflow as configured in PactVerifier for my Provider Pact test. After test run, only "Provider Version" gets populated but not Branch and Tags. I'm using PactNet 4.3.0. Could anyone advice on how to fix this? ``` [Fact] public async void Ensure_Api_Honours_PactWithConsumers() { var config = new PactVerifierConfig { Outputters = new List<IOutput> { new XUnitOutput(_output), }, LogLevel = PactNet.PactLogLevel.Trace }; IPactVerifier pactVerifier = new PactVerifier(config); Assert.True(PactInvoker.IsRunning(out _)); pactVerifier .ServiceProvider("DemoMicroservice", _serverUri) .WithPactBrokerSource(PactBrokerUrl, (c) => { c.TokenAuthentication(PactBrokerToken); c.ConsumerTags(PactBrokerConsumerTags); c.PublishResults(PactBrokerProviderVersion); c.ProviderBranch(PactBrokerProviderBranch); c.ProviderTags(PactBrokerProviderTags); }) .WithProviderStateUrl(new Uri(_serverUri, ProviderStatesEndpoint)) .Verify(); }```

matt.fellows
2023-02-06 07:13
can you please share the logs (looks like you are at trace level) for this? (be sure to redact anything sensitive)

loc.daot
2023-02-06 07:37
has joined #pact-net

ondrej.hajek
2023-02-06 09:45
has joined #pact-net

shravan.baira
2023-02-06 11:16
has joined #pact-net

cameron.doyle
2023-02-06 11:17
has joined #pact-net

ckarlborg45
2023-02-06 11:29
has joined #pact-net

itzhak
2023-02-06 11:56
has joined #pact-net

prashant.singh
2023-02-06 14:05
has joined #pact-net

georgina.sallery
2023-02-06 15:18
has joined #pact-net

guptadaksh56
2023-02-06 20:40
has joined #pact-net

brendanmbliss
2023-02-06 23:14
has joined #pact-net

steven
2023-02-06 23:59
Here is the log from build agent. Only extracted the logs after test run completed. ```##[debug] --environment ##[debug] TestSettings__PactBroker__ProviderVersion=6f3ebdae855f18a6c057fc23cae55408e3015155 ##[debug] --environment ##[debug] TestSettings__PactBroker__ProviderBranch=ITSO-275-FixProviderVerifyTagging ##[debug] --environment ##[debug] TestSettings__PactBroker__ProviderTags=ITSO-275-FixProviderVerifyTagging --- truncated. Added above to show what's expected to be saved into PactFlow ##[debug]12 results ##[debug]found 12 paths ##[debug]applying include pattern ##[debug]adjustedPattern: '/buildagent/_work/_temp/**/*.trx' ##[debug]1 matches ##[debug]1 final results ##[debug]TestManagement.Server.UsePublishTestResultsLibInAgent is on ##[debug]Object of TestLogStore created. Result Attachments will be stored in LogStore ##[debug]Object of TestResultsPublisher created. ##[debug]Object of TestLogStore created. Run Attachments will be stored in LogStore ##[debug]Object of TestRunPublisher created. ##[debug]Object of TestLogStore created. ##[debug]TestManagement.PublishTestResultsTask.EnableXUnitHeirarchicalParsing is on ##[debug]Object of TrxResultParser created. ##[debug]Entering ParseTestResultFiles ##[debug]runContext.ReleaseURI is null ##[debug]runContext.ReleaseEnvironmentUri is null ##[debug]Reading test results from file '/buildagent/_work/_temp/_vm-nwbuildlc-02_2023-02-06_19_05_33.trx'. ##[debug]Setting run start and finish times. ##[debug]Attachment location: /buildagent/_work/_temp/_vm-nwbuildlc-02_2023-02-06_19_05_33/In. ##[debug]Total test results: 1. ##[debug]Leaving ParseTestResultFiles ##[debug]Processed: ##vso[results.publish type=VSTest;mergeResults=false;publishRunAttachments=true;resultFiles=/buildagent/_work/_temp/_vm-nwbuildlc-02_2023-02-06_19_05_33.trx;testRunSystem=VSTS - dotnet;] Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting ##[debug]Uploading build level attachements individually Async Command Start: Publish test results ##[debug]runContext.ReleaseURI is null ##[debug]runContext.ReleaseEnvironmentUri is null ##[debug]Entering PublishToNewTestRunPerTestResultFileAsync ##[debug]Entering CreateTestRunAsync ##[debug]Leaving CreateTestRunAsync ##[debug]Total build level attachments: 0. ##[debug]Entering AddTestResultsAsync Publishing test results to test run '1070690'. TestResults To Publish 1, Test run id:1070690 Test results publishing 1, remaining: 0. Test run id: 1070690 ##[debug]Leaving AddTestResultsAsync ##[debug]Entering UpdateTestRunAsync ##[debug]Leaving UpdateTestRunAsync ##[debug]Entering CreateTestRunAttachmentsAsync ##[debug]Leaving CreateTestRunAttachmentsAsync ##[debug]Uploading test run attachements individually ##[debug]Entering UploadTestRunLogAsync ##[debug]Blob name: GeneralAttachment/_vm-nwbuildlc-02_2023-02-06_19_05_33.trx . ##[debug]File uploaded successsfully on LogStore _vm-nwbuildlc-02_2023-02-06_19_05_33.trx Published Test Run : https://AZDO/_TestManagement/Runs?runId=1070690&_a=runCharts ##[debug]Leaving PublishToNewTestRunPerTestResultFileAsync ##[debug]TestManagement.PTR.CalculateTestRunSummary is on ##[debug]RESOURCE_URIS: ##[debug]Setting task variable METADATA_956bdb31-4403-47cc-af16-40dbcac4b587: {"name":"2a2e097c-18ec-47b6-a1d2-cb9471289385","resourceUris":[],"metadata":{"description":"","relatedUrls":[{"url":"https://AZDO/_build/results?buildId=77995","label":"pipeline-url"}],"humanReadableName":"Test Results from Publish Test Results utility","serializedPayload":"{\"testId\":\"PublishTestResults\",\"testTool\":\"VSTest\",\"testResultAttestation\":{\"total\":1,\"failed\":0,\"passed\":1,\"skipped\":0},\"testDurationSeconds\":0.0,\"testPassPercentage\":\"100\",\"relatedUrls\":[{\"url\":\"https://AZDO/_build/results?buildId=77995\",\"label\":\"pipeline-url\"}]}"}} ##[debug]TestManagement.Agent.PTR.EnableFlakyCheck is on ##[debug]TestManagement.Server.TriggerCoverageMergeJob is on Async Command End: Publish test results```

helloyuanyuan
2023-02-07 02:25
has joined #pact-net

matt.fellows
2023-02-07 02:54
hmmm these logs aren?t helpful, where are the Pact logs output to? These are just .NET logs or something else

steven
2023-02-07 06:01
Hi @matt.fellows, You're right. I rerun the tests locally and got the pact verifier output logs. For troubleshooting purposes, I have also attached the expected provider details per comments below ``` pactVerifier .ServiceProvider("PriceMicroservice", _serverUri) .WithPactBrokerSource(PactBrokerUrl, (c) => { c.TokenAuthentication(PactBrokerToken); c.ConsumerTags(PactBrokerConsumerTags); // master c.PublishResults(PactBrokerProviderVersion); // timestamp. e.g. 20230207162248 c.ProviderBranch(PactBrokerProviderBranch); // local c.ProviderTags(PactBrokerProviderTags); // local }) .WithProviderStateUrl(new Uri(_serverUri, ProviderStatesEndpoint)) .Verify();``` log (partial) ``` Standard Output:? Starting verification... Pact verification successful Verifier Output --------------- The pact at https://demo.pactflow.io/pacts/provider/ProviderMS/consumer/ConsumerMS/pact-version/ad2ae57bcb321110989410bc60c2a454ae8b194c is being verified because the pact content belongs to the consumer version matching the following criterion: * latest version tagged 'master' (4bc7861c4b622a26673d614adddbed7fd7bc5c2d) Verifying a pact between ConsumerMS and ProviderMS A GET request to retrieve health check returns a response which has status code 200 (OK) has a matching body (OK) A GET request to retrieve the Price Given There is a asset with code 'DemoCode' returns a response which has status code 200 (OK) includes headers "Content-Type" with value "application/json; charset=utf-8" (OK) has a matching body (OK) Verifier Logs ------------- 2023-02-07T05:22:56.840073Z INFO ThreadId(01) pact_verifier::pact_broker: Fetching path '/' from pact broker 2023-02-07T05:22:56.840237Z DEBUG ThreadId(01) reqwest::connect: starting new connection: https://demo.pactflow.io/ 2023-02-07T05:22:56.909897Z DEBUG ThreadId(01) hyper::client::connect::http: connecting to 11.22.33.444:443 2023-02-07T05:22:56.934381Z DEBUG ThreadId(01) hyper::client::connect::http: connected to 11.22.33.444:443 2023-02-07T05:22:56.934438Z DEBUG ThreadId(01) rustls::client::hs: No cached session for DnsName(DnsName(DnsName("http://demo.pactflow.io"))) 2023-02-07T05:22:56.934615Z DEBUG ThreadId(01) rustls::client::hs: Not resuming any session 2023-02-07T05:22:56.993404Z DEBUG ThreadId(01) rustls::client::hs: ALPN protocol is Some(b"h2") 2023-02-07T05:22:56.993419Z DEBUG ThreadId(01) rustls::client::hs: Using ciphersuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 2023-02-07T05:22:56.993433Z DEBUG ThreadId(01) rustls::client::tls12::server_hello: Server supports tickets 2023-02-07T05:22:57.032276Z DEBUG ThreadId(01) rustls::client::tls12: ECDHE curve is ECParameters { curve_type: NamedCurve, named_group: secp256r1 } 2023-02-07T05:22:57.032292Z DEBUG ThreadId(01) rustls::client::tls12: Server DNS name is DnsName(DnsName(DnsName("http://demo.pactflow.io"))) 2023-02-07T05:22:57.076876Z DEBUG ThreadId(01) rustls::client::tls12: Session saved 2023-02-07T05:22:57.076934Z DEBUG ThreadId(01) h2::client: binding client connection 2023-02-07T05:22:57.076968Z DEBUG ThreadId(01) h2::client: client connection bound 2023-02-07T05:22:57.076987Z DEBUG ThreadId(01) h2::codec::framed_write: send frame=Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384 } 2023-02-07T05:22:57.077169Z DEBUG ThreadId(01) hyper::client::pool: pooling idle connection for ("https", http://demo.pactflow.io) 2023-02-07T05:22:57.320051Z DEBUG ThreadId(01) reqwest::async_impl::client: response '200 OK' for https://demo.pactflow.io/ 2023-02-07T05:22:57.320730Z DEBUG ThreadId(01) pact_verifier::pact_broker: Link URL is templated 2023-02-07T05:22:57.320878Z DEBUG ThreadId(01) pact_verifier::pact_broker: templated URL = https://demo.pactflow.io/pacts/provider/{provider}/for-verification 2023-02-07T05:22:57.323853Z DEBUG ThreadId(01) pact_verifier::pact_broker: final URL = https://demo.pactflow.io/pacts/provider/ProviderMS/for-verification 2023-02-07T05:22:57.324027Z INFO ThreadId(01) pact_verifier::pact_broker: Fetching path '/pacts/provider/ProviderMS/for-verification' from pact broker 2023-02-07T05:22:57.324118Z DEBUG ThreadId(01) hyper::client::pool: reuse idle connection for ("https", http://demo.pactflow.io) 2023-02-07T05:22:57.492096Z DEBUG ThreadId(01) reqwest::async_impl::client: response '200 OK' for https://demo.pactflow.io/pacts/provider/ProviderMS/for-verification 2023-02-07T05:22:57.492762Z DEBUG ThreadId(01) pact_verifier::pact_broker: templated URL = https://demo.pactflow.io/pacts/provider/ProviderMS/for-verification 2023-02-07T05:22:57.494093Z DEBUG ThreadId(01) pact_verifier::pact_broker: final URL = https://demo.pactflow.io/pacts/provider/ProviderMS/for-verification 2023-02-07T05:22:57.494138Z DEBUG ThreadId(01) pact_verifier::pact_broker: Sending JSON to https://demo.pactflow.io/pacts/provider/ProviderMS/for-verification using POST: {"providerVersionTags":["local"],"includePendingStatus":false,"consumerVersionSelectors":[{"tag":"master","latest":true}],"providerVersionBranch":"local"} 2023-02-07T05:22:57.494234Z DEBUG ThreadId(01) hyper::client::pool: reuse idle connection for ("https", http://demo.pactflow.io) 2023-02-07T05:22:57.636555Z DEBUG ThreadId(01) reqwest::async_impl::client: response '200 OK' for https://demo.pactflow.io/pacts/provider/ProviderMS/for-verification (truncated)``` Please refer to the complete log in testlog file here.

steven
2023-02-07 07:29
What caught my attention this log below, ``` 2023-02-07T05:22:57.494138Z DEBUG ThreadId(01) pact_verifier::pact_broker: Sending JSON to https://demo.pactflow.io/pacts/provider/ProviderMS/for-verification using POST: {"providerVersionTags":["local"],"includePendingStatus":false,"consumerVersionSelectors":[{"tag":"master","latest":true}],"providerVersionBranch":"local"}``` In the request payload, it appears that both "providerVersionTags" and "providerVersionBranch" got assigned the correct value from PactBrokerProviderTags and PactBrokerProviderBranch correctly, from the code snippet above. However these values didn't get updated in Pactflow. Only the Provider Version did with timestamp as expected.

matt.fellows
2023-02-07 10:08
That?s the verification step, not the publishing bit

matt.fellows
2023-02-07 10:09
This is the publishing bit: ```2023-02-07T05:22:58.316533Z INFO ThreadId(01) pact_verifier: Publishing verification results back to the Pact Broker 2023-02-07T05:22:58.316536Z DEBUG ThreadId(01) pact_verifier: Publishing a successful result to PactBroker(https://demo.pactflow.io/, provider_name='ProviderMS') 2023-02-07T05:22:58.318699Z DEBUG ThreadId(01) pact_verifier::pact_broker: Sending JSON to https://demo.pactflow.io/pacts/provider/ProviderMS/consumer/ConsumerMS/pact-version/ad2ae57bcb321110989410bc60c2a454ae8b194c/metadata/c1tdW3RdPW1hc3RlciZzW11bbF09dHJ1ZSZzW11bY3ZdPTExNg/verification-results using POST: {"providerApplicationVersion":"20230207162248","success":true,"testResults":[{"interactionId":"2da03f3edcdbdf18a1c7ccfb6ef3dbf6258db005","success":true},{"interactionId":"8f59d27ead87c2f9110c12f71b97703408bcbf15","success":true}],"verifiedBy":{"implementation":"Pact-Rust","version":"0.4.5"}}```

matt.fellows
2023-02-07 10:17
It looks to be missing the branch info. Not sure where the bug is for that bit, but worth raising it on the Pact .NET repo if you could please for looking into

geetika.joshi
2023-02-07 10:25
has joined #pact-net

matt.fellows
2023-02-07 10:27
Actually after a quick perusal of the Ruby code base. I?m not 100% sure where that data is sent for storage. @bethskurrie or @uglyog do you know which API call sends the branch/tag information alongside the verification results?

erik.haartmans
2023-02-07 10:31
has joined #pact-net

rawisankarn
2023-02-07 12:59
has joined #pact-net

hiep.duong
2023-02-07 13:10
has joined #pact-net

michael.branders484
2023-02-07 14:08
has joined #pact-net

anda.rozenfelde
2023-02-07 14:33
has joined #pact-net

steven
2023-02-07 23:39
@matt.fellows, while waiting for further responses, would you still like me to raise a bug?

uglyog
2023-02-07 23:47
I think there is a separate API call that is meant to happen before the main publish. Here is the code in Pact-JVM: https://github.com/pact-foundation/pact-jvm/blob/master/provider/src/main/kotlin/au/com/dius/pact/provider/VerificationReporter.kt#L106

uglyog
2023-02-07 23:48
That uses the `pb:branch-version` link

vietanhtran.dev
2023-02-08 04:44
has joined #pact-net

steven
2023-02-08 06:07
Thanks for looking into this issues. Is this a regression bug? What would be the ETA having it fixed? Meanwhile, is there any workarounds? if it's a regression issue, is there an older version of PactNet I could use?

goyal.himanshu
2023-02-08 08:23
has joined #pact-net

matt.fellows
2023-02-08 10:15
I can?t say for sure Steven, but the first step would be to raise a bug so we can get it on the radar and probably reviewed. Could you please raise on on the Pact .NET repo?

jeroenlamain
2023-02-08 11:57
has joined #pact-net

pallavi.bose
2023-02-08 13:19
has joined #pact-net

pallavi.bose
2023-02-08 13:36
Hi #pact-net , I'm trying to run consumer pact from pact broker new PactVerifier(config) .ServiceProvider("provider", WebAppUrl) .HonoursPactWith("consumer") //.PactUri(@"C:\SSPL\hiiretail-sslp-customer-service\CustomerService_PactTest\pacts\sslp-customerpact-sslp-customerservice.json") .PactBroker("https://pact-broker.retailsvc.com/pacts/provider/provider/consumer/consumer/latest") .Verify(); but getting SSL error..is there any way to bypass SSL validation? Need help to troubleshoot Below is the error log opening connection to http://pact-broker.retailsvc.com:443... opened starting SSL for http://pact-broker.retailsvc.com:443... SSL established Conn close because of connect error SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

adi.d
2023-02-08 16:25
has joined #pact-net

oriane.rodriguez
2023-02-08 16:59
has joined #pact-net

tdickman
2023-02-08 21:36
has joined #pact-net

matt.fellows
2023-02-08 22:14
Need to know the version of Pact .NET you are using

matt.fellows
2023-02-08 22:15
Any reason you can?t use a real certificate? I find it hard to believe orgs these days can?t stamp real certificates given the likes of Cloud platforms, Let?s Encrypt etc. that all have proper certificate chains


pallavi.bose
2023-02-09 05:00
Using 3.0.2 version... since I was doing this on local...So every machine we will have to add the cert...So was wondering if any other way

george.croucamp
2023-02-09 05:14
has joined #pact-net

gcroucamp
2023-02-09 05:15
has joined #pact-net

matt.fellows
2023-02-09 06:13
OK so a few things: 1. That pact broker is open to the world (is that an accident?) 2. It has a valid certificate 3. The verifier itself can connect to it (I used a CLI variant to check this) So this begs the question - why does it think it?s an invalid certificate? My guess is you have a corporate proxy in place, or something else is going on that should be fixed first. I can see a lot of other contracts there that have been verified, is this the first time you are running into the issue?

matt.fellows
2023-02-09 06:23
I think you can disable it by setting the environment variable to anything (e.g. `1`) `PACT_BROKER_DISABLE_SSL_VERIFICATION`

pallavi.bose
2023-02-09 07:13
Yes, first time working on Pact...and first time getting this error. Although from my git pipeline while publishing the pact did not have any issue...but somehow while reading I'm getting this issue

pallavi.bose
2023-02-09 07:13
I will try PACT_BROKER_DISABLE_SSL_VERIFICATION

pallavi.bose
2023-02-09 07:13
Thanks a lot

pallavi.bose
2023-02-09 07:22
@matt.fellows PACT_BROKER_DISABLE_SSL_VERIFICATION we can do from code as well?Cause I'm getting this error when I'm trying to run pact locally and not from pipeline

matt.fellows
2023-02-09 07:27
no it?s an environment variable, and would need to be set _before_ you execute the process

matt.fellows
2023-02-09 07:27
> Yes, first time working on Pact...and first time getting this error. Although from my git pipeline while publishing the pact did not have any issue...but somehow while reading I?m getting this issue I guess I was saying that it looks like your company already has a lot of pacts, so are others having the issue or just you? have you asked others in your company?

pallavi.bose
2023-02-09 07:46
ohh ok...yeah, Only I'm facing this issue

pallavi.bose
2023-02-09 07:47
net6.0/pact-win32/lib/ruby/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

pallavi.bose
2023-02-09 07:47
will upgrading to 4.X version help?

pallavi.bose
2023-02-09 09:02
I've downloaded the cert from PAct site as well n registered in trusted root..Still this issue is there

tonis.ojandu
2023-02-09 09:46
has joined #pact-net

justyna
2023-02-09 10:03
has joined #pact-net

matt.fellows
2023-02-09 10:55
Could you please add the `--verbose` or set logging to debug level and share? (please redact any security/private info)

matt.fellows
2023-02-09 10:55
Did the environment variable not work?

matt.fellows
2023-02-09 10:56
moving to 4.x.x will be a good idea, but won?t be a trivial change if you have many services. It depends on the root cause of the problem though.

tomer.ghelber
2023-02-09 12:24
has joined #pact-net

tommy.chen
2023-02-10 00:39
has joined #pact-net

sayler.b
2023-02-11 03:46
has joined #pact-net

rm.bozhko
2023-02-12 16:27
has joined #pact-net

matt.fellows
2023-02-12 20:34
:tada:

moid.abdul
2023-02-13 00:16
has joined #pact-net

pallavi.bose
2023-02-13 06:24
Hi @matt.fellows is it necessary to install ruby on windows machine?

matt.fellows
2023-02-13 06:25
no

matt.fellows
2023-02-13 06:25
Does it say somewhere that we should?

pallavi.bose
2023-02-13 06:45
You are right, no where it says we should install ruby...but still the SSL error being thrown from Ruby

pallavi.bose
2023-02-13 06:49
OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

pallavi.bose
2023-02-13 06:49
Unable to understand which cert I need to download

matt.fellows
2023-02-13 07:08
Ruby is bundled into the project automatically

matt.fellows
2023-02-13 07:08
Please refer to my debugging instructions above first and then come back once you have the answers

matt.fellows
2023-02-13 07:08
howtossl


matt.fellows
2023-02-13 07:09
FYI - some extra context about the likely problems you?re running into (your certificate looks correct, so I suspect proxy)

pallavi.bose
2023-02-13 07:33
OK Matt, I will check. Though I'm not running my machine into any kind of VPN. Not sure why this issue

matt.fellows
2023-02-13 07:57
VPN != Proxy

matt.fellows
2023-02-13 07:57
Is it a corporate laptop? Does it work when at work or not at work?

sugi
2023-02-13 09:59
has joined #pact-net

sgeethu21
2023-02-13 11:01
has joined #pact-net

kp1289
2023-02-13 11:59
has joined #pact-net

pallavi.bose
2023-02-13 12:20
Agree Matt...VPN is not Proxy...I verified I don't have any proxy settings specified

rahul.jalagadugu
2023-02-13 15:37
has joined #pact-net

omatuzenko.hse
2023-02-13 18:14
has joined #pact-net

tyler.fleurant
2023-02-13 21:56
has joined #pact-net

matt.fellows
2023-02-14 06:20
You might not have proxy settings enabled, but does your corporate laptop have that configured for you?

matt.fellows
2023-02-14 06:20
Have you followed the advice in the above article? (e.g. adding the broker to the `no_hosts` env var?

matt.fellows
2023-02-14 06:20
Also see the debugging advice (logs) above.

pallavi.bose
2023-02-14 09:06
Sure @matt.fellows

swilkinson
2023-02-14 09:59
has joined #pact-net

cyrus.devnomad
2023-02-14 09:59
Hello, I'm trying to implement multiple test cases for a http://pact.net consumer unit test. Whenever I increase the number of test cases, for example from one test case to two test cases or from two to three the pact.VerfiyAsync() method of one of the test cases throws the following exception: System.InvalidOperationException : Unable to start mock server If I reduce again the number of test case, for example by commenting out one of the test case methods, everything works again. I have created an example project based on the http://pact.net basic .net example with some files from my project added to that and was able to reproduce the behavior: https://github.com/cyrusdevnomad/test-project-for-error-reproducing You can try it for yourself. But make sure to change the number of unit test cases (the exception is thrown if the number of unit test cases is increased) by uncommenting/commenting out unit test case methods to see the exception mentioned above.

pallavi.bose
2023-02-14 10:01
Hi Matt, For us the provider test was working perfectly fine from the git pipeline so far...we had issues running it in local.

pallavi.bose
2023-02-14 10:01
But now In local I'm able to run the pact but in Pipeline I'm getting error like (Pact::hal::RelationNotFoundError)

pallavi.bose
2023-02-14 10:02
(Pact: hal :RelationNotFoundError)

pallavi.bose
2023-02-14 10:11
Was able to troubleshoot this. Used PactBroker base url instead of PactUri Option

matt.fellows
2023-02-14 11:22
so what changed between before and now?

david.hvilava
2023-02-14 14:45
Hi guys, I noticed that when Pact mock service sends a request to Provider from a given contract it doesn't preserve Http Headers case. For instance, in a contract I have the following request headers: ```"interactions": [ { "description": "A GET request with custom headers", "request": { "method": "GET", "path": "/api/provider", "headers": { "Content-Type": "application/json", "TestHeaderKey": "TestHeaderValue" } }, ...``` But my Provider receives them in lowercase. Is is possible to somehow make it case preserving?

brooks
2023-02-14 18:41
has joined #pact-net

carlos.lopez
2023-02-14 19:20
has joined #pact-net

arika.goyal
2023-02-14 21:13
Hi, I am trying out sample code here https://github.com/DiUS/pact-workshop-dotnet-core-v3 with PactNet - 4.3.0. The only change I have made to the sample code is that i am not working with provider states in the test and instead have the required state set as part of controller only. While it works on OSX when i try it on windows I get the following error - ```PactNet.Exceptions.PactFailureException: Pact verification failed PactNet.Exceptions.PactFailureException Pact verification failed at PactNet.Verifier.InteropVerifierProvider.Execute() at PactNet.Verifier.PactVerifierSource.Verify() at tests.ProductApiTestsWithoutBroker.EnsureProviderApiHonoursPactWithConsumer() in C:\repos\ProofOfConcepts\Pact-Product-api\ProviderTests\ProductApiTestsWithoutBroker.cs:line 47 at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) Getting to pact verification Starting verification... Pact verification failed Verifier Output --------------- Verifying a pact between ApiClient and ProductService A valid request for all products returns a response which has status code 200 (FAILED) includes headers "Content-Type" with value "application/json; charset=utf-8" (FAILED) has a matching body (FAILED) Failures: 1) Verifying a pact between ApiClient and ProductService - A valid request for all products 1.1) has a matching body expected 'application/json;charset=utf-8' body but was 'text/html' 1.2) has status code 200 expected 200 but was 400 1.3) includes header 'Content-Type' with value 'application/json; charset=utf-8' Expected header 'Content-Type' to have value 'application/json; charset=utf-8' but was 'text/html' There were 1 pact failures Verifier Logs ------------- 2023-02-14T20:36:14.433512Z INFO ThreadId(33) pact_verifier: Running provider verification for 'A valid request for all products' 2023-02-14T20:36:14.433752Z INFO ThreadId(33) pact_verifier::provider_client: Sending request to provider at http://localhost:9001/ 2023-02-14T20:36:14.433771Z INFO ThreadId(33) pact_verifier::provider_client: Sending request HTTP Request ( method: GET, path: /api/products, query: None, headers: None, body: Missing ) 2023-02-14T20:36:14.456312Z INFO ThreadId(33) pact_verifier::provider_client: Received response: HTTP Response ( status: 400, headers: Some({"cache-control": ["no-store"], "via": ["1.1 ForcepointCGCluster"], "date": ["Tue", "14 Feb 2023 20:36:32 GMT"], "content-type": ["text/html"], "connection": ["close"], "content-language": ["en"], "content-length": ["666"]}), body: Present(666 bytes, text/html) ) 2023-02-14T20:36:14.456421Z INFO ThreadId(33) pact_matching: comparing to expected response: HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json; charset=utf-8"]}), body: Present(130 bytes) ) 2023-02-14T20:36:14.457552Z WARN ThreadId(33) pact_matching::metrics: Please note: We are tracking events anonymously to gather important usage statistics like Pact version and operating system. To disable tracking, set the 'PACT_DO_NOT_TRACK' environment variable to 'true'. 2023-02-14T20:36:14.495312Z WARN ThreadId(33) rustls::conn: Sending fatal alert DecodeError``` P.S - I am using .NET 7 and i tried including PactNet.Windows nuget package but it did not help. Any pointers would be very helpful here. Thanks.

carlos.lopez
2023-02-14 21:16
@carlos.lopez has left the channel

uglyog
2023-02-14 22:18
Unfortunately, the underlying HTTP implementation is doing that, because lower case headers are required for HTTP2 and HTTP3. With HTTP 1 and 1.1, headers are case insensitive so things should still work with the lowercase names.

sam.mirzaee
2023-02-15 02:35
has joined #pact-net

pallavi.bose
2023-02-15 08:20
Locally I still have problem connecting to Pact Broker. I just left it there as from pipeline it's working as expected.

david.hvilava
2023-02-15 09:49
Thank you for the answer

matt.fellows
2023-02-15 09:51
If you can share debug logs we can try and help you for local dev

matt.fellows
2023-02-15 09:51
The above error you mentioned you have locally is different than you first reported, this is why I was asking

kam.sobon
2023-02-15 11:26
has joined #pact-net

tomer.ghelber
2023-02-15 12:45
@tomer.ghelber has left the channel

mail391
2023-02-15 14:59
has joined #pact-net

pallavi.bose
2023-02-15 15:03
Sure...We can get in huddle if that suits you. Tomorrow if possible

jmoreno
2023-02-15 21:27
has joined #pact-net

matt.fellows
2023-02-16 00:24
I would just like the logs or some more info on it and what you?ve done

marcio.duarte
2023-02-16 03:38
has joined #pact-net

pallavi.bose
2023-02-16 05:18
VEry much I summed up earlier. My provider snippet is like below new PactVerifier(config) .ServiceProvider("provider", WebAppUrl) .HonoursPactWith("consumer") .PactBroker("https://pact-broker.retailsvc.com") .Verify();

pallavi.bose
2023-02-16 05:19
I'm using old version 3.0.2 version of PactNet

pallavi.bose
2023-02-16 05:19
My web api is running in Docker

pallavi.bose
2023-02-16 05:20
I'm not passing any auth details like user name or password to the pactbroker from local

pallavi.bose
2023-02-16 05:22
but tests fail with below error OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

pallavi.bose
2023-02-16 05:24
I've added SSL_CERT_FILE env variable for the ca_cert I downloaded

matt.fellows
2023-02-16 05:38
It?s this that I?m after. This should hopefully help us to understand what is going on.

matt.fellows
2023-02-16 05:38
I?m not sure how to set that flag in .NET, but there must be an option somewhere and that?s what we need to be able to help you

pallavi.bose
2023-02-16 15:04
I will see if I can get that kind flag setting in pactnet

bryen.vieira
2023-02-16 16:34
has joined #pact-net

ryan319
2023-02-16 22:50
has joined #pact-net

pallavi.bose
2023-02-17 04:42
var pactConfig = new PactVerifierConfig { Outputters = new List<IOutput> //NOTE: We default to using a ConsoleOutput, however xUnit 2 does not capture the console output, so a custom outputter is required. { new XUnitOutput(_Output) }, Verbose = true //Output verbose verification logs to the test output };

pallavi.bose
2023-02-17 04:42
I've set verbose to true

matt.fellows
2023-02-17 06:14
did you get any logs from it?

pallavi.bose
2023-02-17 07:52
Nothing other than this

zhig.ivan
2023-02-17 08:56
has joined #pact-net

yerken.tussupbekov
2023-02-17 11:40
has joined #pact-net

yerken.tussupbekov
2023-02-17 11:52
Hey Matt, I am curious what is the current situation like with PactNet and if there is any plan to support Pact Specification v4 ? The reason I am asking is that we are considering to use Pact for contract validation for our .NET services. Some of the services use GRPC + Protobuf, but if I understand correctly for that to work the pact library should support v4 specification first ?

iamchughmayank
2023-02-17 18:30
has joined #pact-net

jake.kline
2023-02-18 04:11
has joined #pact-net

matt.fellows
2023-02-19 09:45
We would like to add support but we don?t have current timelines/plans. We will need to coordinate with @pact544 and create a clearer implementation guide for maintainers before this work can happen.

yerken.tussupbekov
2023-02-20 04:00
Thanks for the response. Do you know if there is any work-around at the moment ?

culudamar
2023-02-20 08:12
has joined #pact-net

gawaine.ogilvie
2023-02-20 17:01
has joined #pact-net

matt.fellows
2023-02-21 02:35
I think you could run the native verifier: https://docs.pact.io/implementation_guides/cli#native-binary-new

matt.fellows
2023-02-21 02:35
(if it?s just provider side verification)


yerken.tussupbekov
2023-02-21 07:06
Thanks for the links, I think the native C interface link is broken

matt.fellows
2023-02-21 07:10
Thanks, i?ll update that now.


james414
2023-02-22 10:00
has joined #pact-net

nbolam
2023-02-22 20:26
has joined #pact-net

lambent21
2023-02-23 13:35
has joined #pact-net

pach
2023-02-23 17:34
has joined #pact-net

richard.ruiter
2023-02-24 06:43
has joined #pact-net

spalle
2023-02-24 10:54
has joined #pact-net

alex637
2023-02-24 14:32
has joined #pact-net

egrep
2023-02-25 17:32
has joined #pact-net

ykamali
2023-02-26 05:10
has joined #pact-net

kripa.kurian
2023-02-27 04:35
has joined #pact-net

jordan.brooks
2023-02-27 09:46
has joined #pact-net

courtel.yann
2023-02-27 10:47
has joined #pact-net

nathan.hickson
2023-02-27 13:07
has joined #pact-net

mark.simpson
2023-02-27 13:08
has joined #pact-net

masykur.sn
2023-02-27 15:21
has joined #pact-net

makifkus
2023-02-28 03:51
has joined #pact-net

jacob.waller
2023-02-28 21:08
has joined #pact-net

dipak8959
2023-02-28 21:18
has joined #pact-net

sanketh.shanbhag
2023-03-01 03:57
has joined #pact-net

adam.cox
2023-03-01 12:34
has joined #pact-net

steve.short
2023-03-01 15:14
has joined #pact-net

kgrady
2023-03-01 18:58
has joined #pact-net

pratima.patil
2023-03-02 11:13
has joined #pact-net

shilpa199350
2023-03-02 12:40
has joined #pact-net

syamphaneendrak
2023-03-02 16:21
has joined #pact-net

neeraj.sharma
2023-03-02 16:33
has joined #pact-net

dominik.chmielarz
2023-03-02 16:55
has joined #pact-net

xchen
2023-03-02 18:59
has joined #pact-net

fdawson
2023-03-03 08:15
has joined #pact-net

yousafn
2023-03-03 11:39
if it works with one, but fails with two, are you using random ports? is it unable to start the mock server, because it's already started on that port

cyrus.devnomad
2023-03-03 11:51
Locally it has always worked with one, but often failed with two or three methods. But in the pipeline its failing even with one method. But I have not checked in pipeline whether the port is really free or not. I can try to do that. But in case of multiple unit test methods, would it be a good choice to have each unit test method using a different free port?

yousafn
2023-03-03 12:02
mock servers are stateful, so if you have async tests and you use the same port in tests you will run into issues. using the same port you would not want to run your tests in parallel, which means slower tests random port per test means you spin up a mock server per test which is isolated, you need pact file write mode set to merge otherwise the last mock server to write to fill will clobber. pipeline sounds like a separate issue if it doesn't work at all

tom.meldrum
2023-03-03 13:02
has joined #pact-net

dragos.neagu
2023-03-03 16:44
has joined #pact-net

facundo.g
2023-03-06 12:13
has joined #pact-net

michael.bryson
2023-03-06 14:59
has joined #pact-net

kingsley
2023-03-06 22:47
has joined #pact-net

cyrus.devnomad
2023-03-07 08:01
Thanks to your inputs I was able to resolve the problem. I have indeed different unit test methods that each call an async method of the tested client. Now I have changed my code to spin up the mock server per test and it seems to work now even without setting the write mode to merge. But because of the point you metioned I will try to set the write mode as you suggested. Now its working in pipeline too.

cyrus.devnomad
2023-03-07 10:31
How can I set the pact file write mode to "merge" in http://Pact.NET? This option was mentioned in the following conversation: https://pact-foundation.slack.com/archives/C9UTHV2AD/p1676368784117769

matt.fellows
2023-03-07 10:49
FYI I don?t think on the most recent version of Pact .NET that option exists - it was something unique to the Ruby core (which version of Pact .NET are you running? If 4+ then it should automatically merge)


matt.fellows
2023-03-07 10:53
you should let the OS pick a dynamic port

cyrus.devnomad
2023-03-07 15:22
I'm using http://Pact.NET Version="4.4.0". So that would explain why my configuration seems to work even without having configured any merge option. The port was hard coded to 9000 in that version that I put on GitHub. That version was meant to reproduce the problem I was facing. But I have another local version that is working now and for this version, I spin up a mock server for each test and each time I look programmatically for a port that is available. I guess that would match your suggestion to let the OS pick a dynamic port yes?

marckpuiu
2023-03-07 15:58
has joined #pact-net

matt.fellows
2023-03-08 01:30
yep!

facundo.g
2023-03-08 09:31
@facundo.g has left the channel

duncan3142
2023-03-08 19:42
has joined #pact-net

william.stewart
2023-03-08 20:25
has joined #pact-net

trc229
2023-03-09 01:34
has joined #pact-net

zaira.zafar
2023-03-09 10:41
has joined #pact-net

dominik.goltermann
2023-03-09 15:31
has joined #pact-net

sharathkonda
2023-03-09 15:37
has joined #pact-net

allen.ayala
2023-03-09 16:33
has joined #pact-net

jacob.waller
2023-03-09 17:41
Hey y'all. I'm trying to set up a provider. Does anyone have an example of using Wiremock .NET or something similar to set up the mock server? Or does anyone have recommendations for what tools to use for that?

slawomir.pawluk
2023-03-09 18:22
has joined #pact-net

casavelha
2023-03-09 19:49
has joined #pact-net

nikita.gupta
2023-03-09 22:21
has joined #pact-net

matt.fellows
2023-03-09 23:59
Pact provides a mock server, so you don?t use something like Wiremock with it

matt.fellows
2023-03-09 23:59
howtoexamples


matt.fellows
2023-03-10 00:00
there is at least 1 .NET there I think, as well as one in the .NET github repo

jacob.waller
2023-03-10 00:00
Even on the provider end? I'm using the built-in mock server for the consumer

matt.fellows
2023-03-10 00:10
oh, to mock third party dependencies you mean?

matt.fellows
2023-03-10 00:11
Yes, sorry, you can use whatever you want there

pjayakumar
2023-03-10 02:21
has joined #pact-net

josh.marlow
2023-03-10 15:10
has joined #pact-net

patilb
2023-03-11 17:02
has joined #pact-net

renan.santos
2023-03-11 18:46
has joined #pact-net

keren.eckshtein
2023-03-12 08:57
has joined #pact-net

sr
2023-03-12 11:58
has joined #pact-net

gokuldot
2023-03-12 17:30
has joined #pact-net

ldgaribello
2023-03-13 06:23
has joined #pact-net

lidan.liu
2023-03-13 10:45
has joined #pact-net

vipin.kumar
2023-03-13 12:29
has joined #pact-net

ondrej.hajek
2023-03-13 16:14
Hi, I wonder, how do you publish pacts generated by consumer tests in .net ecosystem? E.g. in Java we have maven goal to do execute the tests and publish to the pact broker for us. I am looking for something similar but for .net, but I wasn?t able to google anything. :gratitude-thank-you:

yousafn
2023-03-13 16:21
Hey @ondrej.hajek, The current recommendation for 4.x versions of pact-net is to use the Pact CLI directly rather than wrapping them


bknapik
2023-03-13 17:13
has joined #pact-net

ravi0894
2023-03-13 17:38
has joined #pact-net

ondrej.hajek
2023-03-13 18:04
i see, thank you!

anji.boddupally
2023-03-13 20:37
has joined #pact-net

voon.wong
2023-03-14 01:34
has joined #pact-net

gigamac
2023-03-14 08:09
has joined #pact-net

ivstam
2023-03-14 08:43
has joined #pact-net

melikesezin
2023-03-14 14:17
has joined #pact-net

gopishankar.haridas
2023-03-14 16:42
has joined #pact-net

rajasekaran.parthiban
2023-03-14 20:13
has joined #pact-net

sbanerjee
2023-03-15 02:46
has joined #pact-net

kurt_schriefer
2023-03-15 13:21
has joined #pact-net

andreas530
2023-03-15 22:32
has joined #pact-net

santiago.rendong
2023-03-15 23:21
has joined #pact-net

santiago.rendong
2023-03-15 23:30
Hi, I've been stuck for a while with a weird bug on the provider side, where my provider state fails: `Request Failed - One or more of the setup state change handlers has failed` It only fails in the CI or the first time the test is run locally, but consequent calls to `dotnet test` do not fail... I can't currently share a minimal reproduction, but may try to recreate it this week. Hopefully this weird behavior of only failing the first time gives enough info to someone that can put me in the right track to investigate the issue. Thanks in advance

matt.fellows
2023-03-16 03:23
Strange. What version of Pact .NET are you running? If you could please share a log with trace level logging enabled, that might help us understand what?s happening

christine.awofeso
2023-03-16 09:58
has joined #pact-net

konstantin.manna
2023-03-16 15:04
has joined #pact-net

cyrus.devnomad
2023-03-16 15:39
I'm trying to write a consumer test for an API method that can receive a post request with email message data and send a corresponding email. The API method returns status code ok if everything is ok but does not return a proper status code in some invalid cases currently. Its not clear to me what to do with the .WithStatus() method: pact.UponReceiving("a request to post an email message with an invalid email address") .WithRequest(http://HttpMethod.Post, "/v1/Mail") .WithBody(requestBody, "application/json") .WillRespond() .WithStatus(?); I would like to do something like .WithStatus(Match.Type("integer")) but I can see that this is not possible. Is there a way to create a pact that does not care what status code is returned for some invalid cases?

emgarcia
2023-03-16 15:44
has joined #pact-net

tjones
2023-03-16 15:51
Not currently. Although, if you?re covering invalid cases, you might not be writing a contract test any more - the contract is about defining the behaviour that the consumer relies upon. If the consumer isn?t relying on the behaviour, then you don?t need to write a test for it in the contract.

john.goodwin
2023-03-16 15:51
has joined #pact-net

tomasz.kowalczyk
2023-03-16 15:51
has joined #pact-net

tjones
2023-03-16 15:53
If you?re asking about testing a generic error handler, sometimes a workaround (which is still a departure from the contract testing philosophy, but can be the right practical choice) is to write a contract for one failure code that you know the provider produces in a particular case, and then treat that as the coverage you need. It does mean that you will tie the provider down to a specific code for that specific case, though.

samir.ferreira
2023-03-16 16:27
has joined #pact-net

cyrus.devnomad
2023-03-16 16:53
Thanks for your explanations. My issue is that currently the API method returns the unspecific error 500 as status code in case of an invalid email addess. This is for now considered as acceptable behavior but that status code was implemented for this case in the absence of any specification defining the explicit behavior in this case. Consequently the status code 500 is missing in the API definition file as a possilbe response (because the status codes in the API definition file are based on explicit specifications). So, I'm not sure whether I want to cover an invalid case. This case is not necessary invalid, its just that the status code 500 which is returned in this case is a bit ugly and unspecific (which is why it was not included in the possible responses in the API defintion file for now) and will have to be replaced by a more specific status code. I thought, maybe because I have a bi-directional pact setting between the consumer and provider, I could have the consumer side to be a bit more indifferent for some specific cases.

kripa.kurian
2023-03-16 19:31
@kripa.kurian has left the channel

raess.simon
2023-03-16 23:02
has joined #pact-net

tjones
2023-03-17 05:08
Right. I?ve faced that problem, and it can be pretty frustrating trying to get provider teams to care about it. Usually my approach is to point out that it?s hard to know how often the service is failing vs usual errors from the logs. 500 is best reserved exclusively for programmer error. If you have a good relationship with them, you could try putting an appropriate error code in the contract, so that it gets corrected when they go to verify it - but I wouldn?t do this without a conversation with them. If you could specify a set of codes, you?d probably want to only give 500 + the code you actually want. Otherwise you?re baking in the assumption that all error codes are acceptable. However, as far as I know, Pact doesn?t support this.

tjones
2023-03-17 05:08
I?m working on a side project that does support it, but it?s not available for .NET yet.

cyrus.devnomad
2023-03-17 08:49
Ok, after explaining the problem to the product owner it was agreed to leave out that interaction in consumer test and create a story to add a better and more specific error code for that case and then add an appropriate interaction in the pact consumer test. So better to go through a bit of additional administrative hassle but remain faithful to the contract testing philosophy.

anshu.ranjan1002
2023-03-17 21:59
has joined #pact-net

mptinternational
2023-03-18 18:12
has joined #pact-net

16728365
2023-03-19 14:30
has joined #pact-net

brick777
2023-03-19 21:47
has joined #pact-net

mark.ingram
2023-03-20 11:31
has joined #pact-net

jo.laing
2023-03-20 17:06
has joined #pact-net

jacob.waller
2023-03-20 21:26
Why was publishing a pact removed from PactNet and now only accessible through the CLI, but verifying a pact with a pact broker source is still there? Wouldn't publishing a pact be extremely useful?

erich.buri
2023-03-20 22:07
has joined #pact-net

matt.fellows
2023-03-20 22:12
The aim is to not have all of the client libraries re-implement all of the CLI functionality.

matt.fellows
2023-03-20 22:12
It reduces the ability to add new features across the board quickly, because each language needs to add the change and each client library is maintained by different people

jacob.waller
2023-03-20 22:13
It seems like a pretty major part of Pact *should* be part of each client library though

matt.fellows
2023-03-20 22:14
why? What?s the problem with installing a CLI?

jacob.waller
2023-03-20 22:15
It adds another step to my pipeline, requires me to curl GitHub every time I run the pipeline, decouples my tests from just the code

jacob.waller
2023-03-20 22:16
It also makes it harder to go between languages if one client library *does* publish to a broker in code (pact-js)

matt.fellows
2023-03-20 22:16
to run a successful Pact pipeline, you would usually require more than just the ability to publish a pact. You would usually also call the `pact-broker can-i-deploy` command and also the `pact-broker record-deployment` command, and possibly several others.

matt.fellows
2023-03-20 22:16
> It also makes it harder to go between languages if one client library *does* publish to a broker in code (pact-js) We?ll be removing that very soon also - sorry :grimacing:

matt.fellows
2023-03-20 22:17
Having code and non-code based versions of what the CLI does also makes it harder to document things, and communicate best practices to people.

matt.fellows
2023-03-20 22:17
We want to simplify that - the boundary is basically ?anything to do with testing, goes in the client library? and everything else pretty much goes in the CLI

jacob.waller
2023-03-20 22:18
My difficulty with pact-net came from the fact that the docs didn't say I needed the CLI in order to use a broker. in fact, I ended up having to come into this slack and look it up here

matt.fellows
2023-03-20 22:18
Yes, that?s a problem that needs addressing. The documentation for Pact .NET is rather sparse

matt.fellows
2023-03-20 22:21
I?m sorry for that confusion. I?m not a .NET developer/maintainer, but we are looking at ways we can help contribute and improve them

jacob.waller
2023-03-20 22:22
Thanks! I'm just working to get buy in for my client on pact and it's been tough with the state of the docs

dmcgill50
2023-03-20 22:25
has joined #pact-net

dmcgill50
2023-03-20 22:27
I am also here because I am struggling to get PactNet up and running...I am on a Mac M2 and have downloaded the native libraries. I have also run dotnet build successfully but I don't know what to do next

yerken.tussupbekov
2023-03-20 23:38
If I am not wrong, PactNet still publishes verification result. Is it going to be moved out to be part of the CLI as well ?

tjones
2023-03-21 01:47
@dmcgill50 It sounds like your question might be separate. Maybe give more details in a different thread?

tjones
2023-03-21 01:47
@yerken.tussupbekov It?s already part of the CLI.

tjones
2023-03-21 01:48
(whether it will be removed from the library in the future is a different question, I think).

xiaorong.ruby
2023-03-21 09:34
has joined #pact-net

markcox20
2023-03-21 10:08
has joined #pact-net

oloruntobi.ayilara
2023-03-21 14:01
has joined #pact-net

pankaj_kumar39
2023-03-21 14:18
has joined #pact-net

ravi_shankar_lakkims
2023-03-21 14:18
has joined #pact-net

sathish.nilla
2023-03-21 14:19
has joined #pact-net

sikandar_kumar.singh
2023-03-21 14:19
has joined #pact-net

benjamin.earle
2023-03-21 19:23
has joined #pact-net

sanjaysingh99in
2023-03-22 00:57
has joined #pact-net

rafalmaciak
2023-03-22 08:03
has joined #pact-net

jyothy18
2023-03-22 09:23
has joined #pact-net

haiyang.huang
2023-03-22 10:30
has joined #pact-net

denispegan4
2023-03-22 13:14
has joined #pact-net

yousafn
2023-03-22 15:13
Are you a Pact-NET wizard? @riezebosch has just dropped a https://github.com/DiUS/pact-workshop-dotnet-core-v3/pull/7 to update the Pact-NET workshop to .NET 6.0 You can read the comments and thread https://github.com/pact-foundation/pact-net/issues/398#issuecomment-1479675904 - We would love your eyes across it if you could spare the time, maybe you've run through the workshop before in the past, or you never have, but you've been using Pact in the wild. We'd love your help and support, in making this useful for yourself, Pact-NET newbies and anyone you are trying to bring on board in your teams/organisations.

ulises.cervino
2023-03-22 21:01
@ulises.cervino has left the channel

tranghetti
2023-03-22 21:15
has joined #pact-net

amruta_mandavilli
2023-03-23 06:23
has joined #pact-net

shubhamshriram.shinde
2023-03-23 06:34
has joined #pact-net

juliemarierosok
2023-03-23 08:20
has joined #pact-net

colin.aygalinc
2023-03-23 09:23
has joined #pact-net

me1685
2023-03-23 10:53
has joined #pact-net

gregpovorozniuk
2023-03-23 11:32
has joined #pact-net

mpalla553
2023-03-23 14:51
has joined #pact-net

sumit.singh
2023-03-23 18:03
has joined #pact-net

quinton.miller
2023-03-23 19:18
has joined #pact-net

hurdledatrade
2023-03-24 11:24
has joined #pact-net

srijan.c
2023-03-24 15:26
has joined #pact-net

praveen.gangasani
2023-03-26 13:19
has joined #pact-net

pallavi.bose
2023-03-27 06:03
Is there any pactnet sample available for .netcore 6 / 7 for minimal API or w/o startup classes?

yzxu
2023-03-27 07:27
has joined #pact-net

1248124408
2023-03-27 08:59
has joined #pact-net

daniel.redelberger
2023-03-27 09:07
has joined #pact-net

mohammed.a.ezzedine
2023-03-27 15:25
has joined #pact-net

kiran.malsetty
2023-03-27 17:20
has joined #pact-net

rchild
2023-03-27 18:46
has joined #pact-net

rchild
2023-03-27 18:56
Hey everyone! I'm trying to update a provider pact test to add a fresh authorization token to all pact requests before they are replayed against the API. I've seen the WithCustomHeader method, but that seems to only add an authorization header, and not update an already present authorization header that might exist within the consumer pact json. Is there any workaround for this? Or is it generally understood to not include auth headers in the consumer json?

asoni
2023-03-27 20:23
has joined #pact-net

matt.fellows
2023-03-27 22:05
howtoauth

2023-03-27 22:05
Approaches to handling authentication in Pact tests: https://docs.pact.io/provider/handling_auth

matt.fellows
2023-03-27 22:05
There?s a couple of approaches :point_up:

yu.xie
2023-03-28 00:08
has joined #pact-net

gamer.fikri
2023-03-28 04:46
has joined #pact-net

pallavi.bose
2023-03-28 10:40
Hi Everyone, I was running by provider tests with pactnet version 3x. I upgraded it to 4x but my tests are failing. Also I'm unable to see the log. Please guide. I tried setting up loglevel to Info as well. but no use. var config = new PactVerifierConfig { Outputters = new List<IOutput> { new XUnitOutput(_output) }, LogLevel = PactLogLevel.Error };

shaun.carmody
2023-03-28 13:23
has joined #pact-net

christianschiepe
2023-03-28 13:50
has joined #pact-net

aberman
2023-03-28 19:24
has joined #pact-net

0xoscario
2023-03-29 03:38
has joined #pact-net

cgoodison
2023-03-29 05:19
Hi Pallavi, where are you looking for your logs? If you are using Visual Studio to run the tests I believe they should be in the test output window

pallavi.bose
2023-03-30 04:44
@cgoodison unfortunately the log in not extensive like, why the test failed. It just says test failed. That's my concern. I tried diff log levels as well nothing seemed to give out exact ans

cgoodison
2023-03-30 04:54
did you try PactLogLevel.Debug? I believe that will be the most detailed. Are you able to share the error message you are getting from it?

paddyhendy94
2023-03-30 12:48
has joined #pact-net

haroldrobson11
2023-03-30 13:16
has joined #pact-net

jfbosca
2023-03-30 15:26
has joined #pact-net

pallavi.bose
2023-03-31 08:34
Sure...I happened to revert back the changes n downgraded my provider to pact 3

pallavi.bose
2023-03-31 08:35
I will redo the changes n let you know about the error...Thanks tons

cgoodison
2023-04-01 02:44
good luck, hope you can get the upgrade working

daominhdam
2023-04-01 10:04
has joined #pact-net

pallavi.bose
2023-04-03 04:57
I found that many ppl facing issues with 4x provider

joseph.gately
2023-04-03 14:14
has joined #pact-net

bram.harmsen
2023-04-04 07:20
has joined #pact-net

sarah.al-hawi
2023-04-04 10:55
has joined #pact-net

andrei.enache
2023-04-04 10:55
has joined #pact-net

sohaib.zahid
2023-04-04 10:55
has joined #pact-net

behrouz.pooladrak
2023-04-04 10:55
has joined #pact-net

amarpal.amrith
2023-04-04 10:57
has joined #pact-net

laszlo.bogardi
2023-04-04 10:57
has joined #pact-net

caroline.thom
2023-04-04 13:20
has joined #pact-net

jeremy.chao
2023-04-04 14:49
has joined #pact-net

bmdk83
2023-04-04 15:51
has joined #pact-net

bmdk83
2023-04-04 15:56
Hi all, Is there a way to validate nullable reference types with Pact .NET? :slightly_smiling_face: If we have the following two classes: ```public class ConsumerClass { public string MyProperty { get; init; } } public class ProviderClass { public string? MyProperty { get; init; } }``` and in my consumer test, I've set the following: `.WithJsonBody(Match.Type(new ConsumerClass { MyProperty = "test" }));` (since I don't want to validate the actual values) I'd expect the provider test to fail this, since I have marked `MyProperty` to be a nullable property.

rchild
2023-04-04 18:46
Thanks for the link! Looking at our options though, it still seems like using the custom header option is our best strategy. However, we are still running into the issue where the custom header option is not replacing the invalid token. Is this a bug?

matt.fellows
2023-04-05 01:10
Matchers aren?t there to describe _how_ your Provider works, they are there to describe the scenarios a consumer needs, which is then checked against a provider

matt.fellows
2023-04-05 01:11
In your case, it seems the consumer always needs the value. This might be true of the scenarios your consumer needs, but not of all scenarios of a given provider. This is how provider states become important. They can differentiate the scenarios. Pure schema checking doesn?t allow this

matt.fellows
2023-04-05 01:11
As Tim Jones eloquently puts it: > Think of the matchers as saying ?this test covers all cases that pass this matcher?, not ?this is the response schema?

matt.fellows
2023-04-05 01:11
If you need to test both scenarios, see howtooptional


matt.fellows
2023-04-05 01:15
How are you setting the header? Could you please share the code?

maithree.uppunda
2023-04-05 07:50
has joined #pact-net

bmdk83
2023-04-05 10:28
Thanks a lot for your answers, Matt :slightly_smiling_face: Greatly appreciated. It totally makes sense. It's not so much the property itself that makes sense to test, but rather the type. If I mark the string as nullable _and_ set it's value to null on provider side, while the consumer expects it to be a string, the provider tests fails. That's exactly what I was after, first hand.

matt.fellows
2023-04-05 13:24
Perfect!

sivamkumar80
2023-04-05 13:34
has joined #pact-net

rchild
2023-04-05 14:04
Setting the custom header? We're doing it through the .net nuget package method: `IPactVerifier pactVerifier = new PactVerifier(config);` `pactVerifier` `.ServiceProvider("Tenant.Api", new Uri(_tenantBaseUrl))` `.WithPactBrokerSource(` `new Uri("https://avidxchange.pactflow.io"),` `options => options` `.TokenAuthentication(_pactflowToken)` `.PublishResults(` `_providerVersion,` `options => options.ProviderTags(_providerTags)` `.ProviderBranch(_providerBranch)))` `.WithProviderStateUrl(new Uri(_fixture.ServerUri, "/provider-states"))` `.WithCustomHeader("Authorization", $"Bearer {tokenValue}")` `.Verify();`

vanja.ilic
2023-04-05 14:24
has joined #pact-net

proydimonoff
2023-04-05 14:30
has joined #pact-net

proy
2023-04-05 14:33
has joined #pact-net

kevin.moylan
2023-04-05 16:13
has joined #pact-net

victor.lau841
2023-04-05 17:05
Does anyone have an example of PactNet of setting up a server without a Startup file? E.g. I have a PactWebFactory that uses Microsofts in-memory, but I want to migrate a bunch of configuration to starting a server without having a <StartUp> file

vijaykumar.patel
2023-04-06 06:36
has joined #pact-net

vijaykumar.patel
2023-04-06 07:57
Hi All, I am completely new to pact-net can someone point me to good example where I can see 1. How to write consumer test and push to pact-broker in pactflow in .NET? 2. How to verify that same thing from provider, getting contract from pactflow and check in .NET?

pallavi.bose
2023-04-06 10:54
HI, How do we publish the provider pact test results? Do we publish it or we record the provider pact results?

ankit.kumar
2023-04-06 10:55
has joined #pact-net

yousafn
2023-04-06 11:50
verification results are published to the pact broker if the appropriate properties are provided an example here https://github.com/pactflow/example-provider-dotnet/blob/34f35c7174dc90f753062289179eaaa0eb577ea8/tests/ProviderApiTests.cs#L51



vijaykumar.patel
2023-04-06 13:10
I feel like it is not really matured for .NET and azure devops? I do not find good samples for the same.

matt.fellows
2023-04-06 13:13
The two questions you asked are unrelated to Azure DevOps and are about how to run tests (a seperate concern to your CI/CD pipeline), would you mind elaborating a bit more on your needs?

matt.fellows
2023-04-06 13:13
Publishing is done through our CLI tools

matt.fellows
2023-04-06 13:14
Running the tests through the usual dotnet means

vijaykumar.patel
2023-04-06 13:16
I mean if we focus on the consumer we are writing tests that create the contract file. Then which cli you mean ? do you have link for cli tool you mention that read this json file and upload to broker from my azure devops pipeline?

vijaykumar.patel
2023-04-06 13:18
Do we have guideline around this cli tool? I mean



vijaykumar.patel
2023-04-06 13:38
Thank you for sharing ! I will spent sometime on it and see !

joye.arbuckle
2023-04-06 14:24
has joined #pact-net

allison.stone
2023-04-06 19:36
has joined #pact-net

mayank
2023-04-06 22:11
has joined #pact-net

ganesh.walunj
2023-04-07 06:05
has joined #pact-net

pallavi.bose
2023-04-07 06:56
:pray:

pallavi.bose
2023-04-07 08:42
After adding these switches publish is failing with below error `publish_verification_results': Error returned from verification results publication 401 (Pact::Provider::VerificationResults::PublicationError)

pallavi.bose
2023-04-07 08:44
Hi, I've set PublishVerificationResult switch to true in my code. Also set up the version But in pipeline it fails with below error After adding these switches publish is failing with below error `publish_verification_results': Error returned from verification results publication 401 (Pact::Provider::VerificationResults::PublicationError) Am I missing any other setting?

tjones
2023-04-07 09:32
401 means that you?re not authenticated. So you?ll need to check / provide your basic auth username and password for the broker (or access token if you?re using pactflow)

pallavi.bose
2023-04-07 10:14
That's already in place while connecting to PactBroker

pallavi.bose
2023-04-07 10:15
var pactUriOptions = new PactUriOptions() .SetBasicAuthentication(config["PACT_BROKER_USERNAME"], config["PACT_BROKER_USERNAME"]); pactVerifier .PactBroker(config["PACT_BROKER_BASEURI"], pactUriOptions);

jan.krolikowski
2023-04-07 14:39
has joined #pact-net

mragni.majhwar
2023-04-07 17:51
has joined #pact-net

matt.fellows
2023-04-08 02:10
The error is pretty clear, so I'd be inclined to assume your configuration is wrong (e.g. CONFIG is not populated or the values are incorrect). Enabling debug logging might help understand further

pallavi.bose
2023-04-10 05:12
Actually @matt.fellows apparently it seems that issue only. But for us we able to fetch the pact n verify it. Problem only while publishing. Do we need any other settings as well. Other teams from our org using same creds for publishing. from nodejs / java projects. And it works fine. From .Net we are receiving this error. So wanted to know if any other setting also required

pallavi.bose
2023-04-10 12:18
I've set Verbose = true. my consumer is written using Pact 4x version and Provider is written using 3x, could that be a probable issue with publishing pact verification results? @matt.fellows @tjones

tjones
2023-04-10 14:58
I would expect that the problem is that the token is not correct or not set

tjones
2023-04-10 14:58
the pact version should not make a difference

tjones
2023-04-11 01:16
Specifically: ```var pactUriOptions = new PactUriOptions() .SetBasicAuthentication(config["PACT_BROKER_USERNAME"], config["PACT_BROKER_USERNAME"]);``` ^ This has PACT_BROKER_USERNAME for both the username and the password.

pallavi.bose
2023-04-11 05:26
ok so we need to pass token instead of creds...Thanks a lot. Will try this

pallavi.bose
2023-04-11 05:39
@tjones @matt.fellows I verified the other applications with in our org, we are using only the user id and password...n it's working fine for tehn w/i any issues. const publishOpts: VerifierOptions = { pactBrokerUsername: process.env.PACT_BROKER_USERNAME, pactBrokerPassword: process.env.PACT_BROKER_PASSWORD, providerVersion: process.env.GIT_COMMIT || '', providerVersionTags: [process.env.GIT_BRANCH ?? ''], publishVerificationResult: true, pactBrokerUrl: process.env.PACT_BROKER_URL, consumerVersionSelectors: [ { // branch: process.env.GIT_BRANCH, // TODO: proper branch matching latest: true, }, ], }; const opts: VerifierOptions = { pactBrokerUrl: 'https://pact-broker.com', consumerVersionSelectors: [ { latest: true, }, ], ...(process.env.PACT_BROKER_URL && publishOpts),

matt.fellows
2023-04-11 06:06
> ok so we need to pass token instead of creds...Thanks a lot. Will try this the point Tim was making is that you are passing the username when you should be passing the password

matt.fellows
2023-04-11 06:07
the token is if you?re using PactFlow or if you?ve added some custom auth. If you have a self-hosted / OSS broker, username/password is what you need

pallavi.bose
2023-04-11 06:12
I got it...It was very sad mistake from my end. Thanks a lot

matt.fellows
2023-04-11 06:14
haha it happens :wink:

vijaykumar.patel
2023-04-11 06:24
Hi Is there anyway we can directly publish the contract file from the .NET tests to pactbroker rather than writing into /dir or publishing from the pipeline?

matt.fellows
2023-04-11 06:33
Not at the moment, it?s best to keep it as a separate step anyway IMO

gonzalo.granizo
2023-04-11 10:13
has joined #pact-net

theburningmonk
2023-04-11 11:29
has joined #pact-net

helenarodcal
2023-04-11 11:31
has joined #pact-net

enver.yasar
2023-04-11 13:39
has joined #pact-net

christian.ledgard
2023-04-11 13:49
has joined #pact-net

ddongre
2023-04-11 15:09
has joined #pact-net

prajapati.pravesh
2023-04-12 02:55
has joined #pact-net

edwin.raju
2023-04-12 08:13
has joined #pact-net

john.hennigan
2023-04-12 08:16
has joined #pact-net

donald.robertson
2023-04-12 10:42
has joined #pact-net

tam.norris
2023-04-12 10:46
has joined #pact-net

gopijaganathan7
2023-04-13 07:27
has joined #pact-net

lukaszmalek90
2023-04-13 11:40
has joined #pact-net

omri.eyal
2023-04-13 13:23
@omri.eyal has left the channel

nickwilliamsqa
2023-04-13 16:15
has joined #pact-net

guozhangliew
2023-04-14 02:03
has joined #pact-net

praboo.p
2023-04-14 07:17
has joined #pact-net

florenciaaldana.rodri
2023-04-14 08:10
has joined #pact-net

pallavi.bose
2023-04-14 10:41
Hi, How do we run webhook in http://Pact.net 3x version? So I get data like below from webhook { "pact-consumers":"basketservice", "pact-consumer":"basketservice", "pact-consumer-branch":"master", "pact-consumer-version":"a46900e6f903bb010f614cd67fd6afa64fc6ad69", "pact-provider":"sslpservice", "pact-provider-branch":"master", "pact-provider-version":"be3ea695707268780b5246ab54a1d94b250f582a", "pact-url":"https://pact-broker.com/pacts/provider/sslpservice/consumer/basketservice/pact-version/78fe8ae578dc3417258241bc76f57985205fc07f/metadata/Y3ZuPWE0NjkwMGU2ZjkwM2JiMDEwZjYxNGNkNjdmZDZhZmE2NGZjNmFkNjkmdz10cnVl", "pact-verification-result-url":"https://pact-broker.com/pacts/provider/sslpservice/consumer/basketservice/pact-version/78fe8ae578dc3417258241bc76f57985205fc07f/verification-results/9041" } Using this I need run the pact provider publish result at pact-verification-result-url. But I'm not sure if it's doable using http://pact.net 3x version. Please guide.:pray:

yousafn
2023-04-14 11:26
In your CI system you would check out your provider on that commit sha, or branch, you would then pass your pact url into the verifier, and set publish results to true (if that func was avail in pact-net v3)

yousafn
2023-04-14 11:28
example in JavaScript here passing the pact url https://github.com/pactflow/example-provider/blob/master/src/product/product.consumerChange.pact.test.js#L32 webhook triggered job that uses the information in the webhook payload to checkout the correct version of the provider https://github.com/pactflow/example-provider/blob/master/.github/workflows/contract_requiring_verification_published.yml#L29-L34

taher.kapasi
2023-04-14 15:53
has joined #pact-net

michael385
2023-04-14 16:40
has joined #pact-net

pallavi.bose
2023-04-14 17:41
So no need to use pact-verification-result-url anywhere

darrenoc3
2023-04-15 03:46
has joined #pact-net

ones.ardo
2023-04-17 07:58
has joined #pact-net

deeptiagrawal
2023-04-17 23:31
has joined #pact-net

madhukar.koratagere
2023-04-18 06:24
has joined #pact-net

mahesh.damavarapu
2023-04-18 06:26
has joined #pact-net

paul.caplan
2023-04-18 14:52
has joined #pact-net

cars2991
2023-04-19 02:42
has joined #pact-net

vaidas.sieber
2023-04-19 06:42
has joined #pact-net

jonathandelaros
2023-04-19 07:40
has joined #pact-net

priyaranjanmudliar
2023-04-19 09:05
has joined #pact-net

ajaydiwakar.ka
2023-04-19 10:11
has joined #pact-net

meghaagr
2023-04-19 10:13
has joined #pact-net

meghaagr
2023-04-19 10:58
hi Team, We are doing a POC using Pactflow in dotnet core application, we would like to know what other API testing tools we can use apart from schemathesis(licensed version). We are looking for free version.

pallavi.bose
2023-04-19 11:57
Hi Team, We are using HttpPost method to fetch data, When I write Pact test for the same it fails. But if I change the method to HTTPGet then the pact test passes. Is there any limitation/ feature from Pact to ignore data returned over Post?

bas
2023-04-19 12:53
Hi @meghaagr, apologies for the shameless plug, but have you seen RestAssured .Net? It's a port of Rest Assured in C# I've created, and I think it's doing a pretty decent job of making it easy to write tests for HTTP APIs in C#. I'm working on examples of how to use it together with Pact, by the way, but that'll take me some more time... In the meantime: https://github.com/basdijkstra/rest-assured-net

hcummins
2023-04-19 12:58
has joined #pact-net

tjones
2023-04-19 13:01
Er. I suspect that if the pact test fails unless you?re using Get, then you?re not really using Post.

michael.dasilva
2023-04-19 13:13
has joined #pact-net

meghaagr
2023-04-19 13:17
Thanx for the reply @bas.... Do u have any example where u have used this for Bidirectional Contract testing...... Actually we are facing some challenges while generating verification result from Provider

matt.fellows
2023-04-19 13:23
Pact just blindly fires the requests you put into the pact file

matt.fellows
2023-04-19 13:23
if your provider tests pass when you put a GET in your consumer test and fail with a POST, there is a misunderstanding somewhere

matt.fellows
2023-04-19 13:24
If you?re sending a body with the GET, then there are additional problems to be concerned about

matt.fellows
2023-04-19 13:24
(bodies should not be sent with a GET)

bas
2023-04-19 13:25
You mean something similar to this? https://github.com/pactflow/example-bi-directional-provider-restassured It's on the roadmap, but there's some features I still need to add to RestAssured .Net first before I can make that work.

ivana.lazic
2023-04-19 14:04
has joined #pact-net

vakong13
2023-04-19 16:15
has joined #pact-net

pallavi.bose
2023-04-20 03:39
For us we don't have any body for the request. We are simply taking data from header. So I simply changed Get to Post. But when I run test it throws error with status code 415 "request": { "headers": { "Accept": "application/json", "Tenant-Id": "DevTenant" }, "method": "POST", "path": "/api/v1/configurations:get-for-audit-determination" },

matt.fellows
2023-04-20 03:44
that error is coming from your provider API. You need to look at the logs for it, or talk to the team that runs the provider API

matt.fellows
2023-04-20 03:45
a 415 is inappropriate media type

matt.fellows
2023-04-20 03:45
so that tells me your provider _doesn?t_ return JSON, but you?re asking it to. Does it return JSON?

pallavi.bose
2023-04-20 04:23
It does

pallavi.bose
2023-04-20 04:24
Sorry...from test?

pallavi.bose
2023-04-20 04:24
Yes...from test I'm not getting any Json

pallavi.bose
2023-04-20 04:28
From Provider test it says it received "" but we debugged the api from test.N it works as expected. It does return json data. But not sure why from test what's the issue...

matt.fellows
2023-04-20 04:35
which test is failing? The consumer one or provider?

pallavi.bose
2023-04-20 04:48
provider one.

pallavi.bose
2023-04-20 04:50
Consumer creates the contract file just fine. But from provider side broker returns "" and fail to validate the response from consumer pact with status code 415

matt.fellows
2023-04-20 04:59
Can you please set logging to DEBUG/Verbose and share?

pallavi.bose
2023-04-20 05:21
yes..Verbose is set to true LOg from test explorer like below ?HiiRetail.Sslp.TrustLevel.Service.UnitTests.Contracts.ProviderTest.EnsureProviderApiHonoursPactWithConsumer ?Source:?ProviderTest.cs?line?19 ?Duration:?19.4 sec Message:? PactNet.PactFailureException : Pact verification failed. See output for details. If the output is empty please provide a custom config.Outputters (IOutput) for your test framework, as we couldn't write to the console. Stack Trace:? PactCoreHost`1.Start() PactVerifier.Verify(String description, String providerState) ProviderTest.EnsureProviderApiHonoursPactWithConsumer()?line?42 RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) Standard Output:? WARN: Ignoring unsupported combine AND for path $ INFO: Reading pact at ../../../pacts/sslp-basketauditdeterminationservice-sslp-trustlevelservice.json Verifying a pact between sslp-basketauditdeterminationservice and sslp-trustlevelservice Given basket audit configurations exist A valid request to get all basket audit configurations with POST /api/v1/configurations:get-for-audit-determination returns a response which WARN: Skipping set up for provider state 'basket audit configurations exist' for consumer 'sslp-basketauditdeterminationservice' as there is no --provider-states-setup-url specified. INFO: Replacing header 'Tenant-Id: DevTenant' with 'Tenant-Id: DevTenant' 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 sslp-basketauditdeterminationservice and sslp-trustlevelservice Given basket audit configurations exist A valid request to get all basket audit configurations with POST /api/v1/configurations:get-for-audit-determination returns a response which has status code 200 Failure/Error: expect(response_status).to eql expected_response_status expected: 200 got: 415 (compared using eql?) 2) Verifying a pact between sslp-basketauditdeterminationservice and sslp-trustlevelservice Given basket audit configurations exist A valid request to get all basket audit configurations with POST /api/v1/configurations:get-for-audit-determination returns a response which has a matching body Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example Actual: Diff -------------------------------------- WARN: Ignoring unsupported combine AND for path $ Key: - is expected + is actual Matching keys and values are not shown -{ - "tenant": { - "defaultTrustLevelNumber": 3, - "id": "DevTenant", - "name": "Use this tenant during development" - } -} Description of differences -------------------------------------- * Expected a Hash (like {"tenant"=>{"defaultTrustLevelNumber"=>3, "id"=>"DevTenant", "name"=>"Use this tenant during development"}}) but got a String ("") at $ 3) Verifying a pact between sslp-basketauditdeterminationservice and sslp-trustlevelservice Given basket audit configurations exist A valid request to get all basket audit configurations with POST /api/v1/configurations:get-for-audit-determination returns a response which includes headers "Content-Type" which equals "application/json; charset=utf-8" WARN: Cannot publish verification for sslp-basketauditdeterminationservice as there is no link named pb:publish-verification-results in the pact JSON. If you are using a pact broker, please upgrade to version 2.0.0 or later. Failure/Error: expect(header_value).to match_header(name, expected_header_value) Expected header "Content-Type" to equal "application/json; charset=utf-8", but was nil 1 interaction, 1 failure Failed interactions: To re-run just this failing interaction, change the verify method to '.Verify(description: "A valid request to get all basket audit configurations", providerState: "basket audit configurations exist")'. Please do not check in this change! # A valid request to get all basket audit configurations given basket audit configurations exist

matt.fellows
2023-04-20 05:32
I think you can also get your version of Pact .NET to write to a log file. Please share that file also and ensure it is set to DEBUG level (it will contain the request/responses)

matt.fellows
2023-04-20 05:34
Pact is going to issue the request in the pact file at your Provider API. The response is what Pact is showing in that output

matt.fellows
2023-04-20 05:35
It?s _possible_, that Pact is not sending what?s in the pact file and that?s the cause of the issue. You can debug this in a few ways 1. Add logging to your provider and check what it sees 2. Use something like Wireshark to snoop the requests/responses, and check against what it should be doing

pallavi.bose
2023-04-20 05:39
Sure... Let me try doing that...Only thing is When I change Post to Get...it falls in place. Will check in PactNet 3x how can I expose debug file..May be it's from CLI only

matt.fellows
2023-04-20 07:04
> Only thing is When I change Post to Get If that works, doesn?t that tell you something important about the problem?

pallavi.bose
2023-04-20 08:06
We had a setting at global level services.AddControllers(options => { options.Filters.Add(new ConsumesAttribute(MediaTypeNames.Application.Json)); }

pallavi.bose
2023-04-20 08:06
which seems to have been causing issues

pallavi.bose
2023-04-20 08:08
So we added empty body in consumer like below .WithBody("{}", $"{MediaTypeNames.Application.Json}; charset={Encoding.UTF8.WebName}") So now our header request looks like below "request": { "headers": { "Accept": "application/json", "Content-Type": "application/json; charset=utf-8", "Tenant-Id": "DevTenant" }, "method": "POST", "path": "/api/v1/configurations:get-for-audit-determination" }, N it works now

matt.fellows
2023-04-20 08:21
this is even more confusing

matt.fellows
2023-04-20 08:21
Now you are _saying_ you?re sending JSON (the `content-type` header), but are not sending JSON at all

pallavi.bose
2023-04-20 08:26
yes, we just intimating request will have content-type but practically it does not have any body. but it's also some set up from our end, requests for it

matt.fellows
2023-04-20 08:36
glad it?s sorted

pallavi.bose
2023-04-20 08:47
Yeah...phew ... We kept thinking may be Pact requires content-type even if it's not needed. But it was our API which actually needed it and not Pact

ravinder.kadiyan
2023-04-20 09:56
has joined #pact-net

ravinder.kadiyan
2023-04-20 10:05
Hi Team, We are trying to use the pactflow bidirection feature and struck on provider side verification result... We don't want to use any other external tool like schemathesis or newman... is it possible to write provider test using xunit (dotnet6) which can also generate the verification result. (provider test similar to whitebox component test, where we start the server inside the test and run test corresponding to it... )

meghaagr
2023-04-20 13:05
hi @bas: I was going through https://github.com/pactflow/example-bi-directional-provider-restassured example, wants to know how are we generating report.txt? It seems it's a static file......

bas
2023-04-20 13:11
Yes, but it's also just an example. You can easily replace that with your own self-produced report, such as a JUnit XML report generated by your test runner of choice (NUnit, xUnit, ....)

bas
2023-04-20 13:18
Are you by any chance working in the same team as @meghaagr? See https://pact-foundation.slack.com/archives/C9UTHV2AD/p1681901880101259

alfredo.castro
2023-04-20 13:27
has joined #pact-net

ravinder.kadiyan
2023-04-20 14:45
Yes @bas .. thanks

lluis.casals
2023-04-20 17:07
has joined #pact-net

rchild
2023-04-20 17:40
Hey Matt, sorry for the super late ping, but did you get a chance to look at this?

eddie
2023-04-20 20:48
Hey, Looking for a way to share interaction setup between our (consumer) contract tests and other functional tests in the consumer application *in the form of `HttpRequestMessage` / `HttpResponseMessage`* pairs. NB: I'm aware of `pact-stub-server` (https://docs.pact.io/getting_started/stubs) however it's not quite what I'm looking for. i.e. assume we've got some shared code to define the "Foo" interaction ```private static void PopulateFooInteraction(IPactBuilderV3 pactBuilder) { pactBuilder .UponReceiving("Request For Foo") .WithRequest(HttpMethod.Get, "/foo/endpoint") .WithHeader("x-correlation-id", "55dbb0b0-b0a0-4b2c-bee2-1cc77e8fba56") .WillRespond() .WithStatus(HttpStatusCode.OK) .WithHeader("Content-Type", "application/json") .WithJsonBody(Match.Type(new { Foo = "Bar" })); }``` Then we exercise the client code that depends on the Foo interaction - it calls `PopulateFooInteraction()` ```[Fact] public async Task CheckFooInteraction() { var pact = Pact.V3("The.Consumer", "The.Provider", new PactConfig()); var pactBuilder = pact.UsingNativeBackend(); PopulateFooInteraction(pactBuilder); await PactBuilder.VerifyAsync(async ctx => { // .. code that consumes the stubbed responses coming back for Foo }); }``` Finally (somehow!) we harvest the messages implied by `PopulateFooInteraction()` *This is the missing bit* ```[Fact] public void GetMessages() { var messageCapture = new MessageCapture(); PopulateFooInteraction(messageCapture); IEnumerable<(HttpRequestMessage, HttpResponseMessage)> messages = messageCapture.CollectInteractions(); }``` The end goal being to use these messages with something like https://www.nuget.org/packages/RichardSzalay.MockHttp.

dprawatya
2023-04-21 01:11
has joined #pact-net

mbutt
2023-04-21 01:11
has joined #pact-net

matt.fellows
2023-04-21 01:31
Perhaps the simplest way would be to read back in the pact file, and programmatically create the `mockhttp` mocks?

matt.fellows
2023-04-21 02:06
oh sorry I missed this. It looks OK to me, might need to raise a bug report on the pact net github so it can be looked into in more detail

marcia.meira
2023-04-21 12:43
has joined #pact-net

raubreysmith
2023-04-21 12:46
has joined #pact-net

ksenia.vasileva
2023-04-21 15:02
has joined #pact-net

jack.amico
2023-04-21 15:48
has joined #pact-net

cheng.ngai
2023-04-22 00:55
has joined #pact-net

tjones
2023-04-22 04:09
What?s the use case here?

tjones
2023-04-22 04:10
Ah, I think I understand - you want to tie the mocks in your functional tests together with the assertions in your contract tests?

tjones
2023-04-22 04:11
I?ve thought about doing something like that - I spoke about a rudimentary approach (using javascript) in the Pact virtual conference a couple of years ago - I?m travelling at the moment, but I can post a link later

tjones
2023-04-22 04:12
I don?t think there?s existing tooling to do this easily, but it would be worth building.

tjones
2023-04-22 04:25
I think one neat way to implement it might be to have a way to say ?this interaction also triggers these state changes?

tjones
2023-04-22 04:25
Then you could use the mock server for your functional tests

tjones
2023-04-22 04:26
(And you might be able to use the mock client that way, too)


aditya.kashyap
2023-04-24 05:13
has joined #pact-net

iustina.gavrila
2023-04-24 09:15
has joined #pact-net

emgarcia
2023-04-24 14:15
same question. Our implementation does not use a startup class and most documentation online refers to WebApplicationFactory for integration tests but PACT explicitely recommends not to use that: https://github.com/pact-foundation/pact-net/blob/master/README.md Others asking the same question: https://stackoverflow.com/questions/74556919/how-to-programmatically-launch-a-net-6-minimal-api-with-no-startup-class

vandana.aveva
2023-04-24 18:24
has joined #pact-net

lucas
2023-04-25 00:01
has joined #pact-net

szydlakus
2023-04-25 11:19
has joined #pact-net

sarah.hutchins
2023-04-25 12:48
has joined #pact-net

kristoffer
2023-04-25 13:31
has joined #pact-net

jack.drake
2023-04-25 15:40
has joined #pact-net

mathivanan.kailasam
2023-04-25 16:15
has joined #pact-net

hornc
2023-04-25 18:00
has joined #pact-net

hulia.suliman
2023-04-25 18:07
has joined #pact-net

yousafn
2023-04-26 10:43
Hey Hey Pact-Netizens got some goodies for you, wouldn't mind some eyes across them :) ? Updated https://github.com/pactflow/example-consumer-dotnet to use pact-net 4.x / .NET 6.0 and branches/environments/record deployments over tags ? Updated https://github.com/pactflow/example-provider-dotnet to use pact-net 4.x / .NET 6.0 and branches/environments/record deployments over tags ? Added a PR to update the v1 workshop https://github.com/pact-foundation/pact-workshop-dotnet-core-v1/pull/25 ? Added a PR to update the v3 workshop https://github.com/DiUS/pact-workshop-dotnet-core-v3/pull/8 I think we may in the very near future, to consolidate all the things. ? rename https://github.com/pact-foundation/pact-workshop-dotnet-core-v1 to `pact-workshop-dotnet` ? canonical example from https://github.com/DiUS/pact-workshop-dotnet-core-v3/pull/8 becomes the main course ? sub foldered (probably easier than branches) workshop for https://github.com/pact-foundation/pact-workshop-dotnet-core-v1/pull/25 ? we can then add additional examples for x framework ? Minimal API https://github.com/DiUS/pact-workshop-dotnet-core-v3/pulls ? Update all the links to point at the renamed https://github.com/pact-foundation/pact-workshop-dotnet PS. I have to say, the DSL is pact-net 4.x is quite nice, and the delta between 3.x -> 4.x isn't bad at all, especially once you've got one test converted, the rest is relatively plain sailing.

bmdk83
2023-04-26 12:39
Hi all, Are there any ways to publish consumer pact files to Azure BlobStorage and then verify them on provider side? :-)

tjones
2023-04-26 13:11
Yes, you can just publish the files that are written by pact, and then download them for verification on the provider side

tjones
2023-04-26 13:11
You?re *much* better off using a broker, though, as it remembers what was compatible, and knows what is deployed where

meghaagr
2023-04-26 13:13
Hi All, We are setting up contract test for kafka events for a dotnet project and going through https://github.com/pact-foundation/pact-net/blob/master/docs/messaging-pacts.md to setup Provider test. In the example the pact json created by customer is manually added to the Provider test. We went through provider Java kafka example https://github.com/pactflow/example-provider-java-kafka, in this example the consumerPact json pact is not provided. Can we achieve something in dotnet kafka provider test also?


yousafn
2023-04-26 13:39
it should be the same as the http examples,

markus.nakhlah
2023-04-26 13:44
has joined #pact-net

bmdk83
2023-04-26 14:38
Thanks a lot for your reply, Timtohy, it?s greatly appreciated :blush: You mean publish the files manually and download them manually? I meant automatically :smiley: sorry that i was not explicit around that

tjones
2023-04-26 15:13
Yep, manually. The way to do it automatically, built in, is to use a broker

tjones
2023-04-26 15:13
The reason there is no other tooling built is that a _significant_ portion of the value of contract testing comes from using the broker for deployment reasoning

tjones
2023-04-26 15:14
There?s an open source one already in a docker container if you want to run your own, or if you want to not have to build that infrastructure, you can use the SaaS one that the fine people at Pactflow run

tjones
2023-04-26 15:16
https://hub.docker.com/r/pactfoundation/pact-broker ^ Free docker image https://pactflow.io/ ^ Paid SaaS broker (though the free tier is fine if you?re just doing a PoC)

tjones
2023-04-26 15:16
Is there some reason you want to use Azure BlobStorage over a broker?

emgarcia
2023-04-26 16:44
Hello, Thanks for the update. Any plans to create a minimal API example without a startup class as this is what new .NET 6.0 projects involve (all is in Program.cs). Many thanks!

yousafn
2023-04-26 17:13
If you re-read the update, there is a pull request that covers your very point :slightly_smiling_face:

yousafn
2023-04-26 17:14
https://github.com/DiUS/pact-workshop-dotnet-core-v3/pulls and this point in particular https://github.com/DiUS/pact-workshop-dotnet-core-v3/pull/7#issuecomment-1523213495 we are more than happy for our community to help build out and contribute to the example repos and workshops as well as our actual repos that contain the core pact code

meghaagr
2023-04-26 17:16
Thank you @yousafn for the reply..... Will try this.....

yousafn
2023-04-26 17:17
You have to build out all the pact broker logic, so although you can we don't spend much showcasing it and there isn't much value in supporting it from the maintainers perspective https://docs.pact.io/pact_broker#can-i-use-pact-without-a-pact-broker https://docs.pact.io/getting_started/sharing_pacts#4-publish-pacts-to-amazon-s3 https://docs.pact.io/implementation_guides/jvm/provider/gradle#verifying-pact-files-from-a-s3-bucket we have taken the time to show some options however

emgarcia
2023-04-26 17:24
Quickly looking at it, I still see that the provider uses the startup file mechanism like before, rather than the Program.cs. Will give it a more in depth look.

jean-francois.renaud
2023-04-26 21:09
has joined #pact-net

bmdk83
2023-04-27 06:08
Thanks for your replies, Timothy and Yousaf :slightly_smiling_face: :pray: The reason I wanted to use Azure BlobStorage for storing the pacts was for a simple proof of concept, since I'm working for a world-wide business where we have teams all over the world (and thus microservices) where we want to try out PACT for contract testing. I've registered a free trial for pactflow now, though :slightly_smiling_face: While I realize that we should use the CLI in our CI/CD pipelines to publish the pacts, I want to quickly spin up a new `HttpClient` in .net to publish the contracts, just to get started. However, I get a 400 bad request when I try :pondering: My code looks like this: ```byte[] jsonBytes = File.ReadAllBytes("../../../../../pacts/mypactfile.json"); var base64 = Convert.ToBase64String(jsonBytes); dynamic payload = new { pacticipantName = "my participant name", pacticipantVersionNumber = 1, contracts = new dynamic[] { new { consumerName = "my consumer", providerName = "my provider", specification = "pact", contentType = "application/json", content = base64 } } }; using var httpClient = new HttpClient(); httpClient.BaseAddress = new Uri("https://myaccount.pactflow.io/"); HttpRequestMessage message = new(http://HttpMethod.Post, "contracts/publish"); message.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "my api token from http://pactflow.io"); message.Content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json"); HttpResponseMessage responseMessage = httpClient.Send(message); if (!responseMessage.IsSuccessStatusCode) { throw new Exception($"Failed to publish pacts. Status code: {responseMessage.StatusCode}"); }``` Any idea of what I did wrong here? :-)

jakazzy
2023-04-27 06:16
has joined #pact-net

tjones
2023-04-27 06:32
> new AuthenticationHeaderValue(?Bearer?, ?my api token from http://pactflow.io?); I don?t know what this does specifically, but in case you hand rolled it, the header must be `Bearer YOURTOKEN` (note the space) Otherwise yours looks ok. In mine, I also have `tags: []`, and `Accept: 'application/json'`.

tjones
2023-04-27 06:33
Ah, sorry - I think it must be `Accept: 'application/hal+json',`


tjones
2023-04-27 06:35
(it?s in JS, but hopefully you can use it to compare)

bmdk83
2023-04-27 06:36
Thanks Timothy :slightly_smiling_face: the AuthenticationHeaderValue is just a standard way to authorize via the http client in .net. It actually works the way I did it :smile: I found the error.. it was a stupid one: name mismatch between the provider name in the contract and what I wrote in the publish method :exploding_head: :laughing:

tjones
2023-04-27 06:38
Hah! I didn?t know it checked the contract contents

tjones
2023-04-27 06:39
If you figure out how to get the detailed verification results publishing, let me know. I haven?t been able to figure that one out and it isn?t documented

tjones
2023-04-27 06:40
I also found some of the endpoints don?t work unless you accept `application/hal+json`

bmdk83
2023-04-27 06:40
It actually works just by setting `application/json`, with out the `hal+json` :slightly_smiling_face:

tjones
2023-04-27 06:41
Nice. Not all of them do this, though I think they produce an appropriate error code when they fail

bmdk83
2023-04-27 06:41
Fetched the error phrase like this, which told me exactly what was wrong: ```HttpResponseMessage responseMessage = httpClient.Send(message); if (!responseMessage.IsSuccessStatusCode) { string error = await responseMessage.Content.ReadAsStringAsync(); throw new Exception($"{error}. Status code: {responseMessage.StatusCode}"); }```

tjones
2023-04-27 06:41
Also the bodies of the response are pretty good


bmdk83
2023-04-27 06:41
yea, they are indeed :slightly_smiling_face: :+1:

bmdk83
2023-04-27 06:47
Kodus to the people behind http://PACT.NET! Setting up pactflow provider verification was a bliss :smile:

tjones
2023-04-27 07:55
Yep! It?s definitely the easiest way

edwin.raju
2023-04-28 11:13
@edwin.raju has left the channel

srinivas.nali
2023-04-28 14:27
has joined #pact-net

dmitriy.tarasevich
2023-04-28 16:00
has joined #pact-net

jigish.mehta
2023-04-28 16:00
has joined #pact-net

juan.felix
2023-04-28 16:01
has joined #pact-net

himesj
2023-04-28 17:25
has joined #pact-net

itsforbabu
2023-04-29 14:25
has joined #pact-net

tea.trader168
2023-04-30 02:04
has joined #pact-net

lori.maurais
2023-05-01 15:27
has joined #pact-net

damola.thompson
2023-05-02 07:26
has joined #pact-net

meghaagr
2023-05-02 12:47
Hi All, We are setting up contract test for kafka events for a dotnet project and going through https://github.com/pact-foundation/pact-net/blob/master/docs/messaging-pacts.md to setup Provider test. I am able to verify the result but dont know how to publish the result without swagger file. For APi Contract testing we are running this command to publish the result. ```publish_provider_contract: @echo "\n========== STAGE: publish-provider-contract (spec + results) ==========\n" ${PACTFLOW_CLI_COMMAND} publish-provider-contract \ ${OAS_PATH} \ --provider ${PACTICIPANT} \ --provider-app-version ${VERSION} \ --branch ${BRANCH} \ --content-type application/xml \ --verification-exit-code=0 \ --verification-results './report.xml' \ --verification-results-content-type ${REPORT_FILE_CONTENT_TYPE}\ --verifier xunit``` where OAS_PATH is the swagger path. Can someone help me how to publish the verification result without Swagger file

ivan.v.kurlovich
2023-05-02 13:01
has joined #pact-net

bas
2023-05-02 13:51
Hey @meghaagr , I think you?re mixing up two concepts here: publishing provider contracts (which you do when you?re doing bidirectional contract testing) and publishing provider verification results (which is typically part of consumer-driven contract testing). Which of these are you trying to do? https://www.ontestautomation.com/approaches-to-contract-testing/

ckulkarni
2023-05-02 14:22
has joined #pact-net

aurel.pintea
2023-05-02 14:55
has joined #pact-net

meghaagr
2023-05-02 17:19
I am doing bidirectional contract testing

bas
2023-05-02 19:19
OK. That means you don?t publish the contract verification result, that?s determined by PactFlow. You can publish additional (unit, integration) test results as some sort of audit trail but not without a contract. There is no point in doing that, PactFlow doesn?t even know how to parse those additional test results, so without a contract you?re essentially publishing nothing. If the provider creates the verification results, you?re not doing bidirectional contract testing.

ariveros142
2023-05-02 20:03
has joined #pact-net

matt.fellows
2023-05-03 01:40
BDCT currently only works with OAS documents on the provider side, so you can?t do Kafka / Messaging with BDCT (unless that could be expressed as an OAS, which? probably it can?t without bending the rules)

matt.fellows
2023-05-03 01:40
We are currently investigating how to support asyc/messaging in BDCT. We just completed a design sprint, but need to do some additional user testing / validation. If you?re interested in sharing your use case and validating some concepts, DM me and we can setup a chat

meghaagr
2023-05-03 04:43
Hi Matt and Bas, Thanks for the reply. I have DMed u

cody.jenkins
2023-05-03 04:48
has joined #pact-net

ashish.tilara
2023-05-03 06:08
has joined #pact-net

alfred.brose00
2023-05-03 08:17
has joined #pact-net

dibya.dhar
2023-05-03 09:04
has joined #pact-net

ronnie.kilsbo
2023-05-03 09:28
has joined #pact-net

caitriona.gallagher
2023-05-03 15:18
has joined #pact-net

majhwar.mragni
2023-05-03 17:03
has joined #pact-net

majhwar.mragni
2023-05-03 17:12
Hi there! I'm just starting out on Pact. My repo is github and pipeline in azure devops. In the "Gold: integrate with PR pipeline" section, one of the step says "Modify the consumer commit pipeline to tag with master branch". Can someone clarify on how to implement this? I'm assuming when it says commit pipeline, CI pipeline (triggerd on merging pull request) is being referred. This is how I'm trying to integrate with pipeline - In PR validation pipeline (triggered on creation of pull request), I published the pact with branch as "feature branch name" and consumer app version as the "git commit hash". In the CI pipeline (triggered on merge), I tried using pact-broker create-version-tag and tag with master in the CI pipeline, but --version is mandatory there and in CI pipeline I'm not able to get the right git commit hash. Also, the documentation says not to use tags anymore if branches are supported. All help and guidance are greatly appreciated.

michael.fenstermaker
2023-05-03 20:56
has joined #pact-net

man.tse
2023-05-03 20:58
has joined #pact-net

tristan
2023-05-04 03:27
has joined #pact-net

michal.kopriva
2023-05-04 11:03
has joined #pact-net

tjones
2023-05-04 15:58
> in CI pipeline I?m not able to get the right git commit hash. Why not?

tjones
2023-05-04 15:58
I think ?tag with master branch? is a misnomer. I think it means publish the Pact with the branch name.

tjones
2023-05-04 15:59
This used to be a separate step. Which document are you reading? It should probably be updated.

james.jenks
2023-05-04 19:09
has joined #pact-net

abdurrahman.muratt
2023-05-04 20:50
has joined #pact-net

meghaagr
2023-05-05 06:03
Hi, I am trying to write a provider test for Async messaging (Kafka).... Below is the test : ```public void EnsureEventApiHonoursPactWithConsumer() { string pactPath = Path.Combine("..", "..", "..", "..", // "Consumer.Tests", "pacts", "Poc.Pactflow.Kafka.Consumer1-Poc.Pactflow.Kafka.Producer1.json"); var defaultSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.Indented }; this.verifier .MessagingProvider("Poc.Pactflow.Kafka.Producer1", defaultSettings) .WithProviderMessages(scenarios => { scenarios.Add("a single event", () => new NotificationSmsEvent() { NotificationId = 237, PhoneNumber = "123456789", Message = "event consumed" }) .Add("some stock events", builder => { builder.WithMetadata(new { ContentType = "application/json", kafka_topic = "products" }) .WithContent(() => new[] { new NotificationSmsEvent() { NotificationId = 237, PhoneNumber = "123456789", Message = "event consumed"} } ); }); }) .WithFileSource(new FileInfo(pactPath)) .Verify(); }``` here this.verifier is the PactVerifier object.... Below is the pactfile generated by Consumer test ```{ "consumer": { "name": "Poc.Pactflow.Kafka.Consumer1" }, "messages": [ { "contents": [ { "message": "event consumed", "notificationId": 123, "phoneNumber": "123456789", "something": "123" } ], "description": "some stock events", "matchingRules": { "body": { "$": { "combine": "AND", "matchers": [ { "match": "type", "min": 1 } ] }, "$[*].message": { "combine": "AND", "matchers": [ { "match": "type" } ] }, "$[*].notificationId": { "combine": "AND", "matchers": [ { "match": "type" } ] }, "$[*].phoneNumber": { "combine": "AND", "matchers": [ { "match": "type" } ] }, "$[*].something": { "combine": "AND", "matchers": [ { "match": "type" } ] } } }, "metadata": { "contentType": "application/json", "kafka_topic": "products" }, "providerStates": [ { "name": "A list of events is pushed to the queue" } ] } ], "metadata": { "pactRust": { "ffi": "0.4.0", "models": "1.0.4" }, "pactSpecification": { "version": "3.0.0" } }, "provider": { "name": "Poc.Pactflow.Kafka.Producer1" } }``` this test is passing.... but when I am changing the contract in pact json, the test is not failing .... but when I change the description it fails...... On debugging I found that thr r no events to verify..... Am I missing anything?


svetoldo444ka
2023-05-05 15:35
has joined #pact-net

majhwar.mragni
2023-05-08 16:14
Thanks for the response. I am referring to https://docs.pact.io/pact_nirvana/step_5 From what I understood from your response, in the PR validation pipeline, I'll publish the pact with feature-branch-name. From CI pipeline (on merge) will publish another pact with branch as 'master' Please correct if I misunderstood.

majhwar.mragni
2023-05-08 16:20
W.r.t "not able to get git commit hash" In the PR validation pipeline I can use system.pullRequest.sourceCommitId, which is same as the git commit hash. But, in the CI pipeline I could not find how to get it. There's a predefined variable "Build.SourceVersion". When using this variable, it is totally different from the git commit hash. This way the consumer app version in the feature branch pact comes out to be different from the consumer version in master branch. Would creating consumer app version by using guid generator be better in this case?

arjun.gowda
2023-05-08 17:07
has joined #pact-net

2023-05-09 06:15
This message was deleted.

matt.fellows
2023-05-09 06:18
how are you calling can-i-deploy?

matt.fellows
2023-05-09 06:18
and also, how is your webhook setup?

pallavi.bose
2023-05-09 06:56
I guess I understood my mistake, in Can I deploy for application-name I'd configured only consumer1 I guess I should have 2 can I deploy for 2 consumers. Does application name takes array?

pallavi.bose
2023-05-09 07:20
I tried adding two can I deploy. And it does not work. We did this circus for one reason. We wanted to write generic provider which will test all the consumers. We using Pact3x and for provider test we added consumerselector. existing consumer selector has tag as mandatory field. From feature branches we are not tagging the consumer. So we tried adding consumer selector tag as "*" / null/"" none of them is working. This is actually our correct problem.

pallavi.bose
2023-05-09 07:21
So how can we instruct provider to verify all the latest consumers irrespective of their tag

pallavi.bose
2023-05-09 07:33
ok...we added two consumer selectors now one "*" with latest true And "prod" with latest http://true.It is working fine. Our issue is resolved for now

ravi_shankar_lakkims
2023-05-09 14:10
Hi All, would like to know that.., when we go for on premises PactFlow do we need to setup our own broker?? Can I have a comprehensive differences among on premises Vs SASS

tjones
2023-05-09 14:34
This is a question for #pactflow

valencianaad
2023-05-09 15:05
has joined #pact-net

marlon.jimenez
2023-05-09 17:53
has joined #pact-net

erollins
2023-05-09 18:49
has joined #pact-net

marcos.aruj
2023-05-09 23:39
has joined #pact-net

meritxell.rodriguez
2023-05-10 06:33
has joined #pact-net

yana.kliuch
2023-05-10 08:58
has joined #pact-net

james.brown
2023-05-10 14:01
has joined #pact-net

mark.bursnall
2023-05-10 14:01
has joined #pact-net

alexandru.simion
2023-05-10 14:01
has joined #pact-net

giulio.giovannini
2023-05-10 14:01
has joined #pact-net

razvan.grigorescu
2023-05-10 14:04
has joined #pact-net

henry.rutman
2023-05-10 18:28
has joined #pact-net

simondemartini
2023-05-10 19:53
has joined #pact-net

stefan.kemp
2023-05-11 07:42
has joined #pact-net

supersmile2009
2023-05-11 12:06
has joined #pact-net

lknaresh2
2023-05-11 18:20
has joined #pact-net

siddharth12345
2023-05-12 09:47
has joined #pact-net

siddharth.shetty
2023-05-12 09:51
has joined #pact-net

lukemstorey
2023-05-12 13:52
has joined #pact-net

rana
2023-05-13 20:56
has joined #pact-net

anatoliy.ganzyuk
2023-05-14 20:15
has joined #pact-net

minhajsid
2023-05-15 10:18
has joined #pact-net

artur.ashyrov984
2023-05-15 16:01
has joined #pact-net

jerson.zuniga
2023-05-15 20:25
has joined #pact-net

sekumar
2023-05-15 21:05
has joined #pact-net

jzunigacoayla
2023-05-15 21:41
has joined #pact-net

matthieu.saleta
2023-05-16 09:31
has joined #pact-net

carls.stfleur
2023-05-16 12:20
has joined #pact-net

dale
2023-05-16 16:01
has joined #pact-net

curb1968
2023-05-17 03:41
has joined #pact-net

robert.turner
2023-05-17 12:26
has joined #pact-net

jsanthakumar
2023-05-18 09:47
has joined #pact-net

rmodrego
2023-05-18 09:47
has joined #pact-net

clm.whyte
2023-05-18 09:48
has joined #pact-net

fdonald
2023-05-18 09:52
has joined #pact-net

mgarcia
2023-05-18 09:53
has joined #pact-net

lsantarelli
2023-05-18 10:26
has joined #pact-net

bdocherty
2023-05-18 11:56
has joined #pact-net

srikanth_vemuri
2023-05-18 12:08
has joined #pact-net

perera.x.roshni
2023-05-18 12:16
has joined #pact-net

mohitkrishna.s.s12
2023-05-18 13:23
has joined #pact-net

dwayne.sykes
2023-05-18 16:23
has joined #pact-net

kancharla.g
2023-05-19 03:31
has joined #pact-net

clm.whyte
2023-05-19 16:34
@clm.whyte has left the channel

joseantonionmfilho
2023-05-19 17:46
has joined #pact-net

anenada
2023-05-20 08:06
has joined #pact-net

rabrosimov
2023-05-20 20:11
has joined #pact-net

arm.arturpetrosyan
2023-05-22 10:37
has joined #pact-net

adra_verma
2023-05-22 12:11
has joined #pact-net

p.keshav.chainani
2023-05-22 12:13
has joined #pact-net

divya.s.parappanavar
2023-05-22 12:13
has joined #pact-net

n.duran
2023-05-22 14:38
has joined #pact-net

robert.turner
2023-05-22 15:52
Hello, was wondering if someone can help me out. I cloned the consumer and provider repos for the bi-directional testing examples. They both use a `make` file that references `pactfoundation/pact-cli`. But this does not exist in the repo so it fails. can't see any sign of this folder anyway. Anyone know what the deal is?

cyrus.devnomad
2023-05-22 23:17
Hello I have a question about Pact and API versions. I've found the following question that was already answered before: https://pact-foundation.slack.com/archives/CLS16AVEE/p1680267252981199 So, according to the answers above, Pact is capable of dealing with multiple API versions. I was indeed able to successfully publish a manually prepared swagger.json file with two paths /api/v1/mail and /api/v2/mail to Pactflow. But I wonder whether this is the recommended way? I have doubts because the "dotnet swagger" command, which is the standard command for generating swagger files in dotnet projects, does not seem to support the generation of a swagger file with multiple versions, or at least not in a straightforward way. The "dotnet swagger" command seems to be designed to create one API version per file: For example: dotnet swagger v1 myapp.dll --output v1/swagger.json or dotnet swagger v2 myapp.dll --output v1/swagger.json So, the question arises whether it would be possible to publish two files with two different API versions for the same provider version? Or is one file with two paths the only (and the proper) way to publish two versions for the same provider version? Or generally speaking, what is the proper way to handle versioning of APIs with regards to Pact?

matt.fellows
2023-05-22 23:22
> So, the question arises whether it would be possible to publish two files with two different API versions for the same provider version? Or is one file with two paths the only (and the proper) way to publish two versions for the same provider version? It?s the latter. we only support a single OAS document for a given provider

matt.fellows
2023-05-22 23:22
I?m sure there are tools that can merge two OAS files though, so that could be an option - merge before publishing to PactFlow

matt.fellows
2023-05-22 23:22
Another option is to version the Provider in Pactflow e.g. `ProviderV1` and `ProviderV2`

cyrus.devnomad
2023-05-23 08:47
Ok, I think the solution with merging two OAS files would be good for us. Thank you for your inputs.

garry.wilson
2023-05-23 12:28
has joined #pact-net

verevad
2023-05-23 13:04
has joined #pact-net

jon.arambarri
2023-05-24 07:34
has joined #pact-net

yonatany
2023-05-24 08:14
has joined #pact-net

scoplin
2023-05-24 20:02
has joined #pact-net

david.hvilava
2023-05-25 16:31
Hi guys. I'm exploring https://github.com/pact-foundation/pact-net/releases/tag/4.5.0 PactNet version that introduces *Provider state teardown*. Can someone explain what is a use case of the feature? Description says teardown is supposed to be executed after each interaction. I have interactions that have different provider states. So in this case the same teardown will be applied for different provider states. Also I tried it and noticed that the delegate code is executed only once. Although test log shows several "Running teardown provider state change handler..." message equal to amount of interactions. Here is how I called it: ```.WithProviderStateUrl( providerStateUrl, (e) => { e.WithTeardown(); Console.WriteLine("Provider state teardown executed."); });```

matt.fellows
2023-05-25 22:12
My understanding is that the teardown hook should be per state. The main idea is to reset the particular state that was setup, as there may be multiple

aemanuelson
2023-05-25 23:41
has joined #pact-net

david.hvilava
2023-05-26 08:15
Right, this is what I would expect from that feature

sreenivas.chaitanya
2023-05-26 08:29
has joined #pact-net

tigrandza
2023-05-26 08:46
has joined #pact-net

tigrandza
2023-05-26 08:52
Hey everyone, I wanted to use PACT with our gRPC Services, is there any guide for that?

tigrandza
2023-05-26 08:54
also is there any guide for contribution? the link on the github readme page is broken https://github.com/pact-foundation/pact-net/blob/master/CONTRIBUTING.md

matt.fellows
2023-05-26 09:29
Sounds like a big somewhere

matt.fellows
2023-05-26 09:29
Mind raising an issue please?

david.hvilava
2023-05-26 09:31
Yes, I will

tle
2023-05-26 09:56
has joined #pact-net

david.hvilava
2023-05-26 11:11
@pact544, can you please shed light on the intention of Provider states teardown feature implemented in v4.5.0

matt.fellows
2023-05-26 12:26
Consumer or Provider side?

matt.fellows
2023-05-26 12:26
At the moment, Pact .NET doesn?t support plugins - so that would need to be added to .NET before it can be tested first class

matt.fellows
2023-05-26 12:27
If you just need to verify gRPC contracts, you could using the CLI verifier: https://docs.pact.io/implementation_guides/cli#native-binary-new

yousafn
2023-05-26 12:32
There doesn't seem to have been one created for pact-net. General contributing guides are on our website https://github.com/pact-foundation/pact-net/pull/453

yousafn
2023-05-26 12:34
V4 of the Pact specification will introduce pact-plugins, The precursor of allowing plugins is introducing the spec in this PR https://github.com/pact-foundation/pact-net/pull/453 and then the plugin methods can be applied after probably in a separate PR. Sure Adam wouldn't mind you reviewing that work

yousafn
2023-05-26 12:34
Also FYI It is Pact, not PACT :slightly_smiling_face:

matt.fellows
2023-05-26 12:58
I?ve given up now Yousaf :laughing:

matt.fellows
2023-05-26 12:58
As long as our logo looks like capitalised text, we?re going to have this problem. Maybe we should fix _that_

matt.fellows
2023-05-26 12:58
?how are your design skillz?

yousafn
2023-05-26 12:58
pass

yousafn
2023-05-26 12:58
@shuying.lin to the rescue

yousafn
2023-05-26 13:01
> As long as our logo looks like capitalised text, we?re going to have this problem. Maybe we should fix _that_ I know right, the hypocrisy hurts :joy: https://github.com/pact-foundation/pact-logo Also google says PACT-Python too :grimacing:

adam699
2023-05-26 13:35
has joined #pact-net

mariusz.kapczynski
2023-05-29 12:10
has joined #pact-net

kazimierz.zarychta
2023-05-29 12:10
has joined #pact-net

pierre.zeidan
2023-05-30 13:10
has joined #pact-net

shkothari
2023-05-30 14:55
has joined #pact-net

bwang
2023-05-30 16:55
has joined #pact-net

dev.talha.akbar
2023-05-31 09:45
has joined #pact-net

msiles
2023-05-31 13:50
has joined #pact-net

eli.thorkelson
2023-05-31 18:14
has joined #pact-net

aberman
2023-06-01 23:30
does anyone know how to handle provider states for running provider tests against the actual api? We're using Docker to run it as its own instance against a test db before running the tests.

matt.fellows
2023-06-02 00:19
Provider states require a test-only endpoint to be available. So if you?re running it in docker, you?d need to make sure that endpoint is available

matt.fellows
2023-06-02 00:19
it?s no different whether you?re running in docker or out of it

aberman
2023-06-02 00:25
Can you run it without provider states? How do people normally test against the actual provider?

matt.fellows
2023-06-02 00:26
It?s not a recommended/common scenario.

matt.fellows
2023-06-02 00:26
Pact is best though of as a unit testing tool (it?s not, but that?s the mindset you should have)

matt.fellows
2023-06-02 00:27
You need to be able to test at a very granular level, which is hard to do when testing ?outside? of the box.

matt.fellows
2023-06-02 00:28
> Can you run it without provider states? I don?t think there is a mode to disable them. But why would you want to do that? Then you wouldn?t be able to test those scenarios properly

aberman
2023-06-02 00:28
so how would it actually test the provider for changes? If you're just testing an endpoint you created for the tests, you're not actually testing anything but a test

aberman
2023-06-02 00:29
I'm trying to verify pacts that we have in Pactflow already

matt.fellows
2023-06-02 00:30
The endpoint is the provider state handler endpoint, not a fake version of your API. You definitely need to test your real API (otherwise as you say, it?s not very useful)

matt.fellows
2023-06-02 00:30
Maybe we?re talking across one another. What?s the actual problem you have?

aberman
2023-06-02 00:30
I haven't seen any examples online of anything involving provider states that wasn't fake, unfortunately

aberman
2023-06-02 00:31
which I think is where the disconnect is happening

matt.fellows
2023-06-02 00:31
can you point to an example? Perhaps I can then make sure it?s not misleading


matt.fellows
2023-06-02 00:35
So what?s fake about it? What happens is this: 1. Pact reads the pact file 2. It then loops through the interactions 3. For each interaction, it executes all provider states (i.e. test preconditions) a. This is where a request to the provider state endpoint is called to setup the provider into a state for the real request (to the actual endpoint) to work correctly. e.g. ensuring a user is in the database for a GET /users/:id 200 or ensuring a user is not in the database for a GET /users/:id 404 scenario) 4. The real request to the actual endpoint is sent 5. Pact checks the response

aberman
2023-06-02 00:37
we have a separate call to seed data that is being done prior to this, I'm guessing that typically that's done by the provider state?

matt.fellows
2023-06-02 00:38
correct. What you?re suggesting is reasonable though if it covers all of the states you need

matt.fellows
2023-06-02 00:39
so I think what you?re asking is that tests not fail if the provider state endpoint is not setup/configured? That?s a reasonable ask

aberman
2023-06-02 00:39
do the states ordinarily line up with the pact or is it just a standard add/remove data?

aberman
2023-06-02 00:40
our strategy may have both been under and overthought

matt.fellows
2023-06-02 00:40
the concept of a state is quite abstract - it could be configuring a mock, seeding data into a database etc. Whatever is required to get the system into the state needed for the test.

matt.fellows
2023-06-02 00:41
So the strategy is less important. The state is best thought of as a pre-condition for the test, made explicit into the contract. If it actually doesn?t do anything, that?s also fine - the test is still clear ?User A exists? or ?The fulfilment system is unavailable? etc.

aberman
2023-06-02 00:43
does the provider state endpoint have to be on the provider or can it exist separately?

aberman
2023-06-02 00:43
I think I'm finally starting to understand what is needed here, thanks

matt.fellows
2023-06-02 00:46
> does the provider state endpoint have to be on the provider or can it exist separately? great question - the answer is that it doesn?t matter. It could be a separate test-only API that also can write to the underlying DB (if that?s the state that needs manipulation). Obviously, in-memory stubbing wouldn?t be effective this way, but I think you get the point

aberman
2023-06-02 00:53
gotcha, thanks for all of your help! you just spared me from a hefty migraine :slightly_smiling_face:

matt.fellows
2023-06-02 01:05
No worries! I?ve got it on my list to update the docs page on provider states. This detail needs to be there Hopefully you can sleep easy now :wink:

jegadeesan.ponnusamy8
2023-06-02 16:19
has joined #pact-net

jegadeesan.ponnusamy8
2023-06-02 18:23
@vijaykumar.patel - Could you please share the documentations or any other useful information based on what you have learnt? I am also looking for some more detailed documentation around .NET and Azure Devops. Just to let you know that, I am yet to take look at the links shared in this thread.

siyuanshen1993
2023-06-03 10:36
has joined #pact-net

pawar.s
2023-06-05 05:15
has joined #pact-net

david.hvilava
2023-06-05 12:36
Managed to figure it out :bananadance_smile: In order to have it work as we expect - teardown for each provider state after each interaction, we need to perform these steps: 1. Turn on teardown feature ```.WithProviderStateUrl( providerStateUrl, (e) => { e.WithTeardown(); });``` It will send an extra request to "provider-states" middleware with new property "action":"teardown". 2. In a test you can define Setup and Teardown delegates for each provider state. 3. In "provider-states" middleware call corresponding delegate depending on received "action" property value (for setup use "action":"setup").

david.hvilava
2023-06-05 12:37
Maybe it will help others how got confused by that feature :slightly_smiling_face:

rohitkrishnan
2023-06-05 20:37
has joined #pact-net

matt.fellows
2023-06-06 00:36
Thanks. Perhaps we should document this somewhere on the .NET code base - where do you think would be best David?

payal.chainani
2023-06-06 06:32
has joined #pact-net

payal.chainani
2023-06-06 06:37
Hi Team, could anyone please share the latest PactFlow .Net Workshop Project link here.

divya.parappanavar
2023-06-06 07:23
has joined #pact-net

mrudula.patil
2023-06-06 08:19
has joined #pact-net

asjad.baig.ind
2023-06-06 11:12
has joined #pact-net

rajat.chouhan
2023-06-06 12:16
has joined #pact-net

yonatany
2023-06-06 12:45
The is a way to publish the code from the contract provider to the pact broker without running PowerShell script (directly from code - currently generating local files)


yonatany
2023-06-06 12:54
im using pact-broker publish and im asking if the possibility from the code

matt.fellows
2023-06-06 12:54
Right. What?s the problem with the CLI?

matt.fellows
2023-06-06 12:57
(FYI I?m heading off for the day, but feel free to respond and we can look tomorrow)

aberman
2023-06-06 21:28
Hi again! I'm attempting to troubleshoot provider states in my middleware code, but the only request body ever received by the provider-states endpoint is this: {"action":"setup","params":{},"state":""} I do see all of the tests running and that appears to be in working order, but I don't know why the endpoint never gets anything other than setup as an action with no states being sent. Any ideas on what could be going wrong here? The pact that I am testing was published to Pactflow.

matt.fellows
2023-06-06 23:23
Are there any states in the pact file?

matt.fellows
2023-06-06 23:23
If you set debug logging it should give us some more info

aberman
2023-06-06 23:23
I'm not using a file, the pact is coming from a Pactflow server

matt.fellows
2023-06-06 23:23
Sure, but does the pact have states in it?

aberman
2023-06-06 23:24
I can't tell from looking at it, it's what was published from the consumer

matt.fellows
2023-06-06 23:26
Can you share a screenshot of this page? Or do any of the interactions have a "given ..." in the descriptions?

aberman
2023-06-06 23:27
they just have the line for the endpoint, ie: POST: /api/Employee/Add

matt.fellows
2023-06-06 23:36
Sounds like you don?t have any states - that?s probably the answer

matt.fellows
2023-06-06 23:36
the empty state is a default state that every interaction gets, in order to create a hook to setup/teardown interactions (it?s a framework level feature)

david.stothers
2023-06-07 07:25
has joined #pact-net

rafaela.azevedosouza
2023-06-07 08:52
has joined #pact-net

newmolti
2023-06-07 10:14
has joined #pact-net

danut.turta
2023-06-07 11:35
has joined #pact-net

dev664
2023-06-07 11:53
has joined #pact-net

aberman
2023-06-07 15:00
okay, I'll have to have a talk with the person who's works on creating the pacts on the consumer end. Thanks!

david.hvilava
2023-06-07 17:23
Examples in README.md look simple and do not cover other things. I think updating https://github.com/pact-foundation/pact-net/blob/master/samples/ReadMe/Provider.Tests/ProviderStateMiddleware.cs sample might be useful. I can try to do it when I have free time

david.blanco
2023-06-07 18:08
has joined #pact-net

pact544
2023-06-07 19:12
It's not really a feature of PactNet itself - it's just a URL that you provide, so that could be implemented in a number of ways. You may even have an entirely different service running in a totally different place handling the provider state changes (e.g. by inserting some data into a database that the real service would use).

jonathan.fisher
2023-06-07 19:30
has joined #pact-net

dev.pactslack
2023-06-07 20:17
has joined #pact-net

dan.nichols52
2023-06-08 04:30
has joined #pact-net

s.lohmeier
2023-06-08 08:08
has joined #pact-net

david.hvilava
2023-06-08 08:43
I have never thought in that direction...interesting :+1:

pact544
2023-06-08 09:54
Yeah that's why we don't ship a provider state middleware :+1: You could never possibly cater to all needs without producing lots of different approaches, none of which would ever quite be right. There's an example of how it might be done in the samples section, but that's far from the only way. For example, you may not even be using http://ASP.Net Core, you might be using another web framework entirely. So implementing a provider state handler is an exercise left to the reader, so that the solution they get fits their needs exactly. It's out of scope for PactNet itself to do this.

radek.stolarczyk
2023-06-08 13:32
has joined #pact-net

zeeshankhan0330
2023-06-08 16:36
has joined #pact-net

marek
2023-06-09 07:57
has joined #pact-net

michael.lawrence
2023-06-09 09:57
has joined #pact-net

yonatany
2023-06-11 07:37
Good morning :slightly_smiling_face: someone can show me how can i verify contract on pact broker via the code ( i know how to do it on js but i didn't find how to set publishVerificationResult to be true)


tjones
2023-06-11 08:51
I think there?s an example in here

yonatany
2023-06-11 13:18
maybe im missing something :confused: ConsumerTests are the tests that create the contract or the ones that verify against it? currently, my consumer is verifying against the broker and my provider creating the contract

tjones
2023-06-11 13:22
The consumer tests create the contract (and sends it to the broker) The provider verification takes the contract from the broker, and checks that the provider satisfies the contract

tjones
2023-06-11 13:22
The part I was trying to draw your attention to is this part: ``` verifier.ServiceProvider("My Provider", this.fixture.ServerUri) .WithPactBrokerSource(new Uri("https://broker.example.org"), options => { options.ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true, Latest = true }) .PublishResults(version, results => { results.ProviderBranch(branch) .BuildUri(new Uri(buildUri)); }); }) .WithProviderStateUrl(new Uri(this.fixture.ServerUri, "/provider-states")) .Verify();```

tjones
2023-06-11 13:23
It looks to me like `.PublishResults` is the equivalent of `publishVerificationResult`. But I don?t know for sure - I don?t know .NET

yonatany
2023-06-11 13:25
My contract is event-driven via msgs :

yonatany
2023-06-11 13:25
```var messagePact = GetPactBuilder(contractName, provider, pactDir); var messageBuilderV3 = messagePact.ExpectsToReceive(description).Given(providerState); var configuredMessageVerifier = messageBuilderV3.WithJsonContent(data); await configuredMessageVerifier.VerifyAsync<object>(entityMessageHandler);```



tjones
2023-06-11 13:30
I think you might be confused by the `VerifyAsync` name - that verify isn?t the provider verification

yonatany
2023-06-11 13:30
i did (maybe too many examples) - will take a second look

tjones
2023-06-11 13:30
it?s verifying that the consumer did work

tjones
2023-06-11 13:31
So, in a consumer test, you don?t publish the verification result (because you?re not verifying a contract)

tjones
2023-06-11 13:31
you publish the contract, because you?re creating a contract

mssachin
2023-06-12 08:06
has joined #pact-net

matt.fellows
2023-06-12 12:21
> I think you might be confused by the `VerifyAsync` name - that verify isn?t the provider verification Yes, I think that?s the .NET ?Async? feature (hence why in the example it?s `await`ed, nothing to do with Pact?s event driven model (unfortunate naming, but I can understand why)

matt.fellows
2023-06-12 12:25
I?m pretty sure Tim is right, the option is on the ?source? that you fetch the contract from. In any place you contact a Pact Broker, this option should be available: https://github.com/pact-foundation/pact-net/blob/9eb58b3057eea281fbbd123880c7d327665d17bd/src/PactNet/Verifier/PactUriOptions.cs#L65

andy.frith
2023-06-12 12:31
has joined #pact-net

ajay_886
2023-06-12 22:38
has joined #pact-net

steven.wang06
2023-06-13 05:06
has joined #pact-net

navanesyan
2023-06-13 07:05
has joined #pact-net

yonatany
2023-06-13 07:27
i understood i mixed between them :slightly_smiling_face: this one is for the consumer .VerifyAsync<object>(entityMessageHandler) , and this one is for the provider : .MessagingProvider(producerName, defaultSettings) .WithProviderMessages(scenarios => { scenarios.Add(description, retrieveScenariosActionMethod); }) .WithPactBrokerSource(new Uri(*PactBrokerServiceUrl*), options => { options.EnablePending() .ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true }) .PublishResults(version, publish => publish.ProviderBranch(branch)); _//_ :point_left: _enable publishing results_ }) .Verify(); - thanks for the clarification

navanesyan
2023-06-13 07:31
Hey guys, I have a question. If I understand everything correctly, in nested models of the response we have to define exact values to verify. So if I have this ResonseModel: `class ResponseModel` `{` `public NestedModel NestedModel {get; set;}` `}` `class NestedModel` `{` `public string Name {get; set;}` `}` I have to specify the `Name` 's value as expected, for example with Request id 123, the `Name` is "Andy". I mean, I cannot somehow specify that it is just a string, because pact verifier checks the value (C# is strongly typed language, I cannot assign `IMatcher` to a `string` ). So when I have to change the expected response to be: `class ResponseModel` `{` `public NestedModel[] NestedModel {get; set;}` `}` I do not know the exact values of the other objects in the array. So how should I proceed in this situation?

tjones
2023-06-13 07:35
It's hard to tell without the code formatting (you can use ``` on a new line each side of your code to format your code) , but I think you have it right


matt.fellows
2023-06-13 11:16
Is there a middle ground where you could provide a provider state middleware (or proxy) _and_ allow for a custom URL? We allow this in Node JS and Pact Go. 99% of people use the state handlers, which are essentially functions mapped to named provider states on the verifier

matt.fellows
2023-06-13 11:17
i.e. provide a sensible default that most would just use, and provide a way to ?DIY? it for the advanced user

david.hvilava
2023-06-13 11:32
Good observation, Matt. I agree with Adam that there are might be many ways of implementing it. But let me give an example of my project. We've been digging into Pact and contract testing topic for about year or more. And we created some kind of a wrapper framework for PactNet. That aimed at providing a simplified interface for other developers. So that anybody can kick start it quickly omitting learning curve. For now there are around 20 teams (microservices of our product) that do contract tests along other types of tests. And as I can see not many people understand the topic as I do, simply because they don't have to. For sure I try to provide the same capabilities as PactNet has to not limit our "users". As for PactNet maybe we can enhance existing code sample showing different features or keep documentation relevant. It will help adopters. Maybe I could help with documentation sometime

ran.tao
2023-06-13 21:46
has joined #pact-net

prakhar.roy371
2023-06-14 05:21
has joined #pact-net

john.joel.thetla
2023-06-14 10:16
has joined #pact-net

drew.bowman
2023-06-14 18:05
has joined #pact-net

devwenzel
2023-06-15 08:26
has joined #pact-net

ronen.yurik
2023-06-15 13:34
has joined #pact-net

matthew.finbury
2023-06-15 13:39
has joined #pact-net

anthony.sharp
2023-06-15 13:43
has joined #pact-net

mariane.leite
2023-06-15 15:25
has joined #pact-net

wvkehoe
2023-06-16 10:27
has joined #pact-net

rost.khanyukov
2023-06-16 22:59
has joined #pact-net

mich.krzyzanowski
2023-06-17 15:22
has joined #pact-net

f.barril
2023-06-18 16:58
has joined #pact-net

delboy1978uk
2023-06-20 07:46
has joined #pact-net

hammid.funsho
2023-06-20 22:18
has joined #pact-net

benjamine.nidhin
2023-06-21 12:15
has joined #pact-net

kuksa.vladyslav
2023-06-22 12:47
has joined #pact-net

suryasaharan
2023-06-22 15:41
has joined #pact-net

gabriel
2023-06-22 21:22
has joined #pact-net

gabriel
2023-06-22 21:27
@tjones I found this thread by looking for "Modify the consumer commit pipeline to tag with master branch" which is step B in https://docs.pact.io/pact_nirvana/step_5#tasks Looks like that from step B I'm supposed to publish the pacts again but using the main branch. If tha'ts the case, what is the Step C about? It feels like the same as step B but then again, I'm not sure https://docs.pact.io/pact_nirvana/step_5#c-add-a-step-at-the-beginning-of-the-pipeline-to-apply-the-tag-with-the-name-of-your-main-branch-eg-master-trunk-or-main

tjones
2023-06-22 22:43
I don?t know. They look the same to me.

gabriel
2023-06-22 22:58
tks. I opened a suport ticket regarding it and will move on as if they are the same for now

bgrgincic
2023-06-26 11:00
has joined #pact-net

svilen.popov
2023-06-27 09:44
has joined #pact-net

gabriel
2023-06-27 15:36
@tjones FYI I received feedback from customer support ```Greetings, Thank you for the feedback on the http://Pact.io documentation. The PactFlow team reviewed it and corrected it (C was removed as it seemed that there was no difference between B and C).```

gabriel
2023-06-27 15:42
Before vs Now

matt982
2023-06-27 16:02
has joined #pact-net

matt.fellows
2023-06-28 12:27
Awesome work @pact544 :clap:!

eltonlinconl07
2023-06-28 17:30
has joined #pact-net

carlosmmelo
2023-06-29 07:00
has joined #pact-net

tigrandza
2023-06-29 09:07
Hey everyone, how should I add option `ignoreContractValues` attribute in generated pact json ?

prerit.jain849
2023-06-29 09:40
has joined #pact-net

matt.fellows
2023-06-29 10:46
What is `ignoreContractValues` (note: I don?t know .NET but it?s not a Pact concept I know of)

tigrandza
2023-06-29 11:00
there was another library called Pactify, I have seen that attribute in the generated pact json and thought that it is part of the specification


matt.fellows
2023-06-29 11:01
right, yeah, Pactify is something else entirely. It?s not clear from the readme what `ignoreContractValues` is intended to do though?

tigrandza
2023-06-29 11:02
so my question is more is there an option in Pact .net library to ignore those values in the contract itself as it allows to ignore the values and focus on the contract itself

tigrandza
2023-06-29 11:02
we had a question here, which is unanswered still https://pact-foundation.slack.com/archives/C9UTHV2AD/p1686641476114129

tigrandza
2023-06-29 11:03
maybe it will give you more context

matt.fellows
2023-06-29 11:06
The wording is very confusing, but I think the ask is - can you be looser on the matching, rather than match on exact values?

matt.fellows
2023-06-29 11:07
if so, the answer is yes and the terminology for that in Pact is calling ?matching? and you use a ?Matcher? to specify how flexible it should be

matt.fellows
2023-06-29 11:07
sorry for the delay, I think you want to look at the concept of Matchers

matt.fellows
2023-06-29 11:07
they allow you to specify the shape of response rather than match on exact values

sssona09
2023-06-29 11:12
has joined #pact-net

sssona09
2023-06-29 11:47
Hi so I want to test my provider implementation. I know you usually first create consumer tests and the contract is made from that, but my lead told us to set up Pact for the provider first. Does it make sense to pretty much use the example here, "Verifying a Provider" https://github.com/pact-foundation/pact-net . Since we wouldn't have a contract file at this stage, I would comment that part out for now? In the example, where is the Pact contract file?

tigrandza
2023-06-29 12:06
that was exactly what we were looking for, but we had problems with it to, let us try a bit more with those Matchers and come back with our questions or maybe answers :slightly_smiling_face: thanks

antonio.blandon
2023-06-29 20:40
has joined #pact-net

navanesyan
2023-06-30 11:05
@matt.fellows thanks for your response. Actually, I have an object with Dictionaries inside it, and I cannot figure out how to specify the pact. When I define the response as Dictionary<IMatcher, IMatcher>, for example: `var response = new {` `JobInfosMap = new Dictionary<IMatcher, IMatcher> {` `{Match.Type(900L), Match.Type(new JobInfo{Id = 900, Number = "900", Name = "Clogged Drain", StartDate = DateTime.Parse("6/13/2023 6:00:00 AM")} )}` `}` `}` the generated pact is: `"jobInfosMap": {` `"pactNet.Matchers.TypeMatcher": {` `"endDate": null,` `"id": 900,` `"name": "Clogged Drain",` `"number": "900",` `"startDate": "2023-06-13T06:00:00Z"` `}` `},` which means that the key is of type `pactNet.Matchers.TypeMatcher` , but the key is of type `long` as I define in `Match.Type(900L)` . So how to be with Dictionaries?

tigrandza
2023-06-30 13:38
seems the key Matcher is not there? in the pact

navanesyan
2023-06-30 13:43
in JSON it is just an object with keys and values, where the keys are just names, not changing values. It is in the Dictionary that the keys actually are changing values, and it's the C# deserializer that makes a Dictionary out of JSON object.

tigrandza
2023-06-30 13:48
gotcha

arjun
2023-07-02 04:23
has joined #pact-net

matt.fellows
2023-07-02 04:26
I don't think you can apply matches to keys in Pact .NET. Do you have dynamic keys or dynamic values?

divya.parappanavar
2023-07-03 06:25
Hi Team, In our application previously, we were using PactNet 3.0 NuGet package and in the code, we are using IMockProviderService for mocking the consumer test cases which was working fine. Consumer test cases were running successfully. Now we upgraded PactNet NuGet to the latest version of 4.5.0. After upgrading to the latest, we are getting error saying "*the type or namespace 'IMockProviderService' could not be found (are you missing a using directive or an assembly reference)*". Can anyone please help us in this regard?


adwait.damle
2023-07-03 06:39
has joined #pact-net

sssona09
2023-07-03 06:44
hi team, how can i setup verification if i don?t have a pact file / consumer tests? I can?t find an example so if anyone could help link me one, i?d appreciate it

divya.parappanavar
2023-07-03 07:14
Thanks a lot :slightly_smiling_face:

matt.fellows
2023-07-03 07:31
So if there are no consumer pacts to verify, what are you planning on verifying?

matt.fellows
2023-07-03 07:32
It?s presumably hosted in the broker, that?s how you should be verifying. Dynamically discovering consumers, and validating their contracts

matt.fellows
2023-07-03 07:33
I think if you?re new to Pact, you?re best creating a dummy contract to verify, publishing it to PactFlow, and then going through the process to verify it. Then when a real consumer comes along, 99% of the work is done

sssona09
2023-07-03 07:41
there will be consumer pacts, we just haven?t implemented them yet and my task is to setup pact with the microservice even though there?s no pacts yet


sssona09
2023-07-03 11:28
thank you!!

stan.amsellem
2023-07-03 14:00
has joined #pact-net

cobookman
2023-07-03 21:14
has joined #pact-net

anshu.behera.02
2023-07-04 07:01
has joined #pact-net

2023-07-04 10:29
This message was deleted.

adam.strawson
2023-07-04 13:24
has joined #pact-net

mathewsa
2023-07-04 15:20
has joined #pact-net

olopezs
2023-07-04 16:03
has joined #pact-net

tjones
2023-07-05 04:42
We can't really answer this, as it is about your project structure. Usually your consumer tests would live alongside the other unit tests for your consumer.

tonis.ojandu
2023-07-05 06:51
@tonis.ojandu has left the channel

nithesh
2023-07-05 08:14
has joined #pact-net

andre.tartarelli
2023-07-05 11:26
has joined #pact-net

laura.huysamen
2023-07-05 12:38
has joined #pact-net

goatleyj11
2023-07-05 12:43
has joined #pact-net

lily.oconnell
2023-07-05 15:32
has joined #pact-net

jegadeesan.ponnusamy8
2023-07-05 16:58
Hello guys, We have set of microservices running in AKS cluster. These services uses DaprClient to interact with reach other. As we are implementing Pactflow for contract testing between the services, I was wondering whether it is possible to mock daprClient using PactNet or anyother work around to be followed here..

mohanraj.r
2023-07-05 19:53
has joined #pact-net

navanesyan
2023-07-05 20:21
if by 'dynamic' you mean that they depend on request arguments, yes....in Dictionary both keys and values are dynamic

matt.fellows
2023-07-06 00:21
?and your consumer project would normally not live alongside your provider code base (unless you have a monorepo)

matt.fellows
2023-07-06 01:03
I mean, could you describe the possible set of keys with something like an OpenAPI file, or are they arbitrary in nature and could be basically anything?

matt.fellows
2023-07-06 01:03
If the former, then you shouldn?t need to match on the _keys_, but matching on values is normal. That?s what most of the Matchers ar efor

ianlutz
2023-07-06 01:34
has joined #pact-net

rohit.m.patil27
2023-07-06 03:51
has joined #pact-net

rohit.m.patil27
2023-07-06 03:56
Hi Gm Team . i need some guidance. i want to pact framework using DOTNET and rest client any one can provide support ? i will pay charges

matt.fellows
2023-07-06 05:01
Hi Rohit, could you please elaborate a bit on your needs? There are some people that come to mind, but we?d need a little more. For example, the scope of help you?d like, budget etc. Have you looked at the pact tutorials and other educational material and if so, what specific challenges are you having?

rohit.m.patil27
2023-07-06 05:08
my organization want to develop contract testing technology using pact with dotnet and restclient . so i need to create framework and how to implement in project [10:35 AM] if u have any ready framework plz send me and also guide me how i can implement [10:36 AM] i will pay whether your charges [10:37 AM] and i need framework this framework i will use in my projec

matt.fellows
2023-07-06 05:12
What do you mean by a ready ?framework??

matt.fellows
2023-07-06 05:12
Pact itself is a framework, are your referring to some framework built on top of Pact? And if so, what would that framework do that Pact doesn?t?

timo.schwarzer
2023-07-06 06:18
has joined #pact-net

kuntol.banerjee
2023-07-06 06:54
has joined #pact-net

adebakre
2023-07-06 11:28
has joined #pact-net

jegadeesan.ponnusamy8
2023-07-06 13:54
To add more.. I made this working by passing Consumer context mockserver uri to DaprClientBuilder and build a DaprClient. But now, I am facing issue with the "Path" i.e. I need to pass the path as "/v1.0/invoke/daprAppServiceId/method/{myapiurl}". "/v1.0/invoke/daprserrviceId/method" is appended by daprclient, which I dont have any control over it. Is there a way to override the Path match rule or to match "contains" instead of "exact" in PactNet?

navanesyan
2023-07-06 14:28
No, they are not a known set of keys. Although they are named keys, they are not names of fields. In fact they are values that change depending on the request. That's the problem..

rajkumarbapuvrs
2023-07-06 17:35
has joined #pact-net

matt.fellows
2023-07-06 23:22
gotcha

matt.fellows
2023-07-06 23:22
I don?t think Pact .NET has the matcher for that yet

matt.fellows
2023-07-06 23:22
but you could raise a PR


divya.parappanavar
2023-07-07 05:57
Hi Team, We are working on Pact Kafka With Message Interactions. We have deployed Consumer and Provider test cases to GitLab CICD pipeline. Consumer test cases are executed successfully. But facing an issue with Provider test cases. Provider test cases are executing successfully in our local Visual Studio and the verification results are getting published to Pactflow with 'Success' status. We are getting the below error on running the Provider test cases in GitLab: *System.PlatformNotSupportedException : The information requested is unavailable on the current platform.* Can anyone help us in this regard.

matt.fellows
2023-07-07 07:53
So the obvious question is what platform is it running on? Do you know which component is throwing that error?

divya.parappanavar
2023-07-07 08:27
Below is the stack trace: *System.PlatformNotSupportedException : The information requested is unavailable on the current platform.* *Stack Trace:* *at http://System.Net.NetworkInformation.StringParsingHelpers.ParseActiveTcpListenersFromFiles(String tcp4ConnectionsFile, String tcp6ConnectionsFile)* *at http://System.Net.NetworkInformation.LinuxIPGlobalProperties.GetActiveTcpListeners()* *at PactNet.Verifier.Messaging.MessagingProvider.FindUnusedPort()* *at PactNet.Verifier.Messaging.MessagingProvider.Start(JsonSerializerSettings settings)* *at PactNet.Verifier.PactVerifier.MessagingProvider(String providerName, JsonSerializerSettings settings)*

jorge.carneiro
2023-07-07 09:43
has joined #pact-net

yousafn
2023-07-07 11:37
> what platform is it running on

divya.parappanavar
2023-07-07 11:42
We are trying to run it on GitLab and we have used .Net framework.

yousafn
2023-07-07 11:42
what operating system and processor

yousafn
2023-07-07 11:42
you?ve already told us the other bit

divya.parappanavar
2023-07-07 11:44
sorry. Its Windows 10 and Processor is 11th Gen Intel(R) Core

carlleferink
2023-07-07 12:01
has joined #pact-net

tigrandza
2023-07-07 12:26
There is vulnerability in the current NewtonSoft Json library version used in http://Pact.net source code, not sure if it is issue. Details under the thread


matt.fellows
2023-07-07 14:50
Can't see how a dos issue would be an issue for a test tool. Is it just needing a version bump?

tigrandza
2023-07-07 14:59
yes it is

matt.fellows
2023-07-07 22:29
Mind opening a pr?

tjones
2023-07-08 12:21
We should probably enable dependabot for that repo.


tjones
2023-07-10 02:51
It?s hard to answer without the relevant details (like error messages etc)


tjones
2023-07-10 02:51
also our guidelines here howtoask

2023-07-10 02:51
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

divya.parappanavar
2023-07-10 05:26
Hi Team, Can anyone help us with the above issue. We are really stuck here.

divya.parappanavar
2023-07-10 07:20
Hi Team, How to add the authentication token in Provider test cases? PactVerifierConfig was having CustomHeaders property in 3.0 version of PactNet. But the latest version 4.5 is not having this property. Can anyone please help how to use the token generated in Provider testcases with newer version of PactNet.

anju.ashk
2023-07-10 07:39
has joined #pact-net

matt.fellows
2023-07-10 07:59
The latest version lets you use a custom header, what have you tried so far?

matt.fellows
2023-07-10 08:00
see howtoask. Ideally, a build (e.g. using GitHub actions) that demonstrates the problem would help. The Pact .NET project currently runs on all common OS/arch combinations, so something must be different about your setup. You need to help us understand this difference

2023-07-10 08:01
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

divya.parappanavar
2023-07-10 08:02
I was trying to use the customheader property like below: var config = new PactVerifierConfig { Outputters = new List<IOutput> { new XUnitOutput(_outputHelper) }, //Custom header CustomHeader = new KeyValuePair<string, string>("testId","test123"), // Output verbose verification logs to the test output Verbose = true }; But it says PactVerifierConfig does not contain a definition for CustomHeader

matt.fellows
2023-07-10 08:04
I?d suggest you take a look at the latest API then


divya.parappanavar
2023-07-10 08:06
Yes exactly. Is there any example on how to add this custom header with latest version using .Net?

matt.fellows
2023-07-10 08:16
I don?t know, but it looks pretty obvious to me. It?s a method adjacent other very important methods you would have to call . Does this example help? https://github.com/pact-foundation/pact-net/blob/master/samples/OrdersApi/Provider.Tests/ProviderTests.cs#L69 I think it would just be added after `WithHttpEndpoint`

john.joel.thetla
2023-07-10 08:54
Hi @yousafn Nabi (http://pactflow.io), I have been following your example at https://github.com/tjohnjoel/example-provider-dotnet is there a way to authenticate a provider Api using pactNet latest version.

matt.fellows
2023-07-10 08:59
Hi John, please avoid `@` ing people

matt.fellows
2023-07-10 09:00
what do you mean by ?authenticate??

divya.parappanavar
2023-07-10 09:06
The latest version of PactNet does not contain the definition for 'WithHttpEndpoint'

john.joel.thetla
2023-07-10 09:14
The provider Api uses a Jwt authorization header to access, I am trying to add a Bearer key in provider side testcase for a successful execution. According to PactNet 4 migration document https://github.com/pact-foundation/pact-net/blob/master/docs/upgrading-to-4.md It is recommended that verification tests run without authentication, but what if I have to use an authentication token. Is there a workaround for this?

yousafn
2023-07-10 09:20
has it ever worked? have you spoken to whoever administers your gitlab instance. i assume gitlab isn?t running on the windows machine, as it?s a linux program

rmahadeorathod
2023-07-10 09:48
has joined #pact-net

ekaterina.essina
2023-07-10 09:59
has joined #pact-net

arca.artem
2023-07-10 10:00
has joined #pact-net

matt.fellows
2023-07-10 10:42
Which version? It looks like it was added a year ago and should be in the latest 4.x.x and 5.x beta: https://github.com/pact-foundation/pact-net/commit/cc4c5ae48f134728bc87f151d4f7f1f4ef5343ca

matt.fellows
2023-07-10 10:43
You're right that the `WithHttpEndpoint` is not in the latest stable, but I hope you can piece together the rest

matt.fellows
2023-07-10 10:45
Have you read howtoauth ?

2023-07-10 10:45
Approaches to handling authentication in Pact tests: https://docs.pact.io/provider/handling_auth

connor.stevens
2023-07-10 11:35
has joined #pact-net

rmahadeorathod
2023-07-10 11:45
Hi team, we are doing POC on contract testing using pact, we need help for implementing pact flow, please share the resources


yousafn
2023-07-10 11:52
are you just trying to add one when it doesn?t exist, or validate that it does exist, is the correct format and then update it.? https://github.com/you54f/pact-workshops here is some examples of the pact-net workshops which show auth mechanisms. I believe there is a withCustomProviderHeader func, there was a gh issue about it recently in pact-net which is work a look

rmahadeorathod
2023-07-10 13:05
thanks, is there any demo framework available for learning and understanding purpose using .NET RestClient.

yousafn
2023-07-10 13:11
can you provide a basic repro of your test, or more logging output. If you can provide a repro codebase, and more details of the gitlab setup, on-prem/hosted, which runners/executors you are attempting to run the provider test on. You mentioned ? locally on windows 10 - x86_64 ? consumer tests pass ? provider tests pass ? on a gitlab executor ? consumer tests pass ? provider tests fail By sharing a repro it helps us understand the setup of your test and the versions of libraries you are using. without this it is very difficult to help, we aren?t a general support helpdesk so asking a good question will help incredibly. > Provider test cases are executing successfully in our local Visual Studio and the verification results are getting published to Pactflow with ?Success? status. I assume this was just for testing purposes (publishing of verification results) as it isn?t recommend to do that from a local machine

sssona09
2023-07-10 13:17
hi team, I am going to write Provider tests to verify my contract, and this will work by running my service in conjunction with the tests. Is this a standard approach? Also, in that case, would I still need to create a TestStartup.cs and ProviderStateMiddleware as seen in the examples? My endpoint GET method is simple and just returns a list of hardcoded string values at the moment. The example I'm referring to: https://github.com/pact-foundation/pact-net/blob/9a4aea964ed6d176adcc566bc138badff8aa47eb/samples/OrdersApi/Provider.Tests/TestStartup.cs#L9

yousafn
2023-07-10 13:24
Don?t think so, not that I?ve seen. The basic principles of Pact apply regardless which .NET example or tutorial you choose, but the actual implementation detail depends on your project structure.

matt.fellows
2023-07-10 22:31
If you don?t have provider states now, but envisage needing them in the future then you may as well get it ready.

matt.fellows
2023-07-10 22:32
Most Pact suites will have them, so if your goal is to be prepared for when you have real consumers then I would

matt.fellows
2023-07-10 22:32
Running your provider locally is what you should be doing, if that?s the question?

sssona09
2023-07-10 22:56
alright thank you! makes sense

rohit.m.patil27
2023-07-11 05:38
hi team .Can we implement pact flow in dot net pact framework? If yes, where can I get a sample or code .

matt.fellows
2023-07-11 05:40
what have you tried searching so far?

rohit.m.patil27
2023-07-11 05:41
how to implement pact flow in existing code

anju.ashk
2023-07-11 06:53
Hi, I tried to do the pact broker setup using cli in windows OS , and facing issue, Kindly provide steps to resolve!

matt.fellows
2023-07-11 07:06
Can you please provide some more information about your setup, what problem you are currently running into (e.g. the commands you?re running) and any other relevant info? Think about somebody trying to answer your question - what information would they need to be able to help?

anju.ashk
2023-07-11 07:21
I followed the steps in official website for pact broker using cli readme file, below is the url for same: https://docs.pact.io/pact_broker/advanced_topics/using-tls#for-non-jvm I am performing docker compose up and facing the below error:

pgeurtsen
2023-07-11 07:30
has joined #pact-net

matt.fellows
2023-07-11 07:35
is the broker running on your machine or somewhere else?

matt.fellows
2023-07-11 07:35
what commands are you passing to get that error?

rjurca
2023-07-11 08:22
has joined #pact-net

sssona09
2023-07-11 11:21
also with the URI we provide in the provider test, is it any random URI on localhost? and that runs our API since we add our actual services to the IServicesCollection ?


rmahadeorathod
2023-07-11 12:25
@yousafn need help regarding implementation of pactflow in the existing framework from the scratch, kindly help us with the required basic to advance resources.

yousafn
2023-07-11 12:27
They are linked on that page, https://docs.pactflow.io/docs/examples/dotnet/consumer/ https://docs.pactflow.io/docs/examples/dotnet/provider/ You probably won?t find hand held based instructions and they will require some investment from your side

yousafn
2023-07-11 12:28
You have already been provided several resources, by community members and maintainers, I would strongly suggest you read them

yousafn
2023-07-11 12:52
https://docs.pact.io/help/how_to_ask_for_help#4-ask-a-good-question If you can provide a public sample of your code base (you mentioned RestClient) someone could help apply Pact to that, otherwise as shown there are examples live today you can run, either locally or in CI via GitHub actions

frederic.vaugeois
2023-07-11 14:12
has joined #pact-net

marko.lamberg
2023-07-11 15:27
has joined #pact-net

sssona09
2023-07-12 04:05
hi all, my .NET service has a WebApplicationBuilder instance and services are added in a method call in Program.cs "builder.AddServices(). Here is where we do builder.Services.AddOptions, Configure, AddServices etc. Should my Provider test still use the Startup.cs and TestStartup.cs ? And I add the services as shown. Also do I use any port for serverUri? https://github.com/pact-foundation/pact-net/blob/9a4aea964ed6d176adcc566bc138badff8aa47eb/samples/OrdersApi/Provider.Tests/ProviderTests.cs

divya.parappanavar
2023-07-12 08:08
Hi Team, I'm getting this error 'PactBuilder is inaccessible due to its protection level' in the new version of PactNet 4.5. This was working fine with Older version of PactNet 3.0. Can anyone pls guide me whats needs to be done here.

matt.fellows
2023-07-12 09:17
You need to review the migration guide from the previous major version .Previous code won't just magically work

lshilling
2023-07-12 09:31
has joined #pact-net

anju.ashk
2023-07-12 10:01
Broker is running on my mahcine. and running docker compose up

matt.fellows
2023-07-12 10:34
What command are you running that?s failing? Can you please show how the broker is running? What IP is it on? What port is it running on?

anju.ashk
2023-07-12 11:20
I restarted the pact broker setup and facing issue while performing bundle install/ gem install pact_broker-client below is the snap of error:

matt.fellows
2023-07-12 12:16
are you on a corporate laptop? Do you get that issue on a personal one? If so, it could mean there is an intermediate proxy on your corporate machine

matt.fellows
2023-07-12 12:16
see howtoproxy


divya.parappanavar
2023-07-12 13:01
Hi Team, We are getting pipeline error on GitLab for Provider test cases and Consumer test cases ran successfully. we are getting the below error: *Failed to load pact (https://...)error trying to connect: Connection reset by peer (os error 104)* Can anyone pls help us.

rudydc
2023-07-12 17:53
has joined #pact-net

bas
2023-07-13 11:58
How is this a .NET related question, @divya.parappanavar? Is this a question about publishing / verifying contracts? Did it work previously? Or has it never worked? Are you pushing contracts to the same broker on the same GitLab Agent? Is this a self-hosted agent or a cloud / public instance? Have you tried adding a step that performs a cUrl with the right API call to see what the response is?

wesley.newcomb
2023-07-13 15:54
has joined #pact-net

divya.parappanavar
2023-07-14 08:41
Hi Team, We understand you would need the code to understand the issue. But there are a lot of things in that code that can't be elaborated/explained via chat. Also, any explanation on anything would require a lot of to and fro. Is there a way we can have a session via smart bear support team for this?

anju.ashk
2023-07-14 09:28
ok, I will discuss with team internally

joris.vaneijden
2023-07-14 10:56
has joined #pact-net

matt.fellows
2023-07-14 11:01
Best to reach out to your account manager directly to organise that.

matt.fellows
2023-07-14 11:04
Might I suggest starting with a super basic example code that doesn't have any commercial/sensitive info in it? That will be helpful no matter which support path you take. Once you can reproduce the issue there it will be easier to track down the root cause. Remember this workspace is monitored by non SmartBear community members also, and Pact .NET is a community maintained project.

prakhar.roy371
2023-07-14 12:59
Hi all, My .net code for provider is on gitlab at the moment. (NOTE : Consumer pacts are already published on pact broker and are in unverified state) The piece of code (as shown in screenshot) is doing its job correctly when I run it from local. (i.e. pact getting verified) But when I am running it via my git cicd job, the job is successful, but my pact on the broker is not getting verified. All I am doing in that job is running the tests present in provider side for verification. (See git yaml script for job in ss below) Can someone help me find what I may be missing here?

yousafn
2023-07-14 13:25
the pact url should be a url of a pact to verify, not the endpoint of the latests pacts for a consumer/provider, that will be terribly undeterministic. there should be two types of provider build, one that runs everytime a provider build runs, and verifies any pacts via consumer version selectors. the uri source is for webhooks, where a single pact requiring verification triggers a provider verification task to verify that specific pact

yousafn
2023-07-14 13:26
you version numbers should not be hard-coded either, they should be set to a variable that describes your point in code, ideally a git commit but it may be some other identifier in your org. It would help if you provided context for others as your setup for publishing and what state the pending pact is in, does it have a version/branch/tag.

yousafn
2023-07-14 13:34
I?ve taken the .NET PactFlow examples which aren?t message based ( REST based ) and got the basic workflow without webhooks working in SaaS GitLab https://gitlab.com/YOU54F/example-consumer-dotnet https://gitlab.com/YOU54F/example-provider-dotnet Feel free to use this as a basis to create a repro or see if you can get it working in your environment. It isn?t clear yet, as to your setup so some assumptions have been made 1. SaaS GitLab 2. SaaS GitLab provided runners a. Tested with Linux x86_64 runner 3. Messaging vs Rest isn?t the issue, as you have just mentioned provided test cases fail a. So we are using our tried and tested REST examples If any of these assumptions are incorrect, please clarify

prakhar.roy371
2023-07-14 15:20
Hey Yousaf, this is more like in demo phase right now. Will look into the hard coded values. *Update on the above issue.* Figured out the issue. At least now, the gitlab provider job is verifying and publishing on the pact broker. But it is failing right now. The test is failing with the following error. *"Request Failed - One or more of the setup state change handlers has failed"* _But the same is working when running test cases from local (visual studio)._ *(Please refer to above screenshot of test case and the logs attached to this message)*

yousafn
2023-07-14 15:26
Hey no worries, that explains it :slightly_smiling_face: do you have a provider state url in your test? it will be trying to hit an endpoint on your service to set the state but your service is returning a 407

tushar.adsul223
2023-07-14 15:29
has joined #pact-net

tushar.adsul223
2023-07-14 15:33
do net pact how to publish pact contract to pact flow broker .Please send steps and code

yousafn
2023-07-14 15:35
pact-net v4+ does not support pact broker client tool functionality anymore, you need to install the pact-cli tools. The docs for publishing are here https://docs.pact.io/pact_broker/client_cli/readme#pacts

divya.parappanavar
2023-07-14 15:39
Hi Team, I am writing the code for Kafka with PactNet version 4.5.0 by referring to the below link https://github.com/pact-foundation/pact-net/blob/master/docs/messaging-pacts.md I am getting error on this piece of code for Provider test cases. Its actually not working at all in Visual studio. Can anyone suggest me with any link/docs so that I can refer to the same for writing testcases for Provider.

tushar.adsul223
2023-07-14 15:40
sry i want code for pact flow .

yousafn
2023-07-14 15:45
its the same command, you just pass it your token rather than a username and password and your broker url


yousafn
2023-07-14 15:51
does it work from the command line? have you had the code running at all? the reason I ask, is it could be a vscode setting

divya.parappanavar
2023-07-14 16:28
No it dint work at all. I have just copied the code from the reference link which i sent and tried to replace it with my data.

divya.parappanavar
2023-07-14 16:29
With some modification it will work. But test cases are getting failed.

sssona09
2023-07-17 04:46
for the Server URI in provider tests, so i give the local host server with the port my app runs on, or any port is fine?

matt.fellows
2023-07-17 04:54
Your app

matt.fellows
2023-07-17 04:54
It's the target of the test

divya.parappanavar
2023-07-17 06:20
Hi Yousaf, This is the first time we are trying to test with Kafka. We are using PactNet 4.5 version. Can you pls give me any other links.

prakhar.roy371
2023-07-17 06:37
The build is going through the same piece of code as when we build in local, right? Why is it working from local and not from git? Is there anything we can do on the CICD job to overcome this issue, @yousafn?

prakhar.roy371
2023-07-17 07:47
We are using proxy to access the external pact broker. (Shown in job screenshot) Then we are getting 407: Proxy Authentication Required Are we missing something here?

anju.ashk
2023-07-17 09:04
Hello, I tried running my consumer test and I am getting following error in snap: I am using rest sharp. Kindly help to resolve this issue.

matt.fellows
2023-07-17 09:07
That error is pretty self explanatory. Are you making a call to the endpoint shown? Note: you must hit the pact mock server, not the real thing

matt.fellows
2023-07-17 09:07
See the examples

anju.ashk
2023-07-17 09:29
I am making call to below LOCALHOST server: Which configuration am I missing

matt.fellows
2023-07-17 09:56
Ots your API client that needs to make the call to the mock server. What does that log file say?

anju.ashk
2023-07-17 11:03
Snap of log file is as:

anju.ashk
2023-07-17 11:07
Will debugging i am getting proper response from api server as well but mocker provider service verification is failed.

anju.ashk
2023-07-17 11:08
Mock server response is as below;

matt.fellows
2023-07-17 11:12
It?s really clear, your API client needs to send the request to the Pact mock server, and it?s not currently doing that in the test. Find the code in your test that sends the API call, and check that the call is not going to the real server, but the Pact provided mock service

francisco.almeida
2023-07-17 11:35
has joined #pact-net

mike.lovely
2023-07-17 12:12
has joined #pact-net

kyam.harris_pact
2023-07-17 12:51
has joined #pact-net

drettie
2023-07-17 13:23
has joined #pact-net

mburns
2023-07-17 13:24
has joined #pact-net

amit.jadhav
2023-07-18 06:19
has joined #pact-net

anju.ashk
2023-07-18 07:29
Hello, Should I follow these steps mentioned in link: https://github.com/pact-foundation/pact-mock_service?

matt.fellows
2023-07-18 07:49
No, that is implementation detail you shouldn?t need to be aware of

matt.fellows
2023-07-18 07:50
Perhaps you share with us the code that tests your API client, that?s the bit that matters


matt.fellows
2023-07-18 07:51
it?s testing the API client, but is giving the URL of the mock service to the API client so that it sends the request to the mock service (automatically provided by Pact), not the real API

matt.fellows
2023-07-18 07:51
This is almost certainly where you?re going wrong

anju.ashk
2023-07-18 08:10
I will make changes, attaching my current project for reference.

matt.fellows
2023-07-18 08:38
Your API Client class doesn?t do anything with the `baseUri` given to it

matt.fellows
2023-07-18 08:40
```using ContracttestingPACT.Model; using Microsoft.AspNetCore.WebUtilities; using Newtonsoft.Json; using PactNetV3BrokerConnect.Model.PactV11; using RestSharp; using System.Diagnostics; using http://System.Net; using Xunit; namespace ContracttestingPACT.Common { public class ApiClient { private string postURL = "https://dummy.restapiexample.com/api"; // <- this is always used private RestClient _client; public ApiClient(string baseUri = null) { _client = new RestClient(postURL); // <- baseUri is ignored } public UserResponse TestPOSTMethodWithJsonData() { var request = new RestRequest(postURL + "/v1/create", http://Method.Post); // <- the URL looks to be hard coded here to postURL anyway request.AddParameter("name", "test"); request.AddParameter("salary", "123"); request.AddParameter("age", "23"); request.RequestFormat = DataFormat.Json; request.AddHeader("Content-Type", "application/json"); var response = _client.ExecutePost(request); // <- this sends the request to "https://dummy.restapiexample.com/api" var content = response.Content.ToString(); if (response.StatusCode.Equals(System.Net.HttpStatusCode.OK)) { return !String.IsNullOrEmpty(content) ? JsonConvert.DeserializeObject<UserResponse>(content) : null; } throw new Exception(); } } }```

aljaz.klanecek
2023-07-18 08:58
has joined #pact-net

amitw
2023-07-18 15:15
has joined #pact-net

fkelly
2023-07-18 17:28
has joined #pact-net

phananhdung104
2023-07-18 18:28
has joined #pact-net

gurubabu.jampala
2023-07-19 01:02
has joined #pact-net

a.kravchenko357
2023-07-19 11:03
has joined #pact-net

anju.ashk
2023-07-19 13:58
Done the changes, still I am getting error.

thiagotrinta
2023-07-19 20:00
has joined #pact-net

sssona09
2023-07-20 00:21
hello, so currently I only have an endpoint that does a GET request (and uses hardcoded data, no repository) so I was wondering how exactly i would implement provider states, since all examples use a repository. Should I make a test repository perhaps, since it would help consumers in the future, if I implement provider states?

matt.fellows
2023-07-20 00:31
> since all examples use a repository they do that because they are examples that have a CRUD database. Whatever the repository equivalent is you should implement in your state handlers. If the state involved stubbing a 3rd party API, do that. If it involves stubbing a database, you could inject data into the database or replace it with a stub. The provider state is orthogonal to implementation (by design). Consumers need not know the implementation detail of the provider (information hiding). So do whatever is most natural in the provider code base (I prefer stubbing, FWIW)

matt.fellows
2023-07-20 00:43
What error are you getting?

sssona09
2023-07-20 00:45
Great thanks! yeah I think I'd prefer to stub my database then

matt.fellows
2023-07-20 03:23
I can see the problem, but I want to see what errors you are getting to debug the situation

anju.ashk
2023-07-20 05:44
During debug , I am getting error in this line

matt.fellows
2023-07-20 05:57
there should be logs that show the problem

matt.fellows
2023-07-20 05:58
make sure the path in your API client matches the path you said it would send in the test

matt.fellows
2023-07-20 05:58
they don?t line up in the code you gave me

anju.ashk
2023-07-20 06:13
Log:

anju.ashk
2023-07-20 06:14
dummy api I am trying to test

matt.fellows
2023-07-20 06:39
That?s not what is defined in your pact test

matt.fellows
2023-07-20 06:39
Also, I want to see the log file that Pact produces. Please see the pact docs for your version on how to do that

matt.fellows
2023-07-20 06:39
(presumably it should be logged to a console)

matt.fellows
2023-07-20 06:40
I?m sorry, but I can?t help you write code in .NET (I don?t know .NET). But the error is really really clear - your API client is not sending the request to the Pact mock server in the way you have setup the test.

anju.ashk
2023-07-20 08:24
I have solved all issues and error now my coding is running and verification is also happening the only issue is with generation of contract pact file which is not happening, if u can look into the project and let me know with resolution, it would be helpful

sssona09
2023-07-20 10:30
chatgpt is telling me that for a GET request, i have to modify the code to this since I'm doing a GET request: `if (context.Request.Method == HttpMethod.Get.Method)` `{` `// ... (handle GET request provider states)` `}`


sssona09
2023-07-20 10:30
is this true? i cant get my test to verify

anju.ashk
2023-07-20 10:38
Issue resolved, it 's working thanks for all the support @matt.fellows

lotem.dagan
2023-07-20 10:48
has joined #pact-net

lotem.dagan
2023-07-20 10:49
@lotem.dagan has left the channel

cmesyngi
2023-07-20 20:56
has joined #pact-net

matt.fellows
2023-07-21 01:07
Sorry, Chat GPT is so unreliable for code you won?t find any help/support from me on it. I?ve seen examples where it smashes multiple examples together that look sensible, but actually don?t make sense if you look at the API

matt.fellows
2023-07-21 01:07
I also don?t know .NET, so won?t comment on an AI generated suggested for a language I don?t understand. Best talking to devs on your team that know .NET

alan.barker
2023-07-21 09:47
has joined #pact-net

vijaya.balla.external
2023-07-21 15:06
has joined #pact-net

dennis1125dennis
2023-07-22 02:30
has joined #pact-net

muhammedalimutlu
2023-07-23 18:40
has joined #pact-net

sssona09
2023-07-24 11:32
Hi, wondering if anyone has any ideas for me to resolve this issue in my provider tests: http://stackoverflow.com/questions/76754047/pact-net-pact-verification-failed-with-404-response

yousafn
2023-07-24 11:36
that 404 is coming from your service. if you actually run your provider and make that request, what do you get

yousafn
2023-07-24 11:37
`curl localhost:7058/weather-forecast` I am assuming don?t have that route setup

yousafn
2023-07-24 11:39
it might be setup when you run your non test code, but your test code is starting a server and possibly isn?t connected correctly to your app

yousafn
2023-07-24 11:40
ChatGPT?s dataset is also old, and therefore wouldn?t be up to date with the latest Pact documentation, so you will get a best guess (which will more than likely be incorrect)

yousafn
2023-07-24 11:41
That actually carries true with older Pact code. It will tell you a convincing lie

sssona09
2023-07-24 12:57
i get 200 with the expected data response

sssona09
2023-07-24 12:58
when i run my provider

sssona09
2023-07-24 12:58
the response is hard coded list of weather forecasts

sssona09
2023-07-24 12:59
thanks i?ll look into that

doug.hanke
2023-07-24 17:53
has joined #pact-net

amitw
2023-07-25 08:11
@amitw has left the channel


sameswar.khuntia
2023-07-25 10:17
has joined #pact-net

michal.mirecki
2023-07-25 10:28
has joined #pact-net

muhammedalimutlu
2023-07-25 10:29
Hi All, I need to use Dictionary as nested object. Couldn't find any example about it. Any guidance?


tigrandza
2023-07-25 13:20
also while thinking about the problems when using dictionary in dto, after a good brainstorming in our team, we have decided not to use Dictionaries in DTO payload

muhammedalimutlu
2023-07-25 13:31
Gentlemen, thank you for your responses. U made my day!

jeremyjpark
2023-07-25 15:30
has joined #pact-net

chetana.mahangare
2023-07-25 15:58
has joined #pact-net

kwan
2023-07-25 18:49
has joined #pact-net

sssona09
2023-07-26 04:17
is there an example of pact provider tests which doesn?t use Startup class? i want to use methods in my Program.cs but since the builder is of the type WebApplicationBuikder, i?m getting errors

venkatesh.civic
2023-07-26 16:49
has joined #pact-net

bartlomiej
2023-07-26 18:06
has joined #pact-net

wongkoonwai
2023-07-27 03:14
has joined #pact-net

conrad.john
2023-07-27 08:37
has joined #pact-net

rjurca
2023-07-27 09:28
hello! is it possible to use message interaction pact for serviceBus? to be more specific I have an azure function with serviceBusTrigger in which the message is received

ajit.kumar
2023-07-27 11:37
has joined #pact-net

matt.fellows
2023-07-27 11:56
It should be possible.

matt.fellows
2023-07-27 11:57
message pact doesn?t care about the transport/protocol, only the content produced and consumed

matt.fellows
2023-07-27 11:57
have you tried?

matt.fellows
2023-07-27 11:57
(I don?t know servicebus in detail, but it?s analogous to the AWS services which I know you can test this way)

rjurca
2023-07-27 12:04
ok, I'm working on it. I will let you know how it goes

marekurbanowicz
2023-07-27 12:40
has joined #pact-net

maciej.krakowiak
2023-07-27 13:28
has joined #pact-net

mateusz.luty
2023-07-27 13:29
has joined #pact-net

maciej.krakowiak
2023-07-27 13:40
Hi! We are creating a contract testing solution, and im wondering how to create a class structure for this kind of project. We want to cover at least 16 happy path endpoints and decided to do it as presented on screen (one test class per endpoint), but we struggled with two issues: ? When every test class inherited base class (where in base class pactbuilder was generated) with disabled test parallelization - every test class generated its own pact file, what caused pushing one pact file to our pact repository ? When we used inheritance on IClassFixture<TestSetup> we encountered a the same problem. ? We used a collection with ICollectionFixture<TestSetup> inheritance, but we werent able to turn parallelization off in Xunit (perhaps there is a possibility, but i did not found anything). The only working way we found is to create all tests under one test class. My question is - how you guys create a class tree / clean architecture for your contract test projects in .NET. I'd be thankful for the valuable responses.

pact259
2023-07-27 23:19
has joined #pact-net

hetal.patel
2023-07-28 14:04
has joined #pact-net

thatrandybrown
2023-07-28 16:49
has joined #pact-net

michael072
2023-07-29 03:08
has joined #pact-net

selniumtrainer
2023-07-29 08:10
has joined #pact-net

rmahadeorathod
2023-07-29 09:54
HI team, need help regarding provider side verification using pactbroker.

matt.fellows
2023-07-29 10:22
Rohit please read the following guide: howtoask

2023-07-29 10:22
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

raylincontact
2023-07-31 01:51
has joined #pact-net

ext-damian.rudzinski
2023-07-31 10:01
has joined #pact-net

sssona09
2023-07-31 11:08
Hello, so I am trying to write my Provider test but I get an error. Here is my SO post: http://stackoverflow.com/questions/76803005/pact-verification-failed-provider-test-net

rostas.laszlo.dev
2023-07-31 11:27
has joined #pact-net

anubhuti.shrivastava
2023-08-01 07:35
has joined #pact-net

pavikrish
2023-08-01 07:45
has joined #pact-net

sssona09
2023-08-01 10:17
anyone know?

yousafn
2023-08-01 12:13
I can?t tell from a cursory glance because we don?t have all the code. for example we cant see this function ``` builder.AddBuilderServices(); //my own method which I use to normally add services to my app, // before it starts``` the best way to get help, is to create a reproducible example in a public repo https://docs.pact.io/help/how_to_ask_for_help#4-ask-a-good-question > If you?re trying to demonstrate a problem or diagnose a bug, the best possible thing you can do is provide a https://stackoverflow.com/help/minimal-reproducible-example that doesn?t contain any organisational confidential information. This means someone can drop in and help you, without having to try and reconstruct your test setup


arnoldsi
2023-08-01 15:09
has joined #pact-net

arnoldsi
2023-08-01 15:13
Hi everyone. I would like to get your help with some issues that I've encountered. I'm using pact 4.5.0, I've setup a middleware for my /provider-states and Fake starrup that inherit from main API. When I run the test, the /provider-states works, but when pact is calling the actual API end point, my test server get dissposed and no response is getting back from the end point which fail the test. I've used the examples provided on the github.

arnoldsi
2023-08-01 15:59
I've found it, I'm not sure it's the best solution, but in my TestStartup I added: `var startupAssembly = typeof(Startup).Assembly;` `services` `.AddControllers()` `.AddApplicationPart(startupAssembly)` `.AddControllersAsServices();`

stefan.waldhauser
2023-08-02 13:45
has joined #pact-net

shadman.equebal140
2023-08-02 19:20
has joined #pact-net

aravind.pai
2023-08-03 07:06
has joined #pact-net

ganeshacse01
2023-08-03 08:10
has joined #pact-net

br.holanda15
2023-08-03 14:35
has joined #pact-net

abarkha1
2023-08-03 22:34
has joined #pact-net

boreyuk
2023-08-04 07:22
has joined #pact-net

evan196
2023-08-04 14:33
has joined #pact-net

marek.fexa
2023-08-06 08:36
has joined #pact-net

acemilyalcin
2023-08-06 16:55
has joined #pact-net

aniket.rane
2023-08-07 02:55
has joined #pact-net

antony
2023-08-07 08:11
has joined #pact-net

andreas.marcec.extern
2023-08-07 14:35
has joined #pact-net

jeffreykey
2023-08-07 17:44
has joined #pact-net

vaishali.rastogi
2023-08-08 12:29
has joined #pact-net

michael.knoll
2023-08-08 14:02
has joined #pact-net

michelle.he
2023-08-08 19:02
has joined #pact-net

mohammed.a.ezzedin501
2023-08-09 11:17
has joined #pact-net

jacopo
2023-08-09 15:34
has joined #pact-net

enrique519
2023-08-09 23:57
has joined #pact-net

sheyanr
2023-08-10 02:55
has joined #pact-net

rcalvo
2023-08-10 08:28
has joined #pact-net

endikaposadas
2023-08-10 08:40
has joined #pact-net

chinmaya.mishra
2023-08-10 10:05
has joined #pact-net

anderson.aeb
2023-08-10 12:37
has joined #pact-net

poojarylatika1
2023-08-10 14:17
has joined #pact-net

sebastianmsandri
2023-08-10 16:01
has joined #pact-net

biancoc
2023-08-11 14:27
has joined #pact-net

svarakantham
2023-08-14 00:19
has joined #pact-net

carrm
2023-08-14 13:22
has joined #pact-net

jd.courtoy
2023-08-14 16:25
has joined #pact-net

elenadoty
2023-08-14 20:01
has joined #pact-net

a.adeyeye.gr
2023-08-15 08:49
has joined #pact-net

bas.plijnaer
2023-08-15 12:32
has joined #pact-net

liam.butler
2023-08-15 15:20
has joined #pact-net

marcocbarbieri
2023-08-15 22:47
has joined #pact-net

juandiegopalacio
2023-08-16 09:00
has joined #pact-net

t.vandenberk
2023-08-17 09:12
has joined #pact-net

jianbin.lin
2023-08-17 15:07
has joined #pact-net

artur.suhaniaka
2023-08-17 20:34
has joined #pact-net

aniruddhasingh.kushwa
2023-08-18 01:40
has joined #pact-net

parthiban.rajasekaran
2023-08-18 08:32
has joined #pact-net

gowthamgopal24
2023-08-18 09:52
has joined #pact-net

naimun.siraj
2023-08-18 16:50
has joined #pact-net

eugeniosaulo
2023-08-18 21:28
has joined #pact-net

pere.villega
2023-08-20 17:49
has joined #pact-net

artur.suhaniaka
2023-08-20 21:58
Hello everyone. Can someone please help me to sort out two questions: 1. Am I right that in consumer tests, in VerifyAsync method we call MockServer to confirm that the request was executed, and at the same time we have to return a stub result to execute assert section? The way I see it, we generate a pact file and run a unit-test, is that the point? 2. What are the dangers of just calling the HttpClient Get method in VerifyAsync and then closing assertion by calling Assert.True(true) in Consumer tests?

matt.fellows
2023-08-20 22:29
1. Yes. Except it?s not a stub, it?s a mock (a mock checks behaviour, a stub does not). So you mock the API provider, run a unit test of your API client, which must call the API provider. The mock itself performs part of those assertions, and is used later on to check if the provider behaves correctly also 2. Maybe it?s a .NET thing, but why would you ever run that assertion (i.e. do you have to have at least one assertion to make the framework happy)? Can you just omit it altogether? There may be other assertions on the behaviour of the API client you need to run, but if not, I think what you?re asking is fine

artur.suhaniaka
2023-08-20 22:54
Thanks Matt, that makes more sense to me now. About assertion - I'm referring to the example from the https://github.com/pact-foundation/pact-net, that's why I had a question, what's the point of these assertions, if in fact the expected result is set in pactBuilder.WillRespond() method.

navin.dhanaraj
2023-08-21 00:10
has joined #pact-net

matt.fellows
2023-08-21 02:06
The expected result is not that the API returned the data you told it would, it?s that the API client behaved the way you thought it would. e.g. it might take the HTTP response, unmarshal into a domain model etc. That might be worth testing. If your API client is very basic, then maybe you don?t need additional assertions. But the idea is to unit test the API client - so you?re on the right path if that?s your mindset

eduardo.rodrigues
2023-08-22 08:05
has joined #pact-net

nickkeers
2023-08-22 08:35
has joined #pact-net

stan.amsellem
2023-08-22 09:35
@stan.amsellem has left the channel

christophe.laranjo
2023-08-22 17:34
has joined #pact-net

huthayfa
2023-08-23 08:10
has joined #pact-net

dsherwin
2023-08-23 09:20
has joined #pact-net

marcel.novak
2023-08-23 13:53
has joined #pact-net

davidm
2023-08-23 15:57
has joined #pact-net

svmanikantakumar
2023-08-24 08:50
has joined #pact-net

eomeroff
2023-08-24 13:49
has joined #pact-net

riley.marzka
2023-08-24 17:47
has joined #pact-net

jared.anderson
2023-08-24 18:15
has joined #pact-net

timofeev1valeriy
2023-08-25 08:32
has joined #pact-net

kastala.nirosha
2023-08-25 09:17
has joined #pact-net

kastala.nirosha
2023-08-25 09:32
I have a question about provider tests. My consumer tests are fine and its producing pact contract. When i run the provider tests against it, its returning data from db, even though I have faked data in repository using provider state middleware. How to return fake data that matches against the consumer contract?

kastala.nirosha
2023-08-25 09:33
```public class ProviderStateMiddleware { private static readonly JsonSerializerOptions? Options = new() { PropertyNameCaseInsensitive = true }; private readonly IDictionary<string, Func<IDictionary<string, object>, Task>> _providerStates; private readonly RequestDelegate _next; /// <summary> /// Initialises a new instance of the <see cref="ProviderStateMiddleware"/> class. /// </summary> /// <param name="next">Next request delegate</param> /// <param name="orders">Orders repository for actioning provider state requests</param> public ProviderStateMiddleware(RequestDelegate next) { _next = next; _providerStates = new Dictionary<string, Func<IDictionary<string, object>, Task>> { ["weather forecasts exist"] = EnsureDataExistsAsync, ["weather forecasts doesn't exist"] = EnsureDataDoesNotExistsAsync, }; } /// <summary> /// Ensure an event exists /// </summary> /// <param name="parameters">Event parameters</param> /// <returns>Awaitable</returns> private Task EnsureDataExistsAsync(IDictionary<string, object> parameters) { FakeWeatherForecastRepository.WeatherForecasts = new List<WeatherForecast>() { new WeatherForecast { Date = DateTime.Parse("2023-01-01"), TemperatureC = 32, Summary = "Sunny" } }; return Task.CompletedTask; } /// <summary> /// Ensure an event exists /// </summary> /// <param name="parameters">Event parameters</param> /// <returns>Awaitable</returns> private Task EnsureDataDoesNotExistsAsync(IDictionary<string, object> parameters) { FakeWeatherForecastRepository.WeatherForecasts = new List<WeatherForecast>(); return Task.CompletedTask; } /// <summary> /// Handle the request /// </summary> /// <param name="context">Request context</param> /// <returns>Awaitable</returns> public async Task InvokeAsync(HttpContext context) { if (context.Request.Path.StartsWithSegments("/provider-states")) { await HandleProviderStatesRequest(context); await context.Response.WriteAsync(string.Empty); } else { await _next(context); } } private async Task HandleProviderStatesRequest(HttpContext context) { context.Response.StatusCode = (int)HttpStatusCode.OK; if (string.Equals(context.Request.Method, HttpMethod.Post.ToString(), StringComparison.CurrentCultureIgnoreCase)) { string jsonRequestBody; using (var reader = new StreamReader(context.Request.Body, Encoding.UTF8)) { jsonRequestBody = await reader.ReadToEndAsync(); } var providerState = JsonConvert.DeserializeObject<ProviderState>(jsonRequestBody); //A null or empty provider state key must be handled if (providerState != null && !string.IsNullOrEmpty(providerState.State)) { await _providerStates[providerState.State].Invoke(providerState.Params); } } }```

kastala.nirosha
2023-08-25 09:34
```public class TestStartup { private readonly Startup _inner; public TestStartup(IConfiguration configuration) { _inner = new Startup(configuration); } public void ConfigureServices(IServiceCollection services) { services.AddMvc().AddApplicationPart(Assembly.GetAssembly(typeof(Startup))!); services.AddSingleton<IWeatherForecastRepository, FakeWeatherForecastRepository>(); _inner.ConfigureServices(services); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseMiddleware<ProviderStateMiddleware>(); _inner.Configure(app, env); } }```

kastala.nirosha
2023-08-25 09:34
```public class ProviderApiTests : IDisposable { private static readonly Uri ProviderUri = new Uri("http://localhost:5170"); private readonly IHost _server; private readonly PactVerifier _verifier; public ProviderApiTests(ITestOutputHelper output) { _server = Host.CreateDefaultBuilder() .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseUrls(ProviderUri.ToString()); webBuilder.UseStartup<TestStartup>(); }) .Build(); _server.Start(); _verifier = new PactVerifier("WeatherForecast API", new PactVerifierConfig { LogLevel = PactLogLevel.Debug, Outputters = new List<IOutput> { new XunitOutput(output) } }); } public void Dispose() { _server.Dispose(); _verifier.Dispose(); } [Fact] public void EnsureProviderApiHonoursPactWithConsumer() { // Arrange var pactPath = Path.Combine("..", "..", "..", "..", "..", "..", "pacts", "WeatherForecast Consumer-WeatherForecast API.json"); // Assert _verifier .WithHttpEndpoint(ProviderUri) .WithFileSource(new FileInfo(pactPath)) .WithProviderStateUrl(new Uri(ProviderUri, "/provider-states")) .Verify(); } }```

kastala.nirosha
2023-08-25 09:35
Here port exactly matches the provider's launchsettings

kastala.nirosha
2023-08-25 09:35
Any help would be appreciated..Thanks

kkanova
2023-08-25 12:55
has joined #pact-net

theteea
2023-08-25 13:18
has joined #pact-net

theteea
2023-08-25 13:26
@theteea has left the channel

charlan.bettiol
2023-08-25 16:32
has joined #pact-net

david.tu
2023-08-25 17:51
has joined #pact-net

matt.fellows
2023-08-28 02:45
> How to return fake data that matches against the consumer contract I?m confused about the question. Your provider just needs to respond as it normally would in real life. The only difference is, you are stubbing the repository layer. The data does not need to match exactly (unless you are not using matchers). What?s the actual problem you?re getting?

kastala.nirosha
2023-08-28 02:47
I have fixed it...Its just the DI in startup was not overrided by my fake repo. I have changed the order in TestStartup file and its working now. IS there anyway to publish the contract from consumer using .NET?

matt.fellows
2023-08-28 03:31
> IS there anyway to publish the contract from consumer using .NET? the recommended way is to use the CLI tools

kastala.nirosha
2023-08-28 08:27
how to publish the provider contract json file using rest api after verification with schemathesis?


viktor.stephanyk
2023-08-28 12:46
has joined #pact-net

arpit.gawande
2023-08-28 12:58
has joined #pact-net

alexander.doppelbauer
2023-08-28 17:52
has joined #pact-net

kastala.nirosha
2023-08-28 23:14
Looks like there is no rest api that can publish provider contracts

matt.fellows
2023-08-28 23:15
You should use the CLI

matt.fellows
2023-08-28 23:15
We?ll be publishing our public APIs soon

jayapriya.m
2023-08-29 00:22
has joined #pact-net

grnmeadow7
2023-08-29 03:27
has joined #pact-net

kastala.nirosha
2023-08-29 09:45
How to inject mocked pact if I want to test the micro service that calls provider

kastala.nirosha
2023-08-29 09:46
For example, Service A has a rest endpoint that calls provider api, IS it possible to inject mocked pact in place of provider api and test the service A endpoint?

sayantini.basak
2023-08-29 10:02
has joined #pact-net

shayanadc
2023-08-29 18:19
has joined #pact-net

jack.jones9512
2023-08-30 15:49
has joined #pact-net

craftyqa
2023-08-30 16:54
has joined #pact-net

jean-baptiste.bronisz
2023-08-31 15:48
has joined #pact-net

razorangel
2023-08-31 18:41
has joined #pact-net

dsharma
2023-08-31 19:11
has joined #pact-net

eytan.hanig
2023-08-31 22:10
has joined #pact-net

eytan.hanig
2023-09-01 03:07
@eytan.hanig has left the channel

munitheja91
2023-09-01 13:14
has joined #pact-net

alvarado.kelvin
2023-09-02 12:48
has joined #pact-net

sautade
2023-09-04 01:23
has joined #pact-net

joshua.ellis
2023-09-04 04:51
has joined #pact-net

bbodoque.atsistemas
2023-09-04 10:21
has joined #pact-net

avanlent
2023-09-05 05:56
has joined #pact-net

callum.atkinson
2023-09-05 17:00
has joined #pact-net

emilie.bline
2023-09-05 22:27
has joined #pact-net

me1414
2023-09-06 12:37
has joined #pact-net

juantamosaitis2015
2023-09-06 13:24
has joined #pact-net

ali.tariq
2023-09-06 14:51
has joined #pact-net

anas.zakarneh
2023-09-06 15:04
has joined #pact-net

jvillars
2023-09-06 17:53
has joined #pact-net

kwongs
2023-09-08 01:45
has joined #pact-net

alicankarayelli
2023-09-08 10:43
has joined #pact-net

sgregory875
2023-09-08 12:23
has joined #pact-net

amagana
2023-09-08 22:40
has joined #pact-net

heverson.amorim
2023-09-09 10:43
has joined #pact-net

vdlre1994
2023-09-11 05:55
has joined #pact-net

rware4
2023-09-11 10:16
has joined #pact-net

hdjikine
2023-09-11 13:55
has joined #pact-net

andrea.paschal
2023-09-11 16:48
has joined #pact-net


olof.stalnacke
2023-09-12 05:31
has joined #pact-net

nvangari
2023-09-12 05:39
has joined #pact-net

bas
2023-09-12 11:57
This might just be the trigger I need to start working on a C# implementation of the workshop material I've got in Java. Will get started right away and report here / on SO.

matt.fellows
2023-09-12 12:09
I think we do have an example dotnet core 6 project in the repo, but I agree - having a nice workshop would be great. This was created whilst the latest incarnation was still in beta by a colleague: https://github.com/DiUS/pact-workshop-dotnet-core-v3/pull/7 But after it went live there were a few additional changes and the workshop was made redundant. The PR above hopefully brings it a little closer in line, but it?s a bit much for me to review as I don?t know .NET all that well

rksekar5
2023-09-12 12:30
has joined #pact-net

bas
2023-09-12 13:41
Here's a start: https://stackoverflow.com/a/77089688/20156176 which references https://github.com/basdijkstra/introduction-to-contract-testing-dotnet Lots of work still to be done, but it works :slightly_smiling_face:

matt.fellows
2023-09-12 23:51
Thanks Bas!

ying.li
2023-09-13 02:54
has joined #pact-net

david.hodnett
2023-09-14 18:06
has joined #pact-net

jonatan.bjork
2023-09-15 13:30
has joined #pact-net

jonatan.bjork_test1
2023-09-15 13:41
has joined #pact-net

you1
2023-09-15 13:41
has joined #pact-net

jonatan.bjork_test2
2023-09-15 13:42
has joined #pact-net

you1634
2023-09-15 13:43
has joined #pact-net

m_testnewinvite
2023-09-17 22:43
has joined #pact-net

georg.duemlein
2023-09-18 04:09
has joined #pact-net

georg.duemlein
2023-09-18 04:10
@georg.duemlein has left the channel

sam647
2023-09-18 14:37
has joined #pact-net

edward
2023-09-19 07:24
has joined #pact-net

dbc216
2023-09-19 14:17
has joined #pact-net

tan.k.h.usa
2023-09-20 00:31
has joined #pact-net

daniel.hyun.chae
2023-09-20 13:19
has joined #pact-net

tan.k.h.usa
2023-09-20 16:47
*Q) how to get output on VS Test Explorer* Hello, I am new to pact-net and to get my feet wet, I cloned the pact-workshop-dotnet-core-v3 workshop example. I am able to get the Consumer and Provider tests to run and pass. I am curious why the Pact output shows up when I use "dotnet test" but not when I use the Visual Studio Test Explorer. I attach a picture to give you a view of what I mean. Thanks, (apologise for starting every sentence with an I .. )

matt.fellows
2023-09-20 23:11
> (apologise for starting every sentence with an I .. ) :laughing:

matt.fellows
2023-09-20 23:12
Just note that workshop is out of date

matt.fellows
2023-09-20 23:13
See also this PR for the latest though: https://github.com/DiUS/pact-workshop-dotnet-core-v3/pull/7

matt.fellows
2023-09-20 23:13
I can?t remember the exact reasons, but something to do with it swallowing stderr/stdout.

jake.corn
2023-09-21 14:01
has joined #pact-net

tan.k.h.usa
2023-09-21 15:10
Thanks for all the information provided. OK, I think I hear that the Visual Studio no output is a known problem but no one recalls the fix, if it exists. While I understand that workshop-dotnet-core-v3 is out of date because it uses some old backend (being v3), it is useful as a learning tool and well written. Surprisingly all the steps until Step 9 (adding authentication), work as described. There are some missing code segments in Step 9 that may be due to the out-of-date issue, who knows.

tan.k.h.usa
2023-09-21 15:49
*Q on a Consumer test code* Below is an example code that I saw and have a question. The contract is defined to respond with HttpStatusCode.Unauthorized in line 9 The verification code is expecting HttpStatusCode.Forbidden in line 13 This test like this, where the WillRespond and Expect do not match in logic, will always fail, right? Or am I missing something? ``` [Fact] public async void GetProductMissingAuthHeader() { // Arange pact.UponReceiving("A valid request for a product") .Given("No auth token is provided") .WithRequest(HttpMethod.Get, "/api/products/10") .WillRespond() .WithStatus(HttpStatusCode.Unauthorized); // line 9 await pact.VerifyAsync(async ctx => { var response = await ApiClient.GetProduct(10); Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode); // line 13 }); }```

bas
2023-09-21 15:54
That should indeed always fail, as the mock provider generated by Pact is based on the expectations defined for this interaction, so that will return a 401 and not the 403 expected in your test.

karl980
2023-09-21 16:44
has joined #pact-net

tan.k.h.usa
2023-09-21 17:31
Thank you. In fact, since the Setup and Verify code are in the same place, it would make sense to ensure compliance like using a common variable, expectedCode. ``` [Fact] public async void GetProductMissingAuthHeader() { var expectedCode = HttpStatusCode.Unauthorized; // Arange pact.UponReceiving("A valid request for a product") .Given("No auth token is provided") .WithRequest(HttpMethod.Get, "/api/products/10") .WillRespond() .WithStatus(expectedCode); // line 9 await pact.VerifyAsync(async ctx => { var response = await ApiClient.GetProduct(10); Assert.Equal(expectedCode, response.StatusCode); // line 13 }); }```

doctormiguel
2023-09-22 14:31
has joined #pact-net

felipe.simoes702
2023-09-22 17:37
has joined #pact-net

suat.kose
2023-09-22 22:13
has joined #pact-net

marius.grigoriu
2023-09-23 15:33
has joined #pact-net

noahmcivor
2023-09-24 06:54
has joined #pact-net

matt.fellows
2023-09-24 23:43
Just for some additional insight, this line is really not necessary: `Assert.Equal(expectedCode, response.StatusCode);` The reason is: 1. Pact will always ensure it?s correct anyway (the provider side of this verification will perform the checks on the elements specified in `WillRespond()` then (and the `UponReceiving` during the consumer test, obviously) 2. The Pact setup is really about specifying the HTTP level assertions, you should really be focussed on the unit test itself - in this case, the observable behaviour of `ApiClient` . Probably, you have copied a trivial example but just in case, I wanted to clarify this

marek19922209
2023-09-25 08:09
has joined #pact-net

marek19922209
2023-09-25 08:12
*Q on a pact setup* Hi, Im trying to setup contract tests using pact V3 spec for asp .net API. I have launched testcontainers db for that and im trying to run provider api to run verify contracts against them. Im wondering now do i really need to setup whole api and database for that or just use middleware which will create data like in unit tests. Do i also startup api in TestStartup file or it jsut for start middleware state

bas
2023-09-25 12:05
Hey @marek19922209, I think the only right answer here is 'it depends'. You don't _need to_ setup the entire API and the database, as long as you make sure that what is returned when the API is invoked is the same whether you're using the actual setup or mocks. I'm a big fan of testing against the real thing, so including the actual database, mostly because stub / mock drift is a real thing and has caused me problems in the past. Regarding your second question, what do you mean when you say 'TestStartup file'? Do you have an example? Here's how I'm doing this in my workshop project: https://github.com/basdijkstra/introduction-to-contract-testing-dotnet/blob/main/AddressProvider.Tests/AddressPactTest.cs Test project has a reference to API project, I start the actual API, inject the Pact service URL and provider state middleware and off we go.

marek19922209
2023-09-25 12:36
im just wondering how to start my existing api, i decided to use inmemory db, now only thing i need is to just map controller ?

marek19922209
2023-09-25 12:37
your link pointing to latest documentation ?

marek19922209
2023-09-25 14:52
im receicving 500s from provider

marek19922209
2023-09-25 14:52
not sure what might be the case

marek19922209
2023-09-25 14:53
and states are not being executed

bas
2023-09-25 15:09
No, my link is to my own project, but that uses the latest version of Pact for .NET. Can you share the code with us?

corey_maynard
2023-09-25 20:07
has joined #pact-net

rammohan_mididoddi
2023-09-25 20:12
has joined #pact-net

tan.k.h.usa
2023-09-25 21:06
@matt.fellows Yes, the code is adapted from https://github.com/DiUS/pact-workshop-dotnet-core-v3/ ( which is now deprecated ). I assume it is illustrative of how to use Pact for the newbie. On one hand, why wouldn't checking the response status be a good check on an observable behavior of Apiclient? All API calls have return status and they had better be the correct/expected ones. On the other hand, it would seem silly that we specified in the Setup the return status and then checked the same thing in the Verification part. I mean the unit test would never fail. I am a litte confused here.

matt.fellows
2023-09-25 23:37
> On one hand, why wouldn?t checking the response status be a good check on an observable behavior of Apiclient? All API calls have return status and they had better be the correct/expected ones. Because the consumer Pact test is not about testing the behaviour of the _API provider_, but the behaviour of the _client_ > On the other hand, it would seem silly that we specified in the Setup the return status and then checked the same thing in the Verification part. I mean the unit test would never fail. exactly. It doesn?t add any additional test power either, because Pact does this check on the provider side anyway.

tan.k.h.usa
2023-09-26 02:17
@matt.fellows In that case, if I take out the Assert.Equal(expectedCode, response.StatusCode) from the client unit test, the client unit test will always pass. So, the client test is not well written then right? Any suggestion what should the client unit test check for, that is not specified in the same test code.

kevin
2023-09-26 02:31
has joined #pact-net

matt.fellows
2023-09-26 02:41
no, if you empty the entire block of `VerifyAsync` the test should fail, because you didn?t send an API call to the provider as you said you would (by establishing a Pact mock). Try it out

matt.fellows
2023-09-26 02:41
you _should_ check that the API client did what you want, probably by checking it was able to properly marshal/unmarshal the payload

michael.lemos1
2023-09-26 12:36
has joined #pact-net

sliu
2023-09-27 00:00
has joined #pact-net

ankush.hasani
2023-09-27 10:01
has joined #pact-net

marek19922209
2023-09-27 12:14
im trying to setup it in same way like i on pac-net repo

marek19922209
2023-09-27 12:16
will share log

bas
2023-09-27 14:08
Please do, I'm happy to have a look

bas
2023-09-27 14:14
Quick question, can anyone tell me how to pass arguments to a provider state method? And if it's even recommended (I know using specific values creates coupling between consumer and provider)? This is what my middleware setup looks like, I'd love to pass in the address ID as a parameter so that the provider can set up state for this specific address but I can't figure out how to. Simply changing `Action` to `Action<string>` and using methods that take a `string` argument does not seem to work. Any other recommendations are more than welcome. ```public ProviderStateMiddleware(RequestDelegate next) { _next = next; _providerStates = new Dictionary<string, Action> { { $"address with ID {addressId} exists", CreateAddress }, { $"address with ID {addressId} does not exist", DeleteAddress }, { "no specific state required", DoNothing } }; } private void CreateAddress() { Console.WriteLine("CREATE ADDRESS"); }```

kai
2023-09-27 15:31
has joined #pact-net

marek19922209
2023-09-27 16:26
wondering how i can exclude application json header (i dont have it in consumer test but it is still shown in my pact file

marek19922209
2023-09-27 16:31
is it possible to debug my controller during running pact tests?

bas
2023-09-27 16:49
That?s a lot of separate questions. What have you tried, what worked and what didn?t?


matt.fellows
2023-09-28 02:52
I wish this could be abstracted away in Pact .NET like we have in other languages. I understand it can?t be (or won?t be) because it couples the server implementation. I was hoping that Pact .NET could choose whatever HTTP server implementation it wanted, without impacting the server of choice for clients of the framework, but it seems like that?s not doable

matt.fellows
2023-09-28 02:53
> im receicving 500s from provider this usually means the requests that Pact is sending to your provider aren?t matching up somehow. Are there any logs or output that provide hints to the problem?

bas
2023-09-28 04:38
Thanks Matt! I?ll have a look at that later today and will let you know.

bas
2023-09-28 07:44
That's probably very helpful indeed! I haven't got the time today to completely build that into my repo but it looks good so far. Will update you once it's done.

matt.fellows
2023-09-28 07:49
for example, here is a provider with states (some with parameters). Notice how no middleware needs setting up - it?s just a configuration on the verifier. I want this for Pact .NET, because making people write middleware is painful/creates friction

matt.fellows
2023-09-28 07:50
OK, I remember now - this PR just needs to be pushed along I think: https://github.com/pact-foundation/pact-net/pull/335

bas
2023-09-28 07:52
Gotcha! That would make things easier indeed (especially for providers), but in the meantime I can get by with this. Again, it's 'only' a workshop project, not a full blown implementation. It actually teaches me a lot about the internal of Pact-Net, which has been on my to-do list for a while, so in some weird way this is a good thing.

a.monteiro
2023-09-28 09:59
has joined #pact-net

marek19922209
2023-09-28 12:08
problem with 500s was in my configuration, i was missing few services configuration

marek19922209
2023-09-28 12:08
now i have 401 unathorized even if im passing token in authorization header

matt.fellows
2023-09-28 12:17
Is token expired? The error comes from your service, so it?s going to be hard for us to tell you why that?s happening :slightly_smiling_face:

marek19922209
2023-09-28 12:26
hm maybe its expire after consumer test is ran and pact file is generated, do i need to change something in middleware ?

bas
2023-09-28 12:28
Have you seen this page? https://docs.pact.io/provider/handling_auth Your strategy is no. 5 on the list, without the 'really really long' part I guess :slightly_smiling_face:

marek19922209
2023-09-28 12:45
well better to just exclude passing authorization header

marek19922209
2023-09-28 12:46
in contract

tan.k.h.usa
2023-09-28 16:23
Yes thanks, that is a sensible idea

ml210993
2023-09-29 05:12
has joined #pact-net

prempooon.hc
2023-09-29 11:35
has joined #pact-net

jaishankar.nedunchezh
2023-09-29 17:07
has joined #pact-net

devin.woods
2023-09-29 19:28
has joined #pact-net

vittorio.gue
2023-09-30 10:51
has joined #pact-net

vittorio.gue
2023-09-30 11:24
Hello hello! I was wondering if Pact .Net supports grpc interactions? In our company we would like experiment using Pact but I have no much experience with the .Net library!

bas
2023-09-30 15:43
Technically, it should support it when you?re using the plugin: https://github.com/pactflow/pact-protobuf-plugin I haven?t seen any actual examples using C#, though.

vittorio.gue
2023-09-30 16:11
My understanding is that it needs to support the specification V4 and the plugin system! Unfortunately iI couldnt find anything about plugins in the Pact Net framework beta version

bas
2023-09-30 18:00
Gotcha! You?re absolutely right going by this: https://github.com/pactflow/pact-protobuf-plugin#requirements-to-use-it I?m afraid you?re going to have to wait until Pact .Net does support plugins properly then..

vittorio.gue
2023-09-30 18:05
Ill see if I can help with that! No idea which part to touch but I will compare it with the Java version!

vittorio.gue
2023-09-30 18:06
Thanks

honglu11
2023-10-01 16:47
has joined #pact-net

matt.fellows
2023-10-01 23:30
That?s right Vittorio.

matt.fellows
2023-10-01 23:31
It current supports the V4 spec, but only HTTP and message interactions. If you were up for a PR, we could definitely help support you in adding the capability to .NET.

matt.fellows
2023-10-01 23:31
We have a BDD suite that you could use as a starting point: https://github.com/pact-foundation/pact-compatibility-suite/


matt.fellows
2023-10-01 23:33
we are working on a maintainer guide soon, which is the plan after Python V4 / plugin support work is complete. @joshua.ellis has recently join the maintainer group and is coming up to speed with it all, but given the heavy lifting has already been done in .NET it should mostly be wiring in the interface.

idd90i
2023-10-02 10:37
has joined #pact-net

jamie.weatherby
2023-10-02 13:11
@jamie.weatherby has left the channel

nathan
2023-10-03 00:43
has joined #pact-net

jonathan.ryding
2023-10-03 12:02
has joined #pact-net

suat.kose
2023-10-03 12:22
Hello there! I am new on Pact framework. I got confused about provider implementation. As you can see below, we need to insert a specific data that used in the contract in a real database. I mean, CDC testing is fast right? It works as fast as unit tests. You know, we mock the provider service on consumer side. So, why do we need to access a real database and insert a specific test data into it? . Why don't we just verify our response object on provider side? Thanks in advance! ```public ProviderStateMiddleware(RequestDelegate next, IOrderRepository orders) { this.providerStates = new Dictionary<string, Func<IDictionary<string, object>, Task>> { ["an order with ID {id} exists"] = this.EnsureEventExistsAsync }; } private async Task EnsureEventExistsAsync(IDictionary<string, object> parameters) { JsonElement id = (JsonElement)parameters["id"]; await this.orders.InsertAsync(new OrderDto(id.GetInt32())); }```

matt.fellows
2023-10-03 12:50
> Why don?t we just verify our response object on provider side we do do that, but the actual request will be issued to the provider. If the route is `/order/1` but no order with ID `1` exists, what will come back from it? That?s what states are for. Now, you need not have to use the states - you might have a ?golden? fixture, that already has all of the states you need in it - so then it would ?just work?. Probably, with simple scenarios like this you would do that. But some scenarios get harder (maybe you need to stub a downstream system using in-memory stubs, or cause a 500 etc.). That?s what they exist for

suat.kose
2023-10-03 14:05
With, "golden" fixture did you mean something like this? If not, what do you think about the code? If i make a breaking change on ProductDto, i would break my consumers right? So, here i just create a prodcutDto and return it as response. I am able to verify my response object without accessing a DB and creating some fake data. Is it so dumb? :slightly_smiling_face: ``` public class ProviderStateMiddleware { private readonly RequestDelegate _next; public ProviderStateMiddleware(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext context) { context.Response.ContentType = "application/json; charset=utf-8"; if (context.Request.Path.Value == "/products/1") { var product = new ProductDto { ID = 1, Name = "Sample Product", StockCount = 20, IsActive = true }; var serializedProduct = JsonConvert.SerializeObject(product); await context.Response.WriteAsync(serializedProduct); } } }```

corey_maynard
2023-10-03 20:24
@corey_maynard has left the channel

matt.fellows
2023-10-03 23:32
no, I just mean that when you start the provider service, the data / states are already pre-setup

matt.fellows
2023-10-03 23:33
If I understand what you have done above, it overrides the actual API, and therefore is a completely useless test. We need to test the real API. You can stub at various layers, but replacing the API layer with middleware would mean the actual provider behaviour could change (in a breaking way) and the tests would continue to pass

gabe.hollombe
2023-10-04 03:17
has joined #pact-net

suat.kose
2023-10-04 06:35
It makes sense. I was simply thinking that verifying response model is ok. I thought CDC testing is only about this, not related with provider behaviour. Thanks for your time!

matt.fellows
2023-10-04 06:46
> It makes sense. I was simply thinking that verifying response model is ok. I thought CDC testing is only about this, not related with provider behaviour. Thanks for your time! It?s a delicate balance between contract and functional testing. But definitely, you can?t be outrigth replacing what the actual API provider does - otherwise you?re just marking your own exam :slightly_smiling_face:

pratyusha.boyapati
2023-10-04 08:35
has joined #pact-net

mateusz.socha
2023-10-04 10:41
has joined #pact-net

maja.vitaz
2023-10-05 10:37
has joined #pact-net

martindjk92
2023-10-05 13:05
has joined #pact-net

james814
2023-10-05 20:24
has joined #pact-net

craig.kilpatrick
2023-10-06 00:33
has joined #pact-net

prabakaranplaced
2023-10-06 08:00
has joined #pact-net

likekeys
2023-10-06 14:22
has joined #pact-net

chris.odryna
2023-10-06 16:51
has joined #pact-net

rezaur.rahman
2023-10-06 17:39
has joined #pact-net

julie.laursen
2023-10-06 17:43
has joined #pact-net

pratibha.kachi
2023-10-06 20:02
has joined #pact-net

robert579
2023-10-06 20:22
has joined #pact-net

sbalaranganathan
2023-10-09 12:10
has joined #pact-net

henrik
2023-10-09 18:15
has joined #pact-net

henrik
2023-10-09 18:33
Hello! I have been trying out pact-net during the day and i mostly understand how to work and how i can implement it. But i do have one big issue that i have not found the solution to. The mock server does not seem to return the body i define in .WithBody("myjsonbody", "application/json") no matter what i do. Headers are returned as i define them and so is the status code. Does anyone have an idea of what i could be doing wrong?

matt.fellows
2023-10-09 21:57
Can you please share what you're trying? Ie the code


henrik
2023-10-10 06:28
While i was looking into my code and about to paste it i tried again, this time it seems to be working. I did change what i assert however. But seems odd that it should have an effect

bas
2023-10-10 06:35
@henrik is there a way you can share the code here? I?d love to have a look.

henrik
2023-10-10 06:41
Of course, it is mainly the example from pact-net github: ``` public class UnitTest1 { private readonly IPactBuilderV3 pactBuilder; public UnitTest1() { var pact = Pact.V3("API1 - Consumer", "API2 - Producer", new PactConfig { PactDir = $"{Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName}{Path.DirectorySeparatorChar}pacts", DefaultJsonSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), Converters = new JsonConverter[] { new StringEnumConverter() } }, }); // Initialize Rust backend pactBuilder = pact.WithHttpInteractions(); } [Fact] public async void Test1() { pactBuilder .UponReceiving("Request to get something with Id 1") .Given("Something with id '1'") .WithRequest(HttpMethod.Get, "/somethings/1") .WithHeader("Accept", "application/json") .WillRespond() .WithStatus(HttpStatusCode.OK) .WithHeader("Content-Type", "application/json; charset=utf-8") .WithBody("{\"id\": 1}", "application/json"); await pactBuilder.VerifyAsync(async ctx => { var client = new HttpClient() { BaseAddress = ctx.MockServerUri, }; client.DefaultRequestHeaders.Add("Accept", "application/json"); var something = await client.GetAsync("/somethings/1"); var responseData = await something.Content.ReadAsStringAsync(); Assert.Equal(HttpStatusCode.OK, something.StatusCode); }); } }```

bas
2023-10-10 06:58
I tested that on my machine, in my project and it worked a charm, i.e., it returned the expected message body. Weird! But happy that it seems to work on your machine as well.

johnkavadias
2023-10-10 09:37
has joined #pact-net

jose-antonio.cano
2023-10-10 16:21
has joined #pact-net

henrik
2023-10-11 06:02
I don't know what I changed to get it working but happy it does. I had a thought about if the json was valid, does the mock server validate that before it accepts it as response data?

matt.fellows
2023-10-11 06:34
> I don?t know what I changed to get it working but happy it does. I had a thought about if the json was valid, does the mock server validate that before it accepts it as response data? Sort of. It should produce an error if you specified the media type as JSON but didn?t receive JSON or valid JSON

panagiotis.liaros
2023-10-11 10:15
has joined #pact-net

ananya
2023-10-11 10:38
has joined #pact-net

omar.sakka
2023-10-11 14:38
has joined #pact-net

brandon.king
2023-10-11 18:35
has joined #pact-net

sridhar.nayakwadi
2023-10-11 20:56
has joined #pact-net

saroja.bhogadhi
2023-10-11 20:58
has joined #pact-net

bas
2023-10-12 08:58
I just got a question from someone in my network: are there any plans to include support for XML in Pact .NET as it exists in Pact-JVM and PactJS?

matt.fellows
2023-10-12 09:01
I don?t think there are any concrete plans, but there is a (or several) spec for this now that exists at the foundation level: https://github.com/pact-foundation/pact-compatibility-suite/blob/d22d4667c0bda76d408676044cb33db834e7167e/features/V1/http_consumer.feature#L5C1-L16 If they want it, the best way to get visibility is to create an issue on the Pact .NET repository

bas
2023-10-12 09:05
Thanks! I'll relay that back to them.

chris.paul
2023-10-12 15:54
has joined #pact-net

ryan.standley
2023-10-12 17:34
has joined #pact-net

joseph
2023-10-12 20:58
has joined #pact-net

laurie.green
2023-10-12 22:46
has joined #pact-net

nikesh1123
2023-10-13 10:32
has joined #pact-net

tigrandza
2023-10-13 11:04
hey guys, one question, I want to add matcher for eachKey and eachValue (from pact specification V4). While looking in the source code, I see that we are defining those matchers, writing unit tests for them, but how that new type of matcher is getting processed on provider side while doing that verification ? I didn?t found anything there

imthu55
2023-10-13 11:05
has joined #pact-net

bas
2023-10-13 11:20
I'm not sure but this _could_ be because Pact .Net does not support v4 of the Pact specification yet.. https://docs.pact.io/implementation_guides/pact_specification#implementation-support


tigrandza
2023-10-13 11:22
so there is support for that in 5.x version

bas
2023-10-13 11:27
Gotcha. Are you using Pact .Net 5? Asking because that's still in beta.

yousafn
2023-10-13 11:36
the matchers are used by the Pact framework to assert against the response returned by your provider. you don?t need to do anything explicitly with matchers on the provider side

dzianis_frydliand
2023-10-13 12:36
has joined #pact-net

john.maynard
2023-10-13 14:35
has joined #pact-net

cmuddam.testing
2023-10-15 06:46
has joined #pact-net

david.vadkerti.toth
2023-10-17 08:28
has joined #pact-net

shirley.houter
2023-10-17 08:52
has joined #pact-net

ruth.kurniawati
2023-10-17 20:02
has joined #pact-net

balaaji196
2023-10-18 10:46
has joined #pact-net

maciej.krakowiak
2023-10-18 17:14
Hey, im trying to write simple test, and i encountered a weird behaviour: I almost copy pasted my previous solution that works, i've been sitting couple of hours on that and have completely no idea. It looks like pact mock server adds some headers by itself and fails because of that It's pact 4.5.0 TestClass ``` [TestFixture] public class AddOrReplaceLinkTests : ConsumerTestFixture { [Test] public async Task AddOrReplaceLink() { var dto = new ProducerSourceDto("ContentHub", "xxx", DataProvider.GenerateLinks(), Stochos.Contracts.Enum.LinkStatus.Published); var guid = Guid.NewGuid(); PactBuilder.UponReceiving("test") .Given("test") .WithRequest(HttpMethod.Put, "/api/links/addorreplace") .WithHeader("producer-id", guid.ToString()) .WithJsonBody(dto) .WillRespond() .WithStatus(HttpStatusCode.OK); await PactBuilder.VerifyAsync(async (providerBaseUrl) => { var httpClient = new HttpClient(); httpClient.BaseAddress = providerBaseUrl.MockServerUri; httpClient.DefaultRequestHeaders.Add("producer-id", guid.ToString()); var response = await httpClient.PutAsJsonAsync("/api/links/addorreplace", dto); response.EnsureSuccessStatusCode(); }); } }``` TestFixture class ``` public abstract class ConsumerTestFixture { public IPactBuilderV3 PactBuilder; protected PactConfig Config; private readonly PactHandler _pactHandler; private readonly string _pactFileName = "aaaa-bbbb.json"; private readonly string _pactDir = "pacts"; public ConsumerTestFixture() { Config = new PactConfig { PactDir = _pactDir, DefaultJsonSettings = new Newtonsoft.Json.JsonSerializerSettings { ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() } } }; _pactHandler = new PactHandler(); var pact = Pact.V3("aaaa", "bbbb", Config); PactBuilder = pact.WithHttpInteractions(7226); } public async Task InitializeAsync() { } public async Task DisposeAsync() { await _pactHandler.UploadPactFileAsync($"{_pactFileName}", $"{_pactDir}/{_pactFileName}"); } }``` ``` Mock driver logs: 2023-10-18T17:11:21.825651Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: PUT, path: /api/links/addorreplace, query: None, headers: Some({"transfer-encoding": ["chunked"], "host": ["127.0.0.1:7226"], "content-type": ["application/json; charset=utf-8"], "producer-id": ["76414565-6b24-4e6f-8cda-4ecfc3f34fe3"]}), body: Present(379 bytes, application/json;charset=utf-8) ) 2023-10-18T17:11:21.825902Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: PUT, path: /api/links/addorreplace, query: None, headers: Some({"Content-Type": ["application/json"], "producer-id": ["76414565-6b24-4e6f-8cda-4ecfc3f34fe3"]}), body: Present(342 bytes, application/json) )```

mpokala
2023-10-18 20:37
has joined #pact-net

hiroki.gota
2023-10-18 22:26
has joined #pact-net

mattisrobin
2023-10-18 22:37
has joined #pact-net

matt.fellows
2023-10-18 22:39
What makes you think the mock server is adding additional headers? The mock server is printing what it actually receives from your client

matt.fellows
2023-10-18 22:40
My guess is your client is adding those additional headers. Can you please share the actual failure?

silvimasss
2023-10-18 23:43
has joined #pact-net

maciej.krakowiak
2023-10-19 10:55
Looks like you are right, that my httpclient add some header values to the request, but it's still default .net httpclient - does it mean, that pact doesnt omit values that comes as unexpected with this request? My solution is pretty based on tutorial solution, what's more it's not the first time i create pact tests, and this time i almost copy pasted previous solution that works, so this behaviour is little bit confusing for me.

maciej.krakowiak
2023-10-19 10:57
```Message:? app : Internal Server Error Stack Trace:? HttpExtension.CheckForError(HttpResponseMessage response) HttpExtension.SendAsync[TReturn](String url, HttpMethod httpMethod, CancellationToken cancellationToken, Object content) HttpExtension.Put[TReturn](Object content, String url, CancellationToken cancellationToken) ProducerStochosClient.AddOrReplaceLink(ProducerSourceDto sourceDto, CancellationToken cancellationToken) <b__0>d.MoveNext()?line?28 --- End of stack trace from previous location --- PactBuilder.VerifyAsync(Func`2 interact) AddOrReplaceLinkTests.AddOrReplaceLink()?line?26 GenericAdapter`1.BlockUntilCompleted() NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter) AsyncToSyncAdapter.Await(Func`1 invoke) TestMethodCommand.RunTestMethod(TestExecutionContext context) TestMethodCommand.Execute(TestExecutionContext context) <>c__DisplayClass4_0.b__0() <>c__DisplayClass1_0`1.b__0(Object _) ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) ContextUtils.DoIsolated(ContextCallback callback, Object state) ContextUtils.DoIsolated[T](Func`1 func) SimpleWorkItem.PerformWork() Standard Output:? Mock driver logs: 2023-10-19T10:52:23.669471Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: PUT, path: /api/links/addorreplace, query: None, headers: Some({"content-type": ["application/json; charset=utf-8"], "content-length": ["316"], "host": ["localhost:7226"], "producer-id": ["7e32170b-678b-4e03-813a-444536e171b5"]}), body: Present(316 bytes, application/json;charset=utf-8) ) 2023-10-19T10:52:23.672923Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: PUT, path: /api/links/addorreplace, query: None, headers: Some({"producer-id": ["7e32170b-678b-4e03-813a-444536e171b5"], "Content-Type": ["application/json"]}), body: Present(342 bytes, application/json) )```

maciej.krakowiak
2023-10-19 10:58
this is full log that comes from test runner

matt.fellows
2023-10-19 10:59
The consumer request must match what you've mocked. If there is a mismatch that's one of the checks Pact performs - it's important we catch exactly what is used because it's how we ensure the contract is valid

wanghedi88
2023-10-19 11:16
has joined #pact-net

sarah.diendorfer
2023-10-19 12:34
has joined #pact-net

ahmed.elakour
2023-10-19 12:35
has joined #pact-net

parmin.rock
2023-10-19 14:57
has joined #pact-net

victor.yusuf
2023-10-19 14:58
has joined #pact-net

luke.dove
2023-10-19 15:46
has joined #pact-net

lee.andrews
2023-10-19 15:52
has joined #pact-net

mitchellp
2023-10-19 16:06
has joined #pact-net

mickelback00
2023-10-19 22:25
has joined #pact-net

philip.buttinger
2023-10-20 10:36
has joined #pact-net

adrian.kosyra
2023-10-20 11:58
has joined #pact-net

fabio.rodrigues
2023-10-20 12:56
Hey there: is there any date/plan for release 5 of pact-net becomes oficial?

dave.hooson
2023-10-20 15:13
has joined #pact-net

pavankumar.cse88
2023-10-20 17:58
has joined #pact-net

the.m.bjorklund
2023-10-21 21:05
has joined #pact-net

cmuddam.testing
2023-10-22 07:33
Good evening. I have a requirement where the expected response in consumer contract tests (using pactnet) should have hyphen ('-') in the name attribute. Please take a look at the below screenshot. It is throwing an error. Can someone take a look at it please ?

bas
2023-10-22 07:57
That?s not specially a Pact issue but rather a C# limitation: you can?t have field or variable names with hyphens. One workaround is to create a strongly typed object with the proper annotation added to it. See here for an example using Newtonsoft.JSON: https://stackoverflow.com/questions/14753113/how-to-deserialize-a-property-with-a-dash-in-its-name-with-newtonsoft-json The only thing I don?t know is whether Pact .Net supports Newtonsoft.Json or System.Text.Json, if it?s the latter you?ll probably need a different annotation.

thepiesaresquared
2023-10-22 09:58
has joined #pact-net

vasile.vetisan
2023-10-22 17:50
has joined #pact-net

sartom1994
2023-10-22 18:52
has joined #pact-net

cmuddam.testing
2023-10-23 06:47
Thank you Bas. Will try this.

rebecca.fulton
2023-10-23 09:27
has joined #pact-net

joao.jesus
2023-10-23 10:20
has joined #pact-net

kai.moseley
2023-10-23 10:47
has joined #pact-net

gunarajs
2023-10-23 19:23
has joined #pact-net

ctrando
2023-10-23 21:14
has joined #pact-net

thibault.alix
2023-10-23 22:29
has joined #pact-net

kwapisz.bartosz
2023-10-24 08:38
has joined #pact-net

lijinze01
2023-10-24 09:56
hi team, I have a very weird issue now... I have 2 very similar microservices applications, same test runs perfectly well in 1st microservice repo, however, the 2nd test keep failing, I am so struggling to find the root cause for the last 2 days, can anyone please give me some clue? really appreciated. 2023-10-24T09:55:11.643082Z DEBUG ThreadId(01) verify_interaction{interaction="expenses_test_get_direct_expenses"}: pact_verifier: State Change: "ProviderState { name: "expenses_test_direct_expenses", params: {} }" -> Err(Provider state failed: (interaction_id: a59c899181aaacad3f5d2c2c1f143261ddaa084d) Invalid response: error sending request for url (https://localhost:8080/provider-states): error trying to connect: received corrupt message) 2023-10-24T09:55:11.643120Z ERROR ThreadId(01) verify_interaction{interaction="expenses_test_get_direct_expenses"}: pact_verifier: Provider setup state change for 'expenses_test_direct_expenses' has failed - MismatchResult::Error("Invalid response: error sending request for url (https://localhost:8080/provider-states): error trying to connect: received corrupt message", Some("a59c899181aaacad3f5d2c2c1f143261ddaa084d"))

matt.fellows
2023-10-24 10:42
Looking at this, it looks like your provider states handler is not working properly. Do you know if that URL is up and operable?

btacca
2023-10-24 12:02
has joined #pact-net

anton.l.petersson
2023-10-24 13:54
has joined #pact-net

jowhalen13
2023-10-24 16:27
has joined #pact-net

lijinze01
2023-10-24 23:26
thanks @matt.fellows I got the issue resolved, you are right, my provider state method failed and I wrongly updated the localhost port number as well...

tanyagorn.benjaprompa
2023-10-25 08:09
has joined #pact-net

benguizat
2023-10-25 14:04
has joined #pact-net

stan196
2023-10-25 23:42
has joined #pact-net

manalikhanna92
2023-10-26 07:09
has joined #pact-net

aaron_carey
2023-10-26 09:26
has joined #pact-net

ms.maheshhwari
2023-10-26 09:54
has joined #pact-net

ohisproperties2
2023-10-26 16:34
has joined #pact-net

anupama_enakula
2023-10-26 21:45
has joined #pact-net

roger.liu
2023-10-27 07:15
has joined #pact-net

senbaga.kumarsigamani
2023-10-27 16:12
has joined #pact-net

alejandro.ignacio
2023-10-27 17:42
has joined #pact-net

devendra.patil
2023-10-27 21:40
has joined #pact-net

cmuddam.testing
2023-10-28 08:34
Hi Bas, my issue is resolved. Thank you. Appreciate it.

cmuddam.testing
2023-10-29 11:05
Hi, I am trying to run the provider pact tests against a pact file stored on the local machine. It is failing due to ArgumentNullException even though the pact verification is successful. Am I missing something ? Can Someone take a look at it please ?

cmuddam.testing
2023-10-29 11:07
Here is the verifier logs: Verifier Logs ------------- 2023-10-29T10:40:45.709744Z INFO ThreadId(09) pact_verifier: Running setup provider state change handler 'There is a new user' for 'A valid create user request' 2023-10-29T10:40:45.766917Z INFO ThreadId(09) pact_verifier: Running provider verification for 'A valid create user request' 2023-10-29T10:40:45.767089Z INFO ThreadId(09) pact_verifier::provider_client: Sending request to provider at http://localhost:4000/ 2023-10-29T10:40:45.767098Z INFO ThreadId(09) pact_verifier::provider_client: Sending request HTTP Request ( method: POST, path: users, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(150 bytes) ) 2023-10-29T10:40:47.336087Z INFO ThreadId(09) pact_verifier::provider_client: Received response: HTTP Response ( status: 200, headers: Some({"date": ["Sun", "29 Oct 2023 10:40:46 GMT"], "server": ["Kestrel"], "transfer-encoding": ["chunked"], "content-type": ["application/json; charset=utf-8"]}), body: Present(26 bytes, application/json;charset=utf-8) ) 2023-10-29T10:40:47.336145Z INFO ThreadId(09) pact_matching: comparing to expected response: HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json; charset=utf-8"]}), body: Present(26 bytes) ) 2023-10-29T10:40:47.337172Z WARN ThreadId(09) pact_matching::metrics:

bas
2023-10-29 11:56
What happens on and after line 68 of your ProviderPactTests class? Because the error message is pretty clear to me. Also, and this is not just for you, for the love of everything that is holy please stop pasting screenshots and start pasting (formatted) code and output snippets, so others can search for answers, too. Saves everyone a lot of repeating the same questions over and over again.

cmuddam.testing
2023-10-29 13:03
Thanks Bas and sorry for the inconvenience.

bas
2023-10-29 13:06
No worries. Please let us know if you resolved the issue.

cmuddam.testing
2023-10-29 13:12
Yes Bas the issue is resolved :+1:. Thank you.

matt.fellows
2023-10-30 01:01
What was the issue? Was it with your code or Pact?

cmuddam.testing
2023-10-30 01:36
The issue was with my code Matt

matt.fellows
2023-10-30 01:38
thanks for confirming

shenkesi.shiva
2023-10-30 06:57
has joined #pact-net

guido.lenacota
2023-10-30 09:48
has joined #pact-net

yihong.wang
2023-10-30 10:01
has joined #pact-net

ruth.bassindale
2023-10-30 20:54
has joined #pact-net

ruth.bassindale
2023-10-30 20:56
@ruth.bassindale has left the channel

sgavathe
2023-10-31 22:00
has joined #pact-net

cody.jenkins
2023-11-01 02:39
@cody.jenkins has left the channel

ntthaibk
2023-11-01 04:36
has joined #pact-net

rskilling
2023-11-01 10:23
has joined #pact-net

ravi_shankar_lakkims
2023-11-01 11:15
Hello there! Consumer Messaging Pact Test failing with below error "Expected property Date with a length of 24, but has a length of 20, differs near Z" what's observed is... failing only when the date milliseconds are all zeros such as... "2023-10-31T06:34:24.000Z"

victor_do_val
2023-11-01 19:08
has joined #pact-net

james.corry
2023-11-01 19:23
has joined #pact-net

nicolas.cote-nolin
2023-11-02 12:30
has joined #pact-net

sivaganesh.sivakumar
2023-11-02 13:18
has joined #pact-net

likekeys
2023-11-03 10:21
Hi we are using JsonProperty as below: ```public class Message { [JsonProperty("Id")] public List Ids { get; set; } }``` Here is how we apply pactflow: ```messagePactBuilder .ExpectsToReceive("V3 Message") .Given("pushed by team A to the queue") .WithJsonContent(request) .Verify>(events => { events.Should().BeEquivalentTo(new[]{ mockDataSetup.GetActualMultiOrderReturnData() }); });``` We use the debugging mode to inspect the object "request", the property is "Ids". But after WithJsonContent(), the property is changed to "Id", and which makes the Verify() fail. Could anyone help with this?

id.akanksha26
2023-11-03 11:38
has joined #pact-net

prasant.iragavarapu
2023-11-03 15:06
has joined #pact-net

prasant.iragavarapu
2023-11-03 16:01
Hi Team We have experienced a problem while implementing a pact test from consumer side. Although our C#.Net Object has all properties in PascalCase, And when our pact test execution is complete, it converts all the properties into camel case if the *CamelCasePropertyNamesContractResolver* is used. However, this conversion does not apply to C# Anonymous Types. For instance: We have a property _public object BusinessRules { get; set; }_ Matcher code _BusinessRules = Match.Type(new_ _{_ _Comments = Match.Type("This is a comment"),_ _})_ _For some reason only businessRules is properly converted into camelcase. But Comments remain in Pascal case._ _Any Specific reason why the *CamelCasePropertyNamesContractResolver* is not applied to *Anonymous Types*_

yagocre
2023-11-03 22:46
has joined #pact-net

prakhar.roy371
2023-11-06 08:48
Hi all, We have implemented consumer and provider contract testing. Here, we have 2 consumers : A and B. One provider who is verifying both consumer pacts that have been published on the broker. So, in our case the provider has *2 pact tests.* The issue is when we try to run our test file locally, it gives the following error : "*Failed to listen on prefix 'http://localhost:49152/pact-messages/' because it conflicts with an existing registration on the machine.*" If we run each test case individually, it works and pacts for each consumer get verified. When run together, only one runs.

bas
2023-11-06 10:23
Hey @prakhar.roy371, are you running tests in parallel? If not, how are you setting up your tests? It looks like the second test is trying to register an address that the first one still keeps occupied.

prakhar.roy371
2023-11-06 10:57
We were running the test cases in parallel. Based on your comment, got the hint. [CollectionDefinition("Non-Parallel Collection", DisableParallelization = true)] [Collection("Non-Parallel Collection")] Using above two annotations we are not running them serially now. Thanks! :)

bas
2023-11-06 10:58
You're welcome!

prakhar.roy371
2023-11-06 13:10
Hi all, there is an issue I am facing on C# level of datetime values with pact tests. (See screenshot below) Basically after Json serialization, the trailing insignificant 0's are removed. In the mocked data, we have mentioned those 0s. Hence there is a length difference causing pact test cases to fail with the error : *"Expected property Date with a length of 24, but has a length of 20, differs near Z"* Can someone give any insights to this issue without removing those 0's from our mock data?

bas
2023-11-06 14:22
Can you include the source code for the `TestOrder` class? You can try to work around this by specifying the exact format for date/time (de-)serialization. Here's some examples: https://stackoverflow.com/questions/18635599/specifying-a-custom-datetime-format-when-serializing-with-json-net

bas
2023-11-06 14:26
Also, next time please post the code and error message as text, makes it easier to search in the future. You can format using backticks.

steve.blomeley
2023-11-06 14:50
has joined #pact-net

prakhar.roy371
2023-11-07 05:59
@bas here you go. ```public void Build_Pact_For_Offline_Single_Order_Returns() { pactBuilder. ExpectsToReceive("Offline single order return"). Given("publishes V3 payload"). WithJsonContent(Match.MaxType ( new { OrderNumber = Match.Type("123456"); CreatedDate = Match.Type("2023-04-05107:19:05.000Z"); } 1 ) Verify<IEnumerable<TestOrder>>(events => { events.Should().BeEquivalentTo ( new[] { new TestOrder{OrderNumber = "123456";CreatedDate = "2023-04-05T07:19:05.000Z";} } }); }``` And this is code for testorder class : ```public class TestOrder { public string OrderNumber { get; set; } public string CreatedDate { get; set; } }```

prakhar.roy371
2023-11-07 06:19
Is the JSON serialization happening inside the pact libraries? I am trying different ways to prevent http://JSON.Net to parse string as datetime and then again covert it to string after trimming off the zeros at the end. But it is not taking *any datetime format* that we mention into consideration at all. ```pact = Pact.V3("1003307_VerifyAndReivew_Messaging", "1003307_CreateAndEdit_Messaging", new PactConfig { PactDir = @"../../../ContractFile/pacts", DefaultJsonSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), Formatting = Formatting.Indented, DateFormatString= "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fff" }, Outputters = new[] { new XUnitOutput(outputHelper) } }); pactBuilder = pact.WithMessageInteractions(); mockDataHelper = new MockDataHelper();```

prakhar.roy371
2023-11-07 07:06
FYI Issue was resolved. *JsonConvert.DefaultSettings = () => new JsonSerializerSettings* *{* *DateParseHandling = DateParseHandling.None* *};* We need to add the above code to prevent http://JSON.Net from parsing string value as datetime and converting it back to string after trimming off the zeros at the end.

bas
2023-11-07 07:06
I'm assuming (but again, that's just an assumption) that Pact defers that to an actual library that's written for that purpose. I do see this in the source code: https://github.com/pact-foundation/pact-net/blob/5b5388d81995da48889cc441495153b2ef7c0978/src/PactNet.Abstractions/PactNet.Abstractions.csproj#L14 I'm happy to dive deeper into the source to see if I can find how this works, exactly. Good learning opportunity for me, too. Also, have you tried adding a custom attribute on the fields in your `TestOrder` model class, as the StackOverflow link suggests?

bas
2023-11-07 07:06
Oh that's awesome, thanks for sharing! That is very useful to know.

bas
2023-11-07 07:07
So it _is_ done by http://Json.NET :slightly_smiling_face:

prakhar.roy371
2023-11-07 07:07
We studied this in depth about why http://JSON.Net behaves like this. Many have criticized this behavior but the only workaround to that is adding those few lines as mentioned above.

ndomingues10
2023-11-07 10:14
has joined #pact-net

nswetha.reddy
2023-11-07 19:21
has joined #pact-net

matt.fellows
2023-11-07 22:11
Might best be raised as an issue on the Pact .NET repo, with a reproducible example

matt.fellows
2023-11-07 22:12
Alternatively, you should be able to let Pact .NET specify a port dynamically (all other languages support this, so I suspect it does too). And then you should be able to parallelize them. But usually, in serial they are pretty quick

aparnakrishna1115
2023-11-08 14:55
has joined #pact-net

harry.talbot
2023-11-08 15:05
has joined #pact-net

daniel.phillips
2023-11-08 17:18
has joined #pact-net

yuliya.rahalski
2023-11-08 20:15
has joined #pact-net

olivier.picaud
2023-11-08 21:51
has joined #pact-net

joseenrique.garcia
2023-11-09 12:56
has joined #pact-net

ashish.patel5
2023-11-09 15:20
has joined #pact-net

ndomingues10
2023-11-10 00:25
Hello everyone, I'm studying about a topic which envolves contract testing, and i found pact, so i decided try to implement a contract test between two minimal services. You can check it out here: https://github.com/nomorealex/pactnet-MinimalAPI/ It's not finished because i need to exercise the provider with the pact file as well implement the pact-broker. it's not done yet cause i have some problems in the providertests

bas
2023-11-10 05:25
Hey Nuno! Let us know where we can help.

cnguyen
2023-11-10 08:31
has joined #pact-net

ndomingues10
2023-11-10 10:48
So basically I?m with problems verifying the provider. There is something wrong with the providertests.csproj, where you can check it out in the github page

ndomingues10
2023-11-10 10:56
```namespace providertests { [TestFixture] public class VerifyPact { private readonly string _url = "http://127.0.0.1/9001"; private readonly Uri _Uri = new Uri("http://127.0.0.1/9001"); public VerifyPact() { } [Test] public void Verify_That_Address_Service_Honours_Pacts() { var config = new PactVerifierConfig { LogLevel = PactNet.PactLogLevel.Debug }; using (var _webHost = WebHost.CreateDefaultBuilder().UseUrls(_url).Build()) { _webHost.Start(); //Assert IPactVerifier pactVerifier = new PactVerifier(config); var pactFile = new FileInfo(Path.Join("..", "..", "..", "..", "consumertests", "pacts", "consumer-provider.json")); pactVerifier .ServiceProvider("provider", _Uri) .WithFileSource(pactFile) .Verify(); } } } }``` This is the code, that i'm using to verify the provider with the pact file generated

ndomingues10
2023-11-10 10:58
I think the problem is with the webhost. It says that i need to provide a Startup class. But since this is a minimal API, I donīt need that class, below is the provider web api

ndomingues10
2023-11-10 10:59
```using provider.model; var builder = WebApplication.CreateBuilder(args); // Add services to the container. // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseHttpsRedirection(); List<Jokes> jokesStorage = new List<Jokes> { new Jokes (0,"Why do programmers prefer dark mode? -Because the light attracts bugs!","Jonas" ), new Jokes (1,"Why did the programmer break up with their keyboard? -They had too many arguments.","Peter" ), }; app.MapGet("/jokes", () => { var allJokes = jokesStorage.ToArray(); if (allJokes.Count() > 0) return Results.Ok(jokesStorage); else return Results.NoContent(); }) .WithName("GetJokes") .Produces<Jokes>(StatusCodes.Status200OK) .Produces<string>(StatusCodes.Status204NoContent, contentType: "text/plain"); app.MapGet("/jokes/{id}", (string id) => { int _id = 0; if (!(int.TryParse(id, out _id))) { return Results.BadRequest("BadRequest!"); } Jokes joke = jokesStorage.FirstOrDefault(j => j.Id == _id); if (joke != null) { return Results.Ok(joke); } return Results.NotFound("Joke with the id provided not found!"); }) .WithName("GetJokesId") .Produces<Jokes>(StatusCodes.Status200OK, contentType: "application/json") .Produces<string>(StatusCodes.Status404NotFound, contentType: "text/plain") .Produces<string>(StatusCodes.Status400BadRequest, contentType: "text/plain"); app.MapPost("/jokes", (Jokes entity) => { Console.WriteLine(entity); if (entity is Jokes joke && entity.Id == 0 && entity.Joke != null && entity.Bywho != null) { var lastid = GetLastJokesId(); joke.Id = (lastid != -1) ? ++lastid : 0; jokesStorage.Add(joke); return Results.Created($"/jokes/{joke.Id}", joke); } return Results.BadRequest("BadRequest!"); }) .WithName("PostJoke") .Accepts<Jokes>("application/json") .Produces<Jokes>(StatusCodes.Status201Created) .Produces<string>(StatusCodes.Status400BadRequest, contentType: "text/plain") .Produces<string>(StatusCodes.Status415UnsupportedMediaType, contentType: "text/plain"); app.MapDelete("/jokes/{id}", (string id) => { int _id = 0; if (!(int.TryParse(id, out _id))) { return Results.BadRequest("BadRequest!"); } Jokes joke = jokesStorage.FirstOrDefault(j => j.Id == _id); if (joke != null) { return Results.Ok(joke); } return Results.NotFound("Joke with the id provided not found!"); }) .WithName("DeleteJoke") .Produces<Jokes>(StatusCodes.Status200OK, contentType: "application/json") .Produces<string>(StatusCodes.Status404NotFound, contentType: "text/plain") .Produces<string>(StatusCodes.Status400BadRequest, contentType: "text/plain"); app.Run(); int GetLastJokesId() { if (jokesStorage.Count > 0) { Jokes lastJoke = jokesStorage[jokesStorage.Count - 1]; return lastJoke.Id; } else { return -1; } }```

nam.nguyen414
2023-11-10 12:35
has joined #pact-net

lewis
2023-11-10 16:33
has joined #pact-net

anna.lorenzi
2023-11-10 17:42
has joined #pact-net

nathan334
2023-11-10 18:34
has joined #pact-net

bas
2023-11-10 21:43
Yeah, I tried to get this to work with a minimal API as well but ended up having to wrap it in a lightweight Startup class: https://github.com/basdijkstra/introduction-to-contract-testing-dotnet/tree/main/AddressProvider

bas
2023-11-10 21:43
It?s something I need to revisit anyway as I?m prepping for a workshop in a couple of weeks, but this is what I have / know at the moment

ndomingues10
2023-11-10 23:24
Yes, that workshop will be Based on jvm or .net

ndomingues10
2023-11-10 23:25
@bas Thanks anyways

bas
2023-11-11 06:35
That workshop will be in .NET, it?s for a client. My public workshop (that you registered for) uses Pact-JVM

cmuddam.testing
2023-11-11 07:41
Good evening. Can someone point me to a sample example/github repo for message based dotnet pact tests please ?

matt.fellows
2023-11-12 12:39
Check the Pact .NET repo

cmuddam.testing
2023-11-13 19:15
Okay :+1: thanks Matt

banghung859
2023-11-15 08:38
has joined #pact-net

ndomingues10
2023-11-15 11:13
@bas I was reviewing your work in pact-net can you tell me the purpose of the integration tests. I mean AddressPactTest.cs should make the job, right. https://github.com/basdijkstra/introduction-to-contract-testing-dotnet/blob/main/AddressProvider.Tests/AddressIntegrationTests.cs

bas
2023-11-15 11:18
Those are purely for instructional purposes, they don?t play a role in contract testing. At some point in the workshop I?m talking about different types of testing and that?s where these come in.

ndomingues10
2023-11-15 11:33
ok, that's what is I thought

ndomingues10
2023-11-15 11:33
Thanks

ndomingues10
2023-11-15 11:40
Sir @bas, I'm trying to understand the purpose of the middleware that you provide in the same project.


ndomingues10
2023-11-15 11:45
Is that just for debugging purpose or... Because I'm seeing that the AddressProvider.Tests will read the pact file and then it will verify the state on each interactions and will print a message in the console related to the provider state

bas
2023-11-15 11:46
That?s where the provider state is set before each interaction is replayed.

ndomingues10
2023-11-15 11:49
What if i don't set `.WithProviderStateUrl(new Uri($"{PactServiceUri}/provider-states"))` in the AddressPactTest.cs. My point is what is the impact of not setting the provider states. sorry for my newbie questions.

bas
2023-11-15 11:52
Try it out, you?ll see :) I don?t know. Again, this workshop is still very much work in progress so please please PLEASE don?t use it as a reference for what good Pact .Net tests look like, at least not yet

steve.blomeley
2023-11-15 15:34
Hi all, We're considering using Pact to write contract tests around the message-based interactions between some .NET services (Azure functions implemented in C#). So far we've found reasonable documentation and example code for testing .NET HTTP APIs, but documentation and examples around testing http://_.NET message-based systems_ is hard to find - what little there is seems somewhat patchy and theoretical. So we're wondering whether in practice folks are actually using Pact to test these kind of scenarios. (The sketchy docs and apparent lack of any blog posts or other on-line resources around this subject leads us to suspect not) We'd appreciate any feedback on this, and especially URLs for useful online resources like: worked examples; blog posts; in depth docs; etc. (We already looked at the Pact .NET repo - if there are any reasonably comprehensive docs / examples on there, we haven't found them yet) Thanks! Steve

ali
2023-11-16 04:50
has joined #pact-net

emmanuel
2023-11-16 09:40
has joined #pact-net

dan.corder
2023-11-16 11:37
has joined #pact-net

vikash.kumar.singh
2023-11-16 22:58
has joined #pact-net

matt.fellows
2023-11-17 03:56
This example help: https://github.com/pact-foundation/pact-net/blob/5b5388d81995da48889cc441495153b2ef7c0978/samples/OrdersApi/Consumer.Tests/OrderCreatedConsumerTests.cs#L42-L56 Yousaf ran a Message Pact workshop last month to explain the concepts: https://www.youtube.com/watch?v=81N25-4x27E&t=1s There are also a number of message based examples across language here: https://docs.pactflow.io/docs/examples/

prakhar.roy371
2023-11-17 08:27
Hi all. On the consumer side CICD Job - Pact Publish, we have defined the version to $CI_COMMIT_SH. But on the provider side, verification is done on code level. We are facing the following error on provider side verification in Can-I-Deploy on consumer side ```There is no verified pact between version 1.0.0 of Consumer and the latest version of Producer (c8169874d39b17ac0ca748dcd2fd)``` Wanted to know how we can incorporate git sh in our code. ```pactVerifier .ServiceProvider("City_Provider_API", new Uri(_providerServiceUri)) .WithUriSource(new Uri(pactUri), options => { options.TokenAuthentication("Uiv1OaU4O1wOXX0GoIfLAA"); options.PublishResults(true, "1.0.0", results => // Version -> CI_COMMIT_SH (something of this manner instead of 1.0.0) { results.ProviderBranch("Development"); }); })```

barbara.szczygiel
2023-11-17 14:08
has joined #pact-net

maria.olivero
2023-11-17 16:57
has joined #pact-net

matt.fellows
2023-11-19 01:06
There must be a way to shell out and query the got version locally? Also, any verification done locally shouldn't be publishing results. It should always be done through CI

steve.blomeley
2023-11-20 09:09
Ooh, thanks for those Matt - I hadn't found the Pactober workshops, or that particular code example. Hopefully they'll provide a way in to understanding how we might be able to use Pact for test message based interactions in .Net.

yousafn
2023-11-20 14:51
I?ve not seen demos in the wild for pact-net messaging, but there are examples in other languages, and sample code in the pact-net repo. It sounds like there is a gap that you could potentially fill, if the source code aren?t sufficient enough for you. You could make a public example .NET app that uses a messaging technology, and then look at applying pact-net. If you get stuck you can reach out and people can collab around your example The main thing to remember if you aren?t testing the messaging technology, just the message content that are passing between the systems. Outside of that the pact plugin ecosystem will allow for testing the transport type as well, such as gRPC/Protobuf with an existing pact-protobuf-plugin, or provides an framework to implement your own transport or content matcher


madhawa
2023-11-21 04:59
has joined #pact-net

pascal
2023-11-21 05:25
has joined #pact-net

srinu.innovatus
2023-11-21 08:09
has joined #pact-net

somya.khandelwal
2023-11-21 08:39
has joined #pact-net

marek19922209
2023-11-21 10:29
Hello i have written consumer and verifider tests, i am running pact-broker in which i published contract already. How now i can publish results from verifier test in broker ? this is my verifier test which im running from command line and it is passing, but nothing has changed in broker index page.

marek19922209
2023-11-21 10:51
ok i think that i need to use this (it was bit hidden in github :slightly_smiling_face: ):

marek19922209
2023-11-21 12:57
wondering not how to nicely obtain version, im also bit confused what is BuildUri ? it is something on broker ?

steve.blomeley
2023-11-21 14:22
Hey, thanks for your reply Yousaf. I'll take a look at the demo code that Matt linked to, and take it from there - but would potentially be open to the idea of collaborating on creating a well-documented online example, if that could make the journey a little smoother for other folks in the future.

matt.fellows
2023-11-21 21:58
That would be awesome, thanks Steve!

steve.blomeley
2023-11-22 12:40
So I tried to build/run the sample code in the repo at https://github.com/pact-foundation/pact-net/ - on the master branch, the sample code has a dependency on the http://Pact.Net project - which itself doesn't build, as cannot find file pact_ffi.dll : Error MSB3030 Could not copy the file "C:\...\pact-net\build\windows\x86_64\pact_ffi.dll" because it was not found. I tried pulling in the PactNet and PactNet.Output.XUnit packages from Nuget instead of referencing the local projects, but seems a bunch of the Pact calls made in the sample project aren't compatible with the Nuget version of the PactNet package (4.5) So . . . tried jumping onto the release/4.x branch, but again PactNet won't build due to missing pact_ffi.dll Tried the release/3.x branch and here everything does at least build, and most of the tests pass (after updating Newtonsoft.Json package version) So was wondering if you have any clues what the pact_ffi.dll issue is about, and how to resolve it? Would be great to get the sample tests running against the _latest_ Pact version - as not sure how much value there is in us investigating the samples that build against a 3.x Pact version.

yousafn
2023-11-22 13:35
A link to the build url that generated or verified the contract. it can be used for informational purposes in the broker, or via webhook notifications to provide curtsey links for users

yousafn
2023-11-22 13:42
If running from the repo, you need to download the native libs https://github.com/pact-foundation/pact-net/blob/5b5388d81995da48889cc441495153b2ef7c0978/.github/workflows/ci.yml#L29-L30 They come packaged in the published in the pact-net nuget packages along with the compiled pact-net code. Here is the example pulled out, albeit with pact-net 4.2.1 https://github.com/YOU54F/pact-logical-replication/tree/main/message_pact_net

yousafn
2023-11-22 13:43
Assume you are using dotnet 7? The samples on master were recently updated to target that https://github.com/pact-foundation/pact-net/commit/5b5388d81995da48889cc441495153b2ef7c0978

ndruzhinina
2023-11-22 14:25
has joined #pact-net

steve.blomeley
2023-11-22 14:33
Ah ok, thanks - pulled the dll down manually and all working on master branch now - samples building and tests passing. Now to unpick what the sample code is actually doing . . .

yousafn
2023-11-22 14:41
awesome! I?ve raised an issue about getting started directly with the repo and the lack on contribution guide https://github.com/pact-foundation/pact-net/issues/483 It should work the same as described here https://docs.pact.io/getting_started/how_pact_works#non-http-testing-message-pact so you might be able to use some of that text to help annotate the code whilst going through it :+1: I do want to at some point create a standardised messaging example across all languages, as we do with a http workshop, as it allows the same canonical concept to be taught across multiple langs

jaspal.puri
2023-11-23 10:05
has joined #pact-net

ogbofjnr
2023-11-23 12:25
has joined #pact-net

patricio.dossantos_sl
2023-11-23 20:08
has joined #pact-net

martin.gallauner
2023-11-24 10:40
has joined #pact-net

aschaff
2023-11-24 15:27
has joined #pact-net

bruno.petkovic99
2023-11-25 13:55
has joined #pact-net

cmuddam.testing
2023-11-25 22:11
In http://Pact.NET repo under samples/OrdersApi folder, I could find message pact tests for the consumer but could not find the provider message pact tests. Can someone share the exact location for provider message pact tests please?

carlrconn
2023-11-27 02:22
has joined #pact-net


yi.wu
2023-11-27 08:10
has joined #pact-net

rafaela.azevedosouza
2023-11-27 10:00
Hey hey peeps !

rafaela.azevedosouza
2023-11-27 10:00
Do you have any good tutorial/video/repo for someone that is starting in pact with C# ?

rafaela.azevedosouza
2023-11-27 10:01
ah just saw there is a link on the top lolz

rafaela.azevedosouza
2023-11-27 10:01
hide

rafaela.azevedosouza
2023-11-27 10:01
nevermind xD I was not here !

divya.parappanavar
2023-11-27 13:28
Hi Guys, We are facing a problem on Provider verification. Scenario is we have used "JsonIgnore" attribute in 2 of the properties in the model class(say key1, key2). And the same is used in the consumer model class also. public class Test { public string name {get;set} public string id{get;set} [JsonIgnore] public bool key1 {get;set;} [JsonIgnore] public int key2 {get;set;} } When we run the Provider tests, its giving error saying Actual map is missing the following keys : key1, key2 And also in the Standard Output body those 2 properties are missing. Can anyone pls help us here as we are stuck

brian_worsham
2023-11-27 14:30
has joined #pact-net

jessie.eteng
2023-11-27 15:25
has joined #pact-net

crisciano.botelho
2023-11-27 18:57
has joined #pact-net

matt.fellows
2023-11-27 20:51
We'd need to see the pact/consumer test. They appear to be expected properties

ajg.public
2023-11-27 21:44
has joined #pact-net

aschaff
2023-11-28 04:38
Hello. We are using the DAPR framework for our microservices application. I would like to institute contract testing, but it is unclear how the pieces of the contract testing puzzle fit together in a world with dapr sidecars. Does anyone have any suggestions, examples, links? Any help would be appreciated.

matt.fellows
2023-11-28 05:11
I?ve linked to this post in #general because it seems less of a .NET specific question, and more of a philosophical one at this point

lukasz.lawicki
2023-11-28 10:06
has joined #pact-net

lukasz.lawicki
2023-11-28 10:59
Hey there :wave: In the company I am working in we started using Pact for contract tests. Unfortunately, we are rookies in Contract Testing. Right now, we are struggling with identifying boundaries in contract tests. Do you know any expert that could help us? To give you more context, we are working on distributed system and we would like to have contract tests in place, to make sure other services don?t change the data on their API. We are wondering if contract tests should be black box or white box? Lets take an example: There is a service that works as provider and there is consumer. Provider works as open host. Provider exposes API and there is endpoint `GET /api/document/{id}`. We would like to have contract tests for this as it happened in the past that the contact was broken. ID is `guid`. The question is how should we provide ID? Should it be the one existing in Service A or should it be any valid guid? If the first one, the tests are becoming white box, right? Provider knows about the details & the data in Service A. But service A can take the guid from the contract, act on it and return the data. In this case, there is a temptation to check also the data returned, so you can achieve both functional tests and contract at once. How should this work? How should you provide `id` s for the data you would like to use? How should provider check it? On real data? The same will also apply for resources with availability. Assuming you there is an endpoint `Delete api/document/{id}` . Should you check it in contract tests? If yes, how? Same problem with guid, but also additional problem. If you execute it on any side of tests then the document with {id} will be removed, so you won?t be able to run this for the 2nd time. We really love the tool but after some time we have many questions to ask, as we are not sure how to use it properly :angel: is there any expert in the house that could help us? :thinking_face:

yousafn
2023-11-28 11:37
Hey, Matchers and Provider States are made for this purpose. Matching to deal with flexibility on data, so that you can test schemas rather than exact contents. Provider states allow you to setup data on the provider, without the consumer knowing about the specifics of that data, they just describe the ?state? that the system should be in prior to verification, and the provider can implement that https://docs.pact.io/getting_started/matching https://docs.pact.io/getting_started/provider_states

lukasz.lawicki
2023-11-28 11:44
thanks a lot for the answer and the hint! :pray: To rephrase what you wrote, is it fair to say that contract tests should not work on real data? That contract tests in Pact should be as close to black box ass possible?

matt.fellows
2023-11-28 12:12
> To rephrase what you wrote, is it fair to say that contract tests should not work on real data? That contract tests in Pact should be as close to black box ass possible? I think that delineation is too course. A Pact consumer test is _white box_ test, because it?s very close to a unit test. The mentality of a unit test on each side of the integration point is helpful to have. But to your point, the Pact provider test is more black box - you should not know about implementation details, at least.

matt.fellows
2023-11-28 12:13
But the examples you give with `guuid` is only white box in that the data is known to both parties, the implementation of the provider is never known. Provider states are the way to _communicate intent_ about a test, and this is a common area of confusion

matt.fellows
2023-11-28 12:14
I?d suggest adding to the above 1. Good practices on writing consumer tests: https://docs.pact.io/consumer 2. How to think about contract tests vs function tests: https://docs.pact.io/consumer/contract_tests_not_functional_tests

matt.fellows
2023-11-28 12:15
> In this case, there is a temptation to check also the data returned, so you can achieve both functional tests and contract at once. I?d avoid the temptation to do both, however don?t get too hung up on tests that happen to also do functional testing as a side effect (that are easily maintained). i.e. don?t do it on purpose, but don?t tie yourself in knots if it happens - think of it as a nice bonus.

lukasz.lawicki
2023-11-28 13:31
Thanks for the answer and more hints! Black/whitebox was a shortcut as it depends on the perspective! From consumer that should be black box as and from provider white box. Taking about `guids`. If you have `GET api/document/{id}` endpoint, on consumer side, should you pass correct `guid` for document that is existing (that you know exists in database) or is it any valid guid? Which one is a better approach in your opinion?

jawad.sefiani
2023-11-28 14:08
has joined #pact-net

bas
2023-11-28 15:46
Hey folks, so, I'm trying to get my test for an HTTP POST to work, but it fails on the consumer side with an HTTP 500. Here's the test: ```[Test] public async Task PostAddress_AddressIdIsValid() { Address address = new Address { Id = new Guid(addressIdNonexistent), AddressType = "delivery", Street = "Main Street", Number = 123, City = "Beverly Hills", ZipCode = 90210, State = "California", Country = "United States" }; pact.UponReceiving("A request to create an address by ID") .Given("an address with ID {id} does not exist", new Dictionary { ["id"] = addressIdNonexistent }) .WithRequest(HttpMethod.Post, $"/address") .WithHeader("Content-Type", "application/json; charset=utf-8") .WithJsonBody(address) .WillRespond() .WithStatus(HttpStatusCode.Created); await pact.VerifyAsync(async ctx => { var response = await client.PostAddress(address); Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.Created)); }); }``` This is my client implementation: ```public async Task PostAddress(Address address) { using (var client = new HttpClient { BaseAddress = baseUri }) { try { var response = await client.PostAsync($"/address", new StringContent(JsonSerializer.Serialize(address), Encoding.UTF8, "application/json")); return response; } catch (Exception ex) { throw new Exception("There was a problem connecting to the AddressProvider API.", ex); } } }``` The actual request, as captured by Fiddler: ```POST http://localhost:9876/address HTTP/1.1 Host: localhost:9876 Content-Type: application/json; charset=utf-8 Content-Length: 192 {"Id":"3514466e-3e58-48b3-ab35-e553b91aa2b3","AddressType":"delivery","Street":"Main Street","Number":123,"City":"Beverly Hills","ZipCode":90210,"State":"California","Country":"United States"}``` And the response from the Pact mock provider: ```HTTP/1.1 500 Internal Server Error access-control-allow-origin: * content-type: application/json; charset=utf-8 x-pact: Request-Mismatch content-length: 747 date: Tue, 28 Nov 2023 15:53:22 GMT {"error":"Request-Mismatch : HttpRequest { method: \"POST\", path: \"/address\", query: None, headers: Some({\"content-length\": [\"192\"], \"host\": [\"localhost:9876\"], \"content-type\": [\"application/json; charset=utf-8\"]}), body: Present(b\"{\\\"Id\\\":\\\"3514466e-3e58-48b3-ab35-e553b91aa2b3\\\",\\\"AddressType\\\":\\\"delivery\\\",\\\"Street\\\":\\\"Main Street\\\",\\\"Number\\\":123,\\\"City\\\":\\\"Beverly Hills\\\",\\\"ZipCode\\\":90210,\\\"State\\\":\\\"California\\\",\\\"Country\\\":\\\"United States\\\"}\", Some(ContentType { main_type: \"application\", sub_type: \"json\", attributes: {\"charset\": \"utf-8\"}, suffix: None }), None), matching_rules: MatchingRules { rules: {} }, generators: Generators { categories: {} } }"}``` And the log output: ```2023-11-28T15:53:22.876142Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /address, query: None, headers: Some({"content-length": ["192"], "host": ["localhost:9876"], "content-type": ["application/json; charset=utf-8"]}), body: Present(192 bytes, application/json;charset=utf-8) ) 2023-11-28T15:53:22.876349Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /address, query: None, headers: Some({"Content-Type": ["application/json; charset=utf-8"]}), body: Present(192 bytes, application/json) )``` The only real difference I'm seeing is the capitalization of the `Content-Type` header name, but Pact isn't _that_ fussy, hopefully? EDIT: it doesn't seem like it is, when I change the capitalization in the test to `content-type` it still fails, here's the updated logging: ```2023-11-28T16:11:08.276151Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /address, query: None, headers: Some({"content-length": ["192"], "content-type": ["application/json; charset=utf-8"], "host": ["localhost:9876"]}), body: Present(192 bytes, application/json;charset=utf-8) ) 2023-11-28T16:11:08.276441Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /address, query: None, headers: Some({"content-type": ["application/json; charset=utf-8"]}), body: Present(192 bytes, application/json) )```

yousafn
2023-11-28 16:59
are you sending a json string so `'{}'` rather than `{}` ?

yousafn
2023-11-28 17:00
`new StringContent(JsonSerializer.Serialize(address), Encoding.UTF8, "application/json")`

bas
2023-11-28 17:03
Nope, sending an Address object and serialising that just before sending, as I hoped was clear from the code :)

bas
2023-11-28 17:04
The HttpClient expects an object of type HttpContent and StringContent is what I?m used to using here (in RestAssured .Net in any case). Raw request looks good to me

yousafn
2023-11-28 17:09
it?s just this bit that looks overly escaped, which I thought is happening when you are calling new StringContent method. `body: Present(b\"{\\\"Id\\\":\\\"3514466e-3e58-48b3-ab35-e553b91aa2b3\\\",\\\"AddressType\\\":\\\"delivery\\\",\\\"Street\\\":\\\"Main Street\\\",\\\"Number\\\":123,\\\"City\\\":\\\"Beverly Hills\\\",\\\"ZipCode\\\":90210,\\\"State\\\":\\\"California\\\",\\\"Country\\\":\\\"United States\\\"}\",` especially compared to the headers in the log output. That might be red herring as Fiddler isn?t showing it an a string, but an object

yousafn
2023-11-28 17:10
In the test you are calling `WithJsonBody` and just passing in the address, does that provide something different so the new StringContent(xyz?)

elaine.silva
2023-11-28 17:50
has joined #pact-net

bas
2023-11-28 18:17
Ah I got you now. You might be onto something here. I?ll have a closer look tomorrow or Thursday. Cheers mate! In the meantime, any working examples with POSTs and HttpClient are welcome!

matt.fellows
2023-11-29 02:43
So, what worries me here is that the error messages are hidden away in the log file/output, but not printed nicely.

matt.fellows
2023-11-29 02:44
You?re not the first, and this is a less than ideal developer experience, I?m going to raise a feature request


matt.fellows
2023-11-29 02:55
> If you have `GET api/document/{id}` endpoint, on consumer side, should you pass correct `guid` for document that is existing (that you know exists in database) or is it any valid guid? Which one is a better approach in your opinion? I tend to prefer knowing that there is a ?golden set? of data I can rely upon, as this just makes things faster for all. But in some cases it?s not practical, and that?s where a provider state comes in e.g. given `user with ID 1234 exists`, the provider verification could then ensure a user with id `1234` exists

bas
2023-11-29 07:24
Cheers Matt! I?ll have another look today or tomorrow to see if I can fix the issue. It?s all good preparation for my upcoming workshop on Monday, though

bas
2023-11-29 08:54
Thinking just now.. If the extra escaping is a problem, wouldn?t there be a mismatch in the number of bytes expected versus actual? Both are 192.

bas
2023-11-29 08:55
Fiddler HexView also doesn?t show additional bytes due to extra escaping

bas
2023-11-29 09:12
Hmm.. This is weird. When I send the same body, copied from my Fiddler logs, as a string using WithBody(), it works! I?m stumped.

tomasz.myszka
2023-11-29 14:21
has joined #pact-net

tom.willmott944
2023-11-29 14:44
has joined #pact-net

anna.nava
2023-11-29 20:56
has joined #pact-net

pasc.ther
2023-11-29 22:19
has joined #pact-net

shenkesi.shiva
2023-11-30 09:39
Hi, I'm getting pact verification failure error like below. Unable to connect service url and it is refusing it. Can any one help me out , how to resolve below error. Thanks in advance. ```{ "providerName": "DocumentArtifact", "providerApplicationVersion": "1", "success": false, "verificationDate": "2023-11-30T09:31:21+00:00", "testResults": [ { "exceptions": [ { "message": "error sending request for url (http://localhost:9223/api/v1/api/v1/artifact/d4ebdf49-fff0-4968-a6b0-e7bc27072c64): error trying to connect: tcp connect error: No connection could be made because the target machine actively refused it. (os error 10061)" } ], "interactionId": "f7ba0fa997611c33ada03b17e453118d3dfbac56", "success": false } ], "verifiedBy": { "implementation": "Pact-Rust", "version": "1.0.4" },```

matt.fellows
2023-11-30 09:49
The error seems clear to me. Perhaps you could explain your setup a little further, or proof that your API is running on that port/address

yousafn
2023-11-30 10:55
the path `/api/v1/api/v1` looks suspect.

shenkesi.shiva
2023-11-30 11:00
yeah, thanks.

awade
2023-11-30 13:49
has joined #pact-net

eddie
2023-11-30 20:58
When I run `.Verify` if contract verification fails then a `PactFailureException` is thrown. Will results still be published to the broker in this case, though? Is it safe to swallow this exception?

bas
2023-11-30 21:24
Hey @eddie, I can confirm that results will still be published. Here's my `PactFailureException` and the corresponding view from my broker. I'm curious to learn why you would swallow the exception, though?

eddie
2023-11-30 21:26
Well it's implemented as a unit test for us, which runs with all the other unit tests as part of a build. If any test fails build = halted Just because we've failed one particular contract verification, doesn't mean we should fail the build - just means we can't deploy this build to environments where that contract violation would be a problem

bas
2023-11-30 21:30
Ah, that makes sense. As a tester I?m just naturally wary of people swallowing exceptions in their tests :)

eddie
2023-11-30 21:30
Thanks for looking into it for me, by the way :green_heart:

bas
2023-11-30 21:31
No problem, I?m busy preparing a workshop on Pact in C# for next week and this scenario is part of the story so wanted to make sure I got it right. I guess I need to thank you, too!

matt.fellows
2023-11-30 21:41
As Bas mentions, it _should_ send to the broker if you have the publishing setting enabled

matt.fellows
2023-11-30 21:41
this wouldn?t normally be enabled from your dev machine, and is usually something you would only do from CI.

matt.fellows
2023-11-30 21:42
I would personally separate the pact tests from your other tests if the results of running them are treated differently. e.g. have a separate stage in the pipeline

cmuddam.testing
2023-12-01 01:09
Sorry for the late response Matt. I was but confused with the pact file as it has both synchronous and asynchronous interactions. 1. Is there any example (dotnet based) only for message pact tests? 2. Do we use provider state in message pact tests? (Sorry might be a silly question)

matt.fellows
2023-12-01 02:40
> 1. Is there any example (dotnet based) only for message pact tests? why does that matter? Can you just ignore the non-message bits?

matt.fellows
2023-12-01 02:40
> 1. Do we use provider state in message pact tests? (Sorry might be a silly question) In theory, it?s nice to have them enumerated because it provides clarity around the test case, in practice not really

cmuddam.testing
2023-12-02 06:02
Thanks Matt. Appreciate it.

vspallas
2023-12-03 10:18
has joined #pact-net

nicholaspatrickshaw
2023-12-04 10:32
has joined #pact-net

malvine.logina
2023-12-04 11:52
has joined #pact-net

vinicius.gabriel
2023-12-05 13:59
has joined #pact-net

stasiekps
2023-12-05 15:13
has joined #pact-net

antal.tettinger
2023-12-05 15:50
has joined #pact-net

archaanaaa8
2023-12-06 07:19
has joined #pact-net

visaliparimi
2023-12-06 10:03
has joined #pact-net

indrani.r
2023-12-06 10:06
has joined #pact-net

frank.weitmann
2023-12-06 10:23
has joined #pact-net

venketeshvenky
2023-12-06 10:40
has joined #pact-net

kyle.r.shrader
2023-12-07 01:33
has joined #pact-net

ajay991610
2023-12-07 05:27
has joined #pact-net

marko.stevanovic
2023-12-07 10:01
has joined #pact-net

mahesh.manglani
2023-12-07 16:49
has joined #pact-net

mahesh.manglani
2023-12-07 16:51
Hello

mahesh.manglani
2023-12-07 16:52
Does Pact support message testing using azure bus service?

gerard.molina
2023-12-07 17:01
has joined #pact-net

boyd.social
2023-12-07 17:52
has joined #pact-net

bas
2023-12-07 18:18
I?m no Azure Service Bus expert, but as far as I can see it?s impossible to run services and clients locally, which I think makes contract testing using Pact a) technically not feasible (because that?s how Pact works, with local unit tests) and b) moot (because you?ve deployed already). But I?d love to be proven wrong, again, I?m no Azure Service Bus expert (or Azure expert in general).

matt.fellows
2023-12-07 21:46
I believe it might be doable (search https://www.linen.dev/s/pact-foundation to see if you can find it in the history). I?ve definitely heard of people attempting it. The catch of course is that it would be hard to test locally as Bas mentioned, so you would want to properly understand the cost/benefit. Perhaps there is a way to sidestep the inclusion of it (not sure if this recipe helps think that through: https://docs.pact.io/recipes/apigateway) If you manage to get it working, we should add it to the recipes page here: https://docs.pact.io/recipes

muhd_syamil.dzulkafta
2023-12-08 05:47
has joined #pact-net

omer.sucu
2023-12-08 10:04
has joined #pact-net

omer.sucu
2023-12-08 10:30
Hi, I am getting an error in the can-i-deploy step. The reason is that I published a pact, but it does not have any provider yet. How should I manage the pipeline process at this point at the first deploys?

omer.sucu
2023-12-08 10:32
btw i forgot to send


omer.sucu
2023-12-08 10:42
thx :pray:

hermoine807
2023-12-08 12:04
has joined #pact-net

blake.norrish
2023-12-08 17:05
has joined #pact-net

robert.jelic
2023-12-10 23:02
has joined #pact-net

pragna.reddy
2023-12-11 11:32
has joined #pact-net

oguzhannvarol
2023-12-11 14:13
has joined #pact-net

ryan.quinn
2023-12-11 17:57
has joined #pact-net

arnon
2023-12-12 09:01
has joined #pact-net

lewis.blackwood
2023-12-12 14:04
has joined #pact-net

ilie.cotiuga
2023-12-12 14:26
has joined #pact-net

remyjaume
2023-12-12 15:46
has joined #pact-net

amelie.frappier
2023-12-12 18:55
has joined #pact-net

amelie.frappier
2023-12-12 19:01
Hello! Our SCA security tool, IQ Server, returns a critical vulnerability in PactNet.OSX 3.0.2. According to the tool, the vulnerability comes from the usage of the Ruby Gem Bundler 1.x library, which has this CVE associated with it, https://nvd.nist.gov/vuln/detail/CVE-2016-7954 Here is where IQ Server detected it : PactNet.OSX-3.0.2.nupkg => tools/pact-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/definition.rb. Is it possible to patch it to a more secure version (Bundler 2.x)? Thank you.

flament.thom
2023-12-12 20:44
has joined #pact-net

ckbisk
2023-12-12 22:18
has joined #pact-net

matt.fellows
2023-12-13 02:44
Hi Amelie! That?s quite an old version of Pact .NET. It?s possible it could be patched (please submit an issue request to the repo for the maintainer to check). There was a script that used to be called to upgrade the bundled Ruby (https://github.com/pact-foundation/pact-net/blob/3.0.2/script/create-pr-to-update-pact-ruby-standalone.sh) so it might still be easy enough to produce a new release. I would say, this vulnerability is theoretical only - you should see if you can have it excluded from the SCA tool. > might allow remote attackers to inject arbitrary Ruby code into an application If you think about it, how would it actually present a security risk to the company? It?s a dev tool that doesn?t run in production, and the risk is that it could be exploited by a remote attacker.

sterankin
2023-12-13 10:57
has joined #pact-net

shane.bogdan
2023-12-13 12:06
has joined #pact-net

luis.nuno
2023-12-13 18:08
has joined #pact-net

raleigh.schickel
2023-12-13 23:15
has joined #pact-net

hataipat.sup
2023-12-15 05:26
has joined #pact-net

hakan.dilaver
2023-12-15 13:54
has joined #pact-net

eliranbardavid
2023-12-17 09:06
has joined #pact-net

anthony.trad
2023-12-17 12:30
has joined #pact-net

anthony.trad
2023-12-17 12:44
Hey there! Just stumbled on this great channel, i?m starting to use PACT recently and i?m experimenting with the idea of using it more in an end to end way than the samples are showing. I built a small POC of what I had in mind and would love to share it. It comes down to leveraging more the mocks created by the pacts, but I still have some issues that would love to discuss, things like controlling more ?when? the mock server for a given pact is spun up (VerifyAsync). More in :thread: Another note is that I see you?re https://github.com/pact-foundation/pact-net/issues/282, would love to help if still needed :+1:

anthony.trad
2023-12-17 12:45
Here?s a small sample I built for what i had in mind, i added TODOs on what?s wrong if anyone is down to take a look.

bas
2023-12-17 17:06
Could you share this on GitHub? Much easier to have a look at your code that way. Also, I too would love to know if @pact544 is OK being the sole / main contributor to Pact .Net at the moment. If not, like @anthony.trad , I?d love to see if I can play a role here somewhere in 2024.


m.mohammadi.se
2023-12-18 19:31
has joined #pact-net

lewis.foreman
2023-12-18 21:45
has joined #pact-net

matt.fellows
2023-12-18 23:18
Hi Anthony, welcome to the workspace!

matt.fellows
2023-12-18 23:19
Thanks so much for putting this together, i?ll take a look and share some feedback, ideally this week before I head on leave for the year

matt.fellows
2023-12-18 23:21
I?d love an explanation of these TODO?s though. I can guess, but want to get your view > // TODO: ValidateAsync is ugly with this design, pact-net don?t expose the actual mock. Thinking of a clever way to fix this. > // TODO: Service A might be dependant on Service B,C,D..., ValidateAsync might get in the way.

matt.fellows
2023-12-18 23:26
As for additional maintainers, we are always open to more. I can do an intro to @pact544 (who?s not so active on here due to certain logistical issues). The Pact .NET project is in pretty good shape as it?s now on our ?shared core? model, however there are some big ticket features needed: 1. Implementation of the https://github.com/pact-foundation/pact-compatibility-suite/ - this would make it clearer to all in a first-class way, which exact features are supported by Pact .NET (this would be a big improvement on the manual and less clear https://docs.pact.io/roadmap/feature_support) 2. Implementation of Pact V4 spec a. The major item introduced is the synchronous messaging capability b. There are some others also, as documented in (1) 3. Plugin Support (https://github.com/pact-foundation/pact-plugins) a. Supporting plugins is a major initiative to allow users to extend and customise Pact Of course, there are always maintenance, bug fixes, and general support which is all of great help to our community. Let me know how I can help! _P.S. you may also want to jump into the #maintainers channel and say hi there_

suat.kose
2023-12-19 08:29
Hi, I face an issue on provider-side. I can verify the contract on my development machine. But, the test server returns 500 on the CI pipeline. Any idea? ```There were 1 pact failures 1242 1243 Verifier Logs 1244 ------------- 1245 2023-12-19T08:17:09.217242Z INFO ThreadId(01) pact_verifier::pact_broker: Fetching path '/' from pact broker 1246 2023-12-19T08:17:09.217384Z DEBUG ThreadId(01) reqwest::connect: starting new connection: http://pact-broker-listing-k8s-qa.hepsiburada.com/ 1247 2023-12-19T08:17:09.227735Z DEBUG ThreadId(01) hyper::client::connect::http: connecting to 192.168.52.112:80 1248 2023-12-19T08:17:09.228757Z DEBUG ThreadId(01) hyper::client::connect::http: connected to 192.168.52.112:80 1249 2023-12-19T08:17:09.234723Z DEBUG ThreadId(01) pact_verifier::pact_broker: Link URL is templated 1250 2023-12-19T08:17:09.234765Z DEBUG ThreadId(01) pact_verifier::pact_broker: templated URL = http://pact-broker-listing-k8s-qa.hepsiburada.com/pacts/provider/{provider}/for-verification 1251 2023-12-19T08:17:09.235919Z DEBUG ThreadId(01) pact_verifier::pact_broker: final URL = http://pact-broker-listing-k8s-qa.hepsiburada.com/pacts/provider/LISTING_LISTINGAPI/for-verification 1252 2023-12-19T08:17:09.235973Z INFO ThreadId(01) pact_verifier::pact_broker: Fetching path '/pacts/provider/LISTING_LISTINGAPI/for-verification' from pact broker 1253 2023-12-19T08:17:09.236010Z DEBUG ThreadId(01) hyper::client::pool: reuse idle connection for ("http", http://pact-broker-listing-k8s-qa.hepsiburada.com) 1254 2023-12-19T08:17:09.290492Z DEBUG ThreadId(01) hyper::client::pool: pooling idle connection for ("http", http://pact-broker-listing-k8s-qa.hepsiburada.com) 1255 2023-12-19T08:17:09.290620Z DEBUG ThreadId(01) pact_verifier::pact_broker: templated URL = http://pact-broker-listing-k8s-qa.hepsiburada.com/pacts/provider/LISTING_LISTINGAPI/for-verification 1256 2023-12-19T08:17:09.291174Z DEBUG ThreadId(01) pact_verifier::pact_broker: final URL = http://pact-broker-listing-k8s-qa.hepsiburada.com/pacts/provider/LISTING_LISTINGAPI/for-verification 1257 2023-12-19T08:17:09.291199Z DEBUG ThreadId(01) pact_verifier::pact_broker: Sending JSON to http://pact-broker-listing-k8s-qa.hepsiburada.com/pacts/provider/LISTING_LISTINGAPI/for-verification using POST: {"providerVersionTags":[],"includePendingStatus":false,"consumerVersionSelectors":[{"latest":true}]} 1258 2023-12-19T08:17:09.291259Z DEBUG ThreadId(01) hyper::client::pool: reuse idle connection for ("http", http://pact-broker-listing-k8s-qa.hepsiburada.com) 1259 2023-12-19T08:17:09.328112Z INFO ThreadId(01) pact_verifier::pact_broker: Fetching path '/pacts/provider/LISTING_LISTINGAPI/consumer/RETAIL_LISTINGINTEGRATOR_COMMANDAPI/pact-version/91c4ec427a723f7d6168d5e560a658fc1bf9891a/metadata/c1tdW2xdPXRydWUmc1tdW2N2XT0xMTM' from pact broker 1260 2023-12-19T08:17:09.328155Z DEBUG ThreadId(01) hyper::client::pool: reuse idle connection for ("http", http://pact-broker-listing-k8s-qa.hepsiburada.com) 1261 2023-12-19T08:17:09.368650Z DEBUG ThreadId(01) hyper::client::pool: pooling idle connection for ("http", http://pact-broker-listing-k8s-qa.hepsiburada.com) 1262 2023-12-19T08:17:09.370368Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: pact_verifier: Executing provider states 1263 2023-12-19T08:17:09.370378Z INFO ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: pact_verifier: Running setup provider state change handler 'There is an available listing for a given sku and merchant.' for 'A GET request to retrieve listing info.' 1264 2023-12-19T08:17:09.371133Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: pact_verifier::provider_client: Sending HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(165 bytes, application/json) ) to state change handler 1265 2023-12-19T08:17:09.371213Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: reqwest::connect: starting new connection: http://localhost:5001/ 1266 2023-12-19T08:17:09.372417Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: hyper::client::connect::http: connecting to [::1]:5001 1267 2023-12-19T08:17:09.372619Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: hyper::client::connect::http: connected to [::1]:5001 1268 2023-12-19T08:17:39.508682Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: hyper::client::pool: pooling idle connection for ("http", localhost:5001) 1269 2023-12-19T08:17:39.610287Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: hyper::client::pool: reuse idle connection for ("http", localhost:5001) 1270 2023-12-19T08:18:09.622540Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: hyper::client::pool: pooling idle connection for ("http", localhost:5001) 1271 2023-12-19T08:18:10.623922Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: hyper::client::pool: reuse idle connection for ("http", localhost:5001) 1272 2023-12-19T08:18:40.629666Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: hyper::client::pool: pooling idle connection for ("http", localhost:5001) 1273 2023-12-19T08:18:40.629714Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: pact_verifier::provider_client: State change request: Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(5001), path: "/provider-states", query: None, fragment: None }, status: 500, headers: {"content-length": "0", "date": "Tue, 19 Dec 2023 08:18:40 GMT", "server": "Kestrel"} } 1274 2023-12-19T08:18:40.629882Z DEBUG ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: pact_verifier: State Change: "ProviderState { name: "There is an available listing for a given sku and merchant.", params: {"merchantId": String("e750130c-d0ff-469f-8767-66a63af8ea0c"), "sku": String("ARZUM")} }" -> Err(Provider state failed: (interaction_id: 9702a92d252b7b6a6d5e6ad02c452f28eef88eee) Invalid status code: 500) 1275 2023-12-19T08:18:40.629907Z ERROR ThreadId(01) verify_interaction{interaction="A GET request to retrieve listing info."}: pact_verifier: Provider setup state change for 'There is an available listing for a given sku and merchant.' has failed - MismatchResult::Error("Invalid status code: 500", Some("9702a92d252b7b6a6d5e6ad02c452f28eef88eee")) 1276 2023-12-19T08:18:40.630316Z INFO ThreadId(01) pact_verifier: Publishing verification results back to the Pact Broker 1277 2023-12-19T08:18:40.630328Z DEBUG ThreadId(01) pact_verifier: Publishing a failure result to PactBroker(http://pact-broker-listing-k8s-qa.hepsiburada.com/, provider_name='LISTING_LISTINGAPI') 1278 2023-12-19T08:18:40.631594Z DEBUG ThreadId(01) pact_verifier::pact_broker: Sending JSON to http://pact-broker-listing-k8s-qa.hepsiburada.com/pacts/provider/LISTING_LISTINGAPI/consumer/RETAIL_LISTINGINTEGRATOR_COMMANDAPI/pact-version/91c4ec427a723f7d6168d5e560a658fc1bf9891a/metadata/c1tdW2xdPXRydWUmc1tdW2N2XT0xMTM/verification-results using POST: {"providerApplicationVersion":"39d88beb","success":false,"testResults":[{"exceptions":[{"message":"One or more of the setup state change handlers has failed"}],"interactionId":"9702a92d252b7b6a6d5e6ad02c452f28eef88eee","success":false}],"verifiedBy":{"implementation":"Pact-Rust","version":"1.0.4"}} 1279 2023-12-19T08:18:40.631766Z DEBUG ThreadId(01) reqwest::connect: starting new connection: http://pact-broker-listing-k8s-qa.hepsiburada.com/ 1280 2023-12-19T08:18:40.654460Z DEBUG ThreadId(01) hyper::client::connect::http: connecting to 192.168.52.112:80 1281 2023-12-19T08:18:40.655765Z DEBUG ThreadId(01) hyper::client::connect::http: connected to 192.168.52.112:80 1282 2023-12-19T08:18:40.869789Z DEBUG ThreadId(01) hyper::client::pool: pooling idle connection for ("http", http://pact-broker-listing-k8s-qa.hepsiburada.com) 1283 2023-12-19T08:18:40.870260Z INFO ThreadId(01) pact_verifier: Results published to Pact Broker 1284 2023-12-19T08:18:40.870334Z DEBUG ThreadId(01) pact_matching::metrics: 'PACT_DO_NOT_TRACK' environment variable is set, will not send metrics 1285 2023-12-19T08:18:40.870421Z DEBUG ThreadId(01) pact_plugin_driver::plugin_manager: Shutting down all plugins```

suat.kose
2023-12-19 08:31
Here is my verification settings. If i set timeout 20 sec, i got timeout. If i set 60 sec, i got http 500. ```PactVerifier .ServiceProvider("PROVIDER", new Uri(ProviderUrl)) .WithPactBrokerSource(new Uri(pactBrokerSettings.Url), options => { options .ConsumerVersionSelectors(new ConsumerVersionSelector { Latest = true }) .PublishResults(providerVersion) .BasicAuthentication(pactBrokerSettings.Username, pactBrokerSettings.Password); }) .WithCustomHeader("Authorization", $"Token {TestHelper.CreateToken()}") .WithProviderStateUrl(new Uri($"{ProviderUrl}/provider-states")) .WithRequestTimeout(TimeSpan.FromSeconds(60)) .Verify(); }```

matt.fellows
2023-12-19 11:42
If you look carefully at the logs, it's an issue setting up the provider state What does your API logs have to say about it?

suat.kose
2023-12-19 11:59
I can't see the api logs it's because the test server is working on a gitlab agent. Tests are passed on my local dev machine.

matt.fellows
2023-12-19 12:05
Well, the problem is coming from there, so you'll need to solve it soon!

anthony.trad
2023-12-19 12:43
Hi Matt, Thanks you for circling back on this and taking the time to read the sample! The roadmap you shared seems exciting, will pop in on #maintainers as mentioned! Here?s a bit more formal context about the TODOs and using PACTs. Here?s the end state I was looking to have: ? Instead of testing the mocks in isolation on the consumer side as mentioned in the sample, I wanted to leverage the same generated mocks in unit tests for E2E flows. ? This effectively kills 2 birds in 1 stone having people maintaining only PACTs instead of PACTs and redundant mocks depending on the tests. ? This is more realistic in production services and complex scenarios. See example below: ? Imagine Service A as a complex ?orchestrator? Service that calls Service B, C, D etc?. to do some work. There?s 2 ways to test this on unit tests: 1) ? Testing Service A code in isolation + Testing B, C, D in isolation like the samples. ? Dependencies of Service A will need to be mocked again like mentioned above. ? I call those ?low level? or ?focused? unit tests. 2) ? Leverage the `WebApplicationFactory` on unit level that spins up an in-process API for service A. ? This allows you to have more behavioral tests from user POV. ? Those are ?high level? unit tests. Example like `GivenUserIsValid_WhenUserCallsServiceA_ResponseXIsReturned` and `GivenUserIsValidAndServiceBTimesOut_WhenUserCallsServiceA_ResponseYIsReturned` Now realistically, you always have some versions of both options in a given CI. (2) infers less code, maintenance and more confidence when incorporated with PACT. It would be a crazy fast E2E test that you do and add a ton of. PACTs would be linked to behaviors, each test overriding or creating its required behaviors: 1. PACTs can be wired up directly in the WebApplicationFactory with some default behaviors. a. Handy for simple services that won?t change in your tests. Eg: Service C has a single endpoint. 2. PACTs can be overriden or setup differently for certain tests. a. Handy for simulating different flows, errors or bad behaviors in general. Eg: How do we respond if service B times out. All this context is just about the goal of the sample, I would see myself using `pact-net` seemlessly by leveraging it in any consumer test with the only difference is that the interactions are recorded for us to validate later. Now comes the TODOs: ? The PACT mock server is only spun up when calling `VerifyAsync`, and if i am trying to use the mock in my actual tests, I need to inject that mock in the API only afterwards which would ? Slow down the test, (arrange of each test is building WebApplicationFactory like in the sample). ? Does not scale if I have lots of behaviors from different services. The tests are acceptable for Service B, but imagine we have Service C and D that we need to default setup each time. ? My proposition lies around exposing a way for the user to manage when and with what pacts a mock server is spun up or Imagine the following from a user POV: 1. Extension method on IServiceCollection (DI) for WebApplicationFactory like `AddPactMock(Pact[] defaultPacts)` ? HttpClients will work with the default pacts now out of the box. This cover a big chunk of tests. ? Registers a `IPactMocker` interface. 2. For simulating errors, adding or modifying those already running PACTs, I would get the `IPactMocker` in the relevant test and do: a. `IPactMocker.Override(Pact newPact)` b. `IPactMocker.Add(Pact pact)` c. `IPactMocker.Remove(Pact pact)` 3. 2 might create problems where tests are run in parallel so second best would be to a. Either have dedicated mock servers by test set (already catered for depending on how you register in DI, Singleton, Scoped or Transient) and if you?re creating a new `WebApplicationFactory` for each test with random ports etc? b. Relay the problem to the user and let him rebuild and re-inject the mock server when he wants to override somehow

anthony.trad
2023-12-19 13:10
Sorry for the lengthy message, figured a proper context with goals and an initial reasoning might set you up for the review. Let me know if I am way off with what?s presented:+1:

eran.bergman560
2023-12-19 18:43
has joined #pact-net

matt.fellows
2023-12-20 00:59
Interesting ideas! The idea of HttpClients working out of the box with mocks I think applies to both testing scenarios (i.e. it?s a point of confusion for Pact users, and it would be ideal if the http client could be made aware that it?s calling an API endpoint that wasn?t mocked - it would be a better UX and also remove a class of problems newbies have)

matt.fellows
2023-12-20 00:59
as for re-using them in the ?e2e? style tests, technically you could use https://github.com/pact-foundation/pact-stub-server now, albeit it?s not as flexible as you describe

matt.fellows
2023-12-20 01:00
exposing them in the https://github.com/pact-foundation/pact-referencecould be an option

tom.dracz
2023-12-20 09:53
has joined #pact-net

anthony.trad
2023-12-20 10:18
Is the stub-server available in C# as well (in-memory)? Otherwise spinning docker to use it doesn?t leverage PACT to the fullest since ideally everything would be on the unit tests. So it?s either: ? Implement an in-memory stub server for C# if not present or enhance the existing one to be more flexible. ? Or Expose the core making it usable by the users. Ideally with some helpers that does the wiring for you. I?m new here but if we already have (1), might as well enhance it. Might benefit other languages as well and provide a consistent approach all the way through. If not (2) i assume is easier to do, again new here just trying to balance the two and see what can be reasonably suggested.

ivan.gutowski-smith
2023-12-20 10:40
has joined #pact-net

nicolas.vaquero
2023-12-20 11:31
has joined #pact-net

matt.fellows
2023-12-20 12:30
No, not to my knowledge. It would need to be exposing via the rust core I think before C# could use it

matt.fellows
2023-12-20 12:31
Once it?s in the core (which we expose as C/FFI functions to .NET and other languages) it can be made accessible in the .NET Pact SDK

emailmvj
2023-12-20 16:18
has joined #pact-net

noelmccrory
2023-12-21 12:31
has joined #pact-net

fajfer.pawel
2023-12-21 13:39
has joined #pact-net

praful.poudel
2023-12-21 13:44
has joined #pact-net

pratyush.jaiswal88
2023-12-23 16:45
has joined #pact-net

grzegorz.v.bobrowski
2023-12-24 02:37
has joined #pact-net

elias.coelho
2023-12-27 17:52
has joined #pact-net

tomer
2023-12-28 21:52
has joined #pact-net

shenkesi.shiva
2024-01-02 06:25
Hi, I'm getting pact verification failure error like below. If the broker is protected by authentication, set `enable_public_badge_access` to true in the configuration to enable badges to be embedded in a markdown file. [![UBLProcessor/DocumentArtifact Pact Status] this error is shown in pact broker, how to resolve this issue. Thanks in advance.

christopher316
2024-01-02 20:10
has joined #pact-net

matt.pichette
2024-01-02 20:26
has joined #pact-net

ocean.razafiarison
2024-01-03 08:57
has joined #pact-net

salmaan60
2024-01-03 20:14
has joined #pact-net

sam.huang1
2024-01-04 03:20
has joined #pact-net

ratnajenisha
2024-01-04 04:04
has joined #pact-net

fabio.rodrigues
2024-01-04 17:51
Hi, is there any way in pactmet to use OR matchers instead of AND? Some colleague want to match a array that is either has a null value OR a array with at least 1 valid value

markkellett
2024-01-04 18:27
has joined #pact-net

varghesevarampi
2024-01-05 02:10
has joined #pact-net

anju.ashk
2024-01-05 06:52
Hi all, we are testing 2 consumers pointing to a single provider ,when run test test locally we get one flow as passed and other has failed due to 500 error code. Below is the log attached here with, If anyone can help it would be helpful. Below is the code in provider end: [TestFixture] // [Parallelizable(ParallelScope.All)] public class DocumentArtifactServiceContractTest : DocumentArtifactServiceContractTestBase { public Uri PactBrokerUri { get; set; } public DocumentArtifactServiceContractTest(): base() { PactBrokerUri = new Uri("http://127.0.0.1:8000"); } [Test] public void EnsureDocumentArtifactHonoursPactWithConsumerocr() { var pactVerifierConfig = new PactVerifierConfig { Outputters = new List<IOutput> { new ConsoleOutput() }, LogLevel = PactLogLevel.Debug }; IPactVerifier pactVerifier = new PactVerifier(pactVerifierConfig); var providerUri = ServerUri; pactVerifier .ServiceProvider("DocumentArtifact", providerUri) .WithPactBrokerSource(PactBrokerUri, options => { options.ConsumerVersionSelectors(new ConsumerVersionSelector { //MainBranch = true, Latest = true }) .BasicAuthentication("pact_workshop", "pact_workshop") .PublishResults(providerVersion: "1"); }) .WithSslVerificationDisabled() .WithCustomHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2OGVkZTQyNi1mY2JjLTQwZGMtOWUzMS02OWZiZWU2OWNiYmUiLCJleHAiOjE3MDE3OTY4NTgsImlzcyI6Imh0dHA6Ly9iYXNlY29uZS5jb20iLCJhdWQiOiJiYXNlY29uZSIsIk9mZmljZUlkIjoiYmE1ZDE3MTctMzVkYi00OWI2LWFhODQtZjE3NmYxZTMyMWEzIiwiIjoiIn0.ckUbFbDZ7GU1IXqwQA5ffiBknRnPbiL3pAjoCW-vOCs") .Verify(); }}

lbrndmrcr
2024-01-05 11:52
has joined #pact-net

mcarballido17
2024-01-05 20:12
has joined #pact-net

yonahlipman
2024-01-07 04:00
has joined #pact-net

x1destory
2024-01-07 19:21
has joined #pact-net

matt.fellows
2024-01-08 00:06
I don?t believe so. Combining matchers was a brief idea only ever supported in Pact JVM years ago. It is discouraged (and debated :stuck_out_tongue: ) amongst maintainer group

matt.fellows
2024-01-08 00:06
Sorry Shiva, what?s the actual problem here?

matt.fellows
2024-01-08 00:08
You need to look at your Provider API logs, as the problem is with it

christopher.tonog
2024-01-08 18:53
has joined #pact-net

harshad.rayunipet
2024-01-09 08:06
has joined #pact-net

kumar.vas85
2024-01-09 09:50
has joined #pact-net

shuo.diao
2024-01-09 23:54
has joined #pact-net

chris.speck
2024-01-10 02:52
has joined #pact-net

trevor.cook
2024-01-10 18:33
has joined #pact-net

meetbogireddyhere
2024-01-11 16:20
has joined #pact-net

david.garratt
2024-01-12 10:36
has joined #pact-net

noelmccrory
2024-01-12 13:33
@noelmccrory has left the channel

roger.vanburgh
2024-01-12 16:54
has joined #pact-net

sarah.omalley
2024-01-15 10:03
has joined #pact-net

lauren.flanagan
2024-01-15 13:51
has joined #pact-net

tunga
2024-01-15 23:16
has joined #pact-net

sayan.adak
2024-01-16 12:21
has joined #pact-net

shobhit.agarwal
2024-01-16 12:22
has joined #pact-net

carmen.rietdijk
2024-01-16 12:53
has joined #pact-net

nick116
2024-01-17 09:57
has joined #pact-net

steve.blomeley
2024-01-17 12:49
Not sure if this a .net specific question or a general one . . . but we're using Pact Net so here goes: We need to turn off Pact telemetry (because company IT policy) and wondered if there's an easy way to validate that Pact telemetry calls are / are not happening (some kind of logging, perhaps)? Other option we can think of is to use Fiddler or similar tool to inspect outgoing network messages (at least when running locally) but was hoping to find sthg more straighforward. Appreciate any thoughts / suggestions on this!

yousafn
2024-01-17 16:46
The question is definitely a more general one. You can set the appropriate env var and check the logs to see the outgoing requests not being logged/made, as per the logging output. You can also check the source code to determine how it uses the env var as you?ll clearly be able to see what happens. If you need greater assurance then you are on the right path of monitoring your network traffic pre and post applying on the env var to disable tracking. > Please note: > We are tracking events anonymously to gather important usage statistics like Pact version and operating system. To disable tracking, set the `PACT_DO_NOT_TRACK` environment variable to ?true?. > 2022-12-19T05:39:24.181548Z DEBUG ThreadId(01) pactffi_verifier_execute{handle=0x189d5b0d510}: pact_matching::metrics: Sending event to GA - {?av?: ?4.3.0.0", ?cd6?: ?pact_ffi?, ?v?: ?1", ?tid?: ?UA-117778936-1", ?ec?: ?ProviderTest?, ?ea?: ?Completed?, ?aip?: ?true?, ?cd7?: ?0.12.12", ?ev?: ?1", ?ds?: ?client?, ?t?: ?event?, ?cd2?: ?unknown?, ?cid?: ?0aba82903bd92d9ba7dc82dfeacd0325", ?aid?: ?pact-net?, ?cd3?: ?windows-x86_64", ?el?: ?Pacts verified?, ?an?: ?pact-net?}

miguel.heitor
2024-01-18 09:03
has joined #pact-net

anshita.tripathi
2024-01-18 11:07
has joined #pact-net

fabio.rodrigues
2024-01-18 12:19
Hey there, when does pactnet 5 changes from beta to release. It has a beta version since Jun 29, 2023, and we use it without any problem since

hiroshi.fujii
2024-01-18 14:50
has joined #pact-net

matt.fellows
2024-01-18 22:19
Fair point - with enough time, beta releases become defacto releases anyway!

ebernardino
2024-01-19 04:08
has joined #pact-net

hegge.m
2024-01-19 09:40
has joined #pact-net

visser.r
2024-01-19 09:40
has joined #pact-net

dcrivella
2024-01-21 23:51
has joined #pact-net

dmondejar
2024-01-22 03:39
has joined #pact-net

grzegorzstanek
2024-01-22 10:46
has joined #pact-net

ndomingues10
2024-01-22 17:47
Hello everyone. Does anyone, worked with refit and PactNet? It has good integration between them?

ndomingues10
2024-01-22 17:53
I believe that PactNet 5.0.0 can be the solution to not setup everything about the mock server. What i mean is letīs say that we have a class that receives an interface where the endpoints are defined like: `[Get("/api/{id}")]` `Task> GetPinAsync([FromRoute] int id, CancellationToken cancellatio....)` and then you use the `Mock` fo mock server, and when you need to setup the mock in the `return` you canīt define a httpclient of course, because the return needs to be a `Api Response>`.

matt.fellows
2024-01-22 21:39
can you please clarify the problem (ideally for somebody that doesn?t understand .NET (i.e. me))

francois.larouche1
2024-01-23 14:31
has joined #pact-net

sarah.souza
2024-01-23 15:24
has joined #pact-net

ndomingues10
2024-01-23 21:47
```this.Pact .UponReceiving(".......") .Given("......") .WithRequest(HttpMethod.Get, ".....") .WillRespond() .WithStatus(HttpStatusCode.OK) .WithJsonBody(new{ Id = PactNet.Matchers.Match.Integer(1), Name = PactNet.Matchers.Match.Type("string"), Type = PactNet.Matchers.Match.Integer(1), }); ``` Is there any Matchers that allow to define that can return two diferent values for example in the example above the name can be null, so my question is: Is possible to make like `PactNet.Matchers.Match.Type("string") or PactNet.Matchers.Match.null()` . Or do I need to define another test `([Fact])` , and defer in the `match` section.

matt.fellows
2024-01-24 06:18
howtooptional


matt.fellows
2024-01-24 06:18
See above ^^ on why you can?t specify a ?value or null? type thing.

matt.fellows
2024-01-24 06:18
TL;DR - create two tests to cover the scenarios, and use provider states to vary the response during verification

matt.fellows
2024-01-24 06:18
(so yes, I think you need another `([Fact])`

zachary.romano
2024-01-24 19:16
has joined #pact-net

ken.overgard
2024-01-24 19:32
has joined #pact-net

rama.ganapa
2024-01-24 21:13
has joined #pact-net

justin.gilroy
2024-01-24 21:46
has joined #pact-net

naveenkarkra
2024-01-24 23:36
has joined #pact-net

yangtao.ge
2024-01-25 11:07
has joined #pact-net

salman.bilalshah
2024-01-25 11:34
has joined #pact-net

sridhar.munendramani
2024-01-25 14:32
has joined #pact-net

scott.anderson
2024-01-25 15:05
has joined #pact-net

bala.kurakula
2024-01-25 17:21
has joined #pact-net

sarah.hand
2024-01-25 17:28
has joined #pact-net

corey.jewett
2024-01-25 18:48
has joined #pact-net

eddjlsh94
2024-01-26 09:41
has joined #pact-net

falkowski.b
2024-01-26 10:59
has joined #pact-net

yash.khade
2024-01-26 18:50
has joined #pact-net

joe.allen
2024-01-26 18:50
has joined #pact-net

andrew.voronin
2024-01-26 18:50
has joined #pact-net

richie.schramm
2024-01-26 18:55
has joined #pact-net

dsteinbach77
2024-01-26 23:23
has joined #pact-net

rachida_laghmami
2024-01-28 15:53
has joined #pact-net

hrushikesh.agrawal
2024-01-29 07:13
has joined #pact-net

santos.danallanbray
2024-01-29 10:50
has joined #pact-net

katie.andriacchi
2024-01-29 15:05
has joined #pact-net

darren.grove
2024-01-29 15:11
has joined #pact-net

michael.brandeis
2024-01-29 16:37
has joined #pact-net

niki.mahurin
2024-01-29 17:51
has joined #pact-net

arina
2024-01-29 21:48
has joined #pact-net

tomasz.perek
2024-01-30 12:19
has joined #pact-net

sofia
2024-01-30 17:12
has joined #pact-net

wesley.williams
2024-01-30 18:02
has joined #pact-net

j.sauret
2024-01-31 14:03
has joined #pact-net

michelle.ryals
2024-01-31 22:17
has joined #pact-net

jyothi.kaspa
2024-01-31 23:34
has joined #pact-net

jyothi.kaspa
2024-02-01 16:27
Hi Team, We have the contract tests integrated in PR pipelines and lately we noticed that even though our contract tests are failing, the pipeline shows the status as Green. Can you please suggest what could be going on here?


patrika.patil
2024-02-01 16:41
has joined #pact-net

tim.willis
2024-02-01 16:44
has joined #pact-net

yogi.patel
2024-02-01 18:38
has joined #pact-net

sebbmoreno
2024-02-01 21:23
has joined #pact-net

cverma28
2024-02-02 10:30
has joined #pact-net

a.g.s.maxwell
2024-02-02 12:54
has joined #pact-net

t.mazelin
2024-02-02 23:33
has joined #pact-net

maeleeuxs
2024-02-03 10:20
has joined #pact-net

swaroopsonline
2024-02-04 02:44
has joined #pact-net

jose.silva
2024-02-04 14:45
has joined #pact-net

sonal3062000
2024-02-05 09:52
has joined #pact-net

lorenz.ammon082
2024-02-05 14:44
has joined #pact-net

patrick.barnes
2024-02-05 19:44
has joined #pact-net

andrew.kostka
2024-02-05 20:24
has joined #pact-net

allie
2024-02-05 20:25
has joined #pact-net

bryan.anderson
2024-02-05 21:18
has joined #pact-net

alec.abdul-rahim
2024-02-05 23:34
has joined #pact-net

filip.olszewski
2024-02-06 12:00
has joined #pact-net

amol.jose
2024-02-06 18:03
has joined #pact-net

ryoshida
2024-02-07 01:47
has joined #pact-net

pallam.sudhasrinivas1
2024-02-07 13:21
has joined #pact-net

michal
2024-02-07 16:36
has joined #pact-net

niels.schuette
2024-02-08 14:18
has joined #pact-net

jeremy.buchmann
2024-02-09 00:11
has joined #pact-net

rachel.green
2024-02-09 00:15
has joined #pact-net

jj.guo
2024-02-09 00:33
has joined #pact-net

dipali.gulhane
2024-02-09 07:01
has joined #pact-net

manoj.chaudhari
2024-02-09 09:13
has joined #pact-net

martha.chambers
2024-02-09 16:15
has joined #pact-net

adonay.berhe
2024-02-09 16:52
has joined #pact-net

camilo.morales
2024-02-09 16:52
has joined #pact-net

divya.parappanavar
2024-02-12 07:40
Hi, We have a requirement where a parameter will be empty or null. How can we match null type? We are using the regex, but its not working. Can you guys pls suggest me if pact flow supports matching null type.

matt.fellows
2024-02-12 08:00
Howtooptional


jonathan.barker
2024-02-12 08:56
has joined #pact-net

tobiasroland
2024-02-12 10:48
has joined #pact-net

samantha.lam
2024-02-12 12:32
has joined #pact-net

divya.parappanavar
2024-02-12 12:35
The parameter for which we are testing it will either return empty string or Null. We have to match for null as well. Is pact flow doesn't support match type for null values at all?

logi.ragnarsson
2024-02-12 15:22
has joined #pact-net

matt.fellows
2024-02-12 21:44
Did you read the link? You need to write two separate tests for it, one for each state

michal.patron
2024-02-13 10:41
has joined #pact-net

tomasz.fiechowski
2024-02-13 11:14
has joined #pact-net

coletaylor017
2024-02-13 19:50
has joined #pact-net

lachlan.austin
2024-02-13 22:44
has joined #pact-net

rejeesh.gangadharan
2024-02-14 00:55
has joined #pact-net

utku.kilincci01
2024-02-14 08:00
has joined #pact-net

ahmadlotfygamersfield
2024-02-14 14:38
has joined #pact-net

evan.hafers
2024-02-14 15:11
has joined #pact-net

wiktor2.karpinski
2024-02-15 09:31
has joined #pact-net

cae.vieira
2024-02-15 11:37
has joined #pact-net

m.barbosa
2024-02-15 13:54
has joined #pact-net

christophe.laranjo
2024-02-15 17:04
Hello, I'm doing a verification test, but I don't manage to have the branch name in my broker

christophe.laranjo
2024-02-15 17:05
everytime my Branch is with N/A

yousafn
2024-02-15 17:09
https://github.com/pact-foundation/pact-net/blob/master/docs/upgrading-to-4.md#provider-tests ``` verifier.WithHttpEndpoint(this.fixture.ServerUri) .WithPactBrokerSource(new Uri("https://broker.example.org"), options => { options.ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true, Latest = true }) .PublishResults(version, results => { results.ProviderBranch(branch) .BuildUri(new Uri(buildUri)); }); }) .WithProviderStateUrl(new Uri(this.fixture.ServerUri, "/provider-states")) .Verify();```

yousafn
2024-02-15 17:11
you need results.ProviderBranch as part of the 2nd param to PublishResults. You can set the BuildUri too on results

r_connolly
2024-02-15 20:22
has joined #pact-net

christophe.laranjo
2024-02-15 20:42
ok thanks, I tested but now I have "master" as my branch but it's not my branch, do I need to add something?

wally.yuen
2024-02-16 00:42
has joined #pact-net

david.montero
2024-02-16 10:29
has joined #pact-net

hristian.iliev
2024-02-16 10:37
has joined #pact-net

v-rybam-gri
2024-02-16 13:49
has joined #pact-net

msarayu1111
2024-02-16 13:49
has joined #pact-net

shivanirajebhosale16
2024-02-17 10:50
has joined #pact-net

maciej.harapinski
2024-02-19 09:42
has joined #pact-net

d.madureira
2024-02-19 14:17
has joined #pact-net

dpunna
2024-02-19 18:35
has joined #pact-net

michael.schmidt
2024-02-20 11:01
has joined #pact-net