matt.fellows
2020-08-11 07:18
has joined #spring-cloud-contract

nodirbek
2020-08-11 07:18
has joined #spring-cloud-contract

nodirbek
2020-08-11 09:39
Thx Matt

nodirbek
2020-08-11 09:41
Guys do you know, if there is a possibility to annotate or tag the generated tests (generated by spring cloud contract verifier)?

matt.fellows
2020-08-11 10:13
Annotate in a way that makes it obvious it came from SCC?

matt.fellows
2020-08-11 10:14
I?m not away that you can do it in SCC, but you could easily add it to the metadata section of the JSON document before uploading to the broker

matt.fellows
2020-08-11 10:14
unless you actually mean these tags: https://docs.pact.io/pact_broker/tags#docsNav

matt.fellows
2020-08-11 10:14
in which case, yes

heytaco
2020-08-25 03:57
has joined #spring-cloud-contract

heytaco
2020-08-25 03:57
Hi there! My name is HeyTaco!, and you can use me to give people tacos to show your appreciation. My tacos will spread joy through Slack!

robert.strehli
2020-08-27 14:40
has joined #spring-cloud-contract

sarajcarbajal
2020-09-17 20:31
has joined #spring-cloud-contract

darshan
2020-10-28 13:11
has joined #spring-cloud-contract

simone.cusimano92
2021-01-19 10:07
has joined #spring-cloud-contract

akos.csurai
2021-03-11 10:12
has joined #spring-cloud-contract

dmitry.korolev
2021-04-06 11:49
has joined #spring-cloud-contract

marcin.grzejszczak
2021-04-29 06:41
has joined #spring-cloud-contract

marcin.grzejszczak
2021-04-29 06:41
I think I should join this channel :wink:

matt.fellows
2021-04-29 06:47
Seems relevant!

matt.fellows
2021-04-29 06:47
Maybe we could setup a Q&A?

marcin.grzejszczak
2021-04-29 07:02
sure, I mean if anyone has any questions I'll be happy to answer them

marcin.grzejszczak
2021-04-29 07:02
I haven't gone through the comparison page yet :disappointed:

marcin.grzejszczak
2021-04-29 07:03
BTW I would really love to meet you in person @matt.fellows :slightly_smiling_face: I really regret that I didn't have this opportunity just yet. The whole Pact team does a great job in propagating the contract testing approach. Great work and congratulations.

matt.fellows
2021-04-29 07:39
Likewise! If/when travel ever resumes I hope we can!

kurst03
2021-05-30 20:06
has joined #spring-cloud-contract

tylerkron
2021-07-19 02:30
has joined #spring-cloud-contract

marcin.grzejszczak
2021-07-19 11:42
FYI the upcoming `3.1.0-M1` Spring Cloud Contract will support Pact `4.1.23` . We can't support Pact `4.2.x` cause its baseline is java11. We should do it for Contract `4.0`.

matt.fellows
2021-07-19 14:12
Very cool! cc @uglyog @michael.branders

marcin.grzejszczak
2021-07-19 17:19
Meh, after upgrading to the latest 4.1.x I can't seem to programatically fetch pacts

marcin.grzejszczak
2021-07-19 17:21
this is the log I have from communicating with the broker


marcin.grzejszczak
2021-07-19 17:22

marcin.grzejszczak
2021-07-19 17:23
and this is the producer that can't fetch the pact from the broker https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/producer_pact - you can just run `./mvnw clean install` in one or the other

marcin.grzejszczak
2021-07-19 17:23
this is the published Pact ```{ "provider": { "name": "beer-api-producer-pact" }, "consumer": { "name": "beer-api-consumer-pact" }, "interactions": [ { "_id": "cf7c01f93ae7a216d6f4b6746bb04502b026792a", "description": "Represents a successful scenario of getting a beer", "request": { "method": "POST", "path": "/check", "headers": { "Content-Type": "application/json;charset=UTF-8" }, "body": { "name": "marcin", "age": 25 } }, "response": { "status": 200, "headers": { "Content-Type": "application/json;charset=UTF-8" }, "body": { "status": "OK" } }, "providerStates": [ { "name": "" } ] }, { "_id": "d35b961335e7b04b08d48b8320ecbc26be584136", "description": "Represents an unsuccessful scenario of getting a beer", "request": { "method": "POST", "path": "/check", "headers": { "Content-Type": "application/json;charset=UTF-8" }, "body": { "name": "marcin", "age": 10 } }, "response": { "status": 200, "headers": { "Content-Type": "application/json;charset=UTF-8" }, "body": { "status": "NOT_OK" } }, "providerStates": [ { "name": "" } ] } ], "metadata": { "pactSpecification": { "version": "3.0.0" }, "pact-jvm": { "version": "4.1.23" } } }```

