Rubén Pérez
06/07/2022, 2:21 PMconsumerVersionSelectors
from the PactBroker
annotation on my provider application, and I have a doubt.
Looking into the VersionSelector code, it only allows you to select tags, not branches or environments. I think what I would need is to get the latest from the main branch (master
) and the latest from production. My question is, even if I'm using branches
and environments
, should I also add tags from my consumer for both branches and environments?Rejeesh Gangadharan
06/13/2022, 8:03 AMJulián Álvarez
06/13/2022, 5:15 PMQingyuan Liu
06/16/2022, 5:09 PMPaul
06/20/2022, 2:08 PMFrancislainy Campos
06/20/2022, 8:51 PMGaurav
06/21/2022, 7:26 PMQingyuan Liu
06/22/2022, 10:29 AMMatt (pactflow.io / pact-js / pact-go)
João Luiz Vieira
06/22/2022, 7:35 PMtestImplementation('au.com.dius.pact:consumer:4.3.9')
testImplementation('au.com.dius.pact.consumer:junit:4.3.9'
And creating two interactions for the same consumer and provider (one POST and other PUT).
I am setting the same response header for both of the interactions but the second interaction, the response.headers
are being generated different from what I am setting it.
I am setting responseHeaders.put("Content-Type", "application/json; charset=utf-8");
. The first interaction, the header is "Content-Type": "application/json; charset=utf-8",
but in the second it is "Content-Type": "application/json;charset=utf-8"
the difference being that the second there is no space after the ;
.
I added another header just for testing and in the second interaction it added an =
at the end.
Basically, I want that the space in "application/json; charset=utf-8"
is not removed in second interaction. Do you what can I do to achieve this? I am not sure if I am doing something wrong or is some kind of bug.
(code and image in the thread)Robert
06/23/2022, 10:15 AM@Consumer("consumer2")
. Is there another way?Srinivas Vaddi
06/23/2022, 4:07 PMbstyle killa
06/23/2022, 11:17 PMbstyle killa
06/23/2022, 11:18 PMbstyle killa
06/23/2022, 11:20 PMmvn clean test -PproducerContractTestWithBroker -Dusername=$username -Dpassword=$password -DapiKey=$key -Dpact.broker.url="<https://test.pactflow.io/>" -Dpact.broker.token=$token -Dci.props.git.hash.short="0" -Dci.props.git.branch.name=$branchname -Dpact.verifier.publishResults=true
bstyle killa
06/23/2022, 11:25 PMbstyle killa
06/23/2022, 11:25 PMbstyle killa
06/23/2022, 11:52 PMQingyuan Liu
06/24/2022, 3:16 AMPactDslJsonBody body = new PactDslJsonBody();
body.stringType("name", "almost-anything");
Sandor Arpa
06/24/2022, 10:06 AM$.event_details.net_amount=MatchingRuleGroup(rules=[NumberTypeMatcher(numberType=INTEGER)]
The error I get:
BodyMismatch(expected=-8000, actual=-8000, mismatch=Expected -8000 (JsonPrimitive) to be an integer
Sandor Arpa
06/24/2022, 10:06 AMGitHub
06/28/2022, 4:26 AMGustavs
06/28/2022, 2:26 PMRobert
06/30/2022, 2:00 PMMHNOT
07/04/2022, 2:10 PM@Override
protected RequestResponsePact createPact(final PactDslWithProvider aBuilder)
{
final Map<String, String> requestHeaders = ChatTestUtil.createRequestHeaderMap();
return aBuilder//
.given("A text prod finished successfully")//
.uponReceiving("A request to download text")//
.pathFromProviderState("/textresult/${jobId}", "/textresult/" + ChatTestUtil.DUMMY_JOB_ID)//
.method("GET")//
.headers(requestHeaders)
.willRespondWith()//
.status(200)//
.headers(Map.of("Content-Type", "text/plain"))//
.matchHeader("Content-Length", "[1-9][0-9]+")//
.body(PactDslRootValue.stringType())
//.body(PactDslRootValue.stringMatcher(".*", "whatever"))
//.withBinaryData("FooBar".getBytes(), "text/plain")
.toPact();
}
The variant with "*.body(PactDslRootValue.stringType())*" fails with following exception on provider side:
java.lang.AssertionError:
Failures:
1) Verifying a pact between Core_Chat_Client and Chat_Service - A request to download text
1.1) BodyMismatch: / BodyMismatch: Expected body 'string' to match 'Participants:
TestUser
TestUser sent message
16 Oct 2001 10:14 PM +02:00 Hello World
TestUser sent message
16 Oct 2001 10:14 PM +02:00 Lorem Ipsumupczl
' using equality but did not match
The variant with "*.body(PactDslRootValue.stringMatcher(".*", "whatever")*" fails with also on provider side:
java.lang.AssertionError:
Failures:
1) Verifying a pact between Core_Chat_Client and Chat_Service - A request to download text
1.1) BodyMismatch: / BodyMismatch: Expected body 'whatever' to match 'Participants:
TestUser
TestUser sent message
16 Oct 2001 10:14 PM +02:00 Hello World
TestUser sent message
16 Oct 2001 10:14 PM +02:00 Lorem Ipsumphaai
' using regex '.*' but did not match
And the last variant "*.withBinaryData("FooBar".getBytes(), "text/plain")*" fails also:
java.lang.AssertionError:
Failures:
1) Verifying a pact between Core_Chat_Client and Chat_Service - A request to download text
1.1) BodyMismatch: / BodyMismatch: Expected body 'FooBar' to match 'Participants:
TestUser
TestUser sent message
16 Oct 2001 10:14 PM +02:00 Hello World
TestUser sent message
16 Oct 2001 10:14 PM +02:00 Lorem Ipsumxetoj
' using equality but did not match
How can I verify that the body of a response is not empty?bstyle killa
07/06/2022, 5:53 PMbstyle killa
07/06/2022, 5:55 PMrecord-deployment
command has just been released, and support for the corresponding selector { deployed: true }
has not yet been added to all the Pact client libraries. The previous method of recording releases was to use tags. If you are not using one of the libraries that currently supports the { deployed: true}
selector (currently Javscript and Ruby support it), you will need to use tags in the meantime as per the documentation in the Tags page.bstyle killa
07/06/2022, 6:24 PMbstyle killa
07/07/2022, 6:47 PMPACT_URL="<https://blah.pactflow.io/ngc-provider-service/consumer/ngc-consumer/version/f8823729>" mvn clean test \
-PproducerContractT ...
https://github.com/pact-foundation/pact-jvm/commit/5b367c91e6c006542b6af197f0393c2cc64fc889bstyle killa
07/07/2022, 7:32 PMmvn clean test \
-PproducerContractTestWithBroker \
-Dtest=GetCartsProviderContractWithBrokerRunnerTest \
-DPACT_URL="<https://blah.pactflow.io/pacts/provider/ngc-provider-service/consumer/ngc-consumer/version/12341234>" \