mboudreau
2017-05-18 14:23
has joined #general

jose
2017-05-18 16:28
has joined #general

uglyog
2017-05-18 22:36
has joined #general

mboudreau
2017-05-22 02:43
I'm sick today, so I'm spending the time looking at website stuff :slightly_smiling_face:

uglyog
2017-06-01 06:05
who can answer Pact .Net questions?


mboudreau
2017-06-01 08:23
Not me :/

jose
2017-06-01 08:38
Certainly not me

bethskurrie
2018-03-24 03:32
has joined #general

andrewspinks
2018-03-24 09:14
has joined #general

neil
2018-03-24 09:22
has joined #general

matt.fellows
2018-03-24 11:15
has joined #general

matt.fellows
2018-03-24 11:15
:wave:

marko
2018-03-25 21:23
has joined #general

matt.fellows
2018-03-25 21:50
Just confirming - are we thinking of opening this up to the public or is it just for maintainers?

bethskurrie
2018-03-25 21:51
I assumed public

matt.fellows
2018-03-25 21:51
ok cool

matt.fellows
2018-03-25 21:51
I can create a Heroku setup page to make it easy for people to join

mboudreau
2018-03-25 21:54
I was going to do it, but go ahead if you're keen

matt.fellows
2018-03-25 21:56
keen is a strong word

matt.fellows
2018-03-25 21:56
if you have time, go for it :slightly_smiling_face:

mboudreau
2018-03-25 22:29
Will do :)

andrewcfitzgerald
2018-03-26 02:44
has joined #general

andrewcfitzgerald
2018-03-26 02:45
:wave:

matt.fellows
2018-03-26 02:51
:wave:

slack1
2018-03-26 04:08
has joined #general

bethskurrie
2018-03-26 06:08
:wave:

dennis
2018-03-26 08:41
has joined #general

abubics
2018-03-27 00:55
has joined #general

abubics
2018-03-27 00:56
hey guys, what?s going on

bethskurrie
2018-03-27 02:13
There was no party til you arrived @abubics

andrewcfitzgerald
2018-03-27 03:28
`+:party_parrot:`

bethskurrie
2018-03-27 03:29
Oh no! No party parrot!

bethskurrie
2018-03-27 03:29
Maybe you have to pay Slack for the party parrot.

andrewcfitzgerald
2018-03-27 03:31
ha, new slack pricing model: all features are free, emojis and gifs unlocked by microtransactions

bethskurrie
2018-03-27 03:56
I know a social media platform that has a revenue model pretty much exactly that!

abubics
2018-03-27 05:06
:party_parrot::party_parrot::party_parrot: :party_parrot:

bethskurrie
2018-03-27 05:29
Woot!

bethskurrie
2018-03-27 05:29
Thanks @abubics!


matthew.balvanz
2018-03-27 14:06
has joined #general

ragarwal
2018-03-28 00:22
has joined #general

cfmack
2018-03-28 13:12
has joined #general

abubics
2018-03-29 03:57
is there a recommended `pact-jvm-consumer` version for use with Kotlin?

abubics
2018-03-29 03:57
last time I was in Kotlin, I just used groovy :s


abubics
2018-03-29 05:03
turns out, it?s still very difficult (possibly impossible) to get Kotlin to play with Groovy . . . so I guess I?ll have to go with one of the Java ones :cry:

mboudreau
2018-03-29 05:17
I figure we'd need a kotlin specific build based on the JVM one

abubics
2018-03-29 05:27
yeah, chuck it on the list :wink:

mboudreau
2018-03-29 06:50
I'll get it done after the website/SaaS app :stuck_out_tongue:

cfmack
2018-03-29 14:43
Has anyone got the Provider Webhooks in the Pact Broker calling Jenkins 2.X with CSRF enabled? It looks like Jenkins requires two API calls (one to get a valid CSRF token)


bethskurrie
2018-03-29 19:44
@cfmack Ugh! We've had this problem before. My suggestion was to run a little intermediate rack app that did the CSRF call. I could create a little prototype if that would help, but you might prefer to do something in a language you're comfortable with.

bethskurrie
2018-03-29 22:14
added an integration to this channel: https://pact-foundation.slack.com/services/B9YEJPQQK

bethskurrie
2018-04-05 04:28
removed an integration from this channel: https://pact-foundation.slack.com/services/B9YEJPQQK

bethskurrie
2018-04-05 10:07
@cfmack does this two stage call follow a standard process that would be applicable to other http servers, or is it a Jenkins Special? As in, is it a feature that would be popular if we ended up implementing support for it, for other services?

david.j.smith
2018-04-06 08:21
has joined #general

david.j.smith
2018-04-06 08:22
:wave:

bethskurrie
2018-04-06 08:23
Welcome Dave!

david.j.smith
2018-04-06 08:24
Thanks Beth :slightly_smiling_face:

david.j.smith
2018-04-06 08:24
I noticed you've been chatting to our government!

bethskurrie
2018-04-06 08:24
Indeed.

bethskurrie
2018-04-06 08:25
I liked them more than our own :-|

david.j.smith
2018-04-06 08:25
The civil servants are a good bunch - just the folks in charge of them that need a bit of a kicking :wink: One of my contributors works there atm.

bethskurrie
2018-04-06 08:27
They seemed like they'd had a good think about things before we even talked. It was a good chat.

abubics
2018-04-13 03:22
I?m hitting a related (but different) issue to this: https://github.com/DiUS/pact-jvm/issues/213 Is there a fix (or recommended approach), or should I just use a workaround for now? and/or an issue already, and should I raise one, if not? :stuck_out_tongue: The issue is I?m not specifying any headers, but this is coming up by default in the response: ``` "headers": { "Content-Type": "application/json; charset=UTF-8" }, ``` and then failing provider pact verify, because there isn?t a space in `"application/json; charset=UTF-8"`

bethskurrie
2018-04-13 04:06
Blame @uglyog for putting in a default header :stuck_out_tongue:

uglyog
2018-04-13 04:08
The space should not make it fail. That's a defect.

bethskurrie
2018-04-13 04:10
I don't understand why there is a mismatch on a header you didn't specify?

abubics
2018-04-13 04:19
all of the above :innocent:

abubics
2018-04-13 07:44
I?m getting ``` "matchingRules": { "$.body.accounts": { "match": "type", "min": 0 }, ``` in my pact file, and ``` "accounts": [ ] ``` showing in the broker, but my test looks like ``` body(newJsonBody { container -> container.eachLike("accounts", 1) { ... ``` Should I raise an issue? I expected `eachLike(1)` to make 1 occurrence :thinking_face:

abubics
2018-04-13 07:44
(this is with the java8 consumer)

abubics
2018-04-13 07:48
using `minArrayLike` instead fixes it, but then what is the point of `eachLike`?

bethskurrie
2018-04-13 08:15
Or of lfe in general.

cfmack
2018-04-13 16:49
Apologies. Life has been crazy lately. In my experience with Travis and AppVeyor, I do not think they have this same request or quiet frankly support CRSF. Our internal walk around, was to disable CRSF. While that's imperfect, it works for our internal needs

bethskurrie
2018-04-17 09:58
Sounds like a good work around to me :wink:

bethskurrie
2018-05-04 06:25
Did you work out the problem @abubics?

abubics
2018-05-04 08:58
nope, just workarounds

abubics
2018-05-04 08:59
I provide an explicit `Content-Type` in the Pact description (so it?s brittle)

abubics
2018-05-04 08:59
we are unblocked, at least :slightly_smiling_face:

bethskurrie
2018-05-04 09:07
Why is it bad to set the content type?

abubics
2018-05-04 09:09
because it was failing on a whitespace issue, and it is asserting on a field I didn?t even set

abubics
2018-05-04 09:10
no wait

abubics
2018-05-04 09:10
that was the Content-Type

abubics
2018-05-04 09:10
the `eachLike` issue was always a workaround, and I didn?t see why `minArrayLike` did what I wanted, while `eachLike` didn?t

abubics
2018-05-04 09:11
is there meant to be a difference? what is the point, if not?

bethskurrie
2018-05-04 09:11
Hm. Bug Ron about that.

abubics
2018-05-04 09:11
hey, you brought it up :stuck_out_tongue:

abubics
2018-05-04 09:11
I already forgot about it xD hence the mild confusion

abubics
2018-05-04 09:12
which (of the 2 issues) were you asking about? :innocent:

bethskurrie
2018-05-04 09:13
I can't remember. Just in general. Because the last time we chatted, we ended up questioning the reason for living.

bethskurrie
2018-05-04 09:13
Just needed to make sure you hadn't topped yourself because of Ron.

abubics
2018-05-04 09:13
lololol

abubics
2018-05-04 09:14
yeah, I?m unblocked :stuck_out_tongue: no thanks to @uglyog :troll:

bethskurrie
2018-05-04 09:14
What a slacker.

bethskurrie
2018-05-04 09:14
<hides behind laptop>

matt.fellows
2018-05-07 09:04
New member join url: http://slack.pact.io

matt.fellows
2018-05-07 09:04
@matt.fellows pinned a message to this channel.

matthew
2018-05-07 14:38
has joined #general

thomas.heilbronner
2018-05-07 20:50
has joined #general

sgleadow
2018-05-08 00:27
has joined #general

philip.sturman
2018-05-08 06:12
has joined #general

david
2018-05-08 07:45
has joined #general

david
2018-05-08 07:47
hello :wave:

dominic.jones
2018-05-08 08:33
has joined #general

mark.bridgett
2018-05-08 08:40
has joined #general

mark.bridgett
2018-05-08 08:40
Greetings

david.j.smith
2018-05-08 08:42
Hello :wave:

mboudreau
2018-05-08 08:50
:wave:

abubics
2018-05-08 23:59
howdy howdy howdy :wave:

bethskurrie
2018-05-09 03:35
Hi all. Welcome.

sgleadow
2018-05-09 05:07
Pacticipants unite!