matt.fellows
2021-07-19 22:52
Cool. Looks like you?re on the latest pact broker

matt.fellows
2021-07-19 23:05
I?m wondering if the issue is using the tag `latest` (not recommended) @bethskurrie @uglyog any thoughts? :point_up:

bethskurrie
2021-07-19 23:07
has joined #spring-cloud-contract

uglyog
2021-07-19 23:07
has joined #spring-cloud-contract

matt.fellows
2021-07-19 23:08
I can see that pacts are being returned, here is the list of them: ``` "pb:pacts": [ { "href": "http://localhost:8085/pacts/provider/beer-api-producer-pact/consumer/beer-api-consumer-pact/version/0.0.1-SNAPSHOT", "title": "Pact between beer-api-consumer-pact (0.0.1-SNAPSHOT) and beer-api-producer-pact", "name": "beer-api-consumer-pact" } ],```

bethskurrie
2021-07-19 23:10
Using "latest" as a tag name shouldn't break anything, it's just semantically incorrect and potentially confusing.

bethskurrie
2021-07-19 23:12
What's not working @marcin.grzejszczak? The logs seem to show the links to the pacts are being returned as I would expect.


matt.fellows
2021-07-19 23:18
It uses the JVM `PactBrokerLoader` under the hood, so looks to be delegating there


bethskurrie
2021-07-19 23:30
Though, having said that, some versions of pact JVM do seem to have this thing where they use the tag "latest" to mean the overall latest pact (which is not actually a tag).

bethskurrie
2021-07-19 23:30
So maybe that is an issue.

marcin.grzejszczak
2021-07-20 05:22
So the problem is that the pact loader doesn't return any pacts

marcin.grzejszczak
2021-07-20 05:24
And this used to work with pact 4.0

bethskurrie
2021-07-20 05:52
It's a recent version of the broker :thinking_face: `X-Pact-Broker-Version: 2.80.0`

bethskurrie
2021-07-20 05:53
Have you genuinely got a tag called "latest"?

bethskurrie
2021-07-20 05:55
ok, here's the request for the pacts for verification:

bethskurrie
2021-07-20 05:55
```{"consumerVersionSelectors":[{"latest":true,"tag":"latest"}],"includePendingStatus":true,"providerVersionTags":["latest"]}```

bethskurrie
2021-07-20 05:55
And here's the response

bethskurrie
2021-07-20 05:55
```{"_embedded":{"pacts":[]},"_links":{"self":{"href":"http://localhost:8085/pacts/provider/beer-api-producer-pact/for-verification","title":"Pacts to be verified"}}}```

bethskurrie
2021-07-20 05:56
There is no pact with the tag "latest".

bethskurrie
2021-07-20 05:59
Fetching pacts just by tag name isn't really encouraged any more. We use "consumer version selectors" https://docs.pact.io/consumer_version_selectors

marcin.grzejszczak
2021-07-20 09:29
hmm there was a tag `latest` - at least I thought there was one

bethskurrie
2021-07-20 09:41
when you go to the "view latest tags" link in the broker, what does it show?

bethskurrie
2021-07-20 09:42
that's not a tag

marcin.grzejszczak
2021-07-20 09:42
ah

bethskurrie
2021-07-20 09:42
it's just saying "it is the latest"

bethskurrie
2021-07-20 09:42
you have no tags.

bethskurrie
2021-07-20 09:43
how are you getting your pacts into the broker?

marcin.grzejszczak
2021-07-20 09:43
that's what I supsected - I'm changing the code to not pass the tags

marcin.grzejszczak
2021-07-20 09:44
ok when I removed the tags it does work on the producer side

