https://pact.io logo
Join Slack
Powered by
# pact-jvm
  • é

    Édouard Lopez

    04/21/2022, 2:18 PM
    I'm not clear how I should return a BAD_REQUEST response using state. Do you have example to share?
    s
    b
    • 3
    • 4
  • l

    Lionello Lunesu

    04/21/2022, 5:17 PM
    Hi! Will the latest pact-jvm release 4.1.35 be pushed to the Maven Central repo?
    u
    • 2
    • 3
  • m

    Marcello Rigan

    04/25/2022, 8:11 AM
    Hello, im new to Pact and i want to know if there is an easy way to overcome protected endpoints as the Provider. Endpoint expects an Bearer Token.
    y
    • 2
    • 8
  • m

    Manu Vereecken

    04/25/2022, 12:17 PM
    Hello! I have two tests on my provider side, of which one runs green and the other fails with a "header missing" message. The expected headers are both the same in the .json pact file, same on pactflow, same when I try them on the real swagger ui. How can I best debug to find the cause? Thanks in advance 🙏
    ✅ 1
    y
    • 2
    • 9
  • p

    Prabhakar

    04/26/2022, 6:33 PM
    how to write contract for an API having html content as response. I can verify response header content type is text/html. But does it even make sense to verify the body contains html content, if so how do I write contract in a more general way (may be I would have to check <html and /html> tags exist)
    m
    u
    • 3
    • 9
  • d

    danilchican

    04/27/2022, 9:40 AM
    Hi everyone! I have an issue regarding creating expected response in groovy. I can't write field/attribute in expected response starting from capitalized letter, e.g.
    PORequired
    . It just doesn't build the pact test. Does anyone can help me with that? Issue on github will be created soon.
    b
    • 2
    • 3
  • f

    Francisco González

    04/27/2022, 11:32 AM
    Hi there, Thank you for this great software. Very useful. I want to know if this is by design in PACT-JVM… or a BUG • You are running a PROVIDER Contract Test that gets the contract to validate from PactBroker • The PACT framework parses contract coming from defined PactBroker • This particular contract has this header
    Content-Type: multipart/related; type=\"application/json\"; boundary=myBoundary
    • When parsing contracts quotes disappear on PACT Request Model • But when it serializes the Request Model this is the generated header
    Content-Type: multipart/related; type=application/json; boundary=myBoundary
    👋 1
    u
    • 2
    • 5
  • m

    Marcello Rigan

    04/27/2022, 2:59 PM
    Hey there, im using
    Copy code
    @TestTemplate  
        @ExtendWith(PactVerificationInvocationContextProvider.class)
        void pactVerificationTestTemplate(PactVerificationContext context) {
            context.verifyInteraction();
        }
    to execute my provider test locally. Im using Provider Version 4.36, Junit 5. I wanted to try it out in a gitlab build, but the test wasnt executed. Is that a pipeline issue or am i missing something. +
    👋 2
    y
    u
    • 3
    • 5
  • a

    Alex Zuliqiaer

    04/27/2022, 8:27 PM
    hello everyone, i am new to pact and im following the getting started tutorial posted on github and i keep getting this exception when trying to execute the pact tests
    👋 2
    y
    • 2
    • 19
  • p

    Pavlo Sprogis

    05/02/2022, 8:56 AM
    hi guys, which version of
    <http://au.com|au.com>.dius.pact.provider.junit
    supports
    pact.provider.branch
    system property? Now I’m using 4.1.17 and it ignores
    pact.provider.branch
    value
    • 1
    • 1
  • j

    Jochen Kraushaar

    05/03/2022, 9:31 AM
    Hi guys, I have a question concerning the migration from V3 to V4 spec. Our http interaction returns a json response. So my code looks like:
    Copy code
    builder.expectsToReceive("get entity", "core/interaction/http")
        .with(Map.of("response.contents", Map.of(
            "pact:content-type", "application/json",
            "body", body
        ))).toPact()
    What is the proper way to configure additional matching rules and generators for the response?
    JsonContentMatcher
    seems to only set the body. I may set the rules using
    "response.matchingRules.rules(body)"
    , but setting the generators using
    "response.generators.categories(BODY)"
    fails. Thanks!
    r
    • 2
    • 2
  • s

    Stefano Lucka

    05/04/2022, 9:24 AM
    Hi everyone, I noticed a strange behaviour when using regex matchers using the 4.3.5 JVM DSL. When using Regex then PACT is generating random values that are compliant to my Regex, but.. they are random. This leads to the issue that the broker is unable to cache my PACTs and when re-running the consumer PR pipeline on the same commit than before, it looks like I get a merge conflict in the broker (due to the random generated "discountPrice"). Is this a bug? If not, we should certainly extend the Javadoc of all regex matchers for the JVM module to clearly point out that this does generate Randoms, because the javadoc at the moment does not state this :) The reason why we retry the consumer PR pipeline on the identical PACT version is this: When a changed PACT is not yet ready to merge because the provider doesn't support it yet, my PR is blocked for merging. As soon as the provider has built the changes and published his verification results, I as the consumer, have to rerun my PR pipeline on consumer side. I don't want to have the necessity to push a dummy commit though.
    m
    j
    r
    • 4
    • 12
  • p

    Prabhakar

    05/05/2022, 12:25 AM
    When running provider tests is there any way to enable more user friendly output (like showing description of 'uponReceiving' in contract). For now all I can see is something like this.... ContractVerificationTest.pactVerificationTestTemplate(PactVerificationContext)[1] PASSED
    r
    • 2
    • 3
  • b

    Ben Pilgrim

    05/05/2022, 10:21 AM
    Is it possible to publish pacts to a broker using
    au.com.dius.pact.consumer:junit5
    without
    au.com.dius.pact.provider:maven
    ?
    m
    • 2
    • 1
  • s

    Slackbot

    05/06/2022, 7:55 AM
    This message was deleted.
    👋 1
    m
    a
    u
    • 4
    • 14
  • t

    Thomas Cederholm

    05/09/2022, 2:59 PM
    Hi, I have an issue when my consumer has triggered my Github Action towards the provider, to verify the pact. The webhook contains a payload that contains the "${pactBroker.pactUrl}" that has been resolved in the Pact Broker. The issue is that is does not contain the
    pb:latest-provider-pacts
    entry, and the test fails. The Pact Broker version is
    2.98.0
    and the junit5 lib (
    au.com.dius.pact.provider:junit5
    ) is version
    4.3.6
    . I would very much like some assistance as to where I should investigate...
    r
    m
    • 3
    • 19
  • a

    André Sousa

    05/09/2022, 6:40 PM
    1. how can i prevent this? i want this command to fail when the contract is not verified by Pact
    m
    • 2
    • 4
  • a

    André Sousa

    05/09/2022, 9:06 PM
    also related: https://stackoverflow.com/questions/61632727/mvn-returns-no-tests-found-message-on-running-junit5-contract-tests
    m
    • 2
    • 1
  • a

    André Sousa

    05/09/2022, 9:07 PM
    i've tried mvn surefire:test@pact-test but no tests were executed
    r
    • 2
    • 2
  • a

    Akash

    05/10/2022, 4:21 AM
    Hi. I’m using
    au.com.dius.pact.consumer:junit:4.2.20
    on an android client and I keep running into a
    java.lang.AssertionError: expected:<200> but was:<500>
    error. It’s unclear to me what’s causing the problem. I’ve found a similar issue that was opened in the past which is marked as resolved but probably isn’t.
    m
    • 2
    • 10
  • a

    Akash

    05/10/2022, 5:55 AM
    Hi again. I’ve got another query. We’ve got a key
    blah
    of type array inside an array of objects in the response body on an API like so:
    Copy code
    [
        {
            "id": "10bc2494-610c-4606-b169-0c33014757e9",
            "blah": [
                "testing 123",
                "Testing, testing, 123..."
            ],
            "type": "GENERIC"
        }
    ]
    While I can use:
    Copy code
    DslPart dslPart = PactDslJsonArray.arrayEachLike()
                    .array("blah") // Undocumented at <https://docs.pact.io/implementation_guides/jvm/consumer/junit#building-json-bodies-with-pactdsljsonbody-dsl>
                    .closeArray()
            .closeObject()
    to validate the key
    blah
    to be an array, I can’t seem to find a way to restrict the elements of the array to be of type String. Is this possible using the DSL? I’m using
    au.com.dius.pact.consumer:junit:4.2.20
    .
    r
    • 2
    • 4
  • f

    Francislainy Campos

    05/10/2022, 8:10 AM
    Hi, we’re using pact version 4.0.7 for one of our projects and when trying to authorise with the broker it complains about it. I think it may perhaps be something to do with some error on the syntax on how we’re trying to send these credentials over to pactflow? We have this:
    Copy code
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
            <systemPropertyVariables>
                <pact.provider.version>${project.version}</pact.provider.version>
                <pact.verifier.publishResults>true</pact.verifier.publishResults>
                <pactbroker.host><http://my.pactflow.io|my.pactflow.io></pactbroker.host>
            </systemPropertyVariables>
        </configuration>
    </plugin>
    And then
    Copy code
    @RunWith(PactRunner.class)
    @PactBroker(host = "<http://my.pact.dius.com.au|my.pact.dius.com.au>", consumers = {
            "${pact.filter.consumers:NONE}" }, tags = { "${pact.consumer.tags:latest}" }, authentication = @PactBrokerAuth(token = "myToken"))
    @uglyog I see you helped someone before with a similar error but on gradle? https://github.com/pact-foundation/pact-jvm/issues/902#issuecomment-506959822 Thank you.
    m
    • 2
    • 9
  • g

    Guillermo

    05/10/2022, 1:11 PM
    Hello, Is there a way to use
    eachLike
    with string values inside? It seems that I can only figure out how to add key pair string values to this array. I would like to achieve this :
    ["elem1", "elem2"]
    instead of
    ["key" : "value".. etc]
    m
    • 2
    • 2
  • r

    Rejeesh Gangadharan

    05/10/2022, 6:55 PM
    https://github.com/pact-foundation/pact-jvm/pull/1552 is failing during checks. Can you please look into the issue.
    • 1
    • 1
  • a

    Alexander Gabay

    05/11/2022, 12:48 PM
    Hi all in the group! I have a a bit of problem with setting up pact for a project we are trying at our company. I have a project in intellij running spring boot with pact and it holds both client service and also a provider class responding to https call with a reply. Here is the pickle.. Im running the component im due to test, deployed in a docker container running on wsl on my machine (our company doesnt allow docker on windows... I have sorted the ssl problem by now) So the client class in intellij is sending a https call via the component in the container and back to the provider class in intellij and back to a responseEntity in my client. This works fine via the commandLineRunner in main and the regular SpringBootTest assertEquals (expected, actual). HOWEVER. If i set up a similar test in pact test having the pact test method send a https request via the client class and so forth i get the : au.com.dius.pact.consumer.PactMismatchesException: The following requests were not received: method: POST path: /callNextTicket/v1 query: {} headers: {} matchers: MatchingRules(rules={}) generators: Generators(categories={}) body: MISSING Im suspecting that this has to do with pacts mockserver kicking in. But is there any way around this without having to set up mock versions of all my services etc. deploying the pact project in the container causes a whole set of other problems.. Any thoughts?
    m
    • 2
    • 9
  • g

    Gustavs

    05/12/2022, 1:09 PM
    Hi, has anyone encountered this error for the provider verification test before?
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/antlr/v4/runtime/CharStreams
    r
    • 2
    • 5
  • b

    bstyle killa

    05/12/2022, 6:51 PM
    message has been deleted
    m
    • 2
    • 1
  • j

    James Weng

    05/12/2022, 11:52 PM
    Do we have examples on how to do pact on json rpc and also grpc on jvm systems liike kotlin
    r
    m
    • 3
    • 8
  • g

    Gustavs

    05/13/2022, 2:22 PM
    Hey. I'm wondering if there is a quicker way to create the consumer pact matchers. We have some huge responses of 200+ keys. How would one go about writing tests in such cases? Doesn't seem reasonable to write them by hand. We created a library to convert java DTOs into pactDslPart matchers, but it seems like its going against the whole idea of contract testing. Some of the DTOs are generated from Swagger spec. Any ideas appreciated.
    b
    • 2
    • 1
  • b

    bstyle killa

    05/13/2022, 3:32 PM
    https://github.com/pactflow/example-provider-springboot
    m
    • 2
    • 2
12345...14Latest