sgleadow
2018-05-09 05:10
Can I start asking questions now? Is this instead of Gitter? (I'm not on Pact gitter) We're looking to set up Pact between some mobile apps (Swift/Kotlin) and an aggregation API (Node). My question is about setting up provider state. Our API is stateless, so it looks like we're not so much injecting eg. data into a DB as setting up stubs of downstream calls that reflect the provider state. How do people go about doing that? Spin up a separate stub server where you set up the state, and run your API in a configuration where it points there rather than to real dependencies?

abubics
2018-05-09 05:17
There are several approaches, and it depends how cleanly layered your architecture is

abubics
2018-05-09 05:19
The leanest just gives you confidence that your response entities are the right shape: > just stub the response objects at the endpoint layer

abubics
2018-05-09 05:19
The most integrated means you go through all layers (and potentially hit other complications on the way): > inject data in the DB, or responses at the DB client

abubics
2018-05-09 05:20
and a heap of stuff in-between

abubics
2018-05-09 05:21
As for Pact?s intended philosophical usage . . . I?ll leave that answer to @bethskurrie, @uglyog, and @matt.fellows :slightly_smiling_face:

abubics
2018-05-09 05:21
but if you?re treating Pact as an asynchronous pair of network interface unit tests, the leanest approach gives you value

abubics
2018-05-09 05:23
if you phrase the state and requests as ?given no/some/many? and upon receiving ?a valid/invalid request for blah?, there?s no implied logic to stub, just happy & sad response shapes

uglyog
2018-05-09 05:26
Yes, @sgleadow, it's stub and mock servers all the way down.

uglyog
2018-05-09 05:26
Maybe a turtle or two

uglyog
2018-05-09 05:28
Not sure how you would tie the state to the stub with node, but @matt.fellows would prob be able to help there

bethskurrie
2018-05-09 05:48
One way to do it is to create your own mock implementation class that to can set up response objects on, no "mocking library" necessary. Ideally, you could reuse something in that test that would be an input with your downstream contract tests.

bethskurrie
2018-05-09 05:57
For example, you could stub your `AnimalService#get_alligator(...)` to return `Alligator.new(name: Mary)`, and then use that same object in the pact test for `AnimalService#get_alligator`. eg `given... when... will return... expect(AlligatorService.get_alligator(Mary)).to eq Alligator.new(name: Mary)`

bethskurrie
2018-05-09 05:57
So you can use a shared object as a "contract" too.

bethskurrie
2018-05-09 06:01
Or, you could use the pact that you generated for the AnimalService in your unit tests, to create a stub server using the pact-stub-server. You want to make your request expectations quite relaxed if you do this though, because otherwise it will be quite brittle. Normally, when you use pact in a unit test, you can be quite strict, as you're in full control of the outgoing request.

bethskurrie
2018-05-09 06:12
I've just announced on the gitter channel that it will be closing down, so hopefully we'll have some new pacters soon. Let's try and keep conversations in threads, so it's easier to see which questions have been answered, and which haven't. There are a few really good questions on gitter that didn't get answered recently because of all the noise.

vinod.baradwaj
2018-05-09 06:12
has joined #general

bethskurrie
2018-05-09 06:12
Death to gitter!

bethskurrie
2018-05-09 06:12
Welcome @vinod.baradwaj

vinod.baradwaj
2018-05-09 06:12
thank you :slightly_smiling_face:

ashish.dubey91
2018-05-09 06:13
has joined #general

bethskurrie
2018-05-09 06:14
:wave:

rgshah781988
2018-05-09 06:14
has joined #general

rgshah781988
2018-05-09 06:15
I am facing issue with matchers.

rgshah781988
2018-05-09 06:15
Can any buddy help me ?

bethskurrie
2018-05-09 06:16
shoot

vinod.baradwaj
2018-05-09 06:16
@bethskurrie i tried using hash arguments in mock setup for query parameters and it worked fine... will i be able to use the same approach for an endpoint like this, `/api/tagCollections/{tagCollectionId}/tags/{tagId}` where both tagCollectionId and tagId are dynamic ones

bethskurrie
2018-05-09 06:16
Firstly, which language?

bethskurrie
2018-05-09 06:16
Secondly, I'll move this to a thread. It makes the conversations cleaner.

bethskurrie
2018-05-09 06:16
Ok, @vinod.baradwaj let's continue here.

vinod.baradwaj
2018-05-09 06:17
yeah sure

rgshah781988
2018-05-09 06:17
js

bethskurrie
2018-05-09 06:17
Which language?

vinod.baradwaj
2018-05-09 06:17
JS

bethskurrie
2018-05-09 06:17
Ok, I can probably help you.

bethskurrie
2018-05-09 06:18
You can create a matcher using a regular expression but the nice URL format using {} isn't supported. I'd like it to be. Let's put it in v4.

bethskurrie
2018-05-09 06:18
Or... you could create a JS wrapper method that would turn your {} path into a regexp.

rgshah781988
2018-05-09 06:19
Do we need to create a matchers class?

priyank.shah217
2018-05-09 06:19
has joined #general

bethskurrie
2018-05-09 06:20
@uglyog in the Ruby impl, I made a little util that would allow you to construct a Pact Response body with all the matchers, and then tell it to give you the JSON example for it. I then used that body in the pact test, but also used it in a plain stub for other tests (eg. verifications of upstream pacts). Is this something that could be done with the JVM?

bethskurrie
2018-05-09 06:20
It would be the regular expression class

bethskurrie
2018-05-09 06:20
It's called a `term`

rgshah781988
2018-05-09 06:20
ok

vinod.baradwaj
2018-05-09 06:21
we need to create a method which will use regex to create path instead of these {} args @rgshah781988

bethskurrie
2018-05-09 06:21
When you use a term, you give it a regular expression, and an example.

abubics
2018-05-09 06:21
@abubics pinned a message to this channel.

bethskurrie
2018-05-09 06:22
You could make a `Pact.path("/foo/{id}", {id: 2})` that would build a `Pact.term` with the right regular expression and the expanded path as the example.

bethskurrie
2018-05-09 06:22
Does that make sense?

vinod.baradwaj
2018-05-09 06:27
yeah understood... in case of two arguments(`/foo/{fooId}/action/{actionId}`), will the same approach work ?

vinod.baradwaj
2018-05-09 06:27
would i be able to create Pact.term for this ?

rgshah781988
2018-05-09 06:34
@bethskurrie would i be able to create Pact.term for this ?

sgleadow
2018-05-09 06:50
I think this is a difference in the ruby vs node approaches. The node approach, it's not in the same process, so I can't set mocks in code that get called at runtime (at least not out of the box). I think I'll start with some stubs right at the top, and see if actually running downstream stubs through the entire flow makes sense. (although I'm not 100% sure how I'd set this state in a stateless API)

rgshah781988
2018-05-09 06:51
Response body - i have use :

2018-05-09 06:51
A file was commented on

rgshah781988
2018-05-09 06:53
I am trying same think with pactjs but I am not getting success.

bethskurrie
2018-05-09 07:06
@rgshah781988 ask in the js channel, and tag @matt.fellows or @mboudreau

rgshah781988
2018-05-09 07:12
ok

bethskurrie
2018-05-09 07:13
@sgleadow the provider state set up URL could be on the downstream http mock

bethskurrie
2018-05-09 07:13
I'm writing up a list of options with their various pros and cons. Will post here when finished.

rgshah781988
2018-05-09 07:15
Please share channel link

bethskurrie
2018-05-09 07:41
Absolutely

bethskurrie
2018-05-09 07:41
It's still just a regular expression.

bethskurrie
2018-05-09 07:41
And an example.

bethskurrie
2018-05-09 07:49
If you called something like `Pact.path("/api/tagCollections/{tagCollectionId}/tags/{tagId}", {tagCollectionId: 1, tagId: 2})` it would create a Pact.term with a pattern of `\/api\/tagCollections\/[^/]+\/tags/[^/]+\/` as the regular expression (or similar, don't quote me on the backslashes) and `/api/tagCollections/1/tags/1` as the example.

vinod.baradwaj
2018-05-09 08:27
okay got it.. thanks @bethskurrie :slightly_smiling_face:

rgshah781988
2018-05-09 08:53
:+1:


bethskurrie
2018-05-09 09:21
Here's a start.

bethskurrie
2018-05-09 09:28
@uglyog would you like to add any options or content to the gist? I'll put it in the docs when it's had some more eyes on it.

uglyog
2018-05-09 09:29
I'll have a look tomorrow

bethskurrie
2018-05-09 09:29
ta

uglyog
2018-05-09 09:30
I guess, there are model classes that underpin the pact format

vinod.baradwaj
2018-05-09 13:09
i am not able to start pact-stub-server, tried with the example pact file(https://github.com/pact-foundation/pact-stub-server) i am getting the following error ``` pact-stub-server git:(master) ? docker run -t -p 8080:8080 -v "$(pwd)/pacts/:/app/pacts" pactfoundation/pact-stub-server -p 8080 -d pacts 13:08:16 [WARN] No metadata found in pact file "\"pacts/billy-bobby.json\"", assuming V2 specification 13:08:16 [ERROR] There were errors loading the pact files. 13:08:16 [ERROR] - Failed to load pact from 'pacts' - Failed to parse Pact JSON - expected value at line 1 column 1 ```

rgshah781988
2018-05-09 13:39
How can I get dynamic response from pact files ? I tried using matchers such as like,eachlike I am working on API which has POST call with different payload values. (edited) According response changes.

david.j.smith
2018-05-09 16:18
@rgshah781988 You can't :slightly_smiling_face: Pact testing is done in a *known* state, if you want a different response, you need to define a different request. Essentially you're saying "There are different responses I can get for different requests" but they're all 1 to 1. A common thing to do in unit testing with mocks is to make the same request to, say, `/foo` in every test request but get the mocking framework to supply a different response each time with a before and/or after statement in your test framework. Pact does not do that.

david.j.smith
2018-05-09 16:22
@vinod.baradwaj It's saying that is can't parse your Pact contract files, which it has assumed to be V2 formatted, so the first question is: Do you know you have V2 Pact files? Also, do both of those folders contain Pact files? Are they all the same format? You could try adding the metadata to the files (as a test) to see what happens, I believe it looks like: ``` ...rest of Pact file... "metadata": { "pact-specification": { "version": "2.0.0" } } } ```

vinod.baradwaj
2018-05-09 16:26
@david.j.smith i am trying with the example pact file which is in that repo, the pact file has the metadata which you have given in it.. it was working fine before but now i am not able to start the server with the same pact file.

david.j.smith
2018-05-09 16:41
@vinod.baradwaj It's hard to tell from here but it clear isn't happy with something in that directory. Do you have files in there that aren't Pact files? Can you refresh that file to make sure it hasn't be accidentally changed? Failing that you could send it over for us to look at but if it was working and now it isn't... then something has changed. :slightly_smiling_face:

matt.fellows
2018-05-09 20:44
@rgshah781988 can you please explain what you're trying to do with more details?

brentbarker9
2018-05-09 20:55
has joined #general

uglyog
2018-05-09 21:55
@vinod.baradwaj looks like it can't parse your pact file. You can enable debug logging with `-l debug`

mboudreau
2018-05-09 22:26
please don't repost in several channels

mboudreau
2018-05-09 22:26
use the threads, dave

shekharsp27
2018-05-10 05:27
has joined #general

rgshah781988
2018-05-10 05:38
ok sure

rgshah781988
2018-05-10 05:40
Thanks @david.j.smith

rgshah781988
2018-05-10 05:41
But I have one API call with different payload and response should be dependent on payload. So, what to do? It seems that PACTs doesn't have such feature.

rgshah781988
2018-05-10 05:43
@david.j.smith @vinod.baradwaj But same pact file is working in my computer.

rgshah781988
2018-05-10 05:45
I have one API call with different payload and I am expecting different response as per payload values. Eg : API call is url/assets - POST call. I am providing payload as JSON - {"name":"ravi"} , expected response is name as ravi. Now,API call is url/assets - POST call. I am providing payload as JSON - {"name":"shah"} , expected response is name as shah.

matt.fellows
2018-05-10 05:50
Hopefully that?s an example just to illustrate the point (because you wouldn?t use pact just to test different data values)

matt.fellows
2018-05-10 05:50
BUT? that is entirely possible to do with Pact. What?s the issue you?re running into?

mboudreau
2018-05-10 05:50
@rgshah781988 I've responded to you in a thread in pact-js

rgshah781988
2018-05-10 05:52
I am mocking with pact file via pact stub server. And I need to use pact file.

rgshah781988
2018-05-10 05:52
For test , I can use this as per example . I had posted.

rgshah781988
2018-05-10 05:52
But I need to mock into pact stub server and need to use it.

rgshah781988
2018-05-10 05:53
@vinod.baradwaj Please look into respond also.

rgshah781988
2018-05-10 05:54
pact do same as per my example when I test with consumer.spec.js but I need to mock pact files in pact stub server

matt.fellows
2018-05-10 05:55
ok, so this is the _stubs_, and not the tests themselves right?

rgshah781988
2018-05-10 05:58
Yes,We can write a test for different payload and we will get different responses and according pact interactions will be created

matt.fellows
2018-05-10 05:58
ok cool

matt.fellows
2018-05-10 05:58
so yes, the stub server is not able to do what you?re asking unfortunately

rgshah781988
2018-05-10 05:59
how to do that? I am working on mocking with pact files

matt.fellows
2018-05-10 05:59
See the note at https://docs.pact.io/getting-started/local-api-stubs. We don?t support matching on predicates etc., unless I?m mistaken @uglyog @bethskurrie?

matt.fellows
2018-05-10 05:59
Perhaps there?s a way with headers or something. Typically we use other tools for that job

rgshah781988
2018-05-10 05:59
Yes sure , I am look into link

matt.fellows
2018-05-10 05:59
:thumbsup:

matt.fellows
2018-05-10 06:01
brb

rgshah781988
2018-05-10 06:01
Can you suggest some tool to do such job. I am working on mocking of my each micor services in pact-server at different port.

uglyog
2018-05-10 06:03
The stub server returns responses based on the method + path + query parameters. You can raise an issue to get it to have an option to include the request body as well

rgshah781988
2018-05-10 06:09
Where should I raised issue? @uglyog Please help me




uglyog
2018-05-10 06:21
I'll sort it out for you this weekend, and upgrade it to V3 spec as well

rgshah781988
2018-05-10 06:23
thanks

matt.fellows
2018-05-10 06:28
:thumbsup:

vinod.baradwaj
2018-05-10 06:56
@matt.fellows is there any examples in JS to implement `term` in path ? the endpoint i am trying to mock is like `/api/tagCollections/{tagCollectionId}/tags/{tagId}` which will have dynamic values for both tagCollectionId and tagId.

matt.fellows
2018-05-10 06:58
Maybe not examples, but it?s doable - are you having issues?

bethskurrie
2018-05-10 07:02
It's just the same as a term for any other part of the request.

bethskurrie
2018-05-10 07:02
path : Pact.term(...)

vinod.baradwaj
2018-05-10 07:03
term will expect a matcher and generate right ?

matt.fellows
2018-05-10 07:12
yep

david.j.smith
2018-05-10 08:47
@rgshah781988, I'm 99% sure the Scala stubber does do that. However it's probably more hassle than you'd want to get into.

david.j.smith
2018-05-10 08:49
@mboudreau I'll try but I don't like them very much so often forget :slightly_smiling_face: (Hard to scan for relevant information since it's hidden under threads)

mboudreau
2018-05-10 08:55
the point is to keep details out of the main channels so it's not cluttered

omar
2018-05-10 19:49
has joined #general

kateleighrose
2018-05-10 22:09
has joined #general

rgshah781988
2018-05-11 05:04
I need to create pact file which contain interactions eg : id:1234 is randomly created by other API. Can I provide or pass dynamic number in interactions?

uglyog
2018-05-11 05:08
@rgshah781988 what are you using to create the pact file?

rgshah781988
2018-05-11 05:09
I used Pactjs

uglyog
2018-05-11 05:10
Does it need to be dynamic?

uglyog
2018-05-11 05:10
As long as it is correctly formatted, the actual value should not matter

uglyog
2018-05-11 05:11
You can try use a regex matcher without a example, it might generate a random one

rgshah781988
2018-05-11 05:23
@uglyog: Actually , id:1234 is created by other API. And same ID , i need to used in interactions for next API call

matt.fellows
2018-05-11 06:17
That sounds like a functional test - you don?t want to use pact for functional tests (https://docs.pact.io/best-practices/consumer/contract-tests-vs-functional-tests)

kateleighrose
2018-05-11 14:47
hi, I have kind of a weird use case that I'm hoping to use pact-python for but can't figure out. I have a service in python that calls out to a lambda function via boto3, that lambda is a java app I also have ownership of. I want to write a contract test for the consumer (python service) and provider (java app)

kateleighrose
2018-05-11 14:48
but since the consumer is calling boto and not making a standard HTTP request to an api, I can't use the `with_request` param... unless I'm missing something

matt.fellows
2018-05-11 23:58
interesting

matt.fellows
2018-05-12 00:00
how does the service call lambda via boto - triggering an event or something? Boto is an interface to the AWS SDK, so it must just be triggering the lambda function and therefore it would be an asynchronous interaction

matt.fellows
2018-05-12 00:00
Python doesn?t yet support message pact, but we?ve just introduced it to Pact JS and Pact Go with some success, and will hopefully be rolling it out to Python et. al over the coming months

matt.fellows
2018-05-12 00:01
if you wanted to help contribute, @matthew.balvanz would be the guy to chat with

kateleighrose
2018-05-13 01:31
message sounds like what I need, yeah. good to know it's in the plans

uglyog
2018-05-13 06:41
@rgshah781988 `pactfoundation/pact-stub-server:v0.0.8` has been released with your fix and support for V3 spec pact files

ragarwal
2018-05-14 00:45
Hello, I am using pact-js and jest to write consumer side pact tests. As per https://github.com/pact-foundation/pact-js/blob/master/examples/jest/__tests__/another.spec.js example, we can do `.then(() => provider.verify());` with same it block. When I am doing this for 1 test it works seamlessly. But when I have multiple pact tests, interactions start getting confused and results in test failure. To fix the issue, I end up doing `it('successfully verifies', () => provider.verify());` for each test. Now if I have 2 pact tests, I end up having 4 tests => 2 actual tests and 2 verify `it` block. This is just extra noise, can someone help me with this?

mboudreau
2018-05-14 00:53
I think the problem is that you're returning a promise, but also using the `done` function. You're calling `done` before the actual function is done

mboudreau
2018-05-14 00:53
since it still has to verify

mboudreau
2018-05-14 00:53
just remove the `done`, and it should work

ragarwal
2018-05-14 01:08
describe(?pact tests?, () => { const expectedCreateAgencyResponse = { agencyId: ?A000001?, }; beforeAll(() => { process.env.NAILGUN_API_BASE_URL = ?http://localhost:7080'; return provider.addInteraction(interaction); }); it(?should return an success response with the formatted message?, done => { createAgency(createRequest, response).then(() => { expect(response.send).toHaveBeenCalledWith(expectedCreateAgencyResponse); done(); }); }); it(?successfully verifies?, () => provider.verify()); });

ragarwal
2018-05-14 01:09
This is how I am adding tests as of now

ragarwal
2018-05-14 01:10
Are you suggesting to remove done completely, or calling it in a different way?

mboudreau
2018-05-14 01:10
remove it and put your verify back in the then

ragarwal
2018-05-14 01:15
I will try doing that. Thanks @mboudreau

ragarwal
2018-05-14 01:25
It?s not working without done.

matt.fellows
2018-05-14 01:25
What?s it doing - timing out?

matt.fellows
2018-05-14 01:25
Did you remove the done argument (and not just the `done()`?)

ragarwal
2018-05-14 01:26
yes, I removed the done argument

ragarwal
2018-05-14 01:26
it(?should return an success response with the formatted message?, () => { createAgency(createRequest, response) .then(() => { expect(response.send).toHaveBeenCalledWith(expectedCreateAgencyResponse); }) .then(() => { provider.verify(); }); });

ragarwal
2018-05-14 01:27
Now I am getting this error: console.warn node_modules/bluebird/js/release/debuggability.js:873 Unhandled rejection Error: expect(jest.fn()).toHaveBeenCalledWith(expected) Expected mock function to have been called with: [{?agencyId?: ?A000001"}] But it was not called.

ragarwal
2018-05-14 01:27
I can see this in logs, but entire test suite is saying successful. :flushed:

matt.fellows
2018-05-14 01:27
My recommendation is to have a structure like this ` beforeAll(() => provider.setup()); afterEach(() => provider.verify()); afterAll(() => provider.finalize()); describe ?some big important scenario? it ?does something? it ?does something else? describe ?next big important scenario? ...

matt.fellows
2018-05-14 01:28
It reads a lot better, and is less error prone

matt.fellows
2018-05-14 01:29
Also consider that Jest may run in _parallel_ - if that?s the case, then that could explain the weird issues you?re having.


mboudreau
2018-05-14 01:30
@ragarwal if you're not using `done` you need to return the promise in the test

mboudreau
2018-05-14 01:30
ie. return your `createAgency` function

mboudreau
2018-05-14 01:31
and yeah, paralellization might be an issue with jest

ragarwal
2018-05-14 01:33
I am already passing `runInBand` to solve that issue

mboudreau
2018-05-14 01:34
``` it(?should return an success response with the formatted message?, () => { return createAgency(createRequest, response) .then(() => expect(response.send).toHaveBeenCalledWith(expectedCreateAgencyResponse)) .then(() => provider.verify()); }); ```

matt.fellows
2018-05-14 01:34
``` .then(() => { provider.verify(); }); ``` should be ``` .then(() => { return provider.verify(); }); ``` or just? ``` .then(() => provider.verify()) ```

ragarwal
2018-05-14 01:45
adding return to provider.verify() worked!

mboudreau
2018-05-14 01:45
magic! :stuck_out_tongue:

ragarwal
2018-05-14 01:45
also, as suggested by @matt.fellows, I moved it to afterEach() and now I have it only once in a file, which is more cleaner.

ragarwal
2018-05-14 02:01
with `.then(() => { return provider.verify(); })` my test became flaky. I ran them multiple times and they are randomly passing and failing without any code change.

santoshtrip
2018-05-14 03:24
has joined #general

santoshtrip
2018-05-14 03:26
Has anybody tried out swagger mock validator for contract testing

rgshah781988
2018-05-14 04:52
Thanks

rgshah781988
2018-05-14 04:52
Let me try this out

shekharsp27
2018-05-14 06:41
I have done POC using swagger petstore

rgshah781988
2018-05-14 09:05
can you share a link ?


shekharsp27
2018-05-14 09:45
My POC is on local machine, so please let me know if you still require a POC. Will commit it to repo.

ashish.dubey91
2018-05-14 11:51
hey guys. I have a question. I'm thinking of writing pact based tests and automate execution based on collection of BDD scenarios

ashish.dubey91
2018-05-14 11:52
is it possible that I can do provider verification per behavior basis?

ashish.dubey91
2018-05-14 11:52
if there was some way to tag interactions with steps definitions like in cucumber, that would have helped

ashish.dubey91
2018-05-14 11:52
I haven't seen anything like that in the docs hence I'm asking here

matt.fellows
2018-05-14 12:06
Hmm in theory it is possible, with environment variables

matt.fellows
2018-05-14 12:07
I'm on mobile, but off the top of my head, you can replay specific provider interactions, keyed by the description in the pact

matt.fellows
2018-05-14 12:07
But why?

ashish.dubey91
2018-05-14 15:09
so that I can pick certain provider interactions based on the relative importance. or at some point, I can tell for certain descriptions (BDD scenarios) in my case, if there exists a provider interaction that I can verify

santoshtrip
2018-05-14 16:29
Thanks @shekharsp27

timothy.clifford
2018-05-15 00:08
has joined #general

tjones
2018-05-15 01:04
has joined #general

vinod.baradwaj
2018-05-15 08:46
@matt.fellows term worked fine for endpoint which is `/api/tagCollections/{tagCollectionId}` but when i use the same technique for `/api/tagCollections/{tagCollectionId}/tags/{tagId}` i get `multiple interaction found`

vinod.baradwaj
2018-05-15 08:48
because both the endpoints `/api/tagCollections/{tagCollectionId}/tags/{tagId}` and `/api/tagCollections/{tagCollectionId}/tags` are getting matched

matt.fellows
2018-05-15 08:48
Are you clearing interactions between tests? As a general rule, you should only hit one per test. Or is this for local stubs?

vinod.baradwaj
2018-05-15 08:48
this is for local stubs

bethskurrie
2018-05-15 08:50
Can you give more information @vinod.baradwaj

bethskurrie
2018-05-15 08:50
I'm not sure we have the same understanding of "local stubs".

bethskurrie
2018-05-15 08:51
I think the regular expression you're using needs start and end markers on it.

bethskurrie
2018-05-15 08:51
^ and $

vinod.baradwaj
2018-05-15 08:54
i have not used start and end markers, let me try with that

bethskurrie
2018-05-15 11:11
Needs more Tims!

vinod.baradwaj
2018-05-15 11:52
i have used term like this `path: term({generate: "/api/tagCollections/10197", matcher: "/api/tagCollections/"+'\\d{5}'})`

bethskurrie
2018-05-15 12:04
You'll need to escape the forward slashes correctly. And put a $ at the end.

bethskurrie
2018-05-15 12:05
`\/api`

timothy.clifford
2018-05-15 23:01
I'll see what I can do

timothy.clifford
2018-05-15 23:04
Day 2 at Orica and I've already seen "contract testing" on the wish list

timothy.clifford
2018-05-15 23:04
I automatically started muttering "PACT" over and over

matt.fellows
2018-05-15 23:06
:laughing:

matt.fellows
2018-05-15 23:06
You know who to talk to :slightly_smiling_face:

matt.fellows
2018-05-15 23:07
Try using something like this to test your regexes: http://rubular.com/

timothy.clifford
2018-05-15 23:12
I get a commission now, right?

matt.fellows
2018-05-15 23:12
Sure

matt.fellows
2018-05-15 23:12
You can own 1/20th of a slide deck :slightly_smiling_face:

timothy.clifford
2018-05-15 23:12
YES! I'm in

rgshah781988
2018-05-16 05:21
I have a scenario - When I make a GET API call , response is unknown in my application.

rgshah781988
2018-05-16 05:22
How can I create pact for this kind of GET API call ?

uglyog
2018-05-16 05:23
You'll need to be more specific on what "response is unknown in my application" means

rgshah781988
2018-05-16 05:25
Few job are running automatically and it will have id and response depend on job. When I create a pact file for GET api call then response should be different.

uglyog
2018-05-16 05:26
and the job is specified in the path or as query parameters?

bethskurrie
2018-05-16 06:17
@rgshah781988 please provide some example code (ideally in a git repository), describe your expected outcome, and the actual outcome.

vinod.baradwaj
2018-05-16 06:18
same api end point but with different responses every time when u make request to the same endpoint ? @rgshah781988

rgshah781988
2018-05-16 06:20
@vinod.baradwaj :same api end point but with different responses every time when u make request to the same endpoint - > Yes

rgshah781988
2018-05-16 06:20
We need this case for GET Call. I am not changing end-point data - api/assets

bethskurrie
2018-05-16 06:23
It's perfectly normal to set up the same request and expect different responses for different situations. You need to run each test separately, however. You can't load all the interactions into the mock service at the same time. You'll have to do a set up, 1 interaction, test it, tear down, set up the 2nd interaction, test it, tear down etc.

rgshah781988
2018-05-16 06:24
ok

ashish.dubey91
2018-05-16 06:57
Is it possible to do provider verification programmatically (say, in a python function) for a specific interaction? Sorry if it's too obviously mentioned in the docs. I think this slack group is friendly, and I'm exploiting that fact too much

mboudreau
2018-05-16 07:04
probably ask in the python channel if it's python specific since each language has a different way of doing things

nand.sharma
2018-05-16 07:25
has joined #general

nand.sharma
2018-05-16 07:28
Is there a ways to provide pact broker url to pact stub server ? As per https://github.com/pact-foundation/pact-stub-server documentation , we can provide directory of pact file


bethskurrie
2018-05-16 07:58
No, I don't think the rust implementation supports that. The ruby one does though (if I released it. I only did the code for it the other day. Let me check.)

bethskurrie
2018-05-16 07:59
Oh, I beg your pardon. Just read the docs. Yes!

vinod.baradwaj
2018-05-16 08:44
thanks @matt.fellows @bethskurrie

james.hogarth
2018-05-16 09:21
has joined #general

matt.fellows
2018-05-16 10:55
:+1:

uglyog
2018-05-16 23:38
@nand.sharma directly supporting the pact broker is an excellent idea. Can you raise an issue for that?

gnewitt
2018-05-17 03:28
has joined #general

jaime.jaramillo
2018-05-17 18:24
has joined #general

rollertone
2018-05-19 17:21
has joined #general

minhdoan
2018-05-21 03:13
has joined #general

minhdoan
2018-05-21 08:53
Hi team, i am buidling a Pact record with the response contains:

minhdoan
2018-05-21 08:53
{ "Id": 35345786, "DATA_TYPE": { "EntityTypeName": "STRING", } }


minhdoan
2018-05-21 08:53
{ "Id": 35345786, "DATA_TYPE": null

minhdoan
2018-05-21 08:56
I used the pact-jvm-consumer-junit_2.12:3.5.16 and it seems the or() method, e.g: or("DATA_TYPE", null, PM.nullValue(), PM.stringType()) does not work in this case

minhdoan
2018-05-21 08:56
Could you please help to instruct me how to build it?

minhdoan
2018-05-21 08:56
Many thanks!

abhilash.hanumanth
2018-05-21 09:43
has joined #general

abhilash.hanumanth
2018-05-21 09:45
I am also having similar requirement as @minhdoan

abhilash.hanumanth
2018-05-21 09:45
I have a simple pact record :

abhilash.hanumanth
2018-05-21 09:45
[ { "id":123, "name":"Abhilash" }, { "id":1234, "name":"Hanumanth" } ]

abhilash.hanumanth
2018-05-21 09:45
How do I construct the pactDslJsonBody for the above example body ?

abhilash.hanumanth
2018-05-21 09:49
@uglyog: Can you pls provide a solution for this as I see ``` public PactDslJsonArray array() { throw new UnsupportedOperationException("use the array(String name) form"); } ``` in PactDslJsonBody.java

minhdoan
2018-05-21 09:58
@abhilash.hanumanth for your case

minhdoan
2018-05-21 09:58
body(new PactDslJsonBody() .id("Id") .stringValue("name", "Abhilash") ).toPact();

minhdoan
2018-05-21 09:59
and the pact record:

minhdoan
2018-05-21 09:59
{ "status": 200, "headers": { "Content-Type": "application/json" }, "body": { "name": "Abhilash", "Id": 1234567890 } }

minhdoan
2018-05-21 09:59
Is it satisfied your need?

abhilash.hanumanth
2018-05-21 10:20
Sorry @minhdoan. My bad. I changed my requirement. Please check

abhilash.hanumanth
2018-05-21 10:21
body: ``` [ { "id":123, "name":"Abhilash" }, { "id":1234, "name":"Hanumanth" } ] ```

minhdoan
2018-05-21 10:36
@abhilash.hanumanth

minhdoan
2018-05-21 10:37
.body(new PactDslJsonBody() .array("value") .object() .id("id") .stringValue("name", "Abhilash") .closeObject() .object() .id("id") .stringValue("name", "Hanumanth") .closeObject() .closeArray() ).toPact();

minhdoan
2018-05-21 10:37
and pact record:

minhdoan
2018-05-21 10:37
"body": { "value": [ { "name": "Abhilash", "id": 1234567890 }, { "name": "Hanumanth", "id": 1234567890 } ] }

minhdoan
2018-05-21 10:37
try it

peter.banjo
2018-05-21 10:49
has joined #general

abhilash.hanumanth
2018-05-21 10:52
Hi @minhdoan: If you observe my Json body, i dont have "value". In your solution, "value" is passed to array() which will generate key name as "value" which is not there in my response. And passing parameter is mandatory to .array() method as I said : ``` public PactDslJsonArray array() { throw new UnsupportedOperationException("use the array(String name) form"); } ```

minhdoan
2018-05-21 11:03
@abhilash.hanumanth Could you send your detail API response received from Postman or some thing like that? Because almost the response have format as:

minhdoan
2018-05-21 11:03
{ value: [} } or { "Name": "Value" }

minhdoan
2018-05-21 11:05
I have not seen the format: { [] }

bethskurrie
2018-05-21 11:21
@abhilash.hanumanth @minhdoan would you mind moving your conversation to the #pact-jvm channel please? We like to keep the conversations focussed so that we can ensure everyone gets their issues addressed. Using threads helps with this too. Thanks! Hope you get your problem worked out.

abhilash.hanumanth
2018-05-21 11:22
Sure Beth

scott.osborne1
2018-05-21 21:55
has joined #general

scott.osborne1
2018-05-22 20:27
I noticed that the pact-broker database has a table called config. Can anyone point me to examples for how to set up pact-broker configuration in the database? Or maybe there's a separate slack channel for pact-broker issues.

aphelps
2018-05-22 21:08
has joined #general

avinash.eediga
2018-05-23 05:55
has joined #general

avinash.eediga
2018-05-23 05:58
any one can share a simple example to start with pact

avinash.eediga
2018-05-23 05:58
in js /jvm

avinash.eediga
2018-05-23 05:58
thanks in advance

vinod.baradwaj
2018-05-23 06:08
try this @avinash.eediga `https://github.com/Mikuu/Pact-JVM-Example` this is in jvm

rgshah781988
2018-05-23 06:21
@avinash.eediga Pactjs is little bit easy to understand

rgshah781988
2018-05-23 06:24
Can we have some automation in creating a pact file ? When user provide swagger file with its details. Then automatically pact file created. Is it possible ? We should have such kind of automation script? Which will boost use of pact.

bethskurrie
2018-05-23 06:25
Hi @rgshah781988 it could be written, but it's not going to help you. The value of pact is that the contract is generated by tests that execute the actual calls that your codebase will make in real life. A pact file generated from a swagger document misses the whole point.

rgshah781988
2018-05-23 06:25
Presently, It is difficult to update contract regularly whenever endpoint changes.

rgshah781988
2018-05-23 06:26
Can we have solution over this?

bethskurrie
2018-05-23 06:26
Presently, your contract tests are making you keep your code in sync with the provider changes. If they didn't do that, then there would be no value in them.

rgshah781988
2018-05-23 06:26
Agreed 100%.

bethskurrie
2018-05-23 06:26
I don't understand your question, sorry.

rgshah781988
2018-05-23 06:27
Can we make it automation to update end-point in contract file of pact

rgshah781988
2018-05-23 06:28
A pact file generated from a swagger document misses the whole point. - Can we find solution on this ?

tom
2018-05-23 06:42
has joined #general

tom
2018-05-23 06:45
I know that this isn't bet practice, but I need a matcher that make confirms that at object has been sent up, but the key/values aren't important

tom
2018-05-23 06:45
Does something like that exist?

tom
2018-05-23 06:59
I should add that is the values themselves would be objects

tom
2018-05-23 07:00
so using like({}) doesn't work

tom
2018-05-23 07:00
I should have mention that i am using pact-js

matt.fellows
2018-05-23 10:08
I'm sure this discussion has been had before.

matt.fellows
2018-05-23 10:09
We should get it up on our website so at least the key aspects to the problem and solution space are documented

matt.fellows
2018-05-23 10:10
:grin:

matt.fellows
2018-05-23 10:11
Hmmm. I don't think so, at least not in pact JS that I'm aware of

matt.fellows
2018-05-23 10:13
The keys are not matchable to my knowledge, they must be known in advance

bethskurrie
2018-05-23 10:15
The point of this sort of contract testing is not to *have* a pact file, it's to have two sets of tests (one in the consumer project using a mock provider, and one in the provider project using a "mock consumer") that are linked together so they can't get out of sync - the pact file is the mechanism for doing that. Generating a pact file from a swagger document is pointless, and is like marking your own exam, as I've heard someone once describe it before.

bethskurrie
2018-05-23 10:17
@tom is the expectation for the request body or the response body?

tom
2018-05-23 10:34
request body

tom
2018-05-23 10:34
Long story:

tom
2018-05-23 10:35
We use Redux

bethskurrie
2018-05-23 10:35
Hm. If it was the response body, you'd be fine, but for the request body, you really have to specify everything you're sending. Read up on Postel's Law if you're not familiar with it.

tom
2018-05-23 10:36
Yeah. Read that in the docs

tom
2018-05-23 10:37
and i totally agree .... EXCEPT

bethskurrie
2018-05-23 10:37
Redux puts extra stuff in that you don't care about?

tom
2018-05-23 10:37
we have 'screen capture'

tom
2018-05-23 10:38
we are currently achieving this by sending the entire state up as an additional parameter

tom
2018-05-23 10:38
HORRIBLE, i know

tom
2018-05-23 10:38
but, genius in comparison to how we were doing it

bethskurrie
2018-05-23 10:39
What level are you writing your pact tests at? Are they going through the UI, or just testing the API client class?

tom
2018-05-23 10:39
through the ui

bethskurrie
2018-05-23 10:39
there's your problem.

bethskurrie
2018-05-23 10:40
Ideally, you write pact tests for as little code as possible. Just the client that is responsible for making the API calls.

bethskurrie
2018-05-23 10:40
Then, you're in control of everything that gets passed into that client.

rgshah781988
2018-05-23 10:40
Thanks for update

tom
2018-05-23 10:40
Hmmmm. You are right (as always)

bethskurrie
2018-05-23 10:40
Back door of the consumer to front door of the provider.

bethskurrie
2018-05-23 10:41
Ha! My husband would disagree with you there :stuck_out_tongue:

bethskurrie
2018-05-23 10:41
But I have done this enough to know how to write painful pact tests, and I know that the more code you cover with them, the more painful they are.

tom
2018-05-23 10:41
BUT, it doesn't help with the next point

tom
2018-05-23 10:42
It will fail on the mock server

tom
2018-05-23 10:42
which would suck because i am using that for deving


tom
2018-05-23 10:43
the cheat answer is to change it to pass up a stringified json object

bethskurrie
2018-05-23 10:43
There may be a workaround. Let me have a look and see if some naughty code I once put in there is still there.

tom
2018-05-23 10:43
but i was hoping to not have to do any re work

tom
2018-05-23 10:44
The weird thing is, it works in 4

tom
2018-05-23 10:44
it broke updating to 5

bethskurrie
2018-05-23 10:45
4/5 of what?

bethskurrie
2018-05-23 10:45
Is that a pact-js version?


tom
2018-05-23 10:45
it shouldn't have worked, so 5 didn't break it,

bethskurrie
2018-05-23 10:46
i haven't touched that part of the code for years.

bethskurrie
2018-05-23 10:46
I'm just seeing if the dirty hack I once put in to allow this sort of thing is still there

tom
2018-05-23 10:46
:crossed_fingers:

tom
2018-05-23 10:48
The weird thing is, as I was explaining to Beth) that it worked in 4.

tom
2018-05-23 10:48
It shouldn't have

bethskurrie
2018-05-23 10:48
ok... we have two options. We can hack the ruby code or we can hack the js code.

tom
2018-05-23 10:49
I am WAY more comfortable with JS

bethskurrie
2018-05-23 10:49
In the request that gets sent to the mock service, at the same level as the body, path, headers keys, you can add another key called `options`.


bethskurrie
2018-05-23 10:49
In that hash, if you set `{"allow_unexpected_keys_in_body": true}` then it will allow extra keys in the body

bethskurrie
2018-05-23 10:50
You'll have to override the javascript code that sends the request. Is monkeypatching js a thing?

tom
2018-05-23 10:50
I will make it so

bethskurrie
2018-05-23 10:50
If that doesn't work, there's a built in mechanism for allowing us to monkeypatch the ruby :wink:

bethskurrie
2018-05-23 10:51
I persuaded michel to put it in, despite great protestations.

tom
2018-05-23 10:51
So i need to send that up with every request where I need this attribute?

bethskurrie
2018-05-23 10:51
yes


tom
2018-05-23 10:52
I will have a play around with it and get back to you.

bethskurrie
2018-05-23 10:53
ok. if that fails, I can send you the ruby for the monkeypatch.

tom
2018-05-23 10:54
The other option is to change the request to strings and then just parse it on the server site


tom
2018-05-23 10:54
thanks again

bethskurrie
2018-05-23 10:54
good to know there's a backup plan.

bethskurrie
2018-05-23 10:54
np

tom
2018-05-23 10:55
but it is only after updated to 5 that it started.

tom
2018-05-23 10:55
It is my fault

matt.fellows
2018-05-23 10:58
We might need an option to pass that through @bethskurrie, with a warning when used

gopinathlangote11
2018-05-23 13:29
has joined #general

scott.osborne1
2018-05-23 15:25
I would love to be able to set pact-broker configuration through the database instead of in the http://config.ru file. Can anyone point me to examples for setting up configuration in the database?

scott.osborne1
2018-05-23 15:26
Specifically I want to set "order_versions_by_date = true" and have it persist over restarts and upgrades to the pact-broker docker image.

scott.osborne1
2018-05-23 15:27
I could package my own docker image that uses your image and updates the config file, but the http://config.ru is not consistent between pact-broker-docker images either, so I would prefer to put these kinds of settings in the database.

peter.banjo
2018-05-23 15:41
hi. i'm trying to test a swagger API with Pact using swagger-mock-validator. the tests are failing and I'm not sure where the problem is. my setup is like this ``` // secure.spec.js const interaction = { state: "authenticated request", uponReceiving: "a request for a secure resource", withRequest: { method: "GET", path: "/secure", headers: { Accept: "application/json", Authorization: "Bearer 1234XYz" } }, willRespondWith: { status: 200, headers: { "Content-Type": "application/json" }, body: EXPECTED_BODY } }; ```

peter.banjo
2018-05-23 15:42
``` // swagger.yaml swagger: "2.0" ... securityDefinitions: Bearer: type: apiKey name: Authorization in: header ... /secure: x-swagger-router-controller: secure get: description: Allows only secure requests operationId: secure security: - Bearer: [] responses: "200": description: Success schema: $ref: "#/definitions/SecureResponse" default: description: Error schema: $ref: "#/definitions/UnauthorizedError" ```

peter.banjo
2018-05-23 15:43
is anyone familiar with using swagger and pact?

greg
2018-05-23 15:45
has joined #general

peter.banjo
2018-05-23 15:50
I found the issue... i had multiple definitions in my pact file so `pactfileWriteMode: "overwrite",` solved it

paulswilliams
2018-05-23 19:33
has joined #general

paulswilliams
2018-05-23 19:35
Hi all.

bethskurrie
2018-05-24 04:17
It's not a feature I really advertise! But there are certain situations where it's better than the alternatives.

gopinathlangote11
2018-05-24 05:18
Hello


bethskurrie
2018-05-24 08:37
I haven't gotten around to making an API for the configuration, but here is the sql to set the config you want:

bethskurrie
2018-05-24 08:38
``` insert into config (name, type, value, created_at, updated_at) values ('order_versions_by_date', 'boolean', '1', now(), now()); ```

bethskurrie
2018-05-24 08:40
Any luck @tom?


rgshah781988
2018-05-24 11:54
:+1:

matt.fellows
2018-05-24 12:19
Nice, thanks Beth

scott.osborne1
2018-05-24 15:26
That's great! Thank you! I was putting in "true" in the database and it wasn't working. I'll use your example. Appreciate it!

santoshtrip
2018-05-24 23:12
@shekharsp27 can you please share the whole dependency set to run this

santoshtrip
2018-05-24 23:13
Having tough time with multiple versions causing conflict

eumirg
2018-05-25 05:14
has joined #general

shirren
2018-05-25 05:44
has joined #general

shekharsp27
2018-05-25 11:11
Here is consumer dependency

shekharsp27
2018-05-25 11:12
<dependencies> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-consumer-junit_2.12</artifactId> <version>3.5.13</version> <scope>test</scope> </dependency> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-consumer-java8_2.12</artifactId> <version>3.5.13</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>com.atlassian.oai</groupId> <artifactId>swagger-request-validator-pact</artifactId> <version>1.3.8</version> </dependency> <!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured --> <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <version>3.0.7</version> <scope>test</scope> </dependency> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-parser</artifactId> <version>1.0.34</version> </dependency> </dependencies>

shekharsp27
2018-05-25 11:13
Here is provider dependency <dependencies> <dependency> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-provider-junit_2.12</artifactId> <version>3.5.13</version> </dependency> <dependency> <groupId>com.atlassian.oai</groupId> <artifactId>swagger-request-validator-pact</artifactId> <version>1.3.8</version> </dependency> <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <version>3.0.7</version> <scope>test</scope> </dependency> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-parser</artifactId> <version>1.0.34</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.9.4</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.9.4</version> </dependency> </dependencies>

dervis4
2018-05-28 09:08
has joined #general

dervis4
2018-05-28 10:22
Hi guys! We (at Norwegian LWA) had some issues with the content-type header when running our tests against a Jetty-server. We have made a improvement in Pact-JVM that makes Pact able to accept content-type header with an optional whitespace character (as pr the W3C-specification). Please see our pull-request here: https://github.com/DiUS/pact-jvm/pull/688. :slightly_smiling_face:

mboudreau
2018-05-28 12:00
thanks for the PR. It's night time for most of the core contributors, but I'm sure it will be looked at soon. Cheers :slightly_smiling_face:

dervis4
2018-05-28 12:15
Thank you @mboudreau (its day time here in Norway)

paulswilliams
2018-05-28 12:34
So I?ve got a reliable consumer + provider test working with contracts held by the broker. However, I now want to add a test for an exception case as well as the positive case. Should I just add a uponReceiving? section to this DSL, and another authClient.login chunk into my existing @Test? As you can only have one test per class using the JUnit integration, should I be using the DSL instead? Using this approach, there seems to be a lot of boilerplate needed :confused: ```public class AuthClientTest { @Rule public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("simple-auth-api", "localhost", 8081, this); @Pact(consumer = "simple-web") public RequestResponsePact createPact(PactDslWithProvider builder) { Map<String, String> requestHeaders = new HashMap<>(); requestHeaders.put("Accept", "application/json, application/cbor, application/*+json"); Map<String, String> expectedResponseHeaders = new HashMap<>(); expectedResponseHeaders.put("Content-Type", "application/json;charset=UTF-8"); return builder .given("Paul exists with password Secret") .uponReceiving("valid authentication details") .path("/login") .query("username=Paul&password=Secret") .headers(requestHeaders) .method("GET") .willRespondWith() .status(200) .headers(expectedResponseHeaders) .body("{\"id\":123,\"username\":\"paul\",\"firstname\":\"Paul\",\"lastname\":\"Williams\"}") .toPact(); } @Test @PactVerification() public void successfulLogin() { User login = new AuthClient().login("Paul", "Secret"); assertThat(login, is(notNullValue())); assertThat(login.getId(), is(123)); assertThat(login.getUsername(), is("paul")); assertThat(login.getFirstname(), is("Paul")); assertThat(login.getLastname(), is("Williams")); } }```

paulswilliams
2018-05-28 12:37
Although one large test testing multiple interactions would work, it gives many reasons for it to fail?

matt.fellows
2018-05-28 12:38
Personally i would try to keep one test for each single interaction rather than make each test more complex, even if it does involve more verbosity/boilerplate. @uglyog might have some opinions tho

mboudreau
2018-05-28 12:40
one way to reduce boilerplate is to have shared 'util' classes that setup the repetitive things from your DSL definition

paulswilliams
2018-05-28 12:40
The boilerplate I?m referring to is less the DSL, more the assertions. Most of: ```MockProviderConfig config = MockProviderConfig.createDefault(); PactVerificationResult result = runConsumerTest(pact, config, mockServer -> { Map expectedResponse = new HashMap(); expectedResponse.put("hello", "harry"); try { assertEquals(new ProviderClient(mockServer.getUrl()).hello("{\"name\": \"harry\"}"), expectedResponse); } catch (IOException e) { throw new RuntimeException(e); } }); if (result instanceof PactVerificationResult.Error) { throw new RuntimeException(((PactVerificationResult.Error)result).getError()); } assertEquals(PactVerificationResult.Ok.INSTANCE, result);```

paulswilliams
2018-05-28 12:41
Testing one thing per test is generally how I?ve done things for 10 years, just trying to work out how to do that succinctly.

paulswilliams
2018-05-28 13:48
Further, is it possible for mocks to throw exceptions in @State methods? The following code seems to cause the exception to be thrown in the wrong context, and thus my ControllerAdvice doesn?t pick it up and convert to 401. ``` @State("Paul exists with password Secret") public void returnSuccessfulLogin() { when(authService.login("Paul", "Secret")).thenReturn(new User(123, "paul", "Paul", "Williams")); when(authService.login("Paul", "Unconcealed")).thenThrow(new BadCredentialsException()); }```

abhilash.hanumanth
2018-05-28 14:06
Did anyone implement PACT for kakfa message queue consumer and provider ?

matt.fellows
2018-05-28 21:00
It's been done, which language?

abhilash.hanumanth
2018-05-29 05:36
using pact jvm

gaurav
2018-05-29 07:56
has joined #general

gaurav
2018-05-29 07:58
configuration for maven plugin.

gaurav
2018-05-29 07:58
Not able to do `mvn pact:publish`

gaurav
2018-05-29 07:58
with above configuration.

gaurav
2018-05-29 07:59
Is there anything wrong I am doing?

gaurav
2018-05-29 08:00
also how can I publish tag? thanks a lot..

gaurav
2018-05-29 08:01
I get this error: `No plugin found for prefix 'pact' in the current project `.. Its in plugins management..

gaurav
2018-05-29 08:03
I was not able to find documentation related to this.. so if someone knows a link then please share.. thanks

such.su
2018-05-29 09:41
has joined #general

such.su
2018-05-29 10:02
Hi all, I am just investigating pact-python to see if it can be used in my services but I got some questions. Could anyone help: 1. Does pact-python support services based on XML message? 2. Is there any reason that it's not implemented or it will be implemented soon?

bethskurrie
2018-05-29 10:03
It isn't yet, but we've just started discussions with someone who is interested in implemeting it. You can use exact string matching, but it will be quite brittle.

such.su
2018-05-29 11:06
Yeah, exact string matching is quite brittle. Is there a release plan for supporting XML? I am quite interesting in using this awesome Pact.

bethskurrie
2018-05-29 11:07
If you look at the pact-dev mailing list, you'll find the current "plan" such as it is.

bethskurrie
2018-05-29 11:08
Oh, actually, that conversation wasn't on that list. Sorry.

such.su
2018-05-29 11:12
Hmmm, where to look at the pact-dev mailing list?:thinking_face:

bethskurrie
2018-05-29 11:12
Sorry, I realised it wasn't on that mailing list

such.su
2018-05-29 11:15
Got it. I am also interested in that mailing list.

bethskurrie
2018-05-29 11:15
I think you can just join it. We're trying to move conversation to slack however.

such.su
2018-05-29 11:16
Cool, thanks:+1:

aswini.j
2018-05-29 11:52
has joined #general

premmkrishna.shenoy
2018-05-29 12:09
has joined #general

premmkrishna.shenoy
2018-05-29 12:11
Hi I am performing a pact test where the provider response is 'application/javascript' with json as body. My provider test is failing on body while my consumer test are good. Do you support 'application/javascript' content type?

aswini.j
2018-05-29 12:13
Does it support JavaScript content-type? The third party service that my microservice interacts with returns the response with the content-type application/JavaScript;charset=UTF-8. Therefore, pact json has response body as string & matching rules has empty body.

aswini.j
2018-05-29 12:14
Using the following pact dependencies:

aswini.j
2018-05-29 12:15
testIntegrationCompile('au.com.dius:pact-jvm-consumer-junit_2.12:3.5.11') testIntegrationCompile('au.com.dius:pact-jvm-provider-junit_2.12:3.5.11') testIntegrationCompile('au.com.dius:pact-jvm-provider-spring_2.12:3.5.11') testIntegrationCompile('au.com.dius:pact-jvm-consumer-java8_2.12:3.5.11')

dagarwal
2018-05-29 20:27
has joined #general

jeremy.shipman
2018-05-29 21:55
has joined #general

jeremy.shipman
2018-05-29 21:57
Hello PACT?ers. I have a random query string being added inside my jQuery ajax config. Is there a way to specify in an interaction that the mock provider service ignore this?

matt.fellows
2018-05-29 21:58
Does the qs have a pattern you can use to match? If it's a cache buster, you could just add a regex matcher for it

jeremy.shipman
2018-05-29 21:58
Ok - yes it?s like a cache buster. Gets around some Safari bug, I see commented

matt.fellows
2018-05-29 22:00
That would work then

bethskurrie
2018-05-29 22:14
You will unfortunately lose the ability to have your pacts "pre-verified" in the broker if you use random data. Let me know if that makes no sense.

uglyog
2018-05-29 23:29
Try using the full artifact name: `pact-jvm-provider-junit_2.12:publish`

uglyog
2018-05-29 23:30
`application/javascript` should be used for Javascript source files. `application/json` should be used for JSON bodies.

uglyog
2018-05-29 23:32
Unfortunately, JavaScript is not a supported content type.

gaurav
2018-05-30 01:11
my bad! I should be using: `pact-jvm-provider-maven_2.12` (not junit_2.12) thanks a lot. Although I believe there should be another maven plugin like `pact-jvm-consumer-maven_2.12` to publish pacts, as publishing pacts are done at consumer side. Anyways, Is there any documentation for this maven plugin goals? Thanks again!

gaurav
2018-05-30 01:15
This time, I am more looking for "how to tag using this maven plugin".. but would love to explore other options this plugin provides.


jeremy.shipman
2018-05-30 02:15
Here?s my code. Is the `query` part of withRequest correct? I?m still getting ?missing requests? urls spitting out. ``` return { uponReceiving: title || mockjax.url, withRequest: { method: mockjax.type || "GET", path: mockjax.url, query: { r: like({ generate: "163aece11f20.7ff22681c8afd", matcher: ".*" }) } }, willRespondWith: { status: mockjax.status || 200, headers: { "Content-Type": "application/json" }, body: mockjax.responseJSON } }; ``` (I?m reusing mock configuration intended for mockjax options)

jeremy.shipman
2018-05-30 02:23
The documentation here: https://docs.pact.io/implementation-guides/javascript suggests the query field should be in this form: `query: /* '?query=parameters' (string) */,`

jeremy.shipman
2018-05-30 02:23
I?m not sure if this means I can?t use js objects to configure it

gaurav
2018-05-30 02:42
thanks a lot. I could pass tags as -D by defining a maven properties. I have another question however bit unrelated so will put that as new slack message. thanks again!

gaurav
2018-05-30 02:53
Hello all, as a best practice, which is more preferable 1. 'mvn pact:verify' to run provider tests 2. Run test with sure-fire plugin (like we we do for normal unit tests in our case). and why?

mboudreau
2018-05-30 02:55
what works best for you?

gaurav
2018-05-30 02:57
I tried both.. both works fine for current purpose so I am trying to decide which one to use. :slightly_smiling_face:

bethskurrie
2018-05-30 02:57
I would suggest it doesn't matter then!

bethskurrie
2018-05-30 02:58
@uglyog may have an opinion

gaurav
2018-05-30 03:00
thanks.. I will also spend little more time experience the whole flow.. checking which one would fit better with our CI pipeline practically. At this point, from my current understanding: both should work just fine.

gaurav
2018-05-30 03:54
I wonder how I can pass 'tag' from command line when running tests through sure-fire.. l have a profile to run provider tests: providerTests. so `mvn test -PproviderTests` will run my provider tests.. However if I want to run provider tests using pacts with a particular tag: 'head' or 'prod' etc., I am wondering how I could achieve that. any ideas? Thanks a lot.

bethskurrie
2018-05-30 03:55
I believe there is a configuration in the maven task config

bethskurrie
2018-05-30 03:55
Can you find the page for the mvn config?


gaurav
2018-05-30 03:58
but thats when I am using `mvn pact:verify` right?

bethskurrie
2018-05-30 03:58
Scroll down until you read the part about the tags.

gaurav
2018-05-30 04:01
I will have to use `mvn pact:verify` if I want to use tag this way..

bethskurrie
2018-05-30 04:01
:thumbsup:

gaurav
2018-05-30 04:01
If I am using surefire then I am defining tags currently as `@PactBroker(host = ?localhost?, port = "80", tags = {"TEST","DEV"})`

uglyog
2018-05-30 04:02
You will probably have to use Java system properties

gaurav
2018-05-30 04:03
I see.. so if I set system properties `pactbroker.tags` to a tag then it should work..


gaurav
2018-05-30 04:13
great. Awesome. Its working. Thanks a lot.

aswini.j
2018-05-30 05:38
Thank you

gaurav
2018-05-30 07:06
Thinking about a bit, I see a possible gap regarding verifying pact with provider when making changes on consumer side. Don?t know how to fill the gap. Following is the scenario: - I checkout a branch on consumer side: my_branch - I make some changes that might impact pact. - I do: `mvn pact:publish -Dpact.tag=my_branch` - Now I want to validate my pact so lets suppose I checkout provider code and do: `mvn test -PproviderTests -Dpactbroker.tags=my_branch` (assuming pom is setup this way) Tests pass and I am happy. BUT I have run master-version-provider to verify pacts. Current master provider code might be different than current production code. I am still not sure whether if I deploy my changes in production then there won?t be any contract issue. Its possible that my current expectation as consumer is not valid with provider service currently running in production.

gopinathlangote11
2018-05-30 07:13
@gaurav I feel, You verified the pacts against your branch, not against master. Whenever you merge the branch to master I think you need to verify once again.

gaurav
2018-05-30 07:15
I verified a pact: consumer-branch with provider-master.. my question is how do I make sure that my consumer-branch will be fine with provider-prod.

bethskurrie
2018-05-30 07:46
@gaurav you need to use the can-i-deploy tool



gaurav
2018-05-30 07:50
thanks a lot Beth. I will read the documentation and try can-i-deploy tool

gaurav
2018-05-30 08:24
thanks, it is starting to make sense now.. So provider version in pact matrix should ideally be git-sha (or anything that can be used to checkout prod version of provider).. right? consumer version does not need git-sha version etc. if doing proper tagging, but probably better to do that way for sake of uniformity.. I am going to do some experiments to get some practical experience of how it would work. Thanks a lot @bethskurrie I also see a scope of a maven plugin to handle many of these things.. Thanks again!

bethskurrie
2018-05-30 08:26
Yes, you should use a git sha (or a version with the git sha in the metadata) for your version. I need to update all the examples, because currently, they have a semantic version, which is now not recommended. Make sure your broker is sorting by date and not semantic version as well. You'll find that setting in the configuration docs in the Pact Broker wiki.

gaurav
2018-05-30 08:33
yea.. may be in next broker release, we can change name ?Consumer Version? to ?Consumer SCM Identifier/tag..etc.? or something like that..

bethskurrie
2018-05-30 08:35
Yes, i wish I'd called it something different. I didn't realise quite what the API would turn into when I first wrote it.

gaurav
2018-05-30 08:35
being agile :slightly_smiling_face:

bethskurrie
2018-05-30 08:36
indeed

gaurav
2018-05-30 08:39
Also the fact that 'the default value is {project.version}' is bit misguiding now.

uldis.sturms
2018-05-30 13:39
has joined #general

jeremy.shipman
2018-05-30 21:09
I?m currently trying to write our first PACT test from a web-based client using pact-web to the ruby stand alone mock provider. We haven?t reached the point of setting up a broker yet.

jeremy.shipman
2018-05-30 21:10
Can anyone @here comment?

jeremy.shipman
2018-05-30 21:12
I?m getting a list of `Missing requests`, but I can?t make make the list smaller. I?m assuming it?ll get smaller if the mock service provider will have correctly configured interactions - where effectively the `r` query param is ignored.

jeremy.shipman
2018-05-30 21:14
I?ve tried deleting previously generated pacts in case that was interfering.

jeremy.shipman
2018-05-30 21:16
I?ve tried the following formats of query matching ``` query: "?r=163aece11f20.7ff22681c8afd", query: { r: somethingLike("163aece11f20.7ff22681c8afd") }, query: { r: like({ generate: "163aece11f20.7ff22681c8afd", matcher: ".*" }) } ```

mboudreau
2018-05-30 22:23
yeah, looking into it

mboudreau
2018-05-30 22:28
ah, right, 'like' isn't the right one for the query

mboudreau
2018-05-30 22:29
you want to use `term` if you want to use the generate/matcher


seb
2018-05-31 08:16
has joined #general

gaurav
2018-05-31 09:38
getting this strangely.. will put more information in the thread comments.

2018-05-31 09:39
A file was commented on

mboudreau
2018-05-31 09:54
can you post the dsl code you're using for this test?

matt.fellows
2018-05-31 09:57
Is myCategory a Boolean value? That error seems to indicate it got a Boolean, but the wrong calue

matt.fellows
2018-05-31 09:57
Value*

g.r.mccann
2018-05-31 10:37
has joined #general

g.r.mccann
2018-05-31 10:41
Hi

g.r.mccann
2018-05-31 10:43
I was hoping I could pick your brains on a migration from https://www.npmjs.com/package/pact to https://github.com/pact-foundation/pact-node or pact-js

g.r.mccann
2018-05-31 10:44
we have a number of tests using the older version. As of this morning one of its downstream dependencies appears to have dissapeared from npm registry @types/node/-/node-9.4.2.tgz so am looking to upgrade the tests

g.r.mccann
2018-05-31 10:46
the current tests make use of the Matchers (eachLike, somethingLike) which don't seem to present in pact-node. According to the docs they should be in pact-js but upon destructing Matchers I'm getting undefined

g.r.mccann
2018-05-31 10:46
are they in a seperate repo or am I barking up the wrong tree

g.r.mccann
2018-05-31 10:46
any help would be much appreciated

matt.fellows
2018-05-31 10:47
You probably want @pact-foundation/pact

g.r.mccann
2018-05-31 10:47
so thats the one I'm trying now

matt.fellows
2018-05-31 10:47
Those matchers are now in `Matchers`

g.r.mccann
2018-05-31 10:47
const { Pact } = require('@pact-foundation/pact'); const {Matchers} = Pact;

g.r.mccann
2018-05-31 10:48
Matchers seems to be undefined


matt.fellows
2018-05-31 10:50
This example should help

matt.fellows
2018-05-31 10:50
Sorry just jumping in a car

g.r.mccann
2018-05-31 10:59
That's fine thanks for your help, much appreciated

g.r.mccann
2018-05-31 10:59
const { Pact, Matchers } = require('@pact-foundation/pact');

g.r.mccann
2018-05-31 11:00
seems to do the job as opposed to how we had it before.

matt.fellows
2018-05-31 13:19
Great!

gaurav
2018-06-01 00:49
Thanks Matt.. got it right! the test code was sending different value in the request.. I am still wondering why mock server gave back the response, if request body was different..

gaurav
2018-06-01 01:28
I understand now.. request body is PactDslJsonBody so it matches with field and field type.. not with field value.

jeremy.shipman
2018-06-01 02:09
Thanks @mboudreau for your help :wave:

mboudreau
2018-06-01 02:12
np :slightly_smiling_face:

gaurav
2018-06-01 05:33
Getting 500 suddenly with mvn pact:publish -Dpact.tag=myBranch (pom is setup accordingly).. was working fine and suddenly stopeed working. Any log that can help?

uglyog
2018-06-01 05:34
What broker are you using?

gaurav
2018-06-01 05:35
x-pact-broker-version: 2.19.1

bethskurrie
2018-06-01 05:35
Docker container?


gaurav
2018-06-01 05:35
yea its container.. checking troubleshooting page.

gaurav
2018-06-01 05:38
pact-broker restart fixed it.. however I am going to set PACT_BROKER_LOG_LEVEL to DEBUG .. just in case it happens again.. thanks all. :slightly_smiling_face:

bethskurrie
2018-06-01 05:38
np

bethskurrie
2018-06-01 05:39
did you find any logs?

gaurav
2018-06-01 05:43
running broker in mesos using marathon and getting logs is bit tricky (our other applications use logstash so we can check app logs in kibana).. We are working on making it better.. however I am going to put ssh in broker docker image so that I can do ssh and get logs from container.. or for any other troubleshooting

gaurav
2018-06-01 07:40
From Pact Nirvana Document: `To reach Pact Nirvana, the final step is to have a CI build that checks out the code for the production version of your provider, and have it verify the same pacts that the head version does.` In case consumer has new pact tests with new states, this won?t work right? because production version of provider code will be having older version of provider tests, that might not run with head version consumer pacts.

bethskurrie
2018-06-01 07:41
I see you've thought this through ;-)

bethskurrie
2018-06-01 07:42
My thought on this is that you could keep the provider state code in a separate repo

bethskurrie
2018-06-01 07:42
This may be difficult

bethskurrie
2018-06-01 07:42
Too difficult

gaurav
2018-06-01 07:43
I intend to put ?independent deployment? in practice so have to think a bit.. :slightly_smiling_face: will think about how to resolve it in our case..

bethskurrie
2018-06-01 07:44
I think it should be OK if you don't go back further than the earliest version that used pacts.

bethskurrie
2018-06-01 07:44
And I'm not 100% sure that it's necessary.

bethskurrie
2018-06-01 07:45
Ensuring that you deploy consume and provider as often as possible should mean you're never in that situation.

gaurav
2018-06-01 07:53
hmm that seems right.. however just to be on safer side: we have all our microservices always running in pre-prod env (same version as prod). If we will be able to replay pact files against those microservices running in pre-prod, and somehow verify that contracts are fine then it might work. at least for few cases (assuming we are using pre-prod data in consumer tests requests).. For negative tests e.g. 404 etc it won?t work. But we don?t need pacts for negative scenarios.

matt.fellows
2018-06-01 11:38
that sort things out Jeremy?

shekharsp27
2018-06-01 13:11
Hi, I have a question about "pact-provider-verifier-docker", as per the document I have done the setup 1) Following is my API docker file, its a simple spring application FROM openjdk:8-jre-alpine COPY ./target/updated-provider-service-0.0.1-SNAPSHOT.jar /usr/src/animal/ WORKDIR /usr/src/animal EXPOSE 8080 CMD ["java", "-jar", "updated-provider-service-0.0.1-SNAPSHOT.jar"] 2) Following is docker-compose yml file <pre>version: '3' services: animalwebapp: build: ./ ports: - "8000:8080" pactverifier: image: dius/pact-provider-verifier-docker links: - animalwebapp environment: - pact_urls=http://192.168.99.100/pacts/provider/zoo__update_provider/consumer/zoo_update_consumer/latest - provider_base_url=http://192.168.99.100:8000</pre> Issue is : When I execute "docker-compose up", the pact verification task is executing before my application gets up & running(also checked by adding depends_on flag). Please let me know what should be the approach here.

gaurav
2018-06-01 13:28
more a docker related question I think.. but if you add ?depends_on? in docker-compose file preferably with a health check then it should be fine. more: https://docs.docker.com/compose/startup-order/

matt.fellows
2018-06-01 13:42
Yep

vikassd2012
2018-06-02 03:35
has joined #general

vikassd2012
2018-06-02 03:36
Hi All needed some of your help. I am trying to run my first test using Pact on dotnet core and I am getting this error {StatusCode: 500, ReasonPhrase: 'Internal Server Error ' I ran the sample solution here https://github.com/tdshipley/pact-workshop-dotnet-core-v1 and it works as expected. I wrote the sample for my application under test following the example


vikassd2012
2018-06-02 03:38
here is my sample code

vikassd2012
2018-06-02 03:38
public void InstrumentReturnsInformationBySerialNumber() { // Arrange var expectedMessage = "{\"runName\":\"dummyRun\",\"instrumentSerialNumber\":\"ea82e963\",\"instrumentDescription\":\"f2bbec3c\",\"instrumenttype\":\"MiSeq\",\"instrumentSoftwareVersion\":\"1.0.0\",\"instrumentApiKeyUsed\":\"c67f59a6b9794c5fb14a594ab1dfe5eb\"}"; _mockProviderService.Given("there is data") .UponReceiving("A valid GET request for Instrument API with a serial number") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = "/v3/instruments", Query = "ea82e963", }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary<string, object> { { "Content-Type", "application/json; charset=utf-8" } }, Body = new { message = expectedMessage } }); // Act var result = InstrumentServiceApiClient.GetInstrumentBySerialNumberUsingInstrumentService("ea82e963", _mockProviderServiceBaseUri).GetAwaiter().GetResult(); Console.WriteLine(result.ToString()); var resultBodyText = result.Content.ReadAsStringAsync().GetAwaiter().GetResult(); // Assert Assert.Contains(expectedMessage, resultBodyText); }

vikassd2012
2018-06-02 03:39
please note if I hit my consumer api itself, consuming the provider api, it works as expected

vikassd2012
2018-06-02 03:59
Found an extra comma in the ProviderServiceRequest, removed that but still the same error.

vikassd2012
2018-06-02 04:49
I found my problem


vikassd2012
2018-06-02 04:51
also I was mucking with mockerserver

vikassd2012
2018-06-02 04:51
MockProviderService = PactBuilder.MockService(MockServerPort, new JsonSerializerSettings());

vikassd2012
2018-06-02 04:51
modified that to MockProviderService = PactBuilder.MockService(MockServerPort);

vikassd2012
2018-06-02 04:51
and now it works

bethskurrie
2018-06-02 04:52
Hello Vikas. Can you ask in the pact net channel, and remember to use threads so we can keep conversations focussed. Thanks!

bethskurrie
2018-06-02 04:53
Putting ``` before and after your code will keep it formatted nicely.

hstene
2018-06-02 05:20
has joined #general

hstene
2018-06-02 05:21
God morning. Migrating to Slack is a great idea! :)

vikassd2012
2018-06-02 05:25
Sure Beth got your points. Didn't use Slave before.

bethskurrie
2018-06-02 08:48
Hi all. We have been alerted to a vulnerability in the Pact Broker webhooks and have released a fix in version 2.19.2. The latest Docker image has been upgraded to this version. If you're unsure of the version of your current installation, you'll find the version number in the X-Pact-Broker-Version header in the API Browser. Please upgrade your instance as soon as possible. If you are using the DiUS hosted version, it has already been updated, and no further action is necessary.

richard.peckett
2018-06-02 11:35
has joined #general

matt.fellows
2018-06-02 12:19
Cross post from the Pact Broker slack, but just note that if you?re using the hosted broker from http://pact.dius.com.au, it is already updated

heymega
2018-06-02 13:05
has joined #general

james.carman
2018-06-02 13:09
has joined #general

james.carman
2018-06-02 13:11
When doing pact verification, I want to spin up my provider locally, download all consumer pacts, and run them against my local instance?

james.carman
2018-06-02 13:13
Does that mean I?m mocking out any downstream services? If so, should these mocks be generating pacts for those downstream services also? Basically, do we have a cascading pact situation going on?

james.carman
2018-06-02 20:09
Is that the right pattern or should I verify against a ?deployed? instance of my provider?

hstene
2018-06-02 21:01
deployed

hstene
2018-06-02 21:03
If you want to mock away downstream services, then you are free to do so. That is what I am recommending in my projects as you want to escape the "integration test hell" that downstream services create.

james.carman
2018-06-02 21:04
@hstene so your recommendation is to do the ?cascading? I?m talking about?

james.carman
2018-06-02 21:04
I like that idea :slightly_smiling_face:

james.carman
2018-06-02 21:05
I mean, if you have to push your provider out to some deployment environment in order to verify the pacts against it, then aren?t you basically doing an ?end-to-end? test (the first end is just one less hop)?

james.carman
2018-06-02 21:06
I?m just trying to understand the best practices here, as I?m somewhat new to this world (and I love the idea)

hstene
2018-06-02 21:06
Who are these downstream services? Is it external APIs or services that you control?

james.carman
2018-06-02 21:06
services I control

james.carman
2018-06-02 21:07
Now, would the pact verification run be a bad time to establish new pacts for the downstream services?

james.carman
2018-06-02 21:08
Or, do I just do regular downstream mocks during the ?verify? run and then during my regular pact establishment run (whatever that is called) I publish my pacts against my downstream service?

james.carman
2018-06-02 21:08
Consider the case of Service A --> Service B --> Service C.

james.carman
2018-06-02 21:08
Service A runs some tests, establishing its ?pact? with Service B

james.carman
2018-06-02 21:09
Now, while I?m verifying Service A?s pact it published against Service B, would I publish my pact for Service C during that verify run?

james.carman
2018-06-02 21:09
Or, would that be a different build and I just use a regular (non-pact) mock of Service C during the verify run for Service B

james.carman
2018-06-02 21:09
I hope I?m making sense. I don?t know all the lingo yet I?m afraid :slightly_smiling_face:

hstene
2018-06-02 21:23
Ok, so in your scenario you have Service A that consumes B, and Service B consumes C. By having created a pact between Service B and Service C, you already have *a trusting relationship* with that provider. You already agree on both input and output data of all endpoints you are using. This trusting relationship is the key to this. When you are creating a new release of your service (Service A) you create a new pact and upload it to the broker. When deploying your new Service you run your integration tests to make sure that your service and Service B are communicating correctly. When Service B is getting a new release, it has to verify all pacts before creating the release. When running pacts, Service B *will not* need to talk to downstream service. Because Service B has a trusting relationship with Service C guaranteed by their pact.

hstene
2018-06-02 21:23
Did that answer your question? :thinking_face: (I am going to bed now, but if you have more questions I will answer them later)

matt.fellows
2018-06-02 22:05
So the recommended approach from the Pact team is the cascading pacts you talk about. The choice can then be how you stub the services in each case. This little gist helps explain the tradeoffs https://gist.github.com/bethesque/43eef1bf47afea4445c8b8bdebf28df0

gaurav
2018-06-03 02:39
I have similar scenario and, for now, I just stub downstream services without pact (hard coded). For contract creation with those downstream services: I have another set of consumer tests. I don?t know whether its the best approach but it keeps things simple (1:1) and works for us fine as we are just using simple 1-2 endpoints of downstream services when running provider tests. The approach of using existing consumer tests to create pact and then create stub is interesting, I will definitely try it and see how it works, in case I have more complex mocking to do.

uglyog
2018-06-03 02:40
It is always best to have the test concentrate on a single integration point at a time

gaurav
2018-06-03 02:41
agree! keeps things simple and we quickly know where the breaking points are. :slightly_smiling_face:

james.carman
2018-06-03 21:53
@matt.fellows Thanks! I will take a look.

james.carman
2018-06-03 21:54
@hstene thank you for your info also. :slightly_smiling_face: I am just now getting back in here. Didn?t see the notification. Sorry

james.carman
2018-06-03 21:55
@gaurav so, you?re saying just do regular mocks while verifying Service B?s pacts? Just tell the WireMock (or whatever) what to do and don?t upload pacts?

gaurav
2018-06-03 23:53
@james.carman thats what I am doing currently. I am not in Pact Foundation Team though.. just a user :slightly_smiling_face:

uglyog
2018-06-03 23:56
You don't have to be in Pact Foundation Team to dispense good advice :smile:

bethskurrie
2018-06-04 00:13
@james.carman make sure that you have something to keep your regular mocks in sync with reality still. That gist Matt sent should give you some ideas how.

james.carman
2018-06-04 01:43
Thanks, guys and gals. This is great stuff. Good community vibe here!

gaurav
2018-06-04 01:47
Thanks. Just wanted him to know that I am not an expert and don?t know ins-outs :slightly_smiling_face:. Also as a user I am kind of new.. used it few months before for short time and now picked up again.. enjoying learning it more and more.

james.carman
2018-06-04 01:48
So, the pact team recommends the cascade method, but multiple community members say to just use regular ole service mocks?

james.carman
2018-06-04 01:50
I?m trying to digest this.

james.carman
2018-06-04 01:51
And to clarify, my ?cascade? terminology means that a service?s verify run yields new pacts for its downstream dependencies.

james.carman
2018-06-04 01:53
Are there perhaps scenarios that might lend themselves better to one approach over the other? Or is this just a general pattern?

james.carman
2018-06-04 01:55
Sorry if my questions are silly and I?m not trying to start a religious war here. Just trying to stand on the shoulders of giants so that I can provide informed guidance to folks at work.

james.carman
2018-06-04 02:01
This is a very interesting debate, though

bethskurrie
2018-06-04 02:36
No, I wouldn't recommend that your verify tests generate pacts for downstream services. That would be quite brittle. But, I do recommend that you ensure that your mocks are kept in sync with reality by using some shared artifact between the plain old mocks and your downstream pact tests. Otherwise, your "chain" has a break in it.

hstene
2018-06-04 05:09
Has there been given any consideration to what happens if a consumer publishes two pacts with conflicting response values from the same endpoint? Like if one field of the response has been renamed. Example: `Consumer v0.0.1 performs POST - /customer` Should return ``` { "status": 200, "headers": { "Content-Type": "application/json;charset=UTF-8" }, "body": { "name": "Roger Antonsen", "id": 0, "ssn": "71039012345" } } ``` Example: `Consumer v0.0.2 performs POST - /customer` Should return ``` { "status": 201, "headers": { "Content-Type": "application/json;charset=UTF-8" }, "body": { "socialSecurityNumber": "31129012345", "name": "Henrik Stene", "id": 0 } } ``` Right now I can never get my provider to verify the pacts as they are conflicting. How would I on the provider side handle this? Can I somehow ignore pacts with older version numbers?

bethskurrie
2018-06-04 05:11
Let's continue this in a thread.

bethskurrie
2018-06-04 05:12
With traditional versioning, you would release a major version with a renamed field. With CDC, you would add the field with the new name, transition all the consumers on to the new field, then, once your contracts showed you that everyone was using the new name, remove the old field.

hstene
2018-06-04 05:13
Ok, so if my consumer suddenly requires the field to be renamed (bad bad consumers) I should just add it?

bethskurrie
2018-06-04 05:13
how would you do it if you didn't have CDC?

hstene
2018-06-04 05:14
Heh, good question. Nothing would happen and all our developers would argue who?s fault it is? :smile:

bethskurrie
2018-06-04 05:14
sounds about right.

bethskurrie
2018-06-04 05:14
:stuck_out_tongue:

bethskurrie
2018-06-04 05:14
I would suggest that if a field needed to be renamed, you'd get together and talk about it first.

bethskurrie
2018-06-04 05:14
and you'd work out the impact

bethskurrie
2018-06-04 05:15
same with cdc.

hstene
2018-06-04 05:15
Yeah, but this is why CDC is such a great idea. It makes changes so apparent and visible!

bethskurrie
2018-06-04 05:15
cdc isn't a license for consumer teams to make up a wish list. it's a concrete artifact that should reflect the agreement that has already been made in person.

bethskurrie
2018-06-04 05:16
consumer teams shouldn't just arbitrarily rename a field.

hstene
2018-06-04 05:16
Unless you want to practice Consumer Driven Development. But that would also be agreed upon first (hopefully)

bethskurrie
2018-06-04 05:16
but if there is business justification for it, it give you a process to migrate everyone.

bethskurrie
2018-06-04 05:17
just because an API is driven by the requirements of a consumer, doesn't mean the consumer team gets to dictate everything :stuck_out_tongue:

bethskurrie
2018-06-04 05:17
"it's not dictator driven contracts" is one of our commonly used lines.

hstene
2018-06-04 05:18
Hah, nice quote! Will definitely use that

bethskurrie
2018-06-04 05:18
In answer to your original question, no there is nothing stopping people putting in conflicting expectations. But at least the conflict is made apparent to all.

hstene
2018-06-04 05:19
How do I remove a single pact from the broker?

bethskurrie
2018-06-04 05:19
http delete request




hstene
2018-06-04 05:20
So there is no ?quick key? in the broker? (Maybe to prevent people from just removing pacts?)

bethskurrie
2018-06-04 05:21
There's no quick key because 99% of the broker development is done by me, and I just don't have enough free time to make a pretty UI.

bethskurrie
2018-06-04 05:21
I figure if you're testing APIs, you can handle a HAL browser.

bethskurrie
2018-06-04 05:22
How's your Ruby? :wink:

bethskurrie
2018-06-04 05:22
(Actually, ideally, it could use a nice react UI)

hstene
2018-06-04 05:23
Hah, No Ruby or Rect on my part I?m afraid. Not yet anyway

hstene
2018-06-04 05:23
Thanks for your input!

bethskurrie
2018-06-04 05:24
Please do read the "Steps to reaching Pact Nirvana" doc (link above). It will answer some of your questions. I see you're doing a talk at NDC. Happy to help out with any questions you have.

hstene
2018-06-04 05:25
Will read it and yes I am. Thank you! :slightly_smiling_face:

shekharsp27
2018-06-04 13:06
Thanks @gaurav, however looks like pact-provider-verifier-docker is not capable of doing matching based on regex

gaurav
2018-06-04 13:07
never tried pact-provider-verifier-docker.. so can?t comment on that :slightly_smiling_face:

richard.peckett
2018-06-04 13:57
@bethskurrie Hi Beth, just following up your email are you saying there is now a .net implementation of PACT which can be used mock AMQP? Cheers

james.carman
2018-06-04 15:49
@bethskurrie so, to follow-up a bit. Do you suggest using the pact mocking system to set up my mocks for my verify run, but just not publish the generated pacts?

james.carman
2018-06-04 20:22
Do we have an updated AWS terraform script for PactBroker or are we focusing on the docker stuff these days?

james.carman
2018-06-04 20:23
I was trying to get it set up in our VPC, but it appears the terraform scripts are out of date a bit

matt.fellows
2018-06-04 21:56
We have a terraform script?

matt.fellows
2018-06-04 21:57
Ah, yes

matt.fellows
2018-06-04 21:57
We don?t maintain that script, it was something a community member created and was willing to share. It may not be up to date

matt.fellows
2018-06-04 21:57
You could look at http://pact.dius.com.au

shekharsp27
2018-06-05 04:26
:+1:

shekharsp27
2018-06-05 05:25
I am exploring "pact-provider-verifier-docker" and I have observed that is not doing matching based on regex. Am I missing something?

bethskurrie
2018-06-05 05:40
I guess you could. There are probably more fully featured http mocking solutions however.

bethskurrie
2018-06-05 05:41
I personally wouldn't use pact as a stub.

bethskurrie
2018-06-05 05:42
No, the underlying ruby code is done, and ready for a dot net dev to wrap the dot net code around it, as the http implementation does.

bethskurrie
2018-06-05 05:44
@shekharsp27 What version of the pact specification are your pacts?

shekharsp27
2018-06-05 06:31
@bethskurrie V3

bethskurrie
2018-06-05 06:31
Sorry, you'll need to use v2 pacts

bethskurrie
2018-06-05 06:32
We haven't implemented v3 matching yet

shekharsp27
2018-06-05 06:32
Ok, Thanks @bethskurrie

bethskurrie
2018-06-05 06:33
Or use the Java verifier


bethskurrie
2018-06-05 06:42
You don't need Ruby

bethskurrie
2018-06-05 06:42
Use the pact-provider-verifier command in that package. It may work with your v3 pacts.

bethskurrie
2018-06-05 06:43
that docker image is WAY out of date.

bethskurrie
2018-06-05 06:43
We should look at retiring it.

bethskurrie
2018-06-05 06:44
@matt.fellows should we make a new version of the verifier in pact-foundation with the nice pact-provider-verifier code?

bethskurrie
2018-06-05 06:44
That one uses the old way that you had to cobble together when I was on mat leave.

matt.fellows
2018-06-05 08:43
I think probably modernise it, people might have it in their build pipelines as docker steps. At the very least, a notice on the repo saying that its out of date

dlucas
2018-06-05 09:32
has joined #general

bethskurrie
2018-06-05 09:42
To make it match the current pact-provider-verifier, we'd need to make breaking changes, which makes me think it would be just easier to deprecate the dius one in favour of a new one in the pact-foundation

matt.fellows
2018-06-05 10:05
good point

richard.peckett
2018-06-05 18:09
this issue is still causing me problems :disappointed:

2018-06-05 22:17
A file, which can't be shown because your team is past the free storage limit, was commented on.

2018-06-06 00:11
A file, which can't be shown because your team is past the free storage limit, was commented on.

bethskurrie
2018-06-06 00:50
I'm surprised more people haven't complained

neil
2018-06-06 00:51
Yeah me too actually.

bethskurrie
2018-06-06 00:51
I don't know of any way to compress the file paths for the gems.

neil
2018-06-06 00:52
I?ll do a bit more investigation, and see what options we have. Path limits in windows is such a PITA!

bethskurrie
2018-06-06 00:52
Docker containers?

bethskurrie
2018-06-06 00:52
Or, same problem?

neil
2018-06-06 00:54
as in linux container running the ruby core?

bethskurrie
2018-06-06 00:56
I'm not sure.

bethskurrie
2018-06-06 00:56
Just throwing random technologies at it and seeing if anything sticks!

neil
2018-06-06 00:57
haha, nah it?s good to think of different options :smile:

neil
2018-06-06 00:57
Is anyone using the rust core? I think that would fix the issue

bethskurrie
2018-06-06 00:57
It would.

bethskurrie
2018-06-06 00:58
@uglyog can tell you. Though, I have had someone roll their eyes when discussing ffi bindings to rust on windows, so it may not be completely straightforward.

neil
2018-06-06 01:12
Yeah like a lot of things trade off one pain for another :stuck_out_tongue:

bethskurrie
2018-06-06 01:12
Sorry, realised we're not in a thread, and are spamming people.

bethskurrie
2018-06-06 01:12
Let's continue this here.

neil
2018-06-06 01:13
Oops :slightly_smiling_face:

bethskurrie
2018-06-06 01:13
If it was just the pact gems, I could try and rearrange the files inside the gems, but the error is coming up for bundler - something I don't control.

bethskurrie
2018-06-06 01:14
@richard.peckett what version of windows are you on?

neil
2018-06-06 01:17
Yeah totally understand, why you can?t change things

uglyog
2018-06-06 01:21
You should drop the ruby core, seems to be causing a lot of issues

uglyog
2018-06-06 01:23
The rust implementation is V3, you just need to work out how to interface to it

neil
2018-06-06 01:32
@uglyog Cool. Sounds like a fun experiment either way. Any docs you could point me to? Also is there any other impl using it yet?

uglyog
2018-06-06 01:32
There is a POC with the Swift implementation, but I don't know where that got to

uglyog
2018-06-06 01:38
A quick google seems that an FFI-based interface will be needed. I also found this: https://github.com/KodrAus/cargo-nuget

neil
2018-06-06 01:43
Nice. Yeah I looked into it a while back and there were a couple of FFI interfaces. The gotcha is making sure we can get .NET core compatibility, which has been quite painful in the past.


gaurav
2018-06-06 06:54
For windows 10 build 1607 onwards, a workaround on user side could be to disable max path using registry key/group policy: https://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx?f=255&MSPPError=-2147217396#maxpath

richard.peckett
2018-06-06 09:34
thanks for the replies guys @gaurav I'll give that a go in the meantime :thumbsup:

richard.peckett
2018-06-06 09:36
@bethskurrie Windows 10

kossling
2018-06-06 10:03
has joined #general

mboudreau
2018-06-06 10:08
@uglyog wait, the rust core is done?! Since when?


richard.peckett
2018-06-06 11:05
Still get the issue when I enable the long file path feature in windows 10, is there something I need to add the project file in Visual Studio to get this to work? :confused:

gaurav
2018-06-06 11:22
It does need a restart @richard.peckett as per the document. Windows typical :stuck_out_tongue_winking_eye:. Just in case you haven't done so.

richard.peckett
2018-06-06 11:22
Yeah I have done :disappointed: @gaurav

gaurav
2018-06-06 11:24
You can test whether it's actually enabled by trying to create a long path with CMD.

gaurav
2018-06-06 11:25
And it also needs at least build 1607.

richard.peckett
2018-06-06 11:30
build is on

richard.peckett
2018-06-06 11:31
when I run mkdir and enter a long file path I get the error "The filename, directory name, or volume label syntax is incorrect."

richard.peckett
2018-06-06 11:31
:neutral_face:

richard.peckett
2018-06-06 11:32
not sure what's going on

mboudreau
2018-06-06 11:54
@uglyog why didn't say so! that's massive news! I need to implement that in pact-node ASAP

matt.fellows
2018-06-06 12:39
@uglyog does this include provider side verification and the stuff we talked about? IIRC one if the primary reasons I didn't adopt it in Pact Go was that a) we had to generate the pact file (unlike how we work with Ruby) and b) the verifier interface hadn't been agreed on. Now that we have message pact, we can probably use the lessons from there

matt.fellows
2018-06-06 12:41
Don't forget we had a fully working Spike in Go, so it doesn't work! E.g. https://github.com/pact-foundation/pact-go/blob/feature/native/dsl/native/mock_server_darwin.go

james.carman
2018-06-06 15:29
Thank you, @bethskurrie

gbeckmann
2018-06-06 18:57
has joined #general

uglyog
2018-06-07 00:14
@matt.fellows there is a verifier, not no verifier language interface. That will come with the first language to interface to it. Maybe .Net is a good candidate.

matt.fellows
2018-06-07 00:48
I'm not sure what words you need from me to confirm that I've already interfaced to it and am ready :laughing:

kra
2018-06-07 06:41
has joined #general

raffi.schmid
2018-06-07 06:41
has joined #general

dervis4
2018-06-07 08:26
Hi guys, could you please guide me to information regarding what the best strategy for testing providers are? At the Norwegian LWA we test our providers against instances that are already deployed and running in Test-environments, however now I am looking into starting local instances of the providers instead. What is your recommendation?

hstene
2018-06-07 08:27
Hello again, Dervis! :slightly_smiling_face:

mboudreau
2018-06-07 08:54
Recommendation? The consumer of you data structure needs use pact to create a contract, that contract can then be shared with pact-broker to the provider (whatever gives the data), the provider, before it goes out to production, would then test to make sure it's not breaking the contract. After both are satisfied, they're not okay to deploy.

mboudreau
2018-06-07 08:54
that is the very very short version of it

hstene
2018-06-07 09:00
They are _not_ okay to deploy? Or did you mean that they _are_ okay?

dervis4
2018-06-07 09:00
We share Pact using the Pact Broker and also tag our deployed Pacts with Production. However, when Jenkins is building our Providers, it runs the Provider-test (using HttpTarget) against an already running instance in the Test-environment.

dervis4
2018-06-07 09:02
My question was more about - every build will then test against the previous version (sort of). I wanted to understand how this idea work when aiming to use the Pact-matrix.

mboudreau
2018-06-07 09:35
@hstene sorry, autocorrect. Meant to say now.



dervis4
2018-06-07 12:36
Thanks :+1:

richard.peckett
2018-06-07 17:40
Peeps, can someone explain to me how verify works? assuming I've started my provider service using something like: " var providerApi = WebHost.CreateDefaultBuilder(null) .UseStartup<Startup>() .UseUrls("http://localhost:9223") .Build(); await providerApi.StartAsync();" Does verify actual query the test server using the URI specified inside the PACT file it retrieves from the broker?

richard.jones
2018-06-07 22:58
has joined #general

matthew.ceroni
2018-06-07 23:28
has joined #general

matthew.ceroni
2018-06-07 23:32
Updated configuration of pact broker as such. But broker still isn?t ordering based on date. This shows in that newly tagged consumer versions, don?t show latest on the latest version.

bethskurrie
2018-06-07 23:33
the latest release of the pact broker has a more elegant solution to the webhooks vulnerability found recently. You will now be able to configure a whitelist to ensure webhooks can only be execute against "safe" hosts. You can read about how to configure the whitelist [here](https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/doc/views/webhooks.markdown#webhook-whitelist)

2018-06-07 23:45
A file was commented on

biaofu
2018-06-08 02:23
has joined #general

mmonson
2018-06-08 03:03
has joined #general

peter.odonovan
2018-06-08 03:30
has joined #general

mikey
2018-06-08 03:31
has joined #general

peter.odonovan
2018-06-08 03:31
:wave:

sam.jarrett
2018-06-08 03:32
has joined #general

niek
2018-06-08 07:13
has joined #general

nic
2018-06-08 08:33
has joined #general

richard.peckett
2018-06-08 09:23
@neil cheers Neil :+1::skin-tone-2:

oliver.gramberg
2018-06-08 09:38
has joined #general

bethskurrie
2018-06-08 09:52
Welcome everyone.

mr.matt.r.long
2018-06-08 13:44
has joined #general

gonzalogarcia243
2018-06-08 14:58
has joined #general

snatarajan
2018-06-08 16:38
has joined #general

rlamb
2018-06-08 17:09
has joined #general

matt.fellows
2018-06-09 04:01
:wave:

daniel.delatorrebabi
2018-06-10 10:38
has joined #general

daniel.delatorrebabi
2018-06-10 10:46
Hello guys, I am having some issues when I try to execute gradlew pactVerify from my provider.

daniel.delatorrebabi
2018-06-10 10:48
My jetty server starts correctly but the process gets stuck when it is executing pact:pact-spring-provider:startProvider

daniel.delatorrebabi
2018-06-10 10:49
it seems that it never goes to my pactbroker server to verify the pact

daniel.delatorrebabi
2018-06-10 10:49
any idea about this?

bethskurrie
2018-06-10 11:15
Hi Daniel. Try the pact-jvm channel. I believe there is a way to switch on debug logs for the pact verify, have a look at the docs.

daniel.delatorrebabi
2018-06-10 11:22
Thanks for the answer Beth, I will do

matt
2018-06-11 01:35
has joined #general

bethskurrie
2018-06-11 11:42
Hi I've just released a new version of the Docker Pact Broker image, with environment variables to configure the new webhooks whitelist. Please remember to upgrade to the latest version ASAP if you haven't already to ensure you are not susceptible to the webhooks vulnerability that was found recently. In other news, I've added a heap of new parameters to the webhooks templates that now make it possible to send pact verification status updates to github. Check out the Webhook template library to see how this is done https://github.com/pact-foundation/pact_broker/wiki/Webhook-template-library

mr.matt.r.long
2018-06-11 13:44
Hi is anyone able to confirm if the matchers for header Content-Type values perform a full match including charset value? I'm currently seeing a validation error my my jvm provider for the header matcher `application\\/json` throwing the error `Expected 'application/json; charset=utf-8' to match 'application\\/json'`

mr.matt.r.long
2018-06-11 13:46
Sorry I see the fix for partial matching is included in 3.5.17: https://github.com/DiUS/pact-jvm/commit/f7d73250c3986c812459d9ada3677fbdd14693e3. I'm currently running 3.5.16

vinod.baradwaj
2018-06-12 09:46
Has anyone implemented Pact in their pipeline jobs? I am planning to make use of Pacts as a stub in place of the real provider to perform acceptance tests for my application.. and also as part of the pipeline i need to do the provider verification as well with the pact files to be sure that the contract is not broken. Can anyone provide me a heads up on how to start working on the flow for this pipeline ?



bethskurrie
2018-06-12 10:17
Be aware of the fact that the higher level you use your pact tests for, the more fiddly and higher maintenance they become. Pact is generally best for unit tests, not acceptance tests.


bethskurrie
2018-06-12 10:19
You can re-use the pact that you generate in unit tests to make a stub, but you may have problems with the exact matching https://github.com/pact-foundation/pact-mock_service#stub-service-usage

bethskurrie
2018-06-12 10:20
Generally, the higher level the tests, the more flexible you want your matching.

vinod.baradwaj
2018-06-12 10:25
thanks @bethskurrie for mocking stuff i wont be needing much matchers since i can control the flow of data, and can make sure that the data remains unchanged every time the tests are executed. The reason why i am planning to make use of stubs is to speed up my AT's. if i have to rely on actual provider, it takes me more than 15 mins to bring up the environment.

dominic.jones
2018-06-12 11:51
@vinod.baradwaj we?ve taken the approach you?re talking about and it seems to be working pretty well so far. You definitely have to be careful about the implicit coupling you create between different types of test. We?ve created common fixtures that we draw from to run our pact unit tests (and therefore create the pacts) and to use in our ?acceptance? tests (running against a stub server generated from pacts). That at least makes it clear that there is coupling there, though can still be a bit fiddly

dominic.jones
2018-06-12 11:56
Hello! This is a slightly lazy question, but is it a know problem that publication fails if one tries to publish the verification result for the same pact twice. I am getting a rather gnarly db error being spat out when we publish a verification from our Java provider side tests (using the Junit runner) ``` {"message":"PG::UniqueViolation: ERROR: duplicate key value violates unique constraint \"verifications_pact_version_id_number_index\"\nDETAIL: Key (pact_version_id, number)=(66, 181) already exists.\n","backtrace":["/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:166:in `async_exec'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:166:in `block in execute_query'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/database/logging.rb:49:in `log_connection_yield'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:166:in `execute_query'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:153:in `block in execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:129:in `check_disconnect_errors'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:153:in `execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:514:in `_execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:326:in `block (2 levels) in execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:536:in `check_database_errors'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:326:in `block in execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/database/connecting.rb:301:in `block in synchronize'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/database/connecting.rb:301:in `synchronize'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:326:in `execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/dataset/actions.rb:1081:in `execute'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:679:in `fetch_rows'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/dataset/actions.rb:942:in `with_sql_each'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/dataset/actions.rb:950:in `with_sql_first'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/adapters/shared/postgres.rb:1607:in `insert_select'","/home/app/pact_broker/vendor/bundle/ruby/2.2.0/gems/sequel-4.48.0/lib/sequel/model/base.rb:2165:in `_insert_select_raw'" ``` (whole error available on request)

dominic.jones
2018-06-12 12:24
ah, ignore that, I accidentally deployed the old pact-broker (pact_broker)

drhansen
2018-06-12 19:25
has joined #general

tlane
2018-06-12 20:58
has joined #general

bethskurrie
2018-06-12 21:44
I can see you've thought it through @dominic.jones. Glad it's working for you.

bethskurrie
2018-06-12 22:15
@dominic.jones is there anything we could do to make it clearer that that one is deprecated?

bethskurrie
2018-06-12 22:16
There's a message in the UI, and the readme, but obviously it's still possible to install it unintentionally.

abhilash.hanumanth
2018-06-13 01:56
I have an array of strings of variable length which is expected in response body. For example : ```"{ Conditions":[ "conditionA", "conditionB", "conditionC" ] }``` How do I use stringType() or stringMatcher() for generalizing while creating pact using LambdaDsl ? Can someone help me with the above problem ?

bethskurrie
2018-06-13 01:57
@abhilash.hanumanth can you ask in pact-jvm please? It makes it easier to find relevant answers.

bethskurrie
2018-06-13 01:58
Please indicate which documentation you have read already, and if there is something missing, let us know which section you would expect it to be in.


vinod.baradwaj
2018-06-13 04:24
@dominic.jones can you share me flow of your process so that i can understand and get an idea how the flow will be ?

dominic.jones
2018-06-13 05:42
I noticed when I loaded it up and saw the UI message, so that was good. Not sure what else you could do without breaking things for people. Maybe add something to logging? But that could be a big faff

dominic.jones
2018-06-13 05:44
@vinod.baradwaj I can try. What would work best? Maybe if I just try to describe in more detail how our process works? I?m busy just now but should have some time later today (I?m in London)

vinod.baradwaj
2018-06-13 05:59
sure, let me know once you are free :slightly_smiling_face:

dominic.jones
2018-06-13 06:13
What time zone are you :slightly_smiling_face: ?

vinod.baradwaj
2018-06-13 06:13
I am from India, IST

zwttgsmu
2018-06-13 08:02
has joined #general

zwttgsmu
2018-06-13 08:07
Hello everyone!)

bethskurrie
2018-06-13 08:09
:wave:

zwttgsmu
2018-06-13 08:10
I want to make a check that an array can contain strings or null Found solutions for Java: "It would also be required to define whether the matchers should be combined with logical AND (all matchers must match) or OR (at least one matcher must match). AND should be the default, but there are cases where an OR makes sense. { "matchingRules": { "header": { "HEADERY": { "combine": "AND", "matchers": [ {"match": "include", "value": "ValueA"}, {"match": "include", "value": "ValueB"} ] } } } }" How can I do this in .NET?

bethskurrie
2018-06-13 08:10
You can't. That functionality is, I believe, being deprecated in the next version of Pact JVM

bethskurrie
2018-06-13 08:11
Let me find the explanation.


bethskurrie
2018-06-13 08:14
Also, the functionality you're describing is in the Pact Specification version 3, and pact net is only up to version 2.

bethskurrie
2018-06-13 09:00
Hopefully someone in the pact-jvm channel can help. Unfortunately, I haven't written or used it, so I'm out of advice!

zwttgsmu
2018-06-13 10:48
Thank you) one more question)) I check for type integer, but in the logs I see an error: -"param1": Bignum +"param1": Fixnum in Google I found such a description: The problem is that FixNum is a platform-dependent type. Ruby automatically switches from FixNum to BigNum if the number becomes bigger than native integer(which has different length on 32-bit and 64-bit platforms). So if you just want to check whether it's an integer you should use Integer for it. For example: timestamp = Time.now.to_i #bad timestamp.is_a? FixNum timestamp.is_a? BigNum #good timestamp.is_a? Integer how can I test this without error?

bethskurrie
2018-06-13 11:40
Can you recreate the issue using this project, and I'll fix the problem in the underlying code https://github.com/pact-foundation/pact-ruby-standalone-e2e-example

matt
2018-06-13 18:12
i'm wondering if we should disable `@` here and `@` channel for regular users.

matt
2018-06-13 18:12
i think slack provides a configuration option to make those admin only

jsyrinek
2018-06-13 23:12
has joined #general

jsyrinek
2018-06-13 23:14
Should we test third-party API's regularly using our consumer contracts?

bethskurrie
2018-06-13 23:15
Pact is not great for testing third party APIs. It assumes you're able to set up provider states without having to use the API you're actually testing.

matt.fellows
2018-06-13 23:16
Thanks for reminding me, this is done :white_check_mark:

bethskurrie
2018-06-13 23:16
Each interaction is tested in isolation, which is fine when you can manipulate the pre-existing data, but not great if you need to set up the data using an API.

jsyrinek
2018-06-13 23:18
That makes sense, but to be clear, my question is more about ensuring that the third-party continues to provide the data our (consuming) application depends on. I'm not asking if we should hit a real API to verify our application/consumer.

jsyrinek
2018-06-13 23:19
Obviously we don't control the third-party API, but if the third-party ever stops providing the things we need, we would want to know.

bethskurrie
2018-06-13 23:19
Indeed. I'm not sure what tool I'd recommend in this situation. If I was using Ruby, I'd use something like VCR.

bethskurrie
2018-06-13 23:19
I don't know what exists in other languages.

jsyrinek
2018-06-13 23:20
I've used yakbak

jsyrinek
2018-06-13 23:20
which is the Javascript analog of VCR, but I'm not sure how to use that in this situation.

bethskurrie
2018-06-13 23:25
I'd probably have a build that ran the live tests regularly and reported if there was a change in the response.

jsyrinek
2018-06-13 23:26
That's what we're thinking as well. And we're thinking of hitting a real API (maybe with Yakback/VCR to mask over third-party outages) then validating using our consumer contract.

jsyrinek
2018-06-13 23:28
We're having a conversation at the office about when/if we should take this approach. In our case, we have a good working relationship with the third-party, so if the contract ever changes, we have a way to address that. I think if we didn't have a relationship like this, we may not take this approach. For instance, if Twitter was the third-party API, we probably can't stop them from changing what they provide. In that case, we should just build the application in a way that it can handle changes gracefully and/or setup alerts when things break so we can take swift action.

jsyrinek
2018-06-13 23:28
I think this thought process is somewhat explained in the bullet points in the FAQ, but you kind of have to piece ideas together.

jsyrinek
2018-06-13 23:29
It might be a good idea to add two recommendations for working with third-party APIs: one for providers that can/will make changes if requested, and one for providers that would not.

bethskurrie
2018-06-13 23:32
That's a good suggestion.

bethskurrie
2018-06-13 23:33
How do you feel about writing those thoughts down and doing a PR to the FAQ page?

jsyrinek
2018-06-13 23:35
I could take a stab at that

bethskurrie
2018-06-13 23:41
That would be greatly appreciated.

matt
2018-06-14 02:57
thank you :simple_smile: now i won't get randomly pinged by people

matt.fellows
2018-06-14 03:15
:slightly_smiling_face:

jonas.lergell
2018-06-14 07:12
has joined #general

oswald.quek
2018-06-14 09:51
has joined #general

dominic.jones
2018-06-14 09:52
we?ve got a bit confused about versions and tags. We version our pacts using the git sha of the consumer code used to produce it. However, as per your docs, the pacts are ordered according ?semver? of version. Obviously this then leads to arbitrary ordering of pacts in our case. If we then want to retrieve the ?latest? (chronologically speaking) pact for a given tag, we seem to be stuck. There is something in your docs about changing a config flag to change how pacts are ordered, but a) we use your docker image b) I?m not sure if this would solve our problem Any suggestions?


bethskurrie
2018-06-14 09:56
Oh, right, the docker version.

dominic.jones
2018-06-14 09:56
and do I have ?access? to that config if I?m using your docker image?

dominic.jones
2018-06-14 09:56
snap

bethskurrie
2018-06-14 09:56
You know what, I've been meaning to change the default any way.

bethskurrie
2018-06-14 09:56
Hang about.

dominic.jones
2018-06-14 09:56
it?s not configurable via env var I assume?

bethskurrie
2018-06-14 09:57
You can insert a config in the db.

bethskurrie
2018-06-14 09:57
But I'll just change it

dominic.jones
2018-06-14 09:58
wow, thanks!

bethskurrie
2018-06-14 10:13
grab 2.22.0-2 when it's built

bethskurrie
2018-06-14 10:13
you'll need to publish another completely new version after you've upgraded to trigger the reordering

dominic.jones
2018-06-14 10:15
ok, great. Thanks very much

bethskurrie
2018-06-14 10:16
np

dominic.jones
2018-06-14 12:16
it works and everything :simple_smile:

bethskurrie
2018-06-14 21:10
Like a shop bought one!

rcheeniyil
2018-06-14 22:26
has joined #general

rcheeniyil
2018-06-14 22:49
Hi there, I see the following warning on verify step: `WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body']` this happens in all tests where each_like is used for type matching array elements in pact-ruby (gem says version 2.7.6). Is this expected behavior or is there some way to use each_like that does not result in this warning?

bethskurrie
2018-06-14 22:50
I'm really sorry - you can ignore that error. It's a very tricky bit of logic to get rid of it, and I just haven't had the brainspace to fix it.

bethskurrie
2018-06-14 22:50
It's all working fine though.

rcheeniyil
2018-06-14 22:50
ya it has expected behavior the warnings are sort of piling up though

rcheeniyil
2018-06-14 22:51
```WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body']['child_events'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body'] WARN: Ignoring unsupported matching rules {"min"=>1} for path $['body']```

abe
2018-06-15 02:24
has joined #general

omar10594
2018-06-15 02:24
has joined #general

rob.lugton
2018-06-15 02:24
has joined #general

rob-manger
2018-06-15 02:24
has joined #general

rholshausen
2018-06-15 02:24
has joined #general

raul.garcia
2018-06-15 02:24
has joined #general

raghunandanjahagirdar
2018-06-15 02:24
has joined #general

prudhvi
2018-06-15 02:24
has joined #general

pivison
2018-06-15 02:24
has joined #general

phil
2018-06-15 02:24
has joined #general

pfajardo
2018-06-15 02:24
has joined #general

paul.davidson
2018-06-15 02:24
has joined #general

patrick
2018-06-15 02:24
has joined #general

ngbrown
2018-06-15 02:24
has joined #general

sai.dileepjana
2018-06-15 02:24
has joined #general

mzacharska
2018-06-15 02:24
has joined #general

mouser
2018-06-15 02:24
has joined #general

mngau
2018-06-15 02:24
has joined #general

mlk
2018-06-15 02:24
has joined #general

mhargiss
2018-06-15 02:24
has joined #general

mende
2018-06-15 02:25
has joined #general

mellis
2018-06-15 02:25
has joined #general

matthewcanty
2018-06-15 02:25
has joined #general

mattfaries
2018-06-15 02:25
has joined #general

mattcoder
2018-06-15 02:25
has joined #general

abhijeet.daspatnaik
2018-06-15 02:25
has joined #general

matt.canty
2018-06-15 02:25
has joined #general

marcevers
2018-06-15 02:25
has joined #general

rolyat.wilson
2018-06-15 02:25
has joined #general

sdulebskiy
2018-06-15 02:25
has joined #general

m.groeneweg
2018-06-15 02:25
has joined #general

timbailey
2018-06-15 02:25
has joined #general

zac.sims
2018-06-15 02:25
has joined #general

willmadison
2018-06-15 02:25
has joined #general

w.everse
2018-06-15 02:25
has joined #general

vinny
2018-06-15 02:25
has joined #general

vijaynag
2018-06-15 02:25
has joined #general

veganjenny
2018-06-15 02:25
has joined #general

v.lukoyanov
2018-06-15 02:25
has joined #general

trenthornibrook
2018-06-15 02:25
has joined #general

travi
2018-06-15 02:25
has joined #general

tom.vanasch
2018-06-15 02:25
has joined #general

tmok01
2018-06-15 02:25
has joined #general

tmcknight
2018-06-15 02:25
has joined #general

tigris
2018-06-15 02:25
has joined #general

shahzadahmad
2018-06-15 02:25
has joined #general

theresa
2018-06-15 02:25
has joined #general

thadir
2018-06-15 02:25
has joined #general

sumit080
2018-06-15 02:25
has joined #general

sudhapatil3
2018-06-15 02:25
has joined #general

stuparty
2018-06-15 02:25
has joined #general

stein
2018-06-15 02:25
has joined #general

sinclair.calleja
2018-06-15 02:25
has joined #general

siaynoqmage
2018-06-15 02:25
has joined #general

shenahas
2018-06-15 02:25
has joined #general

sheetal
2018-06-15 02:25
has joined #general

shashidesai
2018-06-15 02:25
has joined #general

sharding
2018-06-15 02:25
has joined #general

shamilton
2018-06-15 02:25
has joined #general

m.pleijte
2018-06-15 02:25
has joined #general

zerocooljs
2018-06-15 02:25
has joined #general

lukvermeulen
2018-06-15 02:25
has joined #general

eskimoquinn
2018-06-15 02:25
has joined #general

bangn
2018-06-15 02:25
has joined #general

giuseppe.landolfi575
2018-06-15 02:25
has joined #general

areddy
2018-06-15 02:25
has joined #general

aserafim
2018-06-15 02:25
has joined #general

giuseppe.landolfi
2018-06-15 02:25
has joined #general

lkingsley
2018-06-15 02:25
has joined #general

gareth
2018-06-15 02:25
has joined #general

fpelletier
2018-06-15 02:25
has joined #general

fkoner
2018-06-15 02:25
has joined #general

fitzoh
2018-06-15 02:25
has joined #general

finkingma
2018-06-15 02:25
has joined #general

fergusstrange
2018-06-15 02:25
has joined #general

ecoan
2018-06-15 02:25
has joined #general

harryw
2018-06-15 02:25
has joined #general

dniles
2018-06-15 02:25
has joined #general

divs.kanna
2018-06-15 02:25
has joined #general

d.van.dijk
2018-06-15 02:25
has joined #general

cornelia.zintl
2018-06-15 02:25
has joined #general

cormac
2018-06-15 02:25
has joined #general

coco
2018-06-15 02:25
has joined #general

claire.thomson
2018-06-15 02:25
has joined #general

cass
2018-06-15 02:25
has joined #general

asfan.siddiqui
2018-06-15 02:25
has joined #general

beth
2018-06-15 02:25
has joined #general

berisberis
2018-06-15 02:25
has joined #general

benjamin.l.tse
2018-06-15 02:25
has joined #general

gtondi
2018-06-15 02:25
has joined #general

andycampbell92
2018-06-15 02:25
has joined #general

icapurrofagian
2018-06-15 02:25
has joined #general

kanchana
2018-06-15 02:25
has joined #general

lihongmei
2018-06-15 02:25
has joined #general

liam.fisher
2018-06-15 02:25
has joined #general

acooper106
2018-06-15 02:25
has joined #general

lardcanoe
2018-06-15 02:25
has joined #general

kunwardeep
2018-06-15 02:25
has joined #general

krishnaraj.krishnan
2018-06-15 02:25
has joined #general

kong
2018-06-15 02:25
has joined #general

alexei
2018-06-15 02:25
has joined #general

king-smith
2018-06-15 02:25
has joined #general

kevinkraus
2018-06-15 02:25
has joined #general

kevin.meiresonne
2018-06-15 02:25
has joined #general

j03w
2018-06-15 02:25
has joined #general

ken.westdorp
2018-06-15 02:25
has joined #general

kale.mcnaney
2018-06-15 02:25
has joined #general

kabagchi87
2018-06-15 02:25
has joined #general

james
2018-06-15 02:25
has joined #general

jdbann
2018-06-15 02:25
has joined #general

jeanmarclai
2018-06-15 02:25
has joined #general

jeffutter
2018-06-15 02:25
has joined #general

andrew.nicholson
2018-06-15 02:25
has joined #general

jfeng
2018-06-15 02:25
has joined #general

alok.pandey
2018-06-15 02:25
has joined #general

joel_a
2018-06-15 02:25
has joined #general

jsilver
2018-06-15 02:25
has joined #general

gaurav
2018-06-15 03:42
Does anyone have some experience to share using swagger-request-validator-pact? https://bitbucket.org/atlassian/swagger-request-validator/src/master/swagger-request-validator-pact/ From the looks of it, it looks like quite simpler way of achieving CI of contract tests (in organisations using swagger).

shekharsp27
2018-06-15 05:40
Yeah, it verifies pact contract against Swagger specification and enables contract checking from Consumer side as well. It also provides capabilities to enable checks on Response missing required field,Response has the incorrect type for a field among others thought validations are lenient and can control using properties

gaurav
2018-06-15 05:43
seems like worth giving a try. :slightly_smiling_face:

shekharsp27
2018-06-15 05:52
:+1:

bethskurrie
2018-06-15 06:17
I'll try and get back to it soon.

vk.regs
2018-06-15 08:02
has joined #general

gxsham
2018-06-15 12:03
has joined #general

adamgreen
2018-06-15 13:54
has joined #general

santoshtrip
2018-06-15 17:55
This was something great

santoshtrip
2018-06-15 17:55
@shekharsp27 thanks for sharing this earlier with me

minhdoan
2018-06-16 08:53
Hi team,

minhdoan
2018-06-16 08:54
I face an stuck described in the ticket https://github.com/DiUS/pact-jvm/issues/704

minhdoan
2018-06-16 08:54
Any help is highly appreciated!

minhdoan
2018-06-16 08:54
Many thanks

dsbenghe
2018-06-17 16:26
has joined #general

jonas.lergell
2018-06-18 09:25
Hey, im using the pact broker docker image, getting response code 405 when posting to /webhooks, but /webhooks/provider.... works, does the docker image currently not support creating global webhooks?

bethskurrie
2018-06-18 10:33
Nope. I haven't released that yet.

bethskurrie
2018-06-18 10:34
It's on master, but I have to finish off bit more before it can be released. Try again tomorrow.

bethskurrie
2018-06-18 10:34
The gem itself hasn't been released.

bethskurrie
2018-06-18 11:37
@jonas.lergell I've just released a version of the docker image tagged `edge` with the latest code from the repo (not a released gem). There's a known bug if you try and execute a test request (by POSTing to `/webhooks/UUID/execute`) for global webhooks, or ones that have just a consumer or provider, but they execute correctly during normal operation.

jonas.lergell
2018-06-18 11:47
Awesome! Thx

mats.lundkvist
2018-06-18 11:50
has joined #general

mats.lundkvist
2018-06-18 11:56
Hi, I'm using pact ruby standalone and pact-go to write consumer tests in golang but it looks like the generated json file is wrong ```"metadata": { "pactSpecification": { // this is should be pact-specification right? "version": "3.0.0" } }``` Is this an issue or am I just using it wrong?

bethskurrie
2018-06-18 11:56
Version 3 is not yet supported

bethskurrie
2018-06-18 11:57
Oh, the format of the JSON

bethskurrie
2018-06-18 11:57
No, it's the right format. @uglyog needs to update the jvm impl.

mats.lundkvist
2018-06-18 11:58
ok, so the jvm impl will get an update?

bethskurrie
2018-06-18 11:59
It was supposed to a year ago :-P

mats.lundkvist
2018-06-18 11:59
haha okey, I'll inform the people I work with, thanks for the help :smile:

bethskurrie
2018-06-18 11:59
We ended up with about 3 different formats, and I just made the ruby code read it from all three!

bethskurrie
2018-06-18 12:00
It's an embarrassing shemozle.

matt.fellows
2018-06-18 12:22
Out of interest, which bits are you using pact ruby standalone for?

mats.lundkvist
2018-06-18 12:28
what do you mean?

matt.fellows
2018-06-18 13:07
OH, have you just installed them on the command line as per the instructions? I for some reason had the impression you were explicitly using some of the tools (e.g. manually running provider tests or something)

matt.fellows
2018-06-18 13:07
all good if you?ve just added them to the path :thumbsup:

mats.lundkvist
2018-06-18 13:07
okey good :slightly_smiling_face:

adrian.flucus
2018-06-18 14:45
has joined #general

uglyog
2018-06-18 23:51
Sigh, just checked the JVM code, and I didn't fix it as well as I thought :pensive:

bethskurrie
2018-06-18 23:53
I had the thought last night, I could always fix it in the broker. But that wouldn't help pacts exchanged outside the broker.

uglyog
2018-06-18 23:54
I'm going to change it now, but I have a suspicion that the code will just change itself back

bethskurrie
2018-06-18 23:55
It's obviously got gremlins in it.

vk.regs
2018-06-19 07:00
Hi, A am trying to verify request with null field values on consumer pact tests, but pact Framework return error for such field. How can I process such cases? "description": "A request to get export data", "request": { "method": "patch", "path": "/api/export/data", "headers": { "Content-Type": "application/json; charset=utf-8" }, "body": { "CState": { "ConceptId": 0, }, "FileName": null } }

2018-06-19 07:05
A file, which can't be shown because your team is past the free storage limit, was commented on.

vk.regs
2018-06-19 07:07
@bethskurrie thanks, It is .net, sorry

matt.fellows
2018-06-19 07:12
np

james.carman
2018-06-19 21:28
When I verify my pact, it prints out the ?returns a response which? part twice. I only specify 1 request

james.carman
2018-06-19 21:32
Would a github link help?


james.carman
2018-06-19 21:38
I am creating a demo ?org? for doing this pact testing.




uglyog
2018-06-19 23:24
Could you raise an issue at the github site for that?

uglyog
2018-06-19 23:48
Oh, there is already an issue raised: https://github.com/DiUS/pact-jvm/issues/706

james.carman
2018-06-20 01:10
It doesn?t really bother me, per se. I was more worried I was doing something wrong. Thanks for the heads-up.

james.carman
2018-06-20 01:30
I?m going to submit a patch for it.

uglyog
2018-06-20 01:35
already fixed it :smile:

james.carman
2018-06-20 01:36
dang it! I wanted to contribute and this one was easy

james.carman
2018-06-20 01:36
oh well

james.carman
2018-06-20 01:37
I would have been done faster, but the wifi here at starbucks is slow and downloading Gradle was taking forever.

james.carman
2018-06-20 01:38
I changed it to: for(i in 0 until runTimes)

james.carman
2018-06-20 01:38
what did you do @uglyog?


james.carman
2018-06-20 01:40
that?d work too

djrimokbp
2018-06-20 07:54
has joined #general

santoshtrip
2018-06-21 01:03
I was trying to convert the project to gradle

santoshtrip
2018-06-21 01:03
But facing some challenges consumer.consumer.SwaggerValidatorPactConsumerTest > testGetOrderWithInvalidResponse FAILED java.lang.NoSuchMethodError: au.com.dius.pact.model.MockProviderConfig.createDefault(Lau/com/dius/pact/model/PactSpecVersion;)Lau/com/dius/pact/model/MockProviderConfig; at au.com.dius.pact.consumer.PactProviderRule.<init>(PactProviderRule.java:51) at au.com.dius.pact.consumer.PactProviderRule.<init>(PactProviderRule.java:110) at com.atlassian.oai.validator.pact.ValidatedPactProviderRule.<init>(ValidatedPactProviderRule.java:33) at consumer.consumer.SwaggerValidatorPactConsumerTest.<init>(SwaggerValidatorPactConsumerTest.java:42) consumer.consumer.SwaggerValidatorPactConsumerTest > testGetOrderWithAdditionalPropertiesInResponse FAILED java.lang.NoSuchMethodError: au.com.dius.pact.model.MockProviderConfig.createDefault(Lau/com/dius/pact/model/PactSpecVersion;)Lau/com/dius/pact/model/MockProviderConfig; at au.com.dius.pact.consumer.PactProviderRule.<init>(PactProviderRule.java:51) at au.com.dius.pact.consumer.PactProviderRule.<init>(PactProviderRule.java:110) at com.atlassian.oai.validator.pact.ValidatedPactProviderRule.<init>(ValidatedPactProviderRule.java:33) at consumer.consumer.SwaggerValidatorPactConsumerTest.<init>(SwaggerValidatorPactConsumerTest.java:42)

santoshtrip
2018-06-21 01:04
at @Rule public ValidatedPactProviderRule provider = new ValidatedPactProviderRule(SWAGGER_JSON_URL, null, PROVIDER_ID, this);

santoshtrip
2018-06-21 01:04
for the consumer tests

santoshtrip
2018-06-21 01:05
@shekharsp27 do you know what could be the potential issue

shekharsp27
2018-06-21 05:51
@santoshtrip Please check your pact version as mentioned in this issue https://github.com/DiUS/pact-jvm/issues/456

shekharsp27
2018-06-21 13:24
Hi, In case there is no change in pact content, is there a automated way to trigger can-i-deploy utility from consumer side or does the consumer team has to trigger the job manually

matt.fellows
2018-06-21 13:31
what are you trying to do?

james.carman
2018-06-21 14:14
I gave a talk about PactBroker at our local Cincinnati Java User Group yesterday and folks seemed really interested. Thanks for all your help while I prepared for the talk, guys (and gals)!

james.carman
2018-06-21 14:15
@matt.fellows are you the same ?Matt? that answers the emails about the hosted PactBroker?

matt.fellows
2018-06-21 21:13
That's awesome! (And yes)

shekharsp27
2018-06-22 05:49
Hi Matt, Thanks for your reply. As mentioned in wiki https://github.com/pact-foundation/pact_broker/wiki/Webhooks#example-cicd-and-webhook-configuration. If the changes in consumer side does not affect the contract( pact content has not changed), so its in pre verified state; in this case how I'll trigger can-i-deploy utility automatically in consumer pip-line or in this case consumer has to trigger this check manually

matt.fellows
2018-06-22 09:23
You might need to give us more context and what you?re trying to do, though. If a new consumer contract is being published, presumably the consumer is the one publishing it, so why do you need something to trigger the `can-i-deploy` utility? It should just be a step in the consumer pipeline. If nothing has changed from a contract point of view, `can-i-deploy` will return true

madhukar.mishra
2018-06-22 09:37
has joined #general

wchuang
2018-06-22 16:30
has joined #general

james.carman
2018-06-22 16:51
@matt.fellows I might want to set up a PB account for my personal email also. Is that something I need to fill out another form for?

0xorial
2018-06-23 11:23
has joined #general

0xorial
2018-06-23 11:36
Hi! I am here following up this: https://github.com/pact-foundation/pact-specification/issues/59#issuecomment-399667103 . From what I understood, pact is going to use shared ruby core approach, which is not something I like - it is slow and difficult to debug (especially since I use debugging as a learning tool). I would prefer to have a clear specifications and implementations for different platforms (v2 specs seems to require only around 1 week of work to implement). Hence I started my own port (https://github.com/0xorial/PactNetCore). Perhaps there is something else I should know?

bethskurrie
2018-06-23 11:37
Hi ironic. The wrapped ruby implementation is going to be replaced by a shared Rust implementation, which will be called via FFI. This means there will only be ONE implementation for all the "business logic" of pact, which can be easily shared to all the other languages.

bethskurrie
2018-06-23 11:38
If you want to contribute to this effort, learning about the Rust implementation and how to make FFI calls would be the best use of your time.

bethskurrie
2018-06-23 11:39
@neil who is the current .net maintainer would be the person to talk to about this, as well as @uglyog who has written the rust implementation.

bethskurrie
2018-06-23 11:39
I know how much work goes into creating a pact implementation, and I do not recommend starting from scratch!

0xorial
2018-06-23 11:40
hm....

bethskurrie
2018-06-23 11:40
We are always keen to have people who want to contribute on the team however!

0xorial
2018-06-23 11:41
I am still quite optimistic about making a new implementation. The one I have now seems to cover a lot of cases already. mostly it doesn't work on some annoying cases like null/empty matching

bethskurrie
2018-06-23 11:41
Which pact-specification version are you targeting?


bethskurrie
2018-06-23 11:42
v2 is quite simple. v3 is where it gets hard. it's why I've only done v2 in the ruby impl :stuck_out_tongue:

0xorial
2018-06-23 11:42
well, the goal is get to v3 - we started the whole thing because we needed to test messages

bethskurrie
2018-06-23 11:42
I've been too busy to pick up the v3 stuff.

0xorial
2018-06-23 11:42
xD damn

bethskurrie
2018-06-23 11:43
message support in .net should be quite simple with the ruby impl

bethskurrie
2018-06-23 11:43
we've already wrapped it in the go and js

0xorial
2018-06-23 11:43
I will think about it... I still dont feel well about including binaries into packages...

bethskurrie
2018-06-23 11:43
unfortunately our .net maintainer has been busy moving state, so he hasn't had a chance to pick it up

bethskurrie
2018-06-23 11:43
none of us like the solution!

bethskurrie
2018-06-23 11:44
but it's been a pragmatic solution to the problem of trying to support so many different languages.

bethskurrie
2018-06-23 11:44
it's quite unusual for a library to have to do that.

0xorial
2018-06-23 11:44
let me have a closer look at v3...

bethskurrie
2018-06-23 11:44
it's a dirty hack, but it's got us a long way. hopefully it can be retired soon.

bethskurrie
2018-06-23 11:45
if message pact is what you're really after, I can explain how to wrap that.

bethskurrie
2018-06-23 11:45
it shouldn't be a big amount of work.

0xorial
2018-06-23 11:46
wait, are you talking about wrapping specifically ruby in the package? because for me it is wrapping binaries in general, be it ruby, rust or js

0xorial
2018-06-23 11:47
well, if we can go with your 'recommended' solution and get it to support messaging, my managers/architects will definitely be happy :slightly_smiling_face:

bethskurrie
2018-06-23 11:47
It has it's problems, but they are fewer than trying to keep 7+ implementations of pact in sync. It's hard enough keeping the java and ruby one compatible.

0xorial
2018-06-23 11:48
hm, isn't it because you don't have a strict spec ?

bethskurrie
2018-06-23 11:48
The spec is not all there is to it.

bethskurrie
2018-06-23 11:49
There is a lot of behaviour in the mock service and the writing of the pacts and the verifications that is not pact of the matching spec.

bethskurrie
2018-06-23 11:49
Matching is the easiest part to enforce.

bethskurrie
2018-06-23 11:50
Yes, we could go through and nut out documentation for every part of pact, but we'd prefer to share the code.

0xorial
2018-06-23 11:51
I see :slightly_smiling_face: well, if you say it should be easy to add messages support to .net wrapper, this sounds like best way to go..

0xorial
2018-06-23 11:52
So far we tried this port (https://github.com/Mattersight/pact-net-messages/) separately for messages but there is no matching at all in it...


0xorial
2018-06-23 11:53
> About time, hey? yes! :grinning:

bethskurrie
2018-06-23 11:54
@matt.fellows is the person who has done the js message impl

bethskurrie
2018-06-23 11:54
If you're comfortable reading javascript, looking at that implementation may help you

0xorial
2018-06-23 11:58
great! I will give a try on Monday :slightly_smiling_face: thanks for all the information!

bethskurrie
2018-06-23 11:58
No worries.

borkke
2018-06-23 13:13
has joined #general

santoshtrip
2018-06-23 22:50
Can someone help me explain the benefits of doing pact validation using swagger request validator vs pact verification by replaying the interaction against a live instance (full blown application)

santoshtrip
2018-06-23 22:50
Trying to weigh both of them

matt.fellows
2018-06-23 23:12
Yes please

matt.fellows
2018-06-23 23:15
@0xorial the reason for using a shared component is so that we can continually push out new features and changes quickly across all implementations.we used Ruby for a number of reasons and has been a good choice IMO. Writing it from scratch will likely take you more than 1 week, and as soon as you need to implement v3 and v4 it gets harder.

matt.fellows
2018-06-23 23:16
We understand Ruby isn't ideal, and that is why we invested in building a proper shared library in Rust


matt.fellows
2018-06-23 23:18
This is the future core engine for all official implementations. If you have the time, we'd love to see you spend it getting that in the current pact net impl rather than create another

matt.fellows
2018-06-23 23:20
Bah, didn't see this thread until I answered similarly in general.

matt.fellows
2018-06-23 23:22
Anywho, adding Rust to .net is not like adding a binary, it's a shared library which is totally different. It would be like importong C Git if you needed to link to that. Trust me, writing this yourself is non trivial. Ron, who has done it several times already and has been involved with pact for years, took a long while to get it into Rust with all of the versions supported

matt.fellows
2018-06-23 23:23
As for pact message and here and now, you could definitely get that working in a couple of days with the current wrapper. I'd be happy to have a Hangouts to describe how it currently works


neil
2018-06-24 10:00
Sorry just saw this. Yeah more than happy to help with getting more support, however as Beth said my free time is very limited at the moment. Ideally we want to move to using the Rust impl, but that is going to take a bit of discovery. The ruby integration at the moment is a stepping stone (hopefully) to something a bit easier to support, debug and maintain

neil
2018-06-24 10:01
We (Pact-Net) originally had a native implementation of the v1 spec, however as we started adding more features it became a real burden to try keep up. That?s why we though moving to a shared core would make sense.

santoshtrip
2018-06-24 19:48
Can we consider contract testing as a replacement for integration testing ?

santoshtrip
2018-06-24 19:49
Whats the advantage of having both rather than one over the other

matt.fellows
2018-06-24 21:56
@santoshtrip to some extent yes you might consider it as replacement for end to end integrated tests, however there are good reasons to have integrated tests in certain circumstances and the answer is "it depends". Things you might consider alongside contract tests are blue green deploys, Canary releases, small batch sizes, continuous delivery, understand as code etc

matt.fellows
2018-06-24 21:56
They all push and pull on the overall test strategy.

matt.fellows
2018-06-24 22:03
One appropriate strategy and my general recommendation is to do the bulk of your integrated test using tools like pact and then supplement your release process with a very small subset of end to end integrated tests - potentially in your blue green env - and that gives you confidence that everything is wired together correctly (i.e. tests your config)

david.j.smith
2018-06-25 09:08
@matt.fellows Do we have a best practice for handling Origin headers in Pact JS? The browser adds the Origin header automatically to an XHR request, so they aren't part of the explicit contract from the consumers perspective. Thoughts?

mboudreau
2018-06-25 09:21
Unless your contract cars about it, don't add it

david.j.smith
2018-06-25 09:28
Well the contract from the consumer side doesn't, and the origin is never explicitly added because it's done by the browser automagically ...but the server requires it. Hence, the origin header will always be sent, but there is no JS code that actually adds the header.

david.j.smith
2018-06-25 09:29
We could add the header explicitly, but that's not technically correct. If you see what I mean.

david.j.smith
2018-06-25 09:29
It's an edge case, but I thought our JS folks must have come across this :slightly_smiling_face:

mboudreau
2018-06-25 09:41
Most people don't care about origin on the backend since it can get spoofed, and no logic should really depend on it

shekharsp27
2018-06-25 10:06
Currently I am trying to incorporate CDC tests in CI pipeline. I have taken following approach 1) I have 4 containers i) Creates pact by executing unit tests & publish pacts to pact-broker ii) Provider application container to run provider application iii) Verify container to verify contract iv) can_i_deploy container to check published results are fine 2) I have created CDC and published those to pact broker, have created webhooks to trigger provider application & verify step (I am checking the application is up and running before executing this step) if there is a content change in pact (by using 'contract_content_changed' for both the steps) and one for when results are published (can_i_deploy) container (by using 'provider_verification_published') 3) This mechanism works well if there is a change in pact content, as webhooks does the job for me 4) However in case there is no change in pact content. I am trying to find-out way, how I can get information that, webhooks from pact broker are not triggered and have to trigger can_i_deploy container by skipping other steps. Please correct me if I am missing something

bethskurrie
2018-06-25 11:18
I would put it in Dave, if it affects behaviour.

bethskurrie
2018-06-25 11:19
If the server requires it.

matt.fellows
2018-06-25 11:35
I would lean towards adding it if you actually have logic on your server side for CORS headers, and not otherwise. In most places as Michel notes it's not really important

matt.fellows
2018-06-25 11:36
It's a good point tho, I think it's not documented anywhere but a related issue on GH

matt.fellows
2018-06-25 11:45
We'll, the whole point of triggering on contract changed means that it only triggers if it changes. You can use that information to your advantage.

matt.fellows
2018-06-25 11:47
My advice is to have one pipeline for your consumer and another for your provider. Each pipeline is simple: build, run tests, publish pacts, can-i-deploy, deploy.

matt.fellows
2018-06-25 11:47
The can-i-deploy step in each pipeline will take care of itself. No need to trigger builds from webhooks.

matt.fellows
2018-06-25 11:48
If a build goes red, it means something went into the mainline before it was added to the provider, or it broke a consumer. Simple

david.j.smith
2018-06-25 12:36
Thanks all :thumbsup:

cfmack
2018-06-25 21:24
Playing with Pact Broker, I think one cannot use both a tag and a consumer version. Can anyone confirm this is true?

matt.fellows
2018-06-25 21:48
What do you mean, Charles?

matt.fellows
2018-06-25 21:49
They are both first class citizens in the broker and they can (and should) definitely be used together. The can-i-deploy tool relies on these to help you make a decision on which bits are deployable at any point in time

santoshtrip
2018-06-26 01:22
Sharing my question again

bethskurrie
2018-06-26 05:14
Hey Charles. A tag belongs to a pacticipant version.

bethskurrie
2018-06-26 05:14
Let me find the docs.


bethskurrie
2018-06-26 05:17
There's also a great doc on versioning in the broker on http://docs.pact.io

shekharsp27
2018-06-26 06:09
@matt.fellows Thank you!!

shilkumarjadhav
2018-06-26 14:54
has joined #general

cfmack
2018-06-26 19:12
That is what I thought. I do not think we can answer the question that is asked on https://github.com/pact-foundation/pact-php/issues/76#issue-328007239 I think this works: GET /pacts/provider/PROVIDER/consumer/CONSUMER/latest/TAG That GET would retrieve the latest version of this consumer-provider pair with the latest version of the consumer that has this tag. My question is a GET like: GET /pacts/provider/PROVIDER/consumer/CONSUMER/version/VERSION/TAG Get me a particular version of this consumer with this tag and this provider. I cannot see the use case where this would apply, as if you know the version of the CONSUMER, what does the tag matter? Perhaps there is some odd use case like a policy verification step that says all pacts must be tagged a certain way ... super weird use case. To revisit the question: GET /pacts/provider/PROVIDER/consumer/CONSUMER/version/VERSION/TAG This does not make sense to be use together based on my understanding of TAGS. Is that correct?

cfmack
2018-06-26 19:44
Thanks, Matt. My question was poorly worded and missing context. It was one of those times where I had been thinking about it for quiet a while in a particular github issue and that did not translate to my Slack question. There's a thread about it with more background.

matt.fellows
2018-06-26 21:29
:slightly_smiling_face:

matt.fellows
2018-06-26 21:31
If your team uses swagger as its format and potentially publishes it to 3rd parties outside of your company (e.g. who won?t use Pact) then it?s a really nice way to guarantee the contract is valid

matt.fellows
2018-06-26 21:32
in addition to that, lots of companies seem to use Swagger internally to document/communicate things, create tooling/stubs, so doing both gives you the benefits of both pact and swagger

spai
2018-06-27 09:26
has joined #general

kuo-tai.hwang
2018-06-27 20:45
has joined #general

bethskurrie
2018-06-27 21:46
Yes @cfmack. You either retrieve a pact by consumer version number, or by latest tag. Not both.

kristine.jetzke
2018-06-27 22:08
has joined #general

kristine.jetzke
2018-06-27 22:21
Hi @mr.matt.r.long I have a question regarding the `can-i-deploy` command. I have a consumer foo in version 1 and two providers bar and baz. The provider bar has two versions, a and b. Both are tagged with the tag `prod`. Version b is the lastest one. Only version a has a successful verification with the consumer. The other provider has one version tagged with prod and it successfully verified the consumer version 1. If I now run ```can-i-deploy -a foo -e 1 --to prod``` I would expect the command to fail because version 1 was not successfully verified against version b of the provider bar (the latest prod). But what happens instead is that the command succeeds and displays only one line in the result, for the other provider, baz. I assume this happens because the matrix contains no row for consumer version 1 and latest provider tag prod. Is that the expected behavior or is it a bug?

bethskurrie
2018-06-27 22:24
Hi @kristine.jetzke. I can help you with this. I need to draw up a diagram to understand it properly though.

kristine.jetzke
2018-06-27 22:25
thanks!

kristine.jetzke
2018-06-27 22:25
I can try to send sreenshots, I need to change names though

kristine.jetzke
2018-06-27 22:28
I'm still using pact broker 2.17.1

bethskurrie
2018-06-27 22:28
I'm just recreating your scenario as a test and seeing what I get. Give me a few minutes.

bethskurrie
2018-06-27 22:32
Did the verification for bar version b fail, or does it not exist?

kristine.jetzke
2018-06-27 22:33
it does not exist

bethskurrie
2018-06-27 22:34
How does it have a version that is tagged with prod in the broker then?

bethskurrie
2018-06-27 22:34
provider versions only get created when a verification is published.

bethskurrie
2018-06-27 22:34
Is there another consumer involved?

kristine.jetzke
2018-06-27 22:38
it's a strange setup. maybe that's the problem. the provider has an old version 0.0.0 (i will use the real ones now, otherwise I get confused.). This was tagged with prod at some point. during our regular provider build job we add new provider versions and tag them with prod once they are deployed to prod. The current prod version is 95.0. We now added a new contract for the consumer and it was verified again against version 0.0.0. 0.0.0 is still tagged with prod, but it's no longer the latest (because 95.0 is the latest)

bethskurrie
2018-06-27 22:38
I think you're using an old version of pact jvm.

bethskurrie
2018-06-27 22:39
You shouldn't have verifications for 0.0.0.

bethskurrie
2018-06-27 22:40
Also, you may have semantic version ordering turned on. Change this to date ordering https://github.com/pact-foundation/pact_broker/wiki/Configuration#ordering-versions-by-date

kristine.jetzke
2018-06-27 22:40
But even if I upgrade now, i still have them in the broker?

bethskurrie
2018-06-27 22:40
Yes, we still have to work out the data issue.

kristine.jetzke
2018-06-27 22:40
I'm already using date ordering

bethskurrie
2018-06-27 22:40
Cool.

kristine.jetzke
2018-06-27 22:42
i'm using 3.5.17 i can try upgrading to 3.5.18

bethskurrie
2018-06-27 22:43
That's a side issue

bethskurrie
2018-06-27 22:43
``` CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? ---------|-----------|----------|-----------|--------- foo | 1 | baz | z | false ```

bethskurrie
2018-06-27 22:43
Is that what you get?

bethskurrie
2018-06-27 22:44
No, it isn't.

kristine.jetzke
2018-06-27 22:44
if i only have one provider, the check fails because it cannot find any pacts

kristine.jetzke
2018-06-27 22:44
but if there is another provider that passes, everything passes

bethskurrie
2018-06-27 22:45
I need to be able to recreate the issue, and I don't think I have yet.

kristine.jetzke
2018-06-27 22:47
i can try setting up some data and a script with the pact commands

kristine.jetzke
2018-06-27 22:47
and file a bug in github, i just wanted to know first if this is expected behavior before doing all that

bethskurrie
2018-06-27 22:48
I'm not sure if your data is just dodgy, or if there is a problem.

kristine.jetzke
2018-06-27 22:48
me neither...

bethskurrie
2018-06-27 22:48
> and it was verified again against version 0.0.0. You definitely need to get rid of these.

bethskurrie
2018-06-27 22:48
These are in there because you're verifying from your local dev machines.

kristine.jetzke
2018-06-27 22:48
ok i can delete the tag and try to recreate the issue.

kristine.jetzke
2018-06-27 22:48
yes

kristine.jetzke
2018-06-27 22:48
and no

kristine.jetzke
2018-06-27 22:48
also because the provider didn't set any version

bethskurrie
2018-06-27 22:48
You should only be verifying from CI. The latest version of pact jvm requires that you explictly turn on verification publishing.

kristine.jetzke
2018-06-27 22:49
in their build job

kristine.jetzke
2018-06-27 22:49
yes i just saw

kristine.jetzke
2018-06-27 22:49
i will change it as well

bethskurrie
2018-06-27 22:49
So you can ensure you're only publishing verifications from "clean" code on your CI.

bethskurrie
2018-06-27 22:49
Yes, delete the prod tag on 0.0.0.

bethskurrie
2018-06-27 22:49
In fact, see if you can delete the version entirely.

kristine.jetzke
2018-06-27 22:50
Ok, I will do it and try to recreate the issue without it. Tomorrow though because it's after midnight where I live. Thanks for your help :slightly_smiling_face:

bethskurrie
2018-06-27 22:51
No worries. I may not be able to help tomorrow, but if you decide it's a bug, raise an issue in the pact_broker project, with all the information needed to recreate the issue, and I'll have a look at it when I can.

bethskurrie
2018-06-27 22:51
Unfortunately, I'm the only person who knows this code.

kristine.jetzke
2018-06-27 22:52
oh no :disappointed:

santoshtrip
2018-06-28 01:40
@Beth do you know if we have a way to publish verification to the pact broker

santoshtrip
2018-06-28 01:40
As in Java command


santoshtrip
2018-06-28 01:41
Mostly from junit classes

matt.fellows
2018-06-28 01:41
JVM has this capability, have you looked at the JVM docs?

santoshtrip
2018-06-28 01:42
Nope

matt.fellows
2018-06-28 01:43
cool, please do and then let us know if you still have questions

kristine.jetzke
2018-06-28 07:50
Hi again, I can't delete the complete version. I get a foreign key violation because there are still verification results. I did delete the prod tag though but it didn't change anything. What is the best way to create an example? Is there a public pact broker somewhere where I can publish the results?

bethskurrie
2018-06-28 07:51
Ah, my bad with the FK.

bethskurrie
2018-06-28 07:51
I may have fixed that in the latest version.

bethskurrie
2018-06-28 07:51
Yes, there is a public broker, I'll get you the creds

bethskurrie
2018-06-28 07:52
Broker user: dXfltyFMgNOFZAxr8io9wJ37iUpY42M Broker password: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1


kristine.jetzke
2018-06-28 07:52
I just upgraded the pact broker to 2.23.3

kristine.jetzke
2018-06-28 07:52
thanks

bethskurrie
2018-06-28 07:52
I'll raise an issue for deleting provider versions

kristine.jetzke
2018-06-28 08:00
thanks

kristine.jetzke
2018-06-28 13:07
I have created an example to reproduce the issue. The code is here https://github.com/tinexw/pact-broker-example. The matrix is here: https://test.pact.dius.com.au/matrix/provider/de.tine.bar/consumer/de.tine.foo and here: https://test.pact.dius.com.au/matrix/provider/de.tine.baz/consumer/de.tine.foo The output from the last can-i-deploy command is: ``` bin/pact-broker can-i-deploy -a de.tine.foo -e 3.0.0 --to prod Computer says yes \o/ CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? ------------|-----------|-------------|-----------|--------- de.tine.foo | 3.0.0 | de.tine.baz | 20.0.0 | true All verification results are published and successful ``` In the matrix the last version of de.tine.foo is 3.0.0 which was not verified against the latest prod version of de.tine.bar. I think the cause is that I published a new prod version with an already existing version which I probably shouldn't. But I still think that the can-i-deploy command should fail in this case. Maybe someone deploys an older version to prod because they need to do a rollback or they simply misconfigured something.

kristine.jetzke
2018-06-28 13:09
@bethskurrie This is the screenshot from the broker

daniel.kirmse
2018-06-28 16:46
has joined #general

daniel.kirmse
2018-06-28 16:50
Hi, don't where to put this. Can someone tell me a best practice to check multiple consumers against the same contract? Obviously I do have a provider that has to fulfill the contract and I do have several client implementations to comply to the same contract to. I'm done with the first client and got my pact file. How would I use this pact file to develop the other clients (different languages) against this w/o duplicating the interactions for them? Is pact supposed to be used in such a way anyway? Thanks

ssn899
2018-06-28 17:53
has joined #general

matt.fellows
2018-06-28 20:43
@daniel.kirmse each client has its own contract with the provider. It's possible for the clients to evolve over time differently such that they have different needs. Importantly, there are key periods in the application lifecycle where you'll want to make changes to one of them, which is where pact willl help you thru

mboudreau
2018-06-28 22:55
@daniel.kirmse to further matt's point, if you have 2 consumers with the same contract, there's no reason not to use the same code to create the contract between the two consumers :)

bethskurrie
2018-06-29 00:30
@daniel.kirmse here is a FAQ on why you don't use an already generated pact file for another consumer https://docs.pact.io/faq#can-i-generate-my-pact-file-from-something-like-swagger

daniel.kirmse
2018-06-29 06:54
Thanks! I was suspecting this :slightly_smiling_face: I?m fine with this and would support the argument for different contracts too. The code reuse is not possible as the clients are basically a client lib for a remote server (think of proxy pattern) and they are written in python and go and have to have the very same behavior for otherwise I would have introduced an inconsistency. On the other hand having two contracts would enable me to catch up major server changes (new API version) for one client after the other with the ?old? contract still in place for the one client that has to wait (? or never will catch up for it doesn?t need the new API capabilities). Okay, fine, thanks!

davidmichaelkarr
2018-06-29 23:47
has joined #general

davidmichaelkarr
2018-06-30 00:23
I'm pretty new to pacts, but I understand the basic concepts. I see that our organization is using version 3.3.9 of pact-jvm, which is over a year old. Is anyone aware of the version history well enough to say whether there are some particular strong arguments for upgrading to a more recent release?

bethskurrie
2018-06-30 02:36
Yes. The verification publishing has been changed to be off by default, so that verification results are not accidentally published from a dev machine.

bethskurrie
2018-06-30 02:37
This is an important upgrade if you wish to use the pact verification statuses for determining when it is safe to deploy the consumer.


uglyog
2018-06-30 02:39
3.3.9 only supports V2 spec pacts, 3.5.x is full V3

uglyog
2018-06-30 02:40
3.5.x also has JUnit 5, Spring and Java 8 support

davidmichaelkarr
2018-06-30 13:57
can you tell me some important good diffs between v2 and v3 specs?

davidmichaelkarr
2018-06-30 13:59
what does not having java 8 support in 3.3.9 mean exactly? I assume that refers to java 8 features in the pact expression. can you give an example?


slack1409
2018-07-01 08:46
has joined #general

slack1409
2018-07-01 08:53
I saw, that you did merge a Pull Request today https://github.com/DiUS/pact-jvm/pull/721 which I am quite interested in. When do you plan on releasing versoin 3.5.19 which will probably contain the code in this Pull Request? Thx

uglyog
2018-07-01 08:54
Just kicked off the release script. 3.5.19 should be available in maven central in a few hours.

slack1409
2018-07-01 08:55
Great. Thx a lot :slightly_smiling_face:

deshdeepdivakar
2018-07-01 09:35
has joined #general


matthew
2018-07-02 06:07
Need some guidance: I've got an API in Rails that our front end runs pacts against. That API also makes calls out to other APIs that are currently tested with VCR. Any best practices here? The problem we seem to be running into is having the APIs that the API hits be stubbed out when Pact verifies.

can
2018-07-02 09:28
has joined #general


matt.fellows
2018-07-02 10:08
FWIW I usually stub out deps during verify. I find it easier. What's the specific issue you're having?

cve-anton
2018-07-02 10:41
has joined #general

cve-anton
2018-07-02 10:43
Hello guys, I'm going to install (on AWS) Pact for the first time, could you please tell me what platform should I choose?

cfmack
2018-07-02 12:59
I use the docker container provided by Pact Foundation, PostGres PAAS, and EKS

gradzio
2018-07-02 20:53
has joined #general

gradzio
2018-07-02 20:55
hey guys, i am working with pact and i managed to upload my pact file to pact broker (http://pact.dius.com.au) but after that I am not able to upload a new file again. No matter what i get 401 - anyone can help please?

matt.fellows
2018-07-02 21:32
Hi @gradzio there are separate read and write users. Perhaps you're using the read only user account? How did the first contract get in?

elliot.chen7
2018-07-02 21:36
has joined #general

elliot.chen7
2018-07-02 21:56
Hi, I?ve been doing research and I?m struggling to decide how pact fits with grpc calls? I?m using Go in a very new micro service environment. I?m trying to find best practices for integration and/or contract testing. I really like Pacts approach to provider states and was wondering if it was good enough reason to use it. Does anyone have experience with this?

elliot.chen7
2018-07-02 21:56
@matt.fellows suggested I ask here :slightly_smiling_face:

elliot.chen7
2018-07-02 21:59
So far I have been following this approach: https://medium.com/namely-labs/how-we-build-grpc-services-at-namely-52a3ae9e7c35 Each microservice designs it?s .proto defs. They are automatically built and commited in a centralised repo that can been used as a client for other services that communicate with it.

elliot.chen7
2018-07-02 21:59
I?m afraid we?ll lose track of what service communicates with who, etc.

gaurav
2018-07-03 03:14
Hello.. Would `pact-jvm-model:3.5.16` work with both scala version 2.11 and 2.12? Thanks.

gradzio
2018-07-03 07:33
that is right Matt! how could I have missed that? thank you i was using dev account

gradzio
2018-07-03 07:34
it would be nice to get 403 instead of 401 that would lead people into solution

matt.fellows
2018-07-03 09:13
You Probably a good point there

rcheeniyil
2018-07-03 16:11
Hi, Is there support for multipart/form data in Pact Ruby and if so is there any example sitting around? What I've found so far is a post for JVM/JS versions of pact: https://github.com/DiUS/pact-jvm/issues/123

matt.fellows
2018-07-03 21:39
@rcheeniyil same answer for Ruby basically

rcheeniyil
2018-07-03 21:39
do you know if it has to be formatted one line or something weird because I haven't had that working yet

matt.fellows
2018-07-03 21:43
I'm not sure sorry. But as noted in that issue it's possible between JS and JVM (JS uses Ruby under the hood, so that bit is definitely supported)

matt.fellows
2018-07-03 21:44
I would use that example as your starting point

rcheeniyil
2018-07-03 21:49
alrighty ty!

matt.fellows
2018-07-03 21:53
:+1:

ssn899
2018-07-03 22:53
To add onto @elliot.chen7's question, is grpc contract testing in Pact's timeline? If so, has there been any work/progess yet? I would love to contribute to or start the effort.

elliot.chen7
2018-07-03 22:58
Same, I would like to contribute. I'm fairly new to the concept so I just need a little guidance

bethskurrie
2018-07-03 23:01
Hi @rcheeniyil there isn't explicit support, however, it wouldn't be too hard to do it.

bethskurrie
2018-07-03 23:02
What exactly would you want to assert about the file?

bethskurrie
2018-07-03 23:04
As @matt.fellows says, if you can do it in js, you can do it in Ruby, because the js uses the ruby under the covers.

bethskurrie
2018-07-03 23:04
Have you tried doing it as per the example?

matt.fellows
2018-07-03 23:18
Thanks @ssn899 and @elliot.chen7. What language are you using (I know Go is in the mix).

matt.fellows
2018-07-03 23:19
The reason I ask, is that we probably need to do some spikes before we know what it is that we can and more importantly, _should_ do.

ssn899
2018-07-03 23:19
Currently, I am using Pact-JVM.

matt.fellows
2018-07-03 23:19
The latest implementation in Pact JS/Go for message support is protocol/transport agnostic, so in theory could support gRPC. But there are still open questions about the value it provides.

matt.fellows
2018-07-03 23:19
awesome

ssn899
2018-07-03 23:20
But I am pretty flexible

matt.fellows
2018-07-03 23:20
I would think a white paper (in the form of a gist like https://gist.github.com/bethesque/c858e5c15649ae525ef0cc5264b8477c) stating the problem space would be a starting point

matt.fellows
2018-07-03 23:20
we can then collaborate in the open on some technical spikes that might guide implementation

ssn899
2018-07-03 23:21
I can create that

matt.fellows
2018-07-03 23:21
that?d be great!

elliot.chen7
2018-07-03 23:22
@ssn899 let me know how I can help

elliot.chen7
2018-07-03 23:22
@matt.fellows only go for me at the moment

matt.fellows
2018-07-03 23:22
cool, thanks

rcheeniyil
2018-07-03 23:27
not exactly as per example but i've taken generated code from postman and I'm getting a null response for a post I'll take another look at it on thursday and reply here. I'll try to follow the example more thoroughly on my next attempt.

ssn899
2018-07-03 23:29
https://gist.github.com/SnewsButton/91901ac8a0ea63c474ac673457d05e45 here is just a stub for the gist. Feel free to post comments on what exactly needs to be done.

rcheeniyil
2018-07-03 23:30
my `will_respond_with` response assertion is just a json body that worked when I was doing requests with a json body instead of a multipart nothing else is being asserted at this time

rcheeniyil
2018-07-03 23:31
I'll do another round of attempts I just figured I'd ask about it here before throwing too much time at the problem since it doesn't seem to be a common use case

matt.fellows
2018-07-03 23:32
@matt.fellows pinned a message to this channel.

matt.fellows
2018-07-03 23:32
awesome, thanks

matt.fellows
2018-07-04 03:54
I?ve added a couple of thoughts of how we might go about doing it just now (gists don?t get notifications sadly).

liran.tal
2018-07-04 18:56
has joined #general

liran.tal
2018-07-04 18:57
hola amigos! :wink:

liran.tal
2018-07-04 18:57
congrats on your new home

bethskurrie
2018-07-04 22:12
Hi @liran.tal!

bethskurrie
2018-07-04 22:13
Welcome

bethskurrie
2018-07-04 22:13
Much better than gitter

paisrikanth
2018-07-05 02:13
has joined #general

paisrikanth
2018-07-05 02:16
Hey Guys I get this error "Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)" When I try to do pactPublish from build gradle file

paisrikanth
2018-07-05 02:18
plz help

matt.fellows
2018-07-05 02:25
@paisrikanth hello, please try in #pact-jvm and also, you?re going to need to provide more detail (see https://coderanch.com/wiki/659862/Show-Effort)

liran.tal
2018-07-05 05:22
yep!

liran.tal
2018-07-05 05:22
thanks

liran.tal
2018-07-05 05:49
we are refactoring some of our devops and pact patterns flows and I wanted to run a draft plan by you and get some feedback: ``` Consumer ????? PR FLOW: -> Build step -> Run contract tests (we do this as integration tests, I know the docs suggest unit) -> Pact contracts are created -> Pact contracts are pushed to broker (can we push on an existing version? will it override the existing contract of the same version?) -> Identifying the contract with: - Consumer name - Provider name - Version: is the build number - Tag: build -> CI step -> Download the Pact contract from the previous step of the build based on: - Consumer name - Provider name - Version: the build number is passed from the build step to the CI step - Tag: build -> Use the pact contracts to spin up mocked providers using docker pact runner -> Perform Backend E2E tests -> Successful build THEN PR IS MERGED TO MASTER MASTER JOB FLOW BEGINS: -> Build Step ? same as for PR -> CI step ? same as for PR -> If CI succeeds - Increment version for app (tag container image, publish to docker hub, etc) - Publish to Pact Broker with: - Consumer name - Provider name - Version: the app incremented version number - Tag: development NOTES: * We tag the contract as 'development' because the contract may not yet be implemented and we don't want to break the build for the provider. * We accept that tagging it as 'production' (meaning its available on prod) is a manual process that requires clear communication to do so. Provider: -> Build step ? nothing relevant to the contract to be done here -> CI step -> Download the Pact contracts of all of my consumers - Consumer name - Provider name - Version: latest - Tag: production -> Run provider contract tests verification (ensure all contract integrations are not broken) -> Successful verification per contract updates the broker ```

bethskurrie
2018-07-05 05:52
Looks pretty sane. I've got a few questions. What is your version number format?

bethskurrie
2018-07-05 05:53
> can we push on an existing version? will it override the existing contract of the same version? Yes. Yes. Not recommended. Ideally, you should have a unique version number for each pact publication, ideally using or including the git sha if possible. I'll find you a link on this.


bethskurrie
2018-07-05 05:59
For your PRs, you say, the tag is the build - what does that mean?


fergusstrange764
2018-07-05 10:26
has joined #general

zwttgsmu
2018-07-05 14:32
Hello! I run the test on the provider side, the error is displayed: JSON::ParserError: A JSON text must at least contain two octets! as I understood, this is because the response is not in json format Does the pact compare non-json formats? or what is the way to solve this problem?

liran.tal
2018-07-05 20:25
1. we follow semver so our version number format is going to be that. But what I was thinking to use during the build step is that version will be set to the build number: i.e just a simple `159` if that?s the current build number because the published contract to the broker at that point is only used so it can be then downloaded for the CI step and used as a stub with pact runner for the E2E. At that point the contract also doesn?t mean anything. Only when we press the merge button to merge a PR to the master branch then we follow the same testing phase and at that point after CI we do increment version and publish it. so the version being the build number is also because you can have multiple PRs open at the same time. And also the app version doesn?t mean anything, like if I had `v1.1.1-build159` then v1.1.1 doesn?t convey anything because the PR can be open for a week and by that time the version in my `package.json` is obsolete since master is now at `v2.0.0`

liran.tal
2018-07-05 20:27
2. as for ``` can we push on an existing version? will it override the existing contract of the same version? ``` I asked this because it is possible that someone might re-run the PR by actually going to jenkins and restart the build it?s probably an edge case.

liran.tal
2018-07-05 20:31
3. when I publish a contract from the build step to the CI step I tag it as `build` just for semantics, as it doesn?t have any other meaning or purpose (the version number is also the build number so the contract is not really conveying anything important at that point). once `master` successfully finishes CI then we increment a version, set that version in the contract, and tag is as `development` which is semantic again but conveys more meaning at this point.

liran.tal
2018-07-05 20:33
4. will read that article, thanks for sharing! what I really miss is some recipes for devops integration for making CDC happen. there are many deployment and source code versioning strategies (github flow/tbd/etc) where that recipe will change to adapt different workflows.

matt.fellows
2018-07-05 20:53
It can compare non JSON but there are two caveats - the first is that catching rules don't work and it will be comparing by string equality. The second is that you'll need to set the correct content-type so that the framework knows it's media type


bethskurrie
2018-07-06 05:18
@liran.tal I'm working on an idea that will allow "wip" (work in progress) pacts to be verified without actually breaking the provider's build. A "wip" pact would be one with content that has not yet been successfully verified. This means that a consumer could publish a changed pact and get feedback on whether or not it passes, without breaking the provider's build. Once it has successfully been verified, it would be up to the consumer team to promote it to one of the tags that is officially supported by the provider (eg "master", "prod") that _would_ break the providers build.

bethskurrie
2018-07-06 05:19
This also means that any merged branch from the consumer should never block at can-i-deploy, because the pact content should be pre-verified.

vinod.baradwaj
2018-07-06 06:16
@liran.tal we are trying out a similar pipeline in my organisation with pact. Also @dominic.jones has done that

kra
2018-07-06 13:02
Hello Pact community! I just had a lively discussion with a coworker. Since we are using Pact, do we still need another API documentation like Swagger or RESTDocs? The Pact Broker offers pretty good live-documentation of all APIs. Any thoughts/experiences/suggestions on this?

matt
2018-07-06 15:17
I think Pact and Swagger solve different problems, they can even be used together :slightly_smiling_face:

liran.tal
2018-07-06 20:19
@vinod.baradwaj that?s really cool. would be interesting to hear what kind of things you?ve been experimenting with and what challenges you found.

liran.tal
2018-07-06 20:19
@beth yeah, and that brings up another challenge - say I have a consumer and provider contract set in place (tagged production). but then there?s a new API integration between them (i.e: through an API Version header flag) or even a simple new field in the response to support. I can?t just add this interaction to the existing consumer-provider contract that is in production because again, that specific new API is still in development phase of the provider. so I can?t just tag the contract ?development? again to not break providers build because they could be breaking the previous API contract. seems the only way to get around it is via naming the provider differently to get a new contract made just for that.

nick
2018-07-06 22:53
has joined #general

matt.fellows
2018-07-07 01:48
It's a good discussion for this group. Our official position is that they solve different problems and can be used together.

matt.fellows
2018-07-07 01:49
But I'd love to see what other responses you get

gaurav
2018-07-07 03:13
I think Pact Broker is not suitable for documentation purposes at all. Reason is that it shows contract between provider and consumers.. which can be different for different consumers. consumers might need only few fields from provider as response and in that case Pact Broker will only show those few fields as a part of their Pact. Swagger is aimed at documentation and from my opinion, both should be used together. Using Pact with Swagger makes CI integration and pact verification super easy and fast (google swagger-request-validator-pact).

yamad
2018-07-07 09:45
has joined #general

bethskurrie
2018-07-07 11:23
> I think Pact Broker is not suitable for documentation purposes at all. What I'd add to that is that it documents the integration between a particular consumer and provider very well. It doesn't, however, provide _general_ documentation for a provider, which Swagger does very well.

polvara
2018-07-07 11:48
has joined #general

polvara
2018-07-07 11:58
Hello everyone, I'm joining this chat in response to my tweet https://twitter.com/Gpx/status/1015233318848262144?s=19 At my company we're trying to decide if Pact is the right tool for us. I hope someone with more experience than me can help. In a nutshell, we're testing our React application with Selenium using a Django server as a backed. We have huge latency issues due to network calls. We were thinking to replace the server with Pact to speed things up. Is this recommendable? Has someone done something similar before? Thank you

liran.tal
2018-07-07 12:06
Hi @polvara. that can definitely work, although if you are working through some CRUD flows and doing more than just smoke tests then it can be a little bit more work to get things to play together.

gaurav
2018-07-07 14:52
Hello all, I have a question about `ConsumerInfo` class in `pact-jvm-provider_2.12-3.5.19`: `consumerInfo.getPactSource()` gets an instance of `BrokerUrlSource`.. how do I retrieve consumer source from this instance. Sorry I am not really familiar with kotlin. For example: if `consumerInfo.getPactSource().toString()` gives: `BrokerUrlSource(url=http://localhost:52821/pacts/provider/Provider/consumer/Consumer1/version/123, pactBrokerUrl=http://localhost:52821, attributes={}, options={})`, I am interested in `consumerInfo.getSource().someMethod()` that gives `http://localhost:52821/pacts/provider/Provider/consumer/Consumer1/version/123` Thanks a lot.

liran.tal
2018-07-07 15:47
@bethskurrie in https://github.com/pact-foundation/pact_broker/wiki/Pacticipant-version-numbers why is `2.0.0` regarded as a bad example for application version? it is following semver and should be unique for apps.

liran.tal
2018-07-07 17:49
hi all, I?m trying to decide on a good title for a talk I?ll be giving about CDC with Pact, it will mostly intro the subject, show an example, and provide a recipe for teams to adapt in their organisation through devops ci/cd pipelines. ``` 1. Testing Microservices and Staying Alive To Tell The Story 2. Testing Microservices and Staying Alive 3. Testing Microservices and avoiding Integration Hell 4. Contracts Testing for a Microservices Architecture 5. Consumer Driven Contracts testing for SOA 6. <your own suggestion> ``` which do you like most? I?m open to your own suggestions! thanks :wink:

david.j.smith
2018-07-07 18:12
"Life's too short for Dev VM's"? :stuck_out_tongue:

liran.tal
2018-07-07 18:14
:slightly_smiling_face:

ar7ai
2018-07-07 18:25
has joined #general

ar7ai
2018-07-07 18:28
Hello! I use ProviderStateMiddleware. Why is the "private void AddData ()" method executed before the test, is this the correct behavior? (I do according to your example https://github.com/tdshipley/pact-workshop-dotnet-core-v1/blob/master/CompletedSolution/Provider/tests/Middleware/ProviderStateMiddleware.cs)

david.j.smith
2018-07-07 18:32
I'm not familiar with that middleware, but it sounds correct. All provider state setup actions need to run before the tests because their job is to put the provider into a known state before the test executes. For example, if the tests relies on being able to use query params to find document with id 12, then document with id 12 will need to be there in advance!

ar7ai
2018-07-07 18:35
I also think so but so far in this example there is first testing, and only then setting a precondition (adding data)

ar7ai
2018-07-07 18:35
and I do not understand why :disappointed:

ar7ai
2018-07-07 18:37
"Why is the "private void AddData ()" method executed after the test, is this the correct behavior?" sorry, not exactly written

david.j.smith
2018-07-07 18:42
I'm not following you sorry, the code you've sent over isn't a test, and (ok my C# is rusty) I can't see it running a test either. Looks like a ProviderState management class to me?

uglyog
2018-07-07 23:44
try consumerInfo.getPactSource().getUrl()

gaurav
2018-07-08 01:53
hmm I was trying to do.. However just noticed that `getPactSource()` actually returns an object type so need to cast that to `BrokerUrlSource`. So `((BrokerUrlSource)(consumerInfo.getPactSource())).getUrl()` is working! Thanks a lot!

bethskurrie
2018-07-08 02:17
Hi @ar7ai please note the guidelines for raising issues that were sent to you by the greetbot, and ask your question in the relevant channel for your technology. It helps keeps the conversations focussed, and lowers the noise in the general channel.

greetbot
2018-07-08 02:18
has joined #general

paulswilliams
2018-07-08 09:00
Hey all, having run with Pact JVM for a month on our production project, I'm really enjoying it's coverage. As we're around half way through our development phase, we're soon going to need to start thinking about production, api versioning, releasing, branching etc. I've read the matrix page, and wondered if anyone can recommend other supporting documentation / videos etc to best prepare us for go live. If it helps, we're currently developing a single provider, that will be consumed by around 6 consumers, although at this moment, only 1 consumer will be in play. Looking forward to any responses.

bethskurrie
2018-07-08 09:49
1!

bethskurrie
2018-07-08 09:52
Because it doesn't uniquely identify the exact version of your repository that made the contact. You ruin the ability of the matrix to safely allow you to deploy if you can't map your code version to your pact version 1 to 1.

bethskurrie
2018-07-08 09:54
You get some extra benefits by using the sha because you can send verification statuses back to github or gitlab (or equivalent) as commit statuses.

bethskurrie
2018-07-08 09:55
If you must use sem ver, then including the sha as metadata will ensure that your version numbers are unique and can be mapped back to the version of the code that created them.

bethskurrie
2018-07-08 10:06
I think you said you increment the patch version with each build, so you should at least have unique numbers. The reason being able to map back to the sha is if you need to do the last step of the "pact nirvana" document, and you have to check out the production version of the provider to verify it against the new consumer. If you're deploying the provider frequently though, you most likely won't have to do this.

bethskurrie
2018-07-08 10:08
Welcome @paulswilliams this document (though it's still in draft, and pretty ugly, sorry!) should help https://docs.google.com/document/d/e/2PACX-1vRf1kSDccImNipOOm1G-bjcSs-ifbZjf1v54K-dIcq8BLKeFPAAm_bf_p71UKqkRMIx30QWWL-kN8TI/pub

bethskurrie
2018-07-08 10:10
Let me know if you have any further queries after reading this. Because everyone's workflow is different, it's hard to describe exactly how to set things up.

paulswilliams
2018-07-08 10:10
Oh thank you. I will have a good read this afternoon. Thank you for you and everyone?s work on Pact. I had a shaky start, but it?s really starting to show value now.

bethskurrie
2018-07-08 10:11
Good to hear! We know that it's difficult to ramp up.

bethskurrie
2018-07-08 10:11
What did you find most difficult?

steve.cook
2018-07-08 10:15
has joined #general

2018-07-08 10:15
Welcome to the Pact #general channel @steve.cook! Please join the relevant channels for your Pact implementation as well, so you can discuss your issues with the audience who can best help you.

bethskurrie
2018-07-08 10:17
Hi @polvara paxt can definitely help you, but I would caution against writing too many contact tests that go through the full layer. Often you'll end up with an explosion of interactions that you've only added because you're trying to test some element of the UI. We'd generally recommend using Pact to unit test the interactions between the API client (a class in your consumer codebase that is responsible for making the calls to the provider) and the API. You can then use the pact *stub* server to stand up a stub for tests that involve the UI.

paulswilliams
2018-07-08 10:34
Concepts. Thinking I could use Pact to create mocks for acceptance tests, rather than focusing on integration components. Some of the JVM docs using Groovy over Java add unneeded cognitive load. Also, sceptical colleagues who are more confident with end to end tests, but unversioned stored procs in shared database have caused so many issues that they?ve seen the light in embracing decoupling.

bethskurrie
2018-07-08 10:35
Ouch!

bethskurrie
2018-07-08 10:35
Yes, it is a conceptual leap.

paulswilliams
2018-07-08 10:36
Once handling the matrix is understood and battle hardened, I?d hope that we?ll use this approach a lot.

bethskurrie
2018-07-08 10:36
That first one is a really good point. Should we make that clearer somewhere?

paulswilliams
2018-07-08 10:36
I work at a contracting company, the shared db is a customer thing :face_with_head_bandage:

bethskurrie
2018-07-08 10:37
I work for a consulting company - I've also seen things I'd rather forget!

paulswilliams
2018-07-08 10:37
Perhaps. If others feel same pain? I can?t recall a ?what Pact doesn?t do? section which might be useful.

bethskurrie
2018-07-08 10:38
There is a "what is pact not good for" section actually.

paulswilliams
2018-07-08 10:38
Yeah, although these anti-patterns are making us be creative.

bethskurrie
2018-07-08 10:38
In the docs, underneath the "what is it good for" section.

paulswilliams
2018-07-08 10:39
Yeah, i couldn?t recall it, but then I started a couple of months back.

bethskurrie
2018-07-08 10:39
Next time I'm looking at the main section, I'll have a think if there's any way to make that clearer.

bethskurrie
2018-07-08 10:40
I value the impressions of people who have recently read the docs, because those of us who know pact too well are bad at working out what needs improving.

paulswilliams
2018-07-08 10:41
Okay, cheers. I?ll try and add an issue or PR on docs if I get chance. Lots of juggling as you no doubt experience

bethskurrie
2018-07-08 10:42
Constantly!

paulswilliams
2018-07-08 14:41
That tagging / wip content is exactly what I was looking for. I will read it again in depth after pondering this evening. Cheers!

polvara
2018-07-08 19:10
Thanks for the reply. Yes, that?s what we wanted to do, use the stub server when we run our E2E tests. Most of our UI is tested with unit and integrations tests. We use E2E to check the main workflows, we don?t cover edge cases. I guess the main issue from my side is to understand how much can you push Pact before you have an explosion of interactions

polvara
2018-07-08 19:13
Hey, thanks for the reply and thanks for the tweet too :bow: Our slowness is due to the server. We tried to use a static server for one of our E2E tests and the increase in speed is noticeable?we?re talking minutes vs seconds. As I wrote also here https://pact-foundation.slack.com/archives/C5F4KFKR8/p1531077014000029?thread_ts=1530964717.000011&cid=C5F4KFKR8 the thing that confuses me the most is to understand when a smoke test becomes too specific and it will force us to work agains Pact

bethskurrie
2018-07-09 00:23
> We use E2E to check the main workflows, we don?t cover edge cases Yay!

obradford
2018-07-09 07:08
has joined #general

2018-07-09 07:08
Welcome @obradford!

greetbot
2018-07-09 07:12
@greetbot has left the channel

violeta.minkov
2018-07-09 07:28
has joined #general

bethskurrie
2018-07-09 11:14
@liran.tal no, this new interaction should be added by creating a feature branch of the consumer codebase, and publishing the pact with a tag that matches the name of the feature branch. You can then go to the provider team and say, hey, can you support this new pact (give them the name of the tag). Once that new pact is supported, and deployed to production, then you can merge in your feature branch in your consumer and deploy.

bethskurrie
2018-07-09 11:15
As the "pact nirvana" document outlines, you'll find it much easier if you use tag names that map to your branch names in development, and tag names that match your environments when you deploy.

bethskurrie
2018-07-09 11:16
Your provider should verify the "master" and "production" tags if you follow this scheme.

bethskurrie
2018-07-09 11:17
The approach I outline above for adding new features (using a branch and another tag) will allow you to add new interactions without breaking everything.

bethskurrie
2018-07-09 11:18
Does that make sense at all?

bethskurrie
2018-07-09 11:29
Hi `can-i-deploy` users. I've added a `--retry-while-unknown` option to allow your consumer pipeline to wait for the provider to finish running the pact verifications when it is triggered by a webhook (which is triggered by a changed pact). Remember, however, that pacts can be pre-verified on feature branches to avoid blocking your master build. You can read about how to do this in https://docs.google.com/document/d/e/2PACX-1vRf1kSDccImNipOOm1G-bjcSs-ifbZjf1v54K-dIcq8BLKeFPAAm_bf_p71UKqkRMIx30QWWL-kN8TI/pub

jannik.falkner
2018-07-09 13:10
has joined #general

jannik.falkner
2018-07-09 13:15
Hi, can someone explain why injection with `@Autowire` in this example does not work when verifying via the Gradle Pact plugin? https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-spring#using-a-spring-runner-version-357 I need to inject a bean of `RabbitMqBackend` but it says `kotlin.UninitializedPropertyAccessException: lateinit property rabbitMQBackend has not been initialized`


ssn899
2018-07-09 19:37
@matt.fellows there has been some discussion in the gist.

bethskurrie
2018-07-09 23:25
Hi @jannik.falkner. Welcome to the pact slack. You'll get the audience for your question by asking in the pact-jvm channel

bethskurrie
2018-07-10 02:59
Hi all! To help get the word out about new features in Pact, and to help Pact users share their experiences with each other, we're trying out a fancy new blog at http://blog.pact.io I've written the first couple of posts to get us started.

bethskurrie
2018-07-10 03:00
Here's a quick intro to the new retries feature in can-i-deploy http://blog.pact.io/2018/07/10/retries-for-can-i-deploy/

bethskurrie
2018-07-10 03:01
We'll be adding new posts as new features come out, so be sure to add it to your feed reader.

bethskurrie
2018-07-10 03:04
added an integration to this channel: https://pact-foundation.slack.com/services/BBM3NQTMF

bethskurrie
2018-07-10 06:44
@gaurav would you be interested in writing a blog post about your pact/swagger set up and experiences on the new http://blog.pact.io?

bethskurrie
2018-07-10 06:47
Hi @santoshtrip sorry, I'm not sure if you ever got an answer. The swagger validator is better in situations where there are more consumers than the provider team can realistically maintain provider state data for (maybe 10?)

bethskurrie
2018-07-10 06:47
The down side is that you lose a bit of confidence, because you're adding an extra layer of abstraction.

bethskurrie
2018-07-10 06:48
The up side is that you can get very fast feedback, and in some situations, fast feedback is more valuable that waiting for slightly more accurate feedback.

bethskurrie
2018-07-10 06:49
The broker doesn't current support the exchange of swagger documents, but it's something we're planning on adding in the future

bethskurrie
2018-07-10 06:49
@gaurav has had experience with the pact swagger workflow.

bethskurrie
2018-07-10 06:50
Keep in mind that you need to ensure that your swagger document is in sync with your code either by using dredd or by generating the swagger document from the code itself.

bethskurrie
2018-07-10 06:52
What you lose is the ability to verify what a particular resource looks like with various combinations of data - the "provider states" that pact gives you. This may or may not be particularly important for your api, however.

gaurav
2018-07-10 07:47
Thanks @bethskurrie. I would love to do that but my setup for pact/swagger is not complete yet. Swagger-validator was using quite old pact version so I was working on upgrading the version recently in my fork (there were many changes!). Also wanted to take this chance to understand the internals of swagger-validator. I am ready to create a PR but there is a delay because of organisational processes (they need some CLA for corporate contributors so need to involve legals). Anyways, point is that although my quick evaluation looks very promising.. it would take me some time.. may be a month to be at a stage where I can share experiences about both good and pain points in more practical sense. On side notes, I really think that Pact Foundation and Atlassian should work together to have a complete and easier contract testing solution (I don?t see many contributors in that repo).. Also asked the contributor there to request a slack channel here because of increasing interest in swagger-validator here.. and to be updated with latest pact discussions.

bethskurrie
2018-07-10 07:50
Having a channel here is a good idea. You're right, that we haven't collaborated on this. Some of the atlassian teams wrote it to solve their own problems (much like pact was originally written!) and then open sourced it afterwards.

bethskurrie
2018-07-10 07:51
We'd love to have better integration and support in the broker for this flow, but it just hasn't reached the top of the priority list yet.

bethskurrie
2018-07-10 07:53
I saw that one of the atlassian contributors is going to be at a conference I'm attending soon, so I'll try and catch him to talk about this.

gaurav
2018-07-10 07:57
Sounds like a good idea.. As they are already using swagger-validator for longer than anyone else, they will be good candidates to share experiences as well. :slightly_smiling_face: May be convince them to remove CLA thing.. :wink:

alex.bednarczyk
2018-07-10 13:18
has joined #general

rlamb
2018-07-10 16:51
Is anyone using a tool like RDoc or YARD to document provider states?

sjani
2018-07-10 23:30
has joined #general

bsayers
2018-07-11 07:35
has joined #general

bethskurrie
2018-07-11 07:48
I reckon the devs probably don't have much say over a CLA unfortunately.

raido.letterbox
2018-07-11 07:48
has joined #general

bsayers
2018-07-11 08:07
Hi all, are there many users of swagger-mock-validator in here? My team is considering adding OpenApi 3 support to it and am wondering if that is of interest to anyone here.

polvara
2018-07-11 08:27
Hello, all my API calls to Pact are returning status code `222`. Any idea why is that or how to debug the issue?

raido.letterbox
2018-07-11 08:30
Hi all. I am a bit confused about consumer tests concept. Are they meant just to generate PACT json file or to test the request which the consumer sends too?

abubics
2018-07-11 08:57
They just generate the pact file, and help assert that your API client deserialises the stubbed response properly.

abubics
2018-07-11 08:57
A separate process verifies the pact file against the producer :)

uglyog
2018-07-11 09:20
Is that the HTTP status code?

polvara
2018-07-11 09:39
Yes, which is weird because it?s a code that doesn?t exist

uglyog
2018-07-11 09:45
What language are you using? Is this during the consumer test?

raido.letterbox
2018-07-11 09:45
Thanks! I was writing a response to you and understood a few thing by myself :slightly_smiling_face: Just a small question left: if we are verifying that the consumer deserialises the response correctly, does this mean that the consumer tests should be written in the same language as the consumer itself?

polvara
2018-07-11 09:48
Yes, consumer test in node

polvara
2018-07-11 09:49
``` provider.addInteraction({ state: 'admin user exists', uponReceiving: 'a sign in request', withRequest: { method: 'POST', path: '/be-mock/api-login/', body: { username: '', password: 'welcome' }, }, willRespondWith: { status: 200, body: { token: 'eyJ, }, }, }) ```

polvara
2018-07-11 09:49
This is how I define the interaction

uglyog
2018-07-11 09:53
Wow, that is weird. Maybe the logs from the mock server will help

polvara
2018-07-11 09:56
``` I, [2018-07-11T11:54:38.132877 #1529] INFO -- : Received request POST /be-mock/api-login/ D, [2018-07-11T11:54:38.133058 #1529] DEBUG -- : { "path": "/be-mock/api-login/", "query": "", "method": "post", "body": { "username": "", "password": "welcome" }, "headers": { "Content-Length": "61", "Content-Type": "application/json", "Host": "localhost:1234", "Connection": "keep-alive", "Origin": "http://localhost:3000", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36", "Accept": "*/*", "Referer": "http://localhost:3000/login", "Accept-Encoding": "gzip, deflate", "Accept-Language": "en-US,en;q=0.9", "Cookie": "_ga=GA1.1.419063753.1531302868; _gid=GA1.1.551748798.1531302868; _gat=1; mp_7c7a4eab3982d24cf551ff2e97f58b30_mixpanel=%7B%22distinct_id%22%3A%20%2216488c3732012d-01429e40c5e0a-163b6950-13c680-16488c37321858%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; __stripe_mid=a13be528-1a35-4766-80f6-eda2e807ecf4; __stripe_sid=0d317bf2-c1a8-47b3-b4cb-9938c22928f7", "Version": "HTTP/1.1" } } I, [2018-07-11T11:54:38.135619 #1529] INFO -- : Found matching response for POST /be-mock/api-login/ D, [2018-07-11T11:54:38.135714 #1529] DEBUG -- : { "status": 200, "headers": { }, "body": { "token": "eyJ" } } ```

polvara
2018-07-11 09:56
They look fine

polvara
2018-07-11 09:57
Is it as if the server responds correctly but something changes the response

polvara
2018-07-11 10:04
It?s probably a problem with testcafe because if I query the server with curl it works

hstene
2018-07-11 10:10
I am writing a pact where i care about the content of a string, but not capitalization. So in my pact I want to see if the provider returns the string `'hello'`. The provider does in fact return `'HELLO'` but either way (`'hello'|`HELLO`) is fine by me- How do I represent that in a pact test? I am specifically using pact-jvm

polvara
2018-07-11 10:11
Ok, the problem seems to be this header `'x-hammerhead|fetch|request-credentials: include'`

polvara
2018-07-11 10:11
Any idea why?

can
2018-07-11 10:12
Hi, Henrik! Have you used regular expressions before?

hstene
2018-07-11 10:15
Yes, does pact support regex-types in individual fields? :smile:


hstene
2018-07-11 10:18
Thanks!

bethskurrie
2018-07-11 10:52
Yes

bethskurrie
2018-07-11 10:52
You would use pact to write tests for the client class or classes that make the calls to the API.

bethskurrie
2018-07-11 10:53
Generally unit tests are recommended, to keep the contract focussed.

bethskurrie
2018-07-11 10:53
You are testing that the client class makes the expected http requests, and that it handles the expected responses correctly.

bethskurrie
2018-07-11 10:54
Generally this means deserialising the response into a class that represents the resource.

raido.letterbox
2018-07-11 10:59
Thanks a lot

bethskurrie
2018-07-11 11:02
There have been a few people asking about it recently, so if you do a search, you should find them.

polvara
2018-07-11 11:56
I think it?s a problem in the FE. I contacted testcafe https://github.com/DevExpress/testcafe/issues/1134#issuecomment-404123524 Thanks for the support

matt.fellows
2018-07-11 12:01
@bsayers :point_up:

bsayers
2018-07-11 12:13
@gaurav Our legal team is not negotiable on the CLA. It?s not unusual to need to sign one of these if you want to contribute to open source projects owned by bigger companies, Facebook, Google, Microsoft, Amazon are a few examples of other companies that also require this.

gaurav
2018-07-11 12:44
Sure @bsayers. That was more a light comment. :slightly_smiling_face: may be I am just unhappy with all these legal stuff in general.. but yes, I am sure they are there for reasons!

matt.fellows
2018-07-11 12:58
As per above Been, should we create a channel to discuss the swagger tools you guys have created?

gaurav
2018-07-11 14:08
There is a channel already #swagger-validator

matt
2018-07-11 15:50
I think OpenApi 3 support would be awesome.

santoshtrip
2018-07-11 16:50
@bethskurrie thanks for the detailed explanation. This is what I was looking for.:+1:

santoshtrip
2018-07-11 16:51
Awesome!

bsayers
2018-07-12 00:09
I won?t argue with you there @gaurav, I don?t think highly of the legal overhead either. Unfortunately the choice is open source the way we do today or don?t open source anything!

argos83
2018-07-12 00:46
has joined #general

mikey
2018-07-12 20:43
Hullo! First of all, Pact is *awesome*. Incredible work, ya?ll! We?re about to add Pact for a Javascript consumer. We use Karma to drive our javascript test suite. Which javascript Pact lib would you recommend? I?m thinking https://github.com/pact-foundation/karma-pact but I want to check with the experts who know more about the Pact ecosystem than I :simple_smile:

mikey
2018-07-12 20:46
We use Nodejs for our frontend and I saw pact-node and pact-js too, but I?m not sure how to determine which lib would best meet our needs.

mikey
2018-07-12 20:47
looks like karma-pact uses pact-node?

matt.fellows
2018-07-12 21:05
Hi @mikey! You might want to join us over in #pact-js

matt.fellows
2018-07-12 21:05
short answer is yes, longer answer is avoid Karma where possible

mikey
2018-07-12 21:06
oh right on, thank you! Joining now.

minhdoan
2018-07-13 03:12
Hi team, anyone has experience with request with space(s) in URL, when executing pactVerify the space should encoded to %20, unfortunately the '+'. I am stuck and don't know how to fix https://github.com/DiUS/pact-jvm/issues/693 Could you please help on it? Many thanks in advance!

mboudreau
2018-07-13 03:19
is this for a query string or for the actual URL path?

minhdoan
2018-07-13 03:21
Hi Michel, The actual URL is: /odata/CHAIR?$filter=CREATED_BY/FIRST_NAME eq 'LIMS'&$orderby=Id asc It is the code i wrote in consumer side: .path("/odata/CHAIR") .query("$filter=CREATED_BY/FIRST_NAME eq 'LIMS'&$orderby=Id asc")

minhdoan
2018-07-13 03:21
And the result shown on Broker: { "method": "GET", "path": "/odata/CHAIR", "query": "$filter=CREATED_BY%2F_FIRST_NAME+eq+%27LIMS%27&$orderby=Id+asc" }

mboudreau
2018-07-13 03:25
yep, as it should be. HTTP specification says that all query strings should use `+` for spaces

mboudreau
2018-07-13 03:26
if you've use anything that uses HTTP, it should transform it for you when you add spaces

mboudreau
2018-07-13 03:26
and should still work with pact

minhdoan
2018-07-13 03:27
Do you mean if my provider scheme is HTTP, the pactVerify will encode space to + and sent out the URL

minhdoan
2018-07-13 03:27
If the scheme is HTTPS, it is Ok, right?

mboudreau
2018-07-13 03:28
https will do the same

minhdoan
2018-07-13 03:28
yes, i also try with HTTPS and it not works

minhdoan
2018-07-13 03:28
So please help to instruct me how to overcome it

mboudreau
2018-07-13 03:29
are you just trying to verify, or trying to use the mock?

minhdoan
2018-07-13 03:37
I faced the issue when executing pactVerify against actual provider

minhdoan
2018-07-13 03:38
the mock in consumer side is Okie

minhdoan
2018-07-13 03:38
So the pact records are sucessfully created and published to Broker

bethskurrie
2018-07-13 04:46
As Michel says, `+` is the correct character to use when encoding a space in a query parameter. `%20` is what to use when there is a space in the path.

minhdoan
2018-07-13 04:51
Hi @bethskurrie, Nice to meet you

minhdoan
2018-07-13 04:51
Do you mean the URL: /odata/CHAIR?$filter=CREATED_BY/FIRST_NAME eq 'LIMS'&$orderby=Id asc

minhdoan
2018-07-13 04:52
When executing pactVerify, It would be encoded to: %2Fodata%2FCHAIR%3F%24filter%3DCREATED_BY%2FFIRST_NAME+eq+%27LIMS%27%26%24orderby%3DId+asc

minhdoan
2018-07-13 04:52
and send to actual provider

minhdoan
2018-07-13 04:53
it is a correct behaviour of our pact-jvm, right?

minhdoan
2018-07-13 04:53
So the actual provider should handle the '+', right?

bethskurrie
2018-07-13 04:53
yes

minhdoan
2018-07-13 04:54
Do we have any option to encode space to %20 in the query path as well?

bethskurrie
2018-07-13 04:55
If your HTTP library cannot unencode a + symbol in a query parameter, there is a problem with it.

bethskurrie
2018-07-13 04:56
What library are you using?

minhdoan
2018-07-13 04:58
I think i am using pact-provider-gradle

minhdoan
2018-07-13 04:58
plugins { id 'au.com.dius.pact' version '3.5.9' } group 'ODataPactProvider' version = '1.0.0' // PACTs require SemVer task wrapper(type: Wrapper) { gradleVersion = '4.2' }

bethskurrie
2018-07-13 04:59
I mean, what http library

minhdoan
2018-07-13 05:01
I am unsure Beth, i only know when i execute pactVerify task then the pact library will create a request and send to configured provider service

minhdoan
2018-07-13 05:01
Do we know the info with stacktraceshow option?

bethskurrie
2018-07-13 05:03
Sorry, I have to go.

bethskurrie
2018-07-13 05:03
I could be wrong, but I think you need help with your http framework, rather than pact.

minhdoan
2018-07-13 05:04
Many thanks for your help @bethskurrie and @mboudreau !

mboudreau
2018-07-13 05:04
np

minhdoan
2018-07-13 05:07
Though I am still not clear, in consumer side i used Spring Boot RestTemplate for initialize and send request to mock service

minhdoan
2018-07-13 05:07
No issue in consumer side, pact records created without issue

minhdoan
2018-07-13 05:08
But in provider test, pactVerify fails as demonstrated

mboudreau
2018-07-13 05:08
again, pact isn't the issue, it's the thing that calls the pact specified URL that is

minhdoan
2018-07-13 05:08
So i dont know the issue with http framework you mentioned here is the http framework used in Consumer, Spring Boot, right?

mboudreau
2018-07-13 05:08
since the RFC specification for HTTP calls says that query strings needs to be using `+` and not `%20`

minhdoan
2018-07-13 05:09
Yes, i also see that pact record is Okie

minhdoan
2018-07-13 05:10
But i only need to clarify again that whether our actual provider service must handle the + in the query path?

minhdoan
2018-07-13 05:10
If yes, i must raise a change request to dev team

minhdoan
2018-07-13 05:11
The web serivce must support the + in query option

minhdoan
2018-07-13 05:13
Or the actual issue from the http framework which initialize the request sent to the web service, it should replace the + by %20 before sent???

minhdoan
2018-07-13 05:13
Again, i am really not clear so i must take too long

minhdoan
2018-07-13 05:14
And i thank you so much for your help, very very very much

bethskurrie
2018-07-13 06:08
Yes, your service should accept + as a space delimiter in a query.

bethskurrie
2018-07-13 06:10
> The web serivce must support the + in query option This.

bethskurrie
2018-07-13 06:13
Please see the URL encoding section on https://en.wikipedia.org/wiki/Query_string

minhdoan
2018-07-13 06:54
@bethskurrie It is so cool. Only one more concern to fulfill the change request that whether pact-jvm, pactVerify support any configuration to configure the encoding by ourselves, e.g: replace + by %20 or anything else

bethskurrie
2018-07-13 06:57
There is no configuration option to do that. @uglyog can tell you more about it though.

minhdoan
2018-07-13 08:07
Hi team, i am executing pact provider test, the pact-jvm-provider-gradle library is used. My test suite contains 4 test cases (provider MULTI_USERS_PROVIDER has 4 consumers). My system requires login first so we must add an authorization header to each request as below: pact { // Configure the Pact verification log reports { defaultReports() // adds the standard console output json // report in json format } serviceProviders { MULTI_USERS_PROVIDER { requestFilter = { req -> // Add an authorization header to each request // because of our system needs login first with credential: user:password req.addHeader('Authorization', 'Basic dXNlcjpwYXNzd29yZA==') } protocol = providerScheme host = providerHost port = providerPort path = providerScheme + "://" + providerHost + ":" + providerPort + "/webservice" hasPactsFromPactBroker(pactBrokerScheme + "://" + pactBrokerHost + ":" + pactBrokerPort) } } } But in the test suite, there is one test case must use other user , instead of user:password. So i try to use the stateChange for this one: pact { serviceProviders { MULTI_USERS_PROVIDER { requestFilter = { req -> // Add an authorization header to each request // because of our system needs login first with credential: user:password req.addHeader('Authorization', 'Basic dXNlcjpwYXNzd29yZA==') } hasPactWith('AnotherUser_Consumer') { stateChangeUsesBody = false // defaults to true pactSource = url('http://pact-broker-local-repo.net/provider/MULTI_USERS_PROVIDER/consumer/AnotherUser_Consumer/latest') stateChangeRequestFilter = { req -> // Add an authorization header to each request // another:password req.addHeader('Authorization', 'Basic YW5vdGhlcjpwYXNzd29yZA==') } protocol = providerScheme host = providerHost port = providerPort path = providerScheme + "://" + providerHost + ":" + providerPort + "/webservice" hasPactsFromPactBroker(pactBrokerScheme + "://" + pactBrokerHost + ":" + pactBrokerPort) } } } But it seems the credential is not overwritten for specific test case. Anyone has experience on this stuff? Could you please help?

uglyog
2018-07-13 08:30
I don't think `stateChangeRequestFilter` can take any parameters. You'll have to do it in the `requestFilter`, but you might be able to provide a `requestFilter` for `AnotherUser_Consumer`

liran.tal
2018-07-13 08:31
Because we?re using a trunk based development workflow and we merge integrations even if they aren?t yet ready (we have feature flags and API versioning for this) then the whole process of relying on feature branches and specific branch names is not going to work well for us.

liran.tal
2018-07-13 08:32
:+1:

liran.tal
2018-07-13 08:35
my code version will always be the same as my contract version. when I publish a production contract it is tagged with 2.0.0 which is the consumer version that goes to production. when I tag a new production contract as 2.0.1 that is again the new consumer version as well that is deployed to prod. does that make sense ?

minhdoan
2018-07-13 09:13
@uglyog Thanks so much! But i have a concern that it seems new authentication credential used in AnotherUser_Consumer is also used for the test cases which be executed after it.

minhdoan
2018-07-13 09:13
Do you face that situation?

bethskurrie
2018-07-13 10:39
The version that you supply when you publish *is* the code version (it's the consumer application version). The *pact* version is managed for you by the broker (it's a sha based on the content).

bethskurrie
2018-07-13 10:40
Generally, you tag a version resource with the environment name, or the branch name, rather than a version number, because it generally already has a version number as its identifier.

bethskurrie
2018-07-13 10:41
It would be like tagging version "2.0.0" with a tag "2.0.0".

bethskurrie
2018-07-13 10:42
Are you doing this because you want to verify all your prod versions of a mobile api for backwards compatibility, and that's the easiest way to make the verification configuration do that for you?

bethskurrie
2018-07-13 10:45
Then, how about using the feature tag names?

bethskurrie
2018-07-13 10:46
I've been hoping to find someone with a feature toggle use case.

minhdoan
2018-07-13 12:00
Any solution for each case?

jiinliin
2018-07-15 22:33
has joined #general

bethskurrie
2018-07-15 22:59
@minhdoan if you believe you have found a bug, can you create a github repository with an executable example to demonstrate the issue. This will make any issue easy to identify, and allow us to show that it has been fixed.


minhdoan
2018-07-16 11:30
@bethskurrie I am not sure, i need an option to printout the Authorization for each request to investigate further. Any option ?

minhdoan
2018-07-16 11:30
I have tried with --debug, -i, --info but not info about Authorization.

bethskurrie
2018-07-16 11:31
I'm afraid I don't know much about the JVM implementation. Try asking in the JVM channel. If I was having problems with a library, I'd hook up the debugger and step through the code. Have you tried that?

minhdoan
2018-07-16 11:35
Thanks, Beth! I will try but i am not a developer so i am lack of skill to debug deeply :smile:

bethskurrie
2018-07-16 11:44
Oh, I see. Pact is generally used by developers.

bethskurrie
2018-07-16 11:44
Are you a tester?

minhdoan
2018-07-16 11:53
Hi team, i have a provider with 10 consumers so there are 10 pact records on Broker. And 7 test cases use the default authorization credential, and remaining 3 cases use distinct ones. So i must add requestFilter for each as below code: `'PERMISSION_PROVIDER {` ` requestFilter = { req ->` ` // Add an authorization header to each request` ` // because of our system needs login first` ` //default credential is: superuser:123456` ` req.addHeader('Authorization', 'Basic c3VwZXJ1c2VyOjEyMzQ1Ng==')` ` }` ` protocol = schemeProperty` ` host = hostProperty` ` port = portProperty` ` hasPactsFromPactBroker(brokerScheme + "://" + brokerHost + ":" + brokerPort)` ` // Consumer 1 need the credential: test001:123456` ` hasPactWith('Consumer_1') {` ` pactSource = url('http://localhost/pacts/provider/PERMISSION_PROVIDER/consumer/Consumer_1/latest')` ` requestFilter = { req ->` ` // Add an authorization header to each request` ` // because of our system needs login first` ` // with cre: test001:123456` ` req.addHeader('Authorization', 'Basic dGVzdDAwMToxMjM0NTY=')` ` }` ` }` ` // Consumer 2 need the credential: test002:123456` ` hasPactWith('Consumer_2') {` ` pactSource = url('http://localhost/pacts/provider/PERMISSION_PROVIDER/consumer/Consumer_2/latest')` ` requestFilter = { req ->` ` // Add an authorization header to each request` ` // because of our system needs login first` ` // with cre: test002:123456` ` req.addHeader('Authorization', 'Basic dGVzdDAwMjoxMjM0NTY=')` ` }` ` }` ` ` ` // Consumer 3 need the credential: test003:123456` ` hasPactWith('Consumer_3') {` ` pactSource = url('http://localhost/pacts/provider/PERMISSION_PROVIDER/consumer/Consumer_3/latest')` ` requestFilter = { req ->` ` // Add an authorization header to each request` ` // because of our system needs login first` ` // with cre: test003:123456` ` req.addHeader('Authorization', 'Basic dGVzdDAwMzoxMjM0NTY=')` ` }` ` }` ` }` And i want to ensure that each request will have correct Authorization header info when pactVerify is executed, but i tried with: `gradle pactverify [--info | --debug | -i]` But no option show the Authorization information. Could you please help on it? Many thanks!

minhdoan
2018-07-16 13:04
Yes, i am a tester. We want to apply Pact to our project, replace Integration test

minhdoan
2018-07-16 13:06
And maybe create mock services with Pact

bethskurrie
2018-07-16 19:59
@minhdoan I actually suggested you ask in the #pact-jvm channel. We try to keep the general channel for non language specific discussion.

bethskurrie
2018-07-16 21:15
:+1:

bethskurrie
2018-07-16 21:17
Given that Pact is generally implemented by developers (pact tests on the consumer side are typically unit tests for the provider client classes) I'm interested to know why you've been doing it? Are the developers not interested? Do they think it's a tool for testers?

michael.follmann
2018-07-16 21:36
has joined #general

kaushalye
2018-07-17 01:23
has joined #general

mr.matt.r.long
2018-07-17 12:42
Hi, I've been POC the rollout of Pact within an enterprise organisation, and have had queries regarding how well Pact (specifically the Broker) can scale. I appreciate that the self hosted Broker is scaled according to it's deployment mechanism and infrastructure. However are there any case studies I could refer to? The numbers quoted are 8000 services using the Broker. My suggestion would be to deploy the broker and monitor it and scale as necessary, but I presume that it wouldn't require huge resources

david.j.smith
2018-07-17 16:13
Has anyone seen a problem where pactbroker retrieves the pacts in reverse order i.e. it treats the oldest as latest?

matt.fellows
2018-07-17 21:20
Have you got sort by date added or sort by a versioning scheme enabled?

bethskurrie
2018-07-18 00:42
If you don't have the "order by date" turned on, it will use semantic ordering. If you are using git shas, it currently will accept them, but give you a strange order.

bethskurrie
2018-07-18 00:42
I've changed it to sort by date by default now.

bethskurrie
2018-07-18 00:59
What version of the broker are you using, what are you using for your version numbers, and what version ordering setting are you using?

david.j.smith
2018-07-18 09:53
Now that I?ve been forced to dig into it, I think we?re on a really old version - will see if we can do an upgrade. The problem is on one particular part of the relationships it?s just picking a weird order. It?s ignoring both semantic version and date. But lemme push for an upgrade before we continue - thanks!

david.j.smith
2018-07-18 09:57
Two questions about the versions: 1. Is there somewhere in the UI that gives you the pact broker version? (we may not have it of course if, as I suspect, we have an older version) 2. What is the latest version of pact-broker? I couldn?t see the latest version number on the git readme?s or wiki? Might have just missed it.

bethskurrie
2018-07-18 10:29
It's in the response headers.

bethskurrie
2018-07-18 10:30
If it's not, it's ooooooold man.

bethskurrie
2018-07-18 10:30
You'll find the current version number in the releases page https://github.com/pact-foundation/pact_broker/releases

bethskurrie
2018-07-18 10:30
2.24.0

msc.consults
2018-07-18 13:39
has joined #general

msc.consults
2018-07-18 13:50
Hi everyone, Has anyone looked into creating a pact for non-HTTP protocols for Java? I have this scenario whereby my providers HTTP Endpoint is a Apache Knox Gateway, which is a passthrough API, thus I ideally need to create contracts with the underlying apps (which are not accessible via a HTTP protocol). I've come across this article: https://github.com/pact-foundation/pact-ruby/wiki/Why-Pact-may-not-be-the-best-tool-for-testing-pass-through-APIs - which points to: https://gist.github.com/bethesque/0ee446a9f93db4dd0697, but this is written in Ruby

kra
2018-07-18 19:22
Hei guys I just saw a Tweet saying: "Oh WSDL is called CDC these days. Déjà-vue" What are your arguments against this?

matt.fellows
2018-07-18 20:12
Can you share the link? Seems like a good conversation starter :grinning:


matt.fellows
2018-07-18 20:49
thanks

matt.fellows
2018-07-18 20:50
OK, here goes

matt.fellows
2018-07-18 20:50
1. Is the concept behind WSDL even a bad thing?

matt.fellows
2018-07-18 20:51
2. Maybe, but we learned, and moved forward to REST - where Swagger and OAS has picked things up

matt.fellows
2018-07-18 20:51
3. CDC is an _approach_ and a _concept_ for API design and evolution, WSDL/Swagger etc. is a definition language for implementing it. You can literally _do both_!

matt.fellows
2018-07-18 20:52
4. CDC actually started _during_ the WSDL days _using_ WSDL as the message exchange format (see https://martinfowler.com/articles/consumerDrivenContracts.html)

david.j.smith
2018-07-18 20:54
As it turns out, my plea to upgrade after your security announcement was heeded, and we were already running 2.20.0 :smile: The issue was the sorting config hadn?t been added. Thanks for the help as always :thumbsup:

matt.fellows
2018-07-18 20:55
So it?s a bit confused to equate the two.

matt.fellows
2018-07-18 21:05
@matt.fellows pinned a message to this channel.

bethskurrie
2018-07-19 02:42
My understanding of WSDLs (correct me if I'm wrong) is that all the consumers have to be working on the same version of the document and that if you make an update (add a field) you have to send out the new wsdl to all consumers, even if they don't care about that field. It may be cdc, but it seems to break postel's law in a very annoying way. (disclaimer, I haven't used WSDLs for maybe 10 years, so I may be mis remembering)

bethskurrie
2018-07-19 02:43
Pact JVM supports message pacts. Have a look at the docs.

bethskurrie
2018-07-19 02:45
Generally speaking, the protocol is irrelevant. You should separate your message handling code from your protocol specific code and then you can just test the contract between the message consumer and the message producer "business logic" classes.

bethskurrie
2018-07-19 02:45
No worries.

matt.fellows
2018-07-19 03:20
Yep, that was one of the main issues with it. You had to synchronise deployments or deploy multiple versions (which wasn't very common)

bethskurrie
2018-07-19 21:23
I love it when I open a pact stackover flow issue from my inbox and people have already answered it better than I could! Thanks pact community! https://stackoverflow.com/questions/51386591/how-and-if-test-syntactic-bad-request-validation-with-pact

matt.fellows
2018-07-19 21:24
yep!!

peeter.ulst
2018-07-20 10:48
has joined #general

peeter.ulst
2018-07-20 10:52
Hi, is there anywhere info on the `free` hosted beta service as in how it will fare in the future - for now it's free but when the beta ends then it's not free any more I assume?

bethskurrie
2018-07-20 10:53
Hi @peeter.ulst the free tear will continue to exist. The paid offering will simply add more features.

bethskurrie
2018-07-20 10:53
The free tear will basically be (as it is now) a hosted version of the open source codebase.

peeter.ulst
2018-07-20 10:54
so there will be no functionality loss compared to current beta?

bethskurrie
2018-07-20 10:54
No

bethskurrie
2018-07-20 10:54
The paid tear will have better auth and improved UI, amongst other things.

peeter.ulst
2018-07-20 10:55
and I can tell my company to keep using the beta as it will be seamlessly upgraded to production version and we can continue using it forever?

bethskurrie
2018-07-20 10:56
Indeed.

peeter.ulst
2018-07-20 10:56
:+1: thank you!

bethskurrie
2018-07-20 10:56
It will not lose any functionality while the hosted product exists.

brentbarker9
2018-07-20 18:23
Should a pact fail if there is additional data coming back from a provider test?

suliu
2018-07-20 21:00
has joined #general

uglyog
2018-07-21 00:11
If the data is important, it should be specified in the pact. Anything not in the pact should be ignored.


liran.tal
2018-07-21 00:21
no, it?s all basically app to app api calls, no mobile. but I think we?re aligned on this now. we do trunk based development so the pact version is indeed the consumer version. I don?t tag the contract with a version number, instead I tag it as either ?dev? or ?prod? depending if it should break the provider?s CI (due to the fact that this contract agreed to be on implemented & in prod)

liran.tal
2018-07-21 00:22
I?ll read about the feature tag names though not sure I want to couple to that

bethskurrie
2018-07-21 03:26
Can you outline the problems for me?

bethskurrie
2018-07-21 03:27
So, the provider verifies the "prod" ones in the build, but not the "dev" ones?

liran.tal
2018-07-21 07:47
it verifies both. ?dev? to check for the progress of its implementation and to check whether they can be really moved to ?prod? tags, and ?prod? for whats already in prod and then it will break the build if they fail.

bethskurrie
2018-07-21 08:27
Tell me about your process for introducing changes.

liran.tal
2018-07-21 08:31
my own team is following TBD. So every dev is creating a fork of the repo. Doing changes in their own branches. Opening a PR and when code review and checks are done it gets merged into the upstream repository?s master branch (there aren?t any other branches). once a merge happens to that master branch the server gets deployed.

liran.tal
2018-07-21 08:31
another team which is working on a legacy code base isn?t yet able to benefit from this workflow so even if they merge everything to a ?develop? branch, it doesn?t get deployed until end of iteration.

liran.tal
2018-07-21 08:32
while for them it?s easier to keep a feature branch on the side, for our fast-paced teams I prefer not to.

kaushalye
2018-07-23 04:58
~Hi folks, Im trying to get the pact provider side working with ``` &amp;lt;verificationType&amp;gt;ANNOTATED_METHOD&amp;lt;/verificationType&amp;gt; ``` ref: &lt;https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-maven&gt; Following the example in the above reference, I defined the .groovy file as follows (ignore the simple return type), which get compiled to .class in the test classpath ``` class VehicleTxnResourcePactTest { @PactVerifyProvider('a processed transaction') String verifyTransaction() { JsonOutput.toJson("some string") } } ``` However I am getting the following complaint ```Verifying a pact between MIRB and IPS - a processed transaction Given transactions are processed No signature of method: au.com.dius.pact.provider.ProviderVerifier.invokeProviderMethod() is applicable for argument types: (java.lang.reflect.Method) values: [public java.lang.String net.nxbos.ips.vehicletxn.resource.VehicleTxnResourcePactTest.verifyTransaction()] Possible solutions: invokeProviderMethod(java.lang.reflect.Method, java.lang.Object)```~

kaushalye
2018-07-23 04:58
Any help is highly appreciated.

kaushalye
2018-07-23 04:58
Side question: What do you expect in the classpath? .class file or a .groovy file ?

kaushalye
2018-07-23 04:59
@matt.fellows / @uglyog :wave: :slightly_smiling_face:

kaushalye
2018-07-23 05:03
and Following is the plugin configuration ``` <plugin> <groupId>au.com.dius</groupId> <artifactId>pact-jvm-provider-maven_2.12</artifactId> <version>3.5.18</version> <configuration> <serviceProviders> <!-- You can define as many as you need, but each must have a unique name --> <serviceProvider> <name>IPS</name> <verificationType>ANNOTATED_METHOD</verificationType> <consumers> <consumer> <name>MIRB</name> <pactFile>/Users/malinda/Code/ips-microservice-vehicle-txn/src/test/resources/pacts/MIRB-IPS.json</pactFile> </consumer> </consumers> </serviceProvider> </serviceProviders> <classpathElements> <classpathElement> target/test-classes </classpathElement> </classpathElements> <pactBrokerUrl/> <configuration> <pact.showStacktrace>true</pact.showStacktrace> </configuration> </configuration> </plugin> ```

uglyog
2018-07-23 05:05
@kaushalye let's move this to the #pact-jvm channel

kaushalye
2018-07-23 05:05
:thumbsup:

matt.fellows
2018-07-23 05:17
Ron is your man I?m afraid - what is _maven_ ? :smile:

matt.fellows
2018-07-23 05:17
j/k but I?ve never done any Pact JVM!

thirumal.net
2018-07-23 05:50
has joined #general

kaushalye
2018-07-23 05:59
I have to use pact JVM *Unfortunately* :smile:

minhdoan
2018-07-23 06:47
I want to build a response with Json format as below: {"value":[ { "attribute": "att1", "url": "/att1" }, { "attribute": "att2", "url": "/att2", "type": "Chemistry" }, { "attribute": "att3", "url": "/att3", "type": "Construction" } ] } I have tried with pact consumer code: .body(new PactDslJsonBody() .minArrayLike("value", 2,2) .object() .stringType("url", "/att1") .stringType("attribute", "att1") .closeObject() .object() .stringType("url", "/att2") .stringType("attribute", "/att2") .stringType("kind", "Chemistry") .closeObject()) But the object() method must have a name: `throw new UnsupportedOperationException("use the object(String name) form");` If using another approach as: .body(new PactDslJsonBody() .array("value") .object() .stringType("url", "/att1") .stringType("attribute", "att1") .closeObject() .object() .stringType("url", "/att2") .stringType("attribute", "/att2") .stringType("kind", "Chemistry") .closeObject()) The format is right, but the actual response body contains more than 3 elements (this is unknown number depends on the test system) in "value" array so verification fails. Could you please help to confirm that the format to build a response as example, whether it is supported in pact V3 or i must wait for the V4? Many thanks and nice day, team! (edited)

matt.fellows
2018-07-23 07:02
Can you please move this to #pact-jvm @minhdoan ?

minhdoan
2018-07-23 07:04
@matt.fellows Is Okie, Matt? But i also want to know that others pact libraries support this format? Please help to clarify!

matt.fellows
2018-07-23 07:08
To my eye it doesn?t look out of the ordinary, and it should be doable

minhdoan
2018-07-23 07:14
@matt.fellows Could you please help on it? Many thanks in advance!

matt.fellows
2018-07-23 07:17
Sorry @minhdoan I?m not across the JVM enough to give you specific advice here. Generally speaking, I would start by paring back your Pact test to just a few elements, and then gradually adding bit-by-bit

minhdoan
2018-07-23 07:18
:+1:

minhdoan
2018-07-23 07:18
Thank Matt for your help!

matt.fellows
2018-07-23 07:19
no worries!

psyrez
2018-07-23 07:26
has joined #general

brentbarker9
2018-07-23 16:36
Ok thank you

jim
2018-07-23 17:58
has joined #general

stan
2018-07-23 22:21
has joined #general

arne.zelasko
2018-07-24 07:00
has joined #general


ng.viet.quynh
2018-07-24 07:38
has joined #general

bethskurrie
2018-07-24 09:30
Welcome to all the newcomers :relaxed:

djrimokbp
2018-07-24 10:23
anyone managed to run pact verifications using MockMvcTarget and a controller having Jersey annotations (Java)?

ng.viet.quynh
2018-07-24 10:32
Hi everyone! And thanks for the warm welcome @bethskurrie :relaxed: Not sure where to put this but I am actually writing my bachelor thesis about contract testing in microservices with Pact and would really really appreciate if someone can share their experience implementing Pact in their own team/project. Since I only have a simple prototype, I would love to hear from you guys who have more seriously and intensively work with Pact. - What have run smoothly and what have been difficult for you? - Did contract testing with Pact become a part of your software development lifecycle? Why or why not? - Do you implement Pact in already developed services or in designing new services? Any opinion would be much appreciated! Many thanks!

bethskurrie
2018-07-24 10:36
@djrimokbp try in the pact-jvm channel.

iain.olliver
2018-07-24 10:45
has joined #general

arunesh.rajak
2018-07-24 14:05
has joined #general

gerrymcgovern
2018-07-24 14:26
has joined #general

mohammed.a
2018-07-24 14:32
has joined #general

bethskurrie
2018-07-25 04:11
Pact users. I need some help with a new Pact feature I'm developing. In the languages you've used, are the terms "wip" or "pending" used? And if so, is there a preference for one or the other? Do they have different implications? The feature I'm trying to describe is "if these pacts fail verification, they won't fail the build". I've used "wip" in the code, but I'm tossing up about the term "pending" instead. I'm not sure which is the most cross-language compatible. Doing a quick google comes up with more results for "pending" than "wip". One reason I went for "wip" was that "pending" implies that it is a failing test, and in this case, it's more that we don't know if they'll pass or fail. Happy to take suggestions if you think you have a more descriptive term.

abubics
2018-07-25 04:17
all the other words that I?d associate with that concept are long :stuck_out_tongue: e.g. incomplete, unfinished, etc

abubics
2018-07-25 04:18
but the associated stigmas for wip are intuitively closer to the right concept than pending for me

timothy.clifford
2018-07-25 04:33
For me it comes down to this: `pending` implies that something is planned, but may not yet have been started/finished; `wip` is something that is currently being worked on, but not yet complete

liran.tal
2018-07-25 06:10
agree with timothy and boris

bethskurrie
2018-07-25 06:46
In ruby, if a test that is marked as `pending` passes, the suite actually fails, so that you are alerted that you need to update your test code. Does this behaviour exist in other languages? (This is _not_ the behaviour that we want for this feature, btw - we want the process to exit with a success code all the time, whether the pact verifications pass or fail.)

bethskurrie
2018-07-25 06:47
/poll "What should I call the 'if these pacts fail verification, they won't fail the build' feature?", "WIP pacts", "Pending pacts", "Other (please suggest below)"

sguisado
2018-07-25 10:54
has joined #general

bethskurrie
2018-07-25 11:57
One things I should add to the above description of the "wip/pending" pacts feature is that once the pact is verified successfully, it ceases to be a wip/pending pact.

can
2018-07-25 11:57
Automagically or by the dev that implements the change?

bethskurrie
2018-07-25 11:58
I'm leaning towards "pending" now, as I think "something that was pending that has now succeed" we kind of assume is now not pending. I'm not sure if the same assumption applies to "wip".

bethskurrie
2018-07-25 11:58
Automagically.

bethskurrie
2018-07-25 11:58
It's then up to the consumer team to decide what to do with that previously pending pact.

niedra91
2018-07-25 11:59
has joined #general


can
2018-07-25 12:03
:pray: Thanks for the reading material!

bethskurrie
2018-07-25 12:04
The suggested process for introducing changes would go: * Provider is configured to verify `master` tagged pacts * Consumer creates git branch, modifies pact tests, publishes pact with tag = git branch * Webhook triggers build of provider * Provider runs verification with `master` and "wip/pending" pact but DOES NOT FAIL if the "wip/pending" pact does not pass * If pact passes, consumer merges in branch, and publishes new pact as `master` * If pact does not pass, people talk.

bethskurrie
2018-07-25 12:07
The "wip/pending" pact verification will be an automatic step in the verification process when retrieving pacts from a broker.

can
2018-07-25 12:11
So I guess on the `If pact passes, consumer merges in branch, and publishes new pact as master` is the step where a WIP pact is converted to a concrete one?

mats.lundkvist
2018-07-25 13:26
Hi, I have an issue with providers test in go with json pact generated in java. My go tests cannot find the state when the json looks like this ```"providerStates": [ { "name": "this is my state" } ]``` which is generated with pact-jvm but when I change to ```"providerState": "this is my state"``` it works. This is the metadata in the json ```"metadata": { "pactSpecification": { "version": "3.0.0" }, "pact-jvm": { "version": "3.5.19" } }``` Does anyone have an idea why it is like this?

antonello
2018-07-25 15:46
has joined #general

bethskurrie
2018-07-25 21:46
@mats.lundkvist because go doesn't support v2 pact specification yet.

bethskurrie
2018-07-25 21:47
The consumer will need to write a v2 pact for you.

bethskurrie
2018-07-25 21:47
Exactly @can

anthony.herman
2018-07-25 22:10
has joined #general

bethskurrie
2018-07-26 01:25
I think in the next release of Pact go, you may be able to use the v3 format, but it will ignore any v3 features it can't understand

niedra91
2018-07-26 07:43
Hi everybody! I?m trying to integrate Pact with a SCIM connector for the needs of a project. The development environment is Java + Maven. I checked out the Workshop project which helped me to understand the integration steps. Using this project and the pact-jvm project, I could successfully write a UT for the connector using Pact Mock Server. I described the Pact using Java 8 Lambda. At this point, I wanna go further and: 1/ Incorporate matchers for the Pact 2/ ?Build? the Pact as json data, as it?s done within the workshop project, but from the Java-8 DSL. I don?t need at the moment to automatically export the generated Pact to the provider through the pact broker. 3/ Test the generated pact against the real provider. I?m kind of stucked here. 1/ I looked in the matchers sub-project of pact-jvm, but could find only Scala or Kotlin classes. Are there any matchers for the Java DSL? Where could I find revelant documentation? 2/ I didn?t see any way to build the Pact in java. Is there a sample maven plugin available? Thanks in advance for your support :slightly_smiling_face: *edit*: copied to #general2

uglyog
2018-07-26 08:59
@niedra91 Are you asking how to define a matcher on an attribute in the Java-8 DSL?

niedra91
2018-07-26 09:00
Yes indeed :slightly_smiling_face:

uglyog
2018-07-26 09:01
There are methods in the DSL (like `stringValue` or `stringMatcher`) that will add the appropriate matcher

uglyog
2018-07-26 09:03
Not sure I understand what you mean by "?Build? the Pact as json data". Do you mean generate the pact file?

niedra91
2018-07-26 09:05
yes indeed

niedra91
2018-07-26 09:06
where could I find the documentation for these methods or the package name so that I could browse it directly into my IDE?

niedra91
2018-07-26 09:13
You mean the methods from PactDslRootValue and PactDslJsonRootValue in au.com.dius.pact.consumer.dsl I guess?


uglyog
2018-07-26 09:15
`PactDslJsonBody` would be the one to look at

niedra91
2018-07-26 09:15
:thumbsup:

niedra91
2018-07-26 09:15
Thanks :slightly_smiling_face:

pikestar
2018-07-26 09:25
has joined #general

pikestar
2018-07-26 09:33
Hello, I'm introducing Pact where I work and am starting with creating unit tests on the front end app - a React app. I'm new to front end development and JS. I have followed the guide on install and setup and have a test written however on running 'npm run pactTest', I get the following error:

pikestar
2018-07-26 09:34
my pactSetup.js lives here: /Users/adampike/web-project/packages/app

pikestar
2018-07-26 09:36
my package.json lives in the same directory and the script is:

uglyog
2018-07-26 09:37
is there a `pactSetup.js` file in /Users/adampike/web-project/packages/app/src?

pikestar
2018-07-26 09:37
No. it seems lke the rootDir is wrong and should be up one level

uglyog
2018-07-26 09:38
oh, yeah, maybe try `--setupFiles ../pactSetup.js`

pikestar
2018-07-26 09:38
ok thanks

pikestar
2018-07-26 09:40
yep worked :+1:

pikestar
2018-07-26 09:40
thanks

nicolas.clertan
2018-07-26 15:58
has joined #general

dipjyotimetia
2018-07-27 04:10
has joined #general

kurst03
2018-07-27 04:31
has joined #general

ashish.dubey91
2018-07-27 07:50
Hi guys. I have a question - is there any way to generate an HTTP client out of a pact definition?

bethskurrie
2018-07-27 07:50
No. Can you explain your usecase?

ashish.dubey91
2018-07-27 07:52
so imagine a consumer defines a contract. as part of the contract it defines how it sends the request. This data is also used by pact-verifier I'm guessing when it builds the requests to the provider for verification. What I want is a method by which I can write an HTTP client that sends this request to the provider

bethskurrie
2018-07-27 07:54
Can you explain more about what you're trying to achieve?

ashish.dubey91
2018-07-27 07:56
sure. I have an Android app which defines a contract test for the backend API at a URL /v1/someapi, with some specific headers. Now I want to write some integration tests for this backend API for which I'd have to make the same request with the same headers. I wondered if I could re-use the contract definition to make this easier

bethskurrie
2018-07-27 07:58
You could easily write some code to parse the file and turn the request definitions into a live request, and then execute each request.

bethskurrie
2018-07-27 07:58
I wouldn't recommend it though.

bethskurrie
2018-07-27 07:59
Contract tests have different aims to functional tests.

bethskurrie
2018-07-27 07:59
And you'd be coupling your functional tests to the requests the consumer defines in the pact file.


bethskurrie
2018-07-27 08:01
Please read the above explanation about the difference.

ashish.dubey91
2018-07-27 08:03
that's true I've read this one. This thought started when we were discussing the possibility to start using swagger for documenting APIs and then being able to easily generate clients for those APIs

ashish.dubey91
2018-07-27 08:05
but it also occurred that we've tried out pact and it seems useful for contract testing so we're definitely going to be using it a lot it seems. And since request definition is quite tight in a contract test (which is also what pact docs recommend) it's quite possible to re-use that metadata to generate these API clients

ashish.dubey91
2018-07-27 08:06
functional tests I agree ideally should be decoupled from these contract test definitions

ashish.dubey91
2018-07-27 08:08
but for folks in the team who might want to play with the API for some reason, I thought these could be useful

antonello
2018-07-27 10:39
Hi all! I have a question / some thoughts around verifying responses by type only, using matchers, and wanting to be more strict for particular fields. If I decorate the whole response body with a `like`, can I then override that and make sure a specific field is verified also by value?

bethskurrie
2018-07-27 12:04
You can override it with a regex, just make it match exactly.

antonello
2018-07-27 12:14
Thanks @bethskurrie. So a `term` matcher nested within a `like` matcher will win, is that correct?

niedra91
2018-07-27 17:32
For those who may have been wondering, the PACT was generated for the last UT to be runned inside the ?pacts? directory of my build directory. Although I had two pacts described, one different in each UT, there were not combined. I guess I need to set one unique PACT with various interactions for the whole Test class instead.

bethskurrie
2018-07-27 23:02
Yes

matt
2018-07-28 21:38
> if these pacts fail verification, they won't fail the build may be a bit late to the party, in JUnit this is called `Ignore`

bethskurrie
2018-07-29 21:32
Ta. I'm not sure if I can call the feature "ignore pacts" though!

bethskurrie
2018-07-29 21:32
"ignore failure pacts" is accurate, but a bit clunky.

antonello
2018-07-30 08:32
Thanks!

mark.bridgett
2018-07-30 12:11
Hey there. Anyone know how I can get my Java provider tests to output the full provider response? I'm trying to debug a failed test and would like to see what my service is sending back that is failing. All I have to go on at the moment is this output which doesn't help much : $.some_property -> [{mismatch=Expected List() to have minimum 1, diff=}]

can
2018-07-30 12:13
Hi Mark! I think the folks over at #pact-jvm might be better equipped to help you :slightly_smiling_face:

mark.bridgett
2018-07-30 12:19
Ahh, i'll try there thanks :slightly_smiling_face:

antonello
2018-07-30 14:17
I had the same issue the other day when I was playing with a failure when using an `eachLike` matcher.

oswald.quek
2018-07-30 16:06
hello. in a pact consumer test, is there a way to manually verify a call to a certain endpoint was called x number of times? use case: calling an endpoint on our consumer service (and passing it an auth token in the header) causes it to call another authentication service (the provider). however we're caching the valid tokens on the consumer service so i want to verify that making calling the endpoint multiple times only causes the authentication service to be called once.

can
2018-07-30 16:11
Hmmm. I'm not an expert at this but that doesn't strictly sound like a contract test. Looking forward to what others say!

oswald.quek
2018-07-30 16:19
well there's a contract between the consumer service and the authentication service for sure

matt
2018-07-30 16:21
maybe "Ignore failures"

matt.fellows
2018-07-30 21:34
Yeah, this is better served with traditional unit tests and not worth Pact.

bethskurrie
2018-07-30 22:22
@mats.lundkvist did you get this sorted?

bethskurrie
2018-07-30 22:22
Did you get a chance to read this @can? I'd love any feedback you have.

bethskurrie
2018-07-30 22:27
@liran.tal I came across a use case that demonstrates why you have to be very careful if you put a build number in the version. If you have a webhook that triggers a provider build when the pact changes, you'll end up building a particular SHA of the provider multiple times. If your provider is both a consumer and a provider, you need to make sure that this build publishes its own pacts when it does the verification, otherwise the "latest" version of the provider will have the verification results, but no pacts. This means that when you come to deploy that version `can-i-deploy` will say "NO!".

jarrodlilkendey
2018-07-31 01:53
has joined #general

richard.jones
2018-07-31 05:49
Hi folks, we?re seeing a very strange pact verification failure here in the Java verifer: https://gist.github.com/richard-reece/85d58d296aa8e4806bd59496a39780d1 - so even though our pact is specifying matching by type, I think the verifier is failing because the values don?t match.

bethskurrie
2018-07-31 05:51
That does not look like that Java verifier

bethskurrie
2018-07-31 05:51
It looks like the ruby one, and it only supports v2

bethskurrie
2018-07-31 05:51
If your pact is in v3 format, it won't work.

richard.jones
2018-07-31 05:52
Oh! Sorry, I?m passing on information second-hand from our Java dev here. I?ll clarify with him?

bethskurrie
2018-07-31 05:52
Hm. The matching rules look like v2.

bethskurrie
2018-07-31 05:54
And I take it back - the verifier output has a slight difference to the ruby.

bethskurrie
2018-07-31 05:54
I didn't realise it copied the output so closely.

bethskurrie
2018-07-31 05:55
There might be a bug in the Java type comparison for boolean

richard.jones
2018-07-31 05:55
Ah, righto.

bethskurrie
2018-07-31 05:56
It should be identifying the pact spec version from the file, but there might be a problem with that.

bethskurrie
2018-07-31 05:56
Also, lets move this to a thread.

bethskurrie
2018-07-31 05:57
Can you see any output that says which pact spec version is being used?

richard.jones
2018-07-31 05:58
I?m asking :slightly_smiling_face:

richard.jones
2018-07-31 06:06
I think the Java dev has gone for the day, thanks for trying to help tho.

bethskurrie
2018-07-31 06:15
Can you make sure they're running the latest version tomorrow (I'm not sure what that is)

bethskurrie
2018-07-31 06:15
@uglyog can probably help you more, but he's stuck in a basement with no reception at the moment!

richard.jones
2018-07-31 06:16
ouch for @uglyog :confused:

imran.khan2
2018-07-31 07:16
has joined #general

imran.khan2
2018-07-31 07:17
Hey folks

imran.khan2
2018-07-31 07:18
I was looking for some help with pact usage in the java ecosystem

imran.khan2
2018-07-31 07:19
Is this the right place for those types of questions?

bethskurrie
2018-07-31 07:22
Best place to ask is #pact-jvm @imran.khan2

imran.khan2
2018-07-31 07:23
Thanks @bethskurrie

can
2018-07-31 07:49
From my discussions internally with @antonello, we'd found it to fit the process quite nicely! His feedback would be most valuable, though.

oswald.quek
2018-07-31 08:49
yeah after sleeping on it last night i think so too. thanks.

uglyog
2018-07-31 09:30
Hmm, that doesn?t look right. You?ll need to enable debug logging to see what is going on

antonello
2018-07-31 10:55
Just to make sure I understand correctly: 1) a WIP pact is a pact tagged with a feature branch name that has not yet been successfully verified (ie. either there are no verification results, or the verification failed). 2) any pact that is tagged as `master` will not be considered a WIP pact and the provider pipeline will fail if the verification fails

bethskurrie
2018-07-31 10:55
`master` is just an example name

antonello
2018-07-31 10:56
ok, it will be configurable

antonello
2018-07-31 10:56
because my next question was going to be what if you want to force build failure for more than one branch (for example `master` and `release_candidate_v1.1.1`)

bethskurrie
2018-07-31 10:56
1 is almost correct - it's the "latest" of any tag that is not configured to be verified by the provider.

bethskurrie
2018-07-31 10:57
Usually, the provider has certain tags it chooses to verify - eg `master` and `prod`. WIP pacts are any that are the latest of their tags that aren't in the set of names the provider has chosen to verify.

antonello
2018-07-31 10:57
right, which answers my question above your last message.

bethskurrie
2018-07-31 10:58
Basically we take the list of all the head pacts that have no successful verifications, and remove the pacts that the provider is about to verify.

bethskurrie
2018-07-31 10:59
The one thing I haven't solved yet is what to do with pacts that never get successfully verified, and will never be verified because they are wrong, or the functionality has been decided not to be implemented.

bethskurrie
2018-07-31 11:00
We either need a clean up function, or the ability to remove them from the WIP set when running the verifications.

antonello
2018-07-31 13:08
I went to a meeting and just caught up with the messages now and I?m still a bit confused. I?ll try to give an example.

antonello
2018-07-31 14:08
In the processing of trying to write an example, I was wondering if it may be a useful feature to be able to specify an additional criterion for a webhook based on a list of tags. In other words, make it possible to only trigger a webhook if a pact with a specific tag (or list of tags) has changed.

antonello
2018-07-31 14:23
If that was possible, you could create a specific webhook so that, if a consumer publishes a changed pact from a feature branch (tagging it as `consumer_branch_1`), the pact can be verified by a specific provider branch, which will only verify pacts tagged as `consumer_branch_1`.

oswald.quek
2018-07-31 14:26
so my team ran into a problem recently, and I would like to check if there is a bug with the pact broker, or if our build pipeline is faulty... 1. we have a consumer service and a provider service, both of which have already been deployed to our test, staging and production environments. versions of both services are tagged with "test", "staging" and "production" respectively. 2. we changed the consumer pact to add more interactions and committed to master branch. (API wasn't changed on the provider service). our master build also automatically deploys to the test environment, but this failed because can-i-deploy said we couldn't deploy. makes sense because at this point there is no provider service deployed tagged with "test" that verifies the new consumer pact. 4. this was resolved by re-building the provider service (which A. pulls the new consumer pact from its master branch B. runs the provider tests and tells the pact broker the new pact is verified and C. sets a new version for the provider) and re-deploying (which tags the provider with "test"). the consumer service could then be deployed. 5. for the staging/production environment however, re-deploying the provider service first failed because can-i-deploy blocked the deploy of the provider service. i guess this is expected because for the new version of the provider, there is a new interaction from the consumer side, even though nothing has changed in the provider. note that do we not re-run provider contracts tests on the staging and production deployment builds. so we have a chicken-and-egg scenario - we can't deploy the consumer, because there's no corresponding provider tagged with "staging/production", but we can't deploy the provider, because there's no corresponding consumer tagged with "staging/production". what's the solution and/or what is wrong with my build pipeline? thanks.

nabrosimova
2018-07-31 17:58
has joined #general

nabrosimova
2018-07-31 18:05
Hi, I am trying to figure out how to do file_upload in ruby. Both provider and consumer are written in ruby. I did see pact-jvm examples with scala. But really need examples of how .i can set it up in ruby

nabrosimova
2018-07-31 20:39
@channel

clasalle
2018-07-31 21:24
has joined #general

matt.fellows
2018-07-31 21:49
@nabrosimova I can see you posting in a few channels here. The Ruby channel is probably the most appropriate place for this. That being said have you read through the FAQ, including https://docs.pact.io/faq#how-do-i-test-binary-files-in-responses-such-as-a-download?

matt.fellows
2018-07-31 21:50
In short, testing the actual body is not a recommended practice (but is possible). You can?t use matchers either.

nabrosimova
2018-07-31 21:55
@matt.fellows see I'm trying to upload file with post request which is a bit different problem than download

matt.fellows
2018-07-31 21:55
What?s the problem/difference?

matt.fellows
2018-07-31 21:56
If we take away the actual binary payload, the problems are quite similar. Our advice would be to set the correct path, mime types etc. and test those, ignoring the specific payload contents

nabrosimova
2018-07-31 21:58
well provider has to receive media, and send back it's id and status. the response part is just text but i need media to make the actual api call on the provider side

bethskurrie
2018-07-31 22:06
@antonello I've been expecting someone to ask for that eventually.

bethskurrie
2018-07-31 22:06
I'll put it on the backlog


bethskurrie
2018-07-31 22:11
@oswald.quek I will sit down and work through your scenario as soon as I have a moment.

richard.jones
2018-07-31 22:23
@uglyog the spec version 2 pact should be compatible, yeah?

richard.jones
2018-07-31 22:24
sorry it?s not in that gist (I didn?t want to paste the entire pact, there?s a dozen interactions in it) but the version is declared at the end ?metadata?: { ?pactSpecification?: { ?version?: ?2.0.0" } }

zb582
2018-08-01 02:27
has joined #general

thirumal.net
2018-08-01 06:20
PACT Verifier Issue

thirumal.net
2018-08-01 06:21
i am able to mock using mock service but when i try to verify the mock against the provider, it is throwing error. instead of mocking total service response, i did mock only one item. can you please help me what might be the issue ? Mocking Code : def test_callAPI (self): url = 'http://localhost:1234' expected = {'class': 'HealthCheck'} pact.given ( 'sending a request to url' ). upon_receiving ( 'class name should match with HealthCheck' ). with_request ( 'get', '/' ). will_respond_with ( 200,body=expected) with pact: result = callAPI ( url ) self.assertEqual ( result,expected )' *Mock JSON* : '{ "consumer": { "name": "consumer" }, "provider": { "name": "provider" }, "interactions": [ { "description": "a request for the health check", "providerState": "the health of the system is OK", "request": { "method": "get", "path": "/" }, "response": { "status": 200, "headers": { }, "body": { "class": "HealthCheck" } } } ], "metadata": { "pactSpecification": { "version": "2.0.0" } } }' *Real Service Provider Response* : '{ "class": [ "HealthCheck" ], "properties": { "timestamp": "2018-08-01T00:10:00+0000", "systemName": "Test", "buildInfo": { "buildDate": "2018-07-27T07:38:19+0000", "appVersion": "1111", "revision": "2 ", "branch": "develop" }, "health": "OK", "checks": [] }, "links": [ { "rel": [ "self" ], "href": " check" } ] }' i am trying to check only one item from real service response .getting below Error when running against real provider : *Failure/Error: expect(response_body).to match_term expected_response_body, diff_options Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8***

timothy.clifford
2018-08-01 06:28
Um, is it because your real service provider is returning `{ class: [ "HealthCheck" ] ...}` instead of `{class: "HealthCheck"}`?

thirumal.net
2018-08-01 06:40
@timothy.clifford -Thanks, Yes , real service is giving class: [ "HealthCheck" ] so i have changed my mock url = 'http://localhost:1234' expected = {'class': ['HealthCheck']} but unfortunately same error is coming

thirumal.net
2018-08-01 06:44
@timothy.clifford - am i doing correct for just checking only item from real service response , even though it gives 3 items ? Thank you in Advance

timothy.clifford
2018-08-01 06:46
try it with both and see what happens? ¯\_(?)_/¯

matt.fellows
2018-08-01 06:48
@thirumal.net you probably want to use Matchers to match array contents: https://github.com/pact-foundation/pact-python#eachlikematcher-minimum1

matt.fellows
2018-08-01 06:48
If you expect exactly 1 element, but get back 3 it will fail. This matcher says ?I want an array to contain _at least one_ of these types of elements?

matt.fellows
2018-08-01 06:49
that being said, almost certainly there is another problem going on. It seems to be related to encoding.

matt.fellows
2018-08-01 06:50
I suggest we move this to #pact-python where you can get python specific help

thirumal.net
2018-08-01 07:06
@matt.fellows -Thanks, i have changed mock code as you mentioned 'def test_callAPI (self): url = 'http://localhost:1234' expected = EachLike({'class': ["HealthCheck"]}, minimum=1) pact.given ( 'the health of the system is OK' ).upon_receiving ( 'a request for the health check' ).with_request ( 'get', '/' ).will_respond_with (200, body=expected ) with pact: result = callAPI ( url ) self.assertEqual ( result, expected )' after doing this code change two things happened 1) mock was generated 2) even though mock creation successfull, there is error showing in mock it self *AssertionError: [{'class': ['HealthCheck']}] != <pact.matchers.EachLike object at 0x07244E90>*

thirumal.net
2018-08-01 07:07
if i execute the pact verifier same below errors are coming

thirumal.net
2018-08-01 07:07
* 1) Verifying a pact between consumer and provider Given the health of the system is OK a request for the health check with GET / returns a response which has status co de 200 Failure/Error: expect(response_status).to eql expected_response_status expected: 200 got: 403 (compared using eql?) 2) Verifying a pact between consumer and provider Given the health of the system is OK a request for the health check with GET / returns a response which has a matchin g body Failure/Error: expect(response_body).to match_term expected_response_body, diff_options Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8 1 interaction, 1 failure *

matt.fellows
2018-08-01 07:14
Please avoid posting all of this to general, at the very least keep it contained to a thread. Let?s move it to Pact Python - it?s not something everyone can help with

thirumal.net
2018-08-01 07:20
Sorry @matt.fellows. sure, Lets move to pactpython .i have asked the same question over there .

oswald.quek
2018-08-01 08:44
@bethskurrie thanks. maybe the solution is to have an option to disable can-i-deploy on a deploy of the provider if we know nothing has changed.

bethskurrie
2018-08-01 09:07
@oswald.quek you say "C. sets a new version for the provider" What are you using for your version number? Do you have a build number in there?

bethskurrie
2018-08-01 09:12
Which tags does your provider verify?

bethskurrie
2018-08-01 09:12
Just so you don't have to wait another day for me to reply, I'll give you a couple of potential problems/fixes.

bethskurrie
2018-08-01 09:14
Your provider should be configured to verify `test`, `staging`, `production` (and `master` if that's what you call your main development branch). Also, your version number should not contain a build number. I'll see if I can work out how to explain this.

bethskurrie
2018-08-01 09:18
If you are changing the provider version with every build, but you aren't verifying the test/staging/production pacts with every build, you won't have a verification result that links those versions of the consumer with the latest provider.

bsayers
2018-08-01 09:27
Feel free to direct me to the right place to ask this if in here is wrong: We recently had an incident that spawned a debate on what is and is not the responsibility of Pact to detect. The incident was caused by a client who set the request content type header to ?application/json? (which by default has an encoding of utf-8) but it then encoded the request body using a different charset (ISO-8859-1). When the consumer side tests using pact were run they passed and recorded a pact file, but at this point the charset of the request body had been changed by pact as it saves the body within a utf-8 encoded json file, so we are not able to detect this issue via the pact file. So with green pact tests we deployed and the production provider rejected the requests with a http 400 response. So my question is should Pact be responsible for failing on the consumer side when the requests content encoding and the request body encoding do not match? Or should Pact be recording the requests more precisely (a much bigger deal as changing the pact format is hard)? What is the philosophy on what Pact should and should not be validating?

bethskurrie
2018-08-01 09:29
That's a tricky one. Ideally, I'd like to say Pact could catch that, but we often have issues with anything that's not UTF-8 encoded.

bethskurrie
2018-08-01 09:30
TBH, I thought application/json had to be UTF-8 encoded.

bethskurrie
2018-08-01 09:30
I'm quite willing to be corrected on that though.

bethskurrie
2018-08-01 09:31
I suspect the answer is, it would be great if it could, but it may be too technically difficult.

bethskurrie
2018-08-01 09:32
I don't think you can mix file encodings, so having a ISO-8859-1 encoded body inside a UTF-8 pact file would seem impossible to me.

bethskurrie
2018-08-01 09:33
Maybe we should detect and warn about that scenario.

bsayers
2018-08-01 09:39
I agree detecting it on the provider side via a pact file is difficult, you?d have to find a way of encoding the file without losing the information. I can imagine options where the encoding that was used is saved separately and the pact replay mechanism knows how to reproduce that encoding during verification. What are your thoughts on detecting this on the consumer side? Should pact attempt to detect bad requests based on basic knowledge of http?

bethskurrie
2018-08-01 09:39
If you can suggest some reasonable logic, I'd be ok with adding it.

bethskurrie
2018-08-01 09:40
Could your scenario have been detected on the consumer side though? If it was a default, rather than an explicit encoding?

bsayers
2018-08-01 09:41
In our case the logic that rejected the request came from a framework rather then provider specific code

bethskurrie
2018-08-01 09:42
We could warn "hey, you're using something that's not utf-8 and that's not normal", but there's nothing apart from convention to make that warning on.

bsayers
2018-08-01 09:42
So some generic sever code looked at the request and decided it was invalid

bsayers
2018-08-01 09:44
That might prevent some incidents, although our experience tells us warnings are ignored more often then not.

bethskurrie
2018-08-01 09:44
I agree.

bethskurrie
2018-08-01 09:45
I would never suggest that contract tests can or should be able to identify every integration issue - I think in this case, if you think it's worth trying to come up with a technical solution, we can raise a card for it, or we can say, the effort required for adding this is not proportional to the risk of not having it.

bsayers
2018-08-01 09:50
Ok so your main concerns are around cost and complexity of implementing such checks

bsayers
2018-08-01 09:51
You are ok with the idea of Pact ensuring requests are valid in terms of http in principal

bsayers
2018-08-01 09:51
Have I got that right?

bethskurrie
2018-08-01 09:51
Yes, I think so. Others may disagree!

bethskurrie
2018-08-01 09:51
In principle, I'd like to see encoding faithfully represented, however, I'm unsure of the effort/reward ratio.

bsayers
2018-08-01 09:53
Hmm I see a difference between capturing the request faithfully vs detecting the request is no good up front and just refusing to record it

bsayers
2018-08-01 09:53
Do you have a preference?

bethskurrie
2018-08-01 09:54
Yes - the second one is much easier!

bethskurrie
2018-08-01 09:54
Seeing as you're the first team who has encountered this issue that we know of, I'd say the effort/number of people affected ratio is much better for the second option.

bethskurrie
2018-08-01 09:57
Gtg, but can chat more later.

matt.fellows
2018-08-01 11:08
hi all, I?d like to announce that I?ll be in the US later this year for re:Invent: - San Francisco: 19th-24th November - Las Vegas: 25th Nov - 1st Dec (re:Invent) The plan is to get to a few meetups in SF and also to run some hands-on workshops. If anybody would like to catch up, attend a workshop or digitally hangout in a local timezone, please DM me - I?d :heart: to chat! (P.S. I?m one of the core contributors and are in constant comms with other core contributors, in case you were thinking ?who the **** is that guy??)

hstene
2018-08-01 11:16
Very cool!

mats.lundkvist
2018-08-01 15:26
@bethskurrie right now we're doing it manually but I'll have a look after my vacation, thank you for the help :)

oswald.quek
2018-08-01 15:37
when I say "C. sets a new version for the provider", I lie! it's just the git commit sha of the latest commit. in this case, it happens there were new commits (non-API related) on the provider side.

oswald.quek
2018-08-01 15:41
actually, i'm not sure why step 4 worked for me. even though i rebuilt the provider here, i'm not sure how can-i-deploy gave it the green light for the provider to be deployed? (we're asking the pact broker whether we can deploy the provider where the tag is "test")

oswald.quek
2018-08-01 15:46
because when i rebuilt the provider (which runs the provider tests), it fetches the consumer pact where tag is "master" and presumably publishes verification where the tag is "master". so I don't know how it got deployed to the test environment, because we're asking can-i-deploy whether we can deploy the provider where the tag is "test"

oswald.quek
2018-08-01 15:47
when you say my provider should be configured to verify `test`, `staging`, `production` and `master` should that be happening in step 4 where I run the provider build?

balthasarbiedermann
2018-08-01 18:28
has joined #general

tushar.gavhane
2018-08-02 04:05
has joined #general

bethskurrie
2018-08-02 07:13
Yes.

bethskurrie
2018-08-02 07:13
That's your problem.

bethskurrie
2018-08-02 07:14
If you only verify master, then there is no verification result between the current test, staging or production consumer versions.

bethskurrie
2018-08-02 07:14
So can I deploy will return false.


oswald.quek
2018-08-02 08:36
yes that makes sense! thanks for all your help.

bethskurrie
2018-08-02 08:37
Np

fatih.kuyucuoglu
2018-08-02 09:35
has joined #general

fatih.kuyucuoglu
2018-08-02 10:06
Hi all, I have a question about the @PactFilter annotation. I need to run a method after a specific state in provider test. In my case the only way to do this is separating the test states in different test classes and using @After annotation for that specific state. Anyway, to get this behaviour, I use the @PactFilter. Everything works fine, but the verification results are not published, I get this message "Skipping publishing of verification results as the interactions have been filtered". Is it possible to publish the verification results of filtered states? If I can not publish the verification results, what is the goal of @PactFilter annotation? Thanks in advance for your support :slightly_smiling_face:

shekharsp27
2018-08-02 10:37
@fatih.kuyucuoglu are you using latest version of pact?

fatih.kuyucuoglu
2018-08-02 10:47
Hi Shekhar i am using the version, which is https://github.com/DiUS/pact-jvm here given as latest. So: Version 3.5.19

uglyog
2018-08-02 10:47
The provider states support a teardown call, which will be invoked afterwards. But it is not implemented for JUnit. Maybe raise an issue for this.

uglyog
2018-08-02 10:58
If the test execution is filtered, the verification results will not be published. This is because the verification status is for the entire pact file.

fatih.kuyucuoglu
2018-08-02 11:05
Hi uglyog thanks for the quick answer. :slightly_smiling_face: Could you give me some clue, starting point, i would like to try to find a solution for that. I will create also an issue.

balthasarbiedermann
2018-08-02 12:30
I'm planning to implement a Kotlin DSL for Pact. My current proposal is in the #pact-jvm channel: https://pact-foundation.slack.com/archives/C9UN99H24/p1533212507000007 *Feedback is very much appreciated*

mark.bridgett
2018-08-02 14:10
Anyone here use the pact-stub-server much?

matt.fellows
2018-08-02 21:10
I use it, what's up?


uglyog
2018-08-02 22:55
It will need to change to support a teardown call afterwards

sethimudit2002
2018-08-03 06:35
has joined #general

fatih.kuyucuoglu
2018-08-03 09:59
Thak you for the answer, i will look at this.

cparrish
2018-08-03 18:42
has joined #general

liran.tal
2018-08-05 18:03
I only put a build number in the version to transfer the pact contract from the unit/integration testing phase to the CI which needs to pull it again from the broker for E2E, when that?s done the contract with the build number as version becomes useless and I tag it as ?development? or ?production? and the consumer?s version which is semver (i.e: 2.1.0). any webhook triggers I will have will only work on the ?development? and ?production? contracts which use actual consumer version, never a build version.

liran.tal
2018-08-05 20:36
where-as the recommended pattern on the consumer side is to create the contracts during unit testing of the consumer?s http client implementation, I wonder what is the recommended approach on doing API testing on the consumer side (think `supertest` or `spring test mvc`) ? anything else beyond just mocking the http client call at that phase ?

dhanarajvallabhuni
2018-08-05 20:54
has joined #general

bethskurrie
2018-08-05 23:10
I think the answer is "whatever works for your situation". I've worked on MS where we didn't mock anything, and other services where we provided mock implementations of certain classes, and others where we used standard mocking frameworks.

david.dyke
2018-08-06 06:30
has joined #general

sgarvey
2018-08-06 11:22
has joined #general

tcanascimento
2018-08-07 14:28
has joined #general

emre.duendar
2018-08-07 14:35
has joined #general

joshua.haney
2018-08-07 15:39
has joined #general

liran.tal
2018-08-07 19:26
to clarify, when I said API testing I referred to integration tests (not e2e test for the server-side). - when you say one option was to not mock anything do you mean you used CDC to make a real request and return stubbed responses? I?m thinking that I can re-use the same mocks that will be used for the unit test in the integration tests.

conallbennett
2018-08-07 22:12
has joined #general

rabih
2018-08-08 09:16
has joined #general

rabih
2018-08-08 09:23
Hello, I am using pact for contract testing for our microservices built in golang. I have added some integration tests in a consumer and added build integration tests to CircleCI. I am using hosted pact broker http://pact.dius.com.au. The issue is that the tests are running without updating the contracts in the broker. Any help regarding this issue or any one have worked with integrating pact with CircleCI :question:

antonello
2018-08-08 09:25
I imagine your code is explicitly publishing your pacts?

rabih
2018-08-08 09:39
after adding the interactions, yes I am publishing pacts with the pact broker settings

antonios.klimis
2018-08-08 09:41
has joined #general

rabih
2018-08-08 10:53
ci config : service-integration: <<: *defaults environment: PACT_BROKER_HOST: ?https://.http://pact.dius.com.au/? PACT_BROKER_USERNAME: ?? PACT_BROKER_PASSWORD: ?? steps: - checkout - setup_remote_docker - run: name: Authenticate with GCR command: | docker login -u _json_key -p ?${}? https://eu.gcr.io - run: name: Create source volume command: | docker create -v ${CIRCLE_WORKING_DIRECTORY} --name source alpine:3.7 /bin/true docker cp ./ source:${CIRCLE_WORKING_DIRECTORY} - run: name: Running integration tests command: CONTAINER_NAME=service-integration make integration - run: name: Copying integration test results command: docker cp service-integration:${CIRCLE_WORKING_DIRECTORY}/test/. ./test - store_test_results: path: ./test destination: test - store_artifacts: path: ./test destination: test

antonello
2018-08-08 12:02
What do your logs say when the tests run?

rabih
2018-08-08 12:22
Consumer: ^@^@Running tests: === RUN TestGetTriggers --- PASS: TestGetTriggers (0.00s) === RUN TestGetTriggerByID --- PASS: TestGetTriggerByID (0.00s) === RUN TestGetTriggerByStatus --- PASS: TestGetTriggerByStatus (0.00s) === RUN Test_pactTriggerControlConsumer_CreateTriggerEvent --- PASS: Test_pactTriggerControlConsumer_CreateTriggerEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerCancelledEvent --- PASS: Test_pactTriggerControlConsumer_TriggerCancelledEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerDeletedEvent --- PASS: Test_pactTriggerControlConsumer_TriggerDeletedEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerErroredEvent --- PASS: Test_pactTriggerControlConsumer_TriggerErroredEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerFailedEvent --- PASS: Test_pactTriggerControlConsumer_TriggerFailedEvent (0.00s) === RUN Test_pactTriggerControlConsumer_TriggerCompletedEvent --- PASS: Test_pactTriggerControlConsumer_TriggerCompletedEvent (0.00s) === RUN TestPactProvider --- PASS: TestPactProvider (0.00s) PASS ok

rabih
2018-08-08 12:23
provider: ^@^@Running tests: === RUN Test_pactTriggerControlProvider_Verify --- PASS: Test_pactTriggerControlProvider_Verify (0.00s) PASS ok

matt.fellows
2018-08-08 12:28
Can you please share your test code? You need to explicitly set the verification to true

matt.fellows
2018-08-08 12:32
When you say "not updating in the broker" what do they mean. Contracts aren't being published from the consumer? Verification status not updating from the provider?

rabih
2018-08-08 12:43
both, contracts are not being updated or published and the verification status not updated

rabih
2018-08-08 12:59
req := types.PublishRequest{ PactURLs: []string{filepath.ToSlash(fmt.Sprintf(?%s/triggerconsumer-controlprovider.json?, pactDir))}, PactBroker: os.Getenv(?PACT_BROKER_HOST?), BrokerUsername: os.Getenv(?PACT_BROKER_USERNAME?), BrokerPassword: os.Getenv(?PACT_BROKER_PASSWORD?), ConsumerVersion: ?1.0.0?, Tags: []string{?latest?}, }

rabih
2018-08-08 12:59
pact.VerifyMessageConsumer(t, message, triggerCompletedHandlerWrapper) p := dsl.Publisher{} err := p.Publish(getRequest())

codypumper
2018-08-08 13:10
has joined #general

liran.tal
2018-08-08 13:10
@rabih on the consumer side, I advise to only do contract testing for unit testing the http client

rabih
2018-08-08 13:13
we are using it also for Message Queue integration testing

liran.tal
2018-08-08 13:17
MQ or HTTP, you probably want to unit test both. do you create the contracts through unit tests or integration tests ?

rabih
2018-08-08 13:20
through integration tests

liran.tal
2018-08-08 13:21
can you share more on how you do integration tests? are you actually hitting some endpoint to trigger the flow?

rabih
2018-08-08 13:22
when testing it without CI it is working, when the CircleCI build runs it is not


liran.tal
2018-08-08 13:26
that doesn?t say much about how you are actually running and what you?re doing in integration tests. the problem is in the terminology - people mean different things when they say integration testing.

liran.tal
2018-08-08 13:27
regardless though, my input for you would be that you might be hitting 2 different providers in a single integration test flow and I noticed that this complicate and couples the flow

smuthaiah
2018-08-08 16:42
has joined #general

mbudde
2018-08-09 08:46
has joined #general

richard.hulm
2018-08-09 09:13
has joined #general

rabih
2018-08-09 15:24
the issue is resolved, by adding pact cli tools in the docker image

rabih
2018-08-09 15:24
however, I am getting this issue now unable to convert consumer test to a valid JSON representation: error creating message: exit status 127 STDERR: /go/lib/ruby/bin/ruby: line 6: /go/lib/ruby/bin.real/ruby: No such file or directory STDOUT:

rabih
2018-08-09 15:27
however, I am getting this issue now unable to convert consumer test to a valid JSON representation: error creating message: exit status 127 STDERR: /go/lib/ruby/bin/ruby: line 6: /go/lib/ruby/bin.real/ruby: No such file or directory STDOUT:

bethskurrie
2018-08-09 21:57
@rabih please ask questions about pact-go in the #pact-go channel.

bethskurrie
2018-08-09 21:59
Also, if you can provide a executable example, you will get better help.

such.su
2018-08-10 07:37
:wave:Does anyone know whether pact-python provides a matcher for matching or ignoring an object key?

bethskurrie
2018-08-10 08:26
In the consumer or provider?

bethskurrie
2018-08-10 08:27
You must specify all keys on the consumer side, and any key you don't specify will be ignored on the provider side.


such.su
2018-08-10 09:25
To be accurate, my question is exactly the same as this one - https://stackoverflow.com/questions/48317108/pact-python-matching-keys-in-response

bethskurrie
2018-08-10 11:49
This is not yet supported in python.

gergia
2018-08-10 17:06
has joined #general

davidmichaelkarr
2018-08-10 18:05
I haven't done much with pact-jvm yet, but I have a question about the json pact file. Our team has a different convention for the name of the pact file, and they've designed this somewhat messy AfterClass method that they want everyone to put in their tests, to rename the file. Is there a cleaner way to do this?

uglyog
2018-08-11 03:18
You can override it in code by extending the Pact model class. There is no configuration for the filename.

gaurav
2018-08-11 11:34
In defining mock for `BigDecimal`, I set type as decimal: `.decimalType("amount", new Decimal(100))`.. but on provider side (I am using mockMvc), it fails with `$.result.parent.0.child.0.amount -> Expected 100 to be a decimal number`. I am pretty sure that on provider side, `amount` in model is `BigDecimal` type. Should I set different type in mock definition? Anything I am doing wrong? Thanks.

gaurav
2018-08-11 13:11
Stacktrace for :point_up:

gaurav
2018-08-11 14:28
Changing to `numberType` worked!

simon.nizov
2018-08-12 09:00
has joined #general

liran.tal
2018-08-12 14:16
is it possible to define multiple responses (meaning they span across multiple requests made) for a single interaction? the purpose is to test API interactions like pagination or continuation tokens

liran.tal
2018-08-12 14:17
admittedly this is probably more of an internal test where I?d just mock the entire request entirely but having them on the same test suite (both mocking the request being made as well as not mocking it and doing an actual request to CDC) feels awkward a bit

liran.tal
2018-08-12 14:18
probably best practice is to mock this internally, let me know if you feel otherwise

antonello
2018-08-12 14:52
@liran.tal IMHO - even if you were able to specify multiple request/responses for one interaction with pact - it wouldn?t be a good idea. I?m not sure if this is what you mean when you say ?mock internally?, but I would simply have separate interaction and use the provider state for each one to make sure that you set up the state in the provider so that it returns what you need in each case.

liran.tal
2018-08-12 15:14
that?s what I?m saying too basically.. it?s more about testing internal handling (the consumer ms) of bulk requests. Not sure though what you meant about the provider state, because basically this is a single test case.

antonello
2018-08-12 15:19
Could you give an actual scenario of what the test is just to make sure I understand unambiguously?

antonello
2018-08-12 15:28
To me it sounds like you want to test a session in a single test.

liran.tal
2018-08-12 15:37
yeah of course. the use-case is where my provider has an API to get a list of items but I can?t request more than 10 in one request, so if I want to request 20 item ids I need to split that to sending 2 requests of 10.

antonello
2018-08-12 15:43
How different is the second request from the first one? I assume both responses will have the same contract.

liran.tal
2018-08-12 15:46
exactly. that?s why I?m saying it?s probably an internal logic test for the consuming microservice

antonello
2018-08-12 15:54
If the two requests are different though, there may be a case for some contract testing. It?s difficult to say without an actual example.

liran.tal
2018-08-12 16:52
while I see that query param arrays are supported through `query: { ids: ['1', '2'] }` which translates to `/someapi?ids=1&ids=2` is it possible to specify a query param array list with the [] notation? i.e: `/someapi?ids[]=1&ids[]=2` ?

bernardo.guerreiro
2018-08-12 19:43
has joined #general

wilkin4
2018-08-12 19:56
has joined #general

david.j.smith
2018-08-12 20:17
Scala-Pact versions `2.2.5` (SBT 0.13.x) and `2.3.2` (SBT 1.x) released. http://io.itv.com/scala-pact/change-log.html

bethskurrie
2018-08-13 00:03
Nice work @david.j.smith

bethskurrie
2018-08-13 00:05
Hm. With which implementation @liran.tal?

bethskurrie
2018-08-13 00:05
Anything that wraps the ruby expects array param names to have square brackets at the end.

lindblad.n
2018-08-13 07:26
has joined #general

liran.tal
2018-08-13 07:59
I?m referring to the javascript/node implementation. maybe @matt.fellows knows more about how to specify an array for the `ids[]=1` type of notation

such.su
2018-08-13 08:30
Got it. Thanks.

matt.fellows
2018-08-13 11:33
Ah, there was an issue with this. I?ll dig it up

liran.tal
2018-08-13 11:35
ahh thanks

liran.tal
2018-08-13 11:35
for now I just hardcoded `query: 'id[]=1'` but would like to find a fix for it which allows me to dynamically compose the query with use of matchers


matt.fellows
2018-08-13 11:36
It might not be obvious, but the `eachLike` matcher works here - it?s an array too!

matt.fellows
2018-08-13 11:36
so something like ``` describe.only("get /dogs using builder pattern", () => { before(() => { const interaction = new Interaction() .given("I have a list of dogs") .uponReceiving("a request for all dogs") .withRequest({ method: "GET", path: "/dogs", headers: { Accept: "application/json", }, query: { param: eachLike("1"), }, }) .willRespondWith({ status: 200, headers: { "Content-Type": "application/json", }, body: EXPECTED_BODY, }); return provider.addInteraction(interaction); }); ``` should work

liran.tal
2018-08-13 11:37
not quite. this will create an expected interaction of query being like `param=1&param=2` which will not be compatible with my request using square brackets: `param[]=1&param[]=2`

liran.tal
2018-08-13 11:37
unless I?m mis-reading that issue (it?s quite long so maybe I missed something)

matt.fellows
2018-08-13 11:41
Hmm, let me doubl check this

matt.fellows
2018-08-13 11:47
you?re right.

matt.fellows
2018-08-13 11:47
so if you want the array notation, you can do this: ``` query: { 'param[]': eachLike("1"), }, ```

liran.tal
2018-08-13 11:56
thanks! I?ll try and will add to my to do list to update the docs and code examples for it

nathanrobert.smith
2018-08-13 12:34
has joined #general

matt.fellows
2018-08-13 13:16
That?d be amazing, thanks!!

amitojduggal
2018-08-13 14:47
has joined #general

antonello
2018-08-13 15:58
Hi all! One of the ?buts? that it?s often brought up when I talk to people about pact is: ?_But how do you make sure that the responses that you expect are up to date? What if you forget to add a field that you?ve recently started consuming?_? My usual answer is ?_There is no guarantee that you won?t forget, but it?s like adding any other type of test. If you forget to write a test for a specific scenario, you won?t be covered for that. It?s a matter of discipline, mixed with code inspections such as code reviews_?. However, I can understand why it may be useful to have some kind of mechanism to help you catch cases in which you forget to update your expected responses. The only way that I can think of, if for example you are lucky/unlucky enough to have some functional tests that mock provider responses, is to use the same responses for those tests and for your consumer pact tests. I am playing in my mind with the above idea and it would be very simple to achieve if your expected pact responses were json objects (which will certainly be if you?re using `pact-js`). However, it gets a little more complicated if you?re using matchers, in which case you would have to perform some kind of _reification_, similarly to what?s done here: https://github.com/pact-foundation/pact-support/blob/master/lib/pact/reification.rb What do people think? Any reason why it may be a bad idea? Finally, should we want to port the reification logic, would you have recommended approaches?

liran.tal
2018-08-13 16:31
I hear you but I think your response to that was well put. Pact doesn't protect you from forgetting and it's not its goal and I'm concerned you might be complicating it too much if you'll try to do it

harris.osserman
2018-08-13 16:54
has joined #general

david.j.smith
2018-08-13 17:04
@antonello To go to the original question: ```"But how do you make sure that the responses that you expect are up to date? What if you forget to add a field that you've recently started consuming?"``` If you?re testing your client code correctly in your consumer tests**, and verifying the pacts against the provider? this should not be possible? (** This might be easier in a statically typed language because you would typically deserialise into a real Type, which is a way of proving that all the fields you expect are indeed there? - perhaps that?s what you meant by reification?)

antonello
2018-08-13 18:35
@david.j.smith That makes complete sense, it?s what the documentation recommends, but, as you say, it?s not easy in JavaScript, if at al possible. You may need to go quite high up the stack to actually have a degree of certainty, which would be impractical and make the tests quite complicated.

can
2018-08-13 18:39
Hey @antonello - As you know, my mission here is to Kotlin everything. Though I haven't used Kt/JS interop, it might make testing JS a little easier?

antonello
2018-08-13 18:41
It is the language of the application code that matters. Unless the front-end teams decide to re-write them or parts of them in kt, it probably won?t help. Typescript has started to be used though, which will help in the long term.

antonello
2018-08-13 18:46
Talking about js consumers, in order to test them you probably end up repeating mocked responses a lot. So having a way of removing the repetition and the pain of having to update responses in multiple places when they change would be something positive, imho. For the same reasons you?d want to use builders in strongly typed languages.

codypumper
2018-08-13 20:31
Our team has been able to use Typescript to define a type, then create an "expected object" of that type (letting the linter check for properties/types). Then, before creating the interaction, we take that expected object, and loop through its properties to apply the matchers and create yet another object which then gets passed to the Pact interaction.

antonello
2018-08-13 21:01
Interesting! Would you be able to provide an example?

abubics
2018-08-14 02:05
The pattern I use (and recommend) is to have a connector that converts the api client model (on-the-wire data model) into a application domain model, and asserting that it has the right shape and types in the Pact test. This lets Pact focus on the transport verification (in `given` and `when`), and the unit test focus on domain verification (the `then` part).

abubics
2018-08-14 02:06
How strict you want to be about types, etc, is up to the application developers. You can use typescript of flowtypes or whatever if you want better safety :slightly_smiling_face: All these concerns should be decoupled

paul.davies
2018-08-14 03:31
has joined #general

paul.davies
2018-08-14 04:18
Hi all, I'm pretty new to Pact and have checked the Stack Overflow but no luck with my problem. I'm having an issue with a Date query parameter which is handled by a DateTime argument resolver at runtime. When debugging my application I can hit the endpoint with this command: GET http://localhost:9090/plan/master/active?from_start_date=2018-08-01T22:00:00.000Z and I can see the date has been correctly interpreted, however when I run my Pact Provider test, which has this in the Pact contract:

2018-08-14 04:18
This message was deleted.

paul.davies
2018-08-14 04:18
~The date comes through as null~

bethskurrie
2018-08-14 04:19
Hi @paul.davies You'll get more focussed help if you ask in the channel for your language.

paul.davies
2018-08-14 04:19
Ah right, thanks. It'll be Java - I'll post there. Cheers!

antonello
2018-08-14 06:04
@matt.fellows What are your thoughts on this?

antonello
2018-08-14 08:06
@david.j.smith By reification in this context, which is what the class in the link does, I mean taking a body with matchers and transform the matchers into a response body without matchers.

simon.nizov
2018-08-14 08:18
Hi! Newcomer here. This project looks incredible so far :smile: I noticed that there is a LOT of useful ?theoretical? information present in the pact-ruby github wiki that I feel should be in the general docs at http://pact.io. For example, took me a while before I found this: https://github.com/pact-foundation/pact-ruby/wiki/Provider-states which was very helpful to understand how provider verification works. I realize this probably happened because the ruby project was the first to be developed. Is there a plan to move this into the general docs? I can help out with the dirty work if someone can guide me on where to put things.

bethskurrie
2018-08-14 08:42
Hi @simon.nizov you're right about the ruby project having the documentation first, but most of it should have been migrated. For example, here are the provider state docs https://docs.pact.io/getting_started/provider_states

bethskurrie
2018-08-14 08:42
If there are things missing, please do let us know so we can move them. Always happy to accept PRs for improving the docs.

simon.nizov
2018-08-14 08:48
Ahh.. weird that I missed that one. I?ll keep an eye out, thanks!

david.j.smith
2018-08-14 09:03
Interesting. I had a similar idea ages ago? thanks for the description!

antonello
2018-08-14 09:09
That is exactly what?s done when a pact file is written. The matchers are stripped out, replaced by an example and matchers sections added to the pact json.

amitojduggal
2018-08-14 11:38
Hello guys, want to know what scheme or workflows everyone is using for the service that is being consumed by the UI interfaces and not by another service. For example, Provider: P Consumer: UI Interface. So the provider tests will be kept in the codebase for "P" but what about the Consumer Test, which service repository should those be kept in? if its an app. Should those be kept as part of android/ios code base?

matt.fellows
2018-08-14 12:24
Tests belong with their code

matt.fellows
2018-08-14 12:26
That's a good starting point unless you have a good train not to

matt.fellows
2018-08-14 12:28
Help is always welcome though, and that website is fully managed in GitHub. If you see small things feel free to send a PR but for big things maybe have a chat in #documentation first

simon.nizov
2018-08-14 12:30
Already did a couple of days ago :wink: https://github.com/pact-foundation/pact.io/pull/58

simon.nizov
2018-08-14 14:52
Is there a way to share matchers between services? Imagine you have domain-specific rules that you?d like to use as matchers across multiple services, written in different languages. For example, the ID of a quote must start with ?Q-?.

codypumper
2018-08-14 14:56
Sure! Our metadata call tests call that responds with our "MetadataRes" type: ```// Metadata for SS35538_35538_29885250, "If the Color Changes" const expectedMetadataObject: MetadataRes = { 'title': 'If the Color Changes', 'category_name': '', 'icc_profile_loc': null, ... } // We want to use Pact to verify the types of the properties on the response let matcherMetadataObject = {} Object.keys(expectedMetadataObject).forEach( (key) => { matcherMetadataObject[key] = Matchers.somethingLike(expectedMetadataObject[key]) })``` Where `expectedMetadataObject` is a sample object of that form. And in this case we're testing the form of the top level properties on the response, so we loop through the values, and add matchers for each one to `matcherMetadataObject`, which is then used in: ``` willRespondWith: { status: 200, headers: { 'Content-Type': 'application/json' }, body: matcherMetadataObject }```

codypumper
2018-08-14 14:58
The `MetadataRes` type is used for this response within our app, so expectations of properties are pretty solid and consistent

codypumper
2018-08-14 14:59
@simon.nizov Something like a shared Regex library could handle that pretty well?

simon.nizov
2018-08-14 15:00
What if the services are written in different languages?

antonello
2018-08-14 15:06
:thumbsup:

antonello
2018-08-14 15:13
@codypumper if you?re applying a `somethingLike` to all properties, why not just decorate the whole object with `like`?

sandeep.seshadri
2018-08-14 15:18
has joined #general

matt.fellows
2018-08-14 22:52
:ok_hand:

dagarwal
2018-08-15 06:42
Hi ,is it possible to create interactions in JS like this ?matchingRules?: { ?$.query.var1[0]?: { ?match?: ?regex?, ?regex?: ?.*? }, ?$.query.var2[0]?: { ?match?: ?regex?, ?regex?: ?.*? },

dagarwal
2018-08-15 06:42
what should i pass in var 2 that my two api calls are successful


dagarwal
2018-08-15 06:43
Is it possible to do by provider states?