bethskurrie
2021-07-20 09:45
so, the jvm had a bit of a funny interface. It (at least it used to) if you put "latest" in the list of tags, it would return the overall latest pact, not the latest pact with the tag "latest".

marcin.grzejszczak
2021-07-20 09:45
yes that's what I did

marcin.grzejszczak
2021-07-20 09:45
and it stopped working

marcin.grzejszczak
2021-07-20 09:45
which is fine

bethskurrie
2021-07-20 09:45
yeah, it should never have worked :laughing:

marcin.grzejszczak
2021-07-20 09:45
:smile:


bethskurrie
2021-07-20 09:46
> Please note that in the Pact Broker (unlike Docker) the term "latest" is not a tag name itself - it's a dynamic reference to the most recently created resource, like "HEAD" in git. The URL `/pacts/provider/{provider}/consumer/{consumer}/latest` refers to pact for the most recently created pacticipant version. The same URL with `/{tag}` appended refers to the pact for the most recently created pacticipant version that has the specified tag. Some Pact-JVM implementations require you to put the key word "latest" in the list of tags for verification when you want the overall latest pact. This is just an implementation choice of that particular client, and does not mean that there is or should be a tag called "latest". Please do not use the tag "latest" or you will get very confused when talking about the "latest latest pact", which would have a URL of `/pacts/provider/Bar/consumer/Foo/latest/latest`!

marcin.grzejszczak
2021-07-20 09:47
:+1:

bethskurrie
2021-07-20 09:49
The new way to get the overall latest pact is to use the selector `{"latest": true}`

bethskurrie
2021-07-20 09:50
There are a bunch of selectors, and a few new ones will be added soon. You probably don't want to have to update your code each time, so if you're able to just allow arbitrary maps, it will make your life much easier.

marcin.grzejszczak
2021-07-20 09:50
I kind of allow it :wink:

bethskurrie
2021-07-20 09:51
Great. I'm about to raise an issue in all of the pact broker client libraries with this text, which will be relevant for you too.

bethskurrie
2021-07-20 09:51
> Add support for new consumer version selector keys > > Please add support for the following keys to be used in the consumer version selectors when fetching pacts for verification: > > ``` > { "deployed": true } > > { "released": true } > > { "environment": "<env name>" } > > { "deployed": true} > > { "released": true} > > { "deployedOrReleased": true } > ``` > > These keys can be used in various combinations ( eg. `{ "environment": "prod", released: true, consumer: "Foo" }` ). Please allow any combination of keys, and do not validate them locally, as the validation rules can change over time as support is added for new selectors - just ensure that any validation error returned from the API is shown clearly to the user. > > See https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown for the usage docs of each selector. > > As more selectors will be added over time, it's my preference that the consumer version selectors are not strongly typed, and are just passed through straight from the configuration object to the API, so that we don't have to make code changes to the Pact clients each time we add new selectors. (eg. there will be a new tag regex matching selector coming sometime). I understand that this is not compatible with the idioms of every Pact client language however, so do whatever you need to do to make the new selectors work elegantly within your language. > > Please update https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors/ for your language once the selectors have been released.

marcin.grzejszczak
2021-07-20 09:58
:+1:

phil.endsley
2021-07-28 22:41
has joined #spring-cloud-contract

mike.key
2021-08-02 03:01
has joined #spring-cloud-contract

mat.auburn
2021-08-04 08:21
has joined #spring-cloud-contract

marcin.baranowski953
2021-08-12 10:49
has joined #spring-cloud-contract

ringo
2021-09-01 06:29
has joined #spring-cloud-contract

matti.anusha
2021-11-03 16:17
has joined #spring-cloud-contract

yousafn
2022-04-29 14:39
has joined #spring-cloud-contract

orbit
2022-05-09 18:04
has joined #spring-cloud-contract

slacksync
2022-06-08 17:22
has joined #spring-cloud-contract

fabricio.mendes.ti
2022-07-12 16:37
has joined #spring-cloud-contract

glenn
2022-08-06 18:15
has joined #spring-cloud-contract

duynguyenptithcm
2022-08-20 07:26
has joined #spring-cloud-contract

orbit
2022-12-01 15:45
has joined #spring-cloud-contract

maciej.harapinski
2024-02-19 09:48
has joined #spring-cloud-contract