Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish verification results with a version tag in pact-jvm-provider-spring_2.12 #823

Closed
yoka791 opened this issue Dec 3, 2018 · 17 comments

Comments

@yoka791
Copy link

yoka791 commented Dec 3, 2018

Hi,
When I want to publish verification results to my pact broker I have to add:

pact.verifier.publishResults=true

alongside with the provider version:

pact.provider.version=0.0.1

My question is: How do I specify the provider tag?
I haven't seen an option to do that in pact-jvm-provider-spring or in pact-jvm-provider-junit..

@uglyog
Copy link
Member

uglyog commented Dec 3, 2018

That is a good question. The way the verifications work is they publish the results back based on the pact URL that was fetched for the test. So when you specify the tag in the test, this will point to a version of the pact file (tags are just labels to a pact file version), and the verification will be posted back against that version.

That is my understanding, but @bethesque is probably the only person who really understands this stuff.

@uglyog uglyog added the question label Dec 3, 2018
@yoka791
Copy link
Author

yoka791 commented Dec 3, 2018

That is a good question. The way the verifications work is they publish the results back based on the pact URL that was fetched for the test. So when you specify the tag in the test, this will point to a version of the pact file (tags are just labels to a pact file version), and the verification will be posted back against that version.

That is my understanding, but @bethesque is probably the only person who really understands this stuff.

Thanks for the quick answer.
Actually, I am talking about the version/tag of the provider rather than the version/tag of the pact file..
with pact.provider.version I can specify the provider version.
It would make sense if I had an option to use something like pact.provider.tag... That's what I am looking for.

@bethesque
Copy link
Member

I need to add this to the ruby impl too, if I haven't already. While you're waiting for this feature, you can either do a curl to PUT the tag in the right place via the API, or use the pact broker client.

@evdzhan
Copy link

evdzhan commented Mar 8, 2019

+1. I really could use the above feature, in the gradle plugin implementation.

@LawrenceMouarkach
Copy link

I need to add this to the ruby impl too, if I haven't already. While you're waiting for this feature, you can either do a curl to PUT the tag in the right place via the API, or use the pact broker client.

Is there a link to the specific req in the API docs to version the provider? Don't want to tag the file just the provider version. Thanks!

@kiranpatel11
Copy link

I need to add this to the ruby impl too, if I haven't already. While you're waiting for this feature, you can either do a curl to PUT the tag in the right place via the API, or use the pact broker client.

@bethesque as discussed on slack, this would help tag the provider later, but the tags info won't be part of the provider_verification_published webhook, which is I guess required if you have to retrigger can-i-deploy on consumer side.

The only workaround I see at the moment is to configure a retry in can-i-deploy.
@bethesque correct me if I am wrong.

@bethesque
Copy link
Member

You can always run the tagging code before you execute the pact tests. It's designed so that you tag first.

@uglyog
Copy link
Member

uglyog commented Sep 27, 2019

@bethesque Do I post/put the tag to the provider to pb:pacticipant-version-tag?

@bethesque
Copy link
Member

Hm, no unfortunately, that will tag the consumer. In the Ruby code, I've fetched the pb:provider and then used the pb:version-tag relation. I've got code in there that falls back to a hardcoded URL if those relations can't be found though.

@uglyog
Copy link
Member

uglyog commented Oct 16, 2019

4.0.1 has been released

@azerzeynalzada
Copy link

azerzeynalzada commented Oct 20, 2019

In provider side, even if specify in JVM system properties System.setProperty("pact.provider.tag", "dev") ,the tag is not included in broker

@l-lin
Copy link

l-lin commented Oct 21, 2019

I think the provider tag parameter is missing in the verificationReporter.reportResults function:

https://github.com/DiUS/pact-jvm/blob/4_0_1/provider/pact-jvm-provider/src/main/kotlin/au/com/dius/pact/provider/TestResultAccumulator.kt#L55-L57

@zeynalzadeazer
Copy link

Below is my code, I can publish provider version,but the tag name is not publishing to pact broker

@MockBean
private Service service;

@beforeeach
public void setupTestTarget(PactVerificationContext context) {
context.setTarget(new HttpTestTarget("localhost", 3412, "/adapter-litka"));

System.setProperty("pact.provider.tag", "dev");
System.setProperty("pact.provider.version", "version1");
System.setProperty("pact.verifier.publishResults", "true");

System.out.println(System.getProperties());

}

@testtemplate
@ExtendWith(PactVerificationInvocationContextProvider.class)
public void pactVerificationTestTemplate(PactVerificationContext context) {
context.verifyInteraction();
}

@State("status endpoint is up")
public void toGetState() {
String customerId = "00086330";
Dto dto = new Dto();
dto.setCustomerId("xxxxx"); when(service.getDtos(eq(customerId))).thenReturn(Collections.singletonList(dto));
}

@zeynalzadeazer
Copy link

4.0.1 has been released

In this version provider can't send tag name to Pact broker.As you see my from code, I'am setting pact.provider.tag but this code is not working.Provider version is publishing to Pact Broker, but tag name not

@uglyog
Copy link
Member

uglyog commented Oct 27, 2019

Good catch @l-lin! This should be fixed now for JUnit based tests

@GlenR16
Copy link

GlenR16 commented Feb 4, 2025

Can someone tell me in which version this issue was fixed ? I am facing the same issue with my pact jvm with the pact.provider.branch argument and am looking for a solution. My organisation does not allow using any random external library, hence I have less version choices available to me.

@rholshausen
Copy link
Contributor

All versions after 3.6.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests