Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 19 09:09
    marcingrzejszczak commented #1809
  • Aug 19 08:56

    marcingrzejszczak on main

    Bumping versions Fix improperly accessed optiona… Merge branch '3.1.x' (compare)

  • Aug 19 08:55

    marcingrzejszczak on 3.1.x

    Fix improperly accessed optiona… (compare)

  • Aug 19 08:55
    marcingrzejszczak milestoned #1808
  • Aug 19 08:55
    marcingrzejszczak labeled #1808
  • Aug 19 08:55
    marcingrzejszczak unlabeled #1808
  • Aug 19 08:55
    marcingrzejszczak closed #1808
  • Aug 19 08:55

    marcingrzejszczak on main

    Fix improperly accessed optiona… (compare)

  • Aug 19 08:55
    marcingrzejszczak closed #1809
  • Aug 19 08:33
    artemy commented #1809
  • Aug 18 14:34
    artemy synchronize #1809
  • Aug 18 14:11

    marcingrzejszczak on main

    Removed rest-assured snapshots … (compare)

  • Aug 18 00:49

    spring-builds on 3.1.x

    Bumping versions (compare)

  • Aug 17 16:47
    artemy synchronize #1809
  • Aug 17 14:49

    spring-builds on main

    Bumping versions (compare)

  • Aug 17 13:43

    marcingrzejszczak on main

    Javadoc fixed (#1810) WireMock… (compare)

  • Aug 17 13:43
    marcingrzejszczak closed #1810
  • Aug 17 13:24
    marcingrzejszczak commented #1809
  • Aug 17 13:22
    artemy commented #1809
  • Aug 17 13:04
    marcingrzejszczak milestoned #1810
Marcin Grzejszczak
@marcingrzejszczak
are you using the latest version cause I remember that those have been fixed a long time ago
oh 3.0.2
yeah sth is wrong
Defrim Hasani
@defrimhasani
We tried that on two windows machines - same behaviour
Marcin Grzejszczak
@marcingrzejszczak
must be a bug
you could theoretically configure the plugin to provide the pattern manually AFAIR
as a workaround
Defrim Hasani
@defrimhasani
do you have any config doc for configuring this manually?
Marcin Grzejszczak
@marcingrzejszczak
try setting contractsPath manually
Defrim Hasani
@defrimhasani
ok we added <includedFiles>*</includedFiles> and it picked then up
not sure if it's expected to work, but it did
Marcin Grzejszczak
@marcingrzejszczak
whatever works, whatever works :D
Defrim Hasani
@defrimhasani
thanks again Marcin - appreciated.
Marcin Grzejszczak
@marcingrzejszczak
no problem
Farroque Ariff
@Farroque
@marcingrzejszczak if the async might be missing from the pact - any recommendation on what can be done to get that to work? We write the contract in groovy but convert to pact and use that everywhere
1 reply
Farroque Ariff
@Farroque
Thanks, will check. Also, any pointers/tip to help get a head start on the PactConverter are much appreciated
and the other way round
Farroque Ariff
@Farroque
👍
zbytt
@zbytt
@marcingrzejszczak What would be your take on writing contracts for API that contain some fields that are encrypted (JWE)? Should they be treated just a strings with no regards to it's content ? What about the stubbing response (or rather matching requests on wiremock side) for those (as it is not really possible to expect that the content will be static, JWE contains some random parts)
8 replies
jakub-bochenski
@jakub-bochenski
@marcingrzejszczak I think multiple contracts per file is bugged in 3.1, this generates only a single test case (for the last contract)
Contract.make {
    name 'happy path'
    request {
        method GET()
        urlPath '/api/endpoints'

    }

    response {
        status OK()

    }
}

Contract.make {
    name 'incorrect accept header'
    request {
        method GET()
        urlPath '/api/endpoints'

    }

    response {
        status OK()

    }
}
Marcin Grzejszczak
@marcingrzejszczak
you're missing [] and a ,
4 replies
[
Contract.make {
    name 'happy path'
    request {
        method GET()
        urlPath '/api/endpoints'

    }

    response {
        status OK()

    }
}
,
Contract.make {
    name 'incorrect accept header'
    request {
        method GET()
        urlPath '/api/endpoints'

    }

    response {
        status OK()

    }
}
]
Jarno Walgemoed
@jwalgemoed
Good morning! I've got a question regarding the automatic setup of contracts using wiremock. We have a lot of services we depend on, and for efficiency only spin up our app with the contracts once, but the wiremock server get spun up for each library of contracts we use during testing (we are up to 21 at the moment). Is there a way to configure the stubrunner to use a single wiremock instance and configure all contracts there? Could reduce startup time and reduce memory footprint. I checked the docs and was unable to find information on it, but feel free to redirect me to the docs if it IS in there and I might have missed it.
Trying to create a setup that's as efficient as possible, and (luckily) there are no collisions between stubs. Configuring a static port for the stubrunner causes an error, so that's not the way to solve it.
  • a static port for two different contract libraries
Thanks in advance for any insights, appreciate it!
Marcin Grzejszczak
@marcingrzejszczak
That's not possible
Jarno Walgemoed
@jwalgemoed
@marcingrzejszczak alright, thanks for letting me know!
Will see what options I have. Appreciate the fast response!
Marcin Grzejszczak
@marcingrzejszczak
I mean what comes to my mind is that when the stubs are being created you would have to aggregate the stubs from all the apps. Then you would generate a single stub JAR with all the stubs
naushadamin
@naushadamin
Hello, I am trying to override a Bean Configuration for a Spring Cloud Contract test. For a unit test we can achieve this with a @TestConfiguration annotation. How do I accomplish that feature on a Spring Cloud Contract test?
2 replies
Robert Ravikumar
@robert07ravikumar

Need your help on cloud contract testing on the spring boot microservice project with rabbitmq.

I have a microservice service that produces messages to a rabbit MQ channel and is listened by another microservice which listens to it.

Publisher side cloud contract testing is done successfully and it pushes the generated stubs to a repo.

Consumer side test is done written but it fails since it could not able to find the label in the stub .

and the list of labels in the stub is also empty.

I opened the stub.jar and I could find the contract file which is contract_name.groovy.

I could see a contract_name.yaml file generated in the target folder of the producer but it's not available in the stub.jar which is downloaded on the consumer build.

what format of the contract file does the stubrunner on the consumer side use. contract_name.groovy or contract_name.yaml.

error message on consumer side testing

IllegalArgumentException No label with name [return_book_for_foo] was found.Here you have the list of dependencies and their labels [Dependency [com.uuuhhh.com.cpp-event:1.0.0-snapshot]:stubs] has labels []]

1 reply
jakub-bochenski
@jakub-bochenski

Is there a working complete example of using the stubs: protocol to download a local file?
I have the jar in /foo/bar/user-LOCAL_SNAPSHOT-stub.jar and I pass STUBRUNNER_IDS=com.package:user:LOCAL-SNAPSHOT:stubs:9876 and STUBRUNNER_REPOSITORY_ROOT=stubs://file://foo/bar
I also tried putting the jar in /foo/bar/com/package/ fodler..

Still I get No stubs were found on classpath for [com.package:user]

11 replies
zbytt
@zbytt
@marcingrzejszczak is is possible to define stubsMode per stub in stub runner ?
I have a situation where I would like to get stubs from SNAPSHOT module within the same project + stub from external dependency, is it possible ?
Also, I've tried to use stubsMode.CLASSPATH for this case, and while it works when running using maven, it does not work when running within Intelij IDE (stubs for the SNAPSHOT module are missing in this case).
5 replies
Josh Geller
@jg123
Anyone running the spring-cloud-contract docker image on a MacBook Pro M1 Pro? We are using 2.1.0, but the container doesn't exit anymore on its own after a successful test run.
20 replies
Knut Schleßelmann
@kschlesselmann
Hi! Here we deploy our CDCs via AWS Lambda for other teams to include some kind of "black box" in their CI pipelines to run contracts on their services. Is there a way to still usw SCC in this kind of world? I'd have to run our contract tests against real infrastructure as "production code" (the lambda source). So basically can I build some logic that executes the SCC tests from a normal java function?
2 replies
Knut Schleßelmann
@kschlesselmann
OK … I've got some weird problem here. We have some "normal" integration tests and some tests using Spring Cloud Contract. Now the tests in SCC (src/contractTest/…) result in failing normal tests if there is some misconfigured @SpringBootTestbase class … how do these things play together here?
6 replies
Tomas Almeida
@TommyAlmeida
Hey guys, how do you manage duplicated code, this being the dtos from the responses and the contract responses? We are struggling with this question at the company where I work
1 reply
Jose E. Garcia Maciñeiras
@jemacineiras
Hi people, we are developing, for internal use mainly and probably to open it to the community, an integration between openapi and asyncpi with Spring Cloud Contracts. During the process we found that building stub for messaging consumer, the stub runner classes is using the output messages body instead of the input message one. We found if a bit confusing, so when we create the Contract Object for a subscribing case we are adding the same body for Input and Output message. In our understand for Consuming it should only use the input message body. Can any one clarifying a bit that logic? Thanks!
71 replies
Troy Nechanicky
@tn185070
Hi, are there release notes somewhere? I cannot find anything after doing some searching
2 replies
Artur Krysiak
@venth
Hi folks, how to force gradle to produce error message containing details of wrong DSL issue? For niwnit presents only an information about failed build in jvm fork
7 replies
Ivanna
@cherryvanna
Hi all,
I'm having issues with Gradle's ./publishStubsToScm task. Cloning Repo on consumer side works well (after I've pushed contracts manually). Have you ever seen such errors / have ideas what's wrong?
Unable to determine git repository commit id
org.eclipse.jgit.api.errors.TransportException: git@github.com:example/contracts-stubs.git: remote hung up unexpectedly
at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:189)
    at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:128)
    at org.springframework.cloud.contract.verifier.plugin.ContractsCopyTask.discoverGitCommitId(ContractsCopyTask.java:521)
    ...at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:153)

    ...Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.jgit.transport.SshSessionFactory.getSession(org.eclipse.jgit.transport.URIish, org.eclipse.jgit.transport.CredentialsProvider, org.eclipse.jgit.util.FS, int)" because "this.sch" is null
    at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:107)
    at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:281)
14 replies
Ivanna
@cherryvanna

Hi all,
any ideas why stubrunner.AetherStubDownloader loads corrupted jar from Nexus repo? Publishing to Nexus looks fine on Producer side, the jar downloaded manually from Nexus is valid.

WARN shaded.org.eclipse.aether.internal.impl.WarnChecksumPolicy - Could not validate integrity of download from https://nexus/com/example/service/2021.0.0/service-2021.0.0-stubs.jar: Checksum validation failed, expected <!-- but is 5ec2b5d7603b7e3f589177ea883b730b26d2aebf

Test:
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = {TestConfig.class, ServiceApplication.class}) @AutoConfigureStubRunner( stubsMode = StubRunnerProperties.StubsMode.REMOTE, repositoryRoot = "https://nexus", ids = "com.example:service:2021.0.0:stubs") @ActiveProfiles("test") public class ConsumerTests {

9 replies
Michael Badger
@devbadger_gitlab

Hello. I am having issues with generated tests when using dsl properties in the response. For instance, I have a contract

body(
        itemList: [[
                        item: [
                                name: value(test(anyNonEmptyString()), stub("Black Shoe Polish")),
                                status: value(test(anyOf('AVAILABLE', 'ORDERED', 'BACK_ORDERED', 'DISCONTINUED')), stub('AVAILABLE'))
                        ],
                        quantity: 3
                ]]
)

Which generates a test with assertions:

assertThatJson(parsedJson).array("['itemList']").field("['item']").field("['name']").matches("[\\S\\s]+")
assertThatJson(parsedJson).array("['itemList']").field("['item']").field("['status']").matches("^AVAILABLE\$|^ORDERED\$|^BACK_ORDERED\$|^DISCONTINUED\$")
assertThatJson(parsedJson).array("['itemList']").contains("['quantity']").isEqualTo(3)

As long as my qty is 3, this generated test will pass but if I want to specify in my contract quantity: anyPositiveInt() the generated code fails even when I do, in fact have a positive integer for my quantity. The assertion generated seems wrong for quantity when I do this:
assertThatJson(parsedJson).array("['itemList']").contains("['quantity']").matches("([1-9]\\d*)

what am I doing wrong? Is using dsl properties not working as it should?

3 replies
Dominik Meister
@neptoon
Is there a way to fail the generateTests maven task if there are no tests generated, eg. because no contracts have been defined? There is failOnNoContracts but that seems only to have an effect on the stubrunner, but not while generating tests.
1 reply
Ivanna
@cherryvanna
Hi , is there a way to deal with Kafka Envelopes being exchanged between 2 services?
4 replies
bensonbenny021
@bensonbenny021

Hi, I have an api which accepts a list of objects each with an id and details.

[
    {
        "id": 1,
        "name": "Meal 1",
        "context": {
            "restaurant": "ABC"
        }
    },
    {
        "id": 2,
        "name": "Meal 2",
        "context": {
            "restaurant": "XYZ"
        }
    }
]

What we have as response to this particular api is a list having all the objects specified in the request with it's id and a score associated to it.

[
    {
        "id": 1,
        "rating": 4.0
    },
    {
        "id": 2,
        "rating": 2.0
    }
]

Is there any default ways in which I can ensure every object in the request is present in the response? Do I need to add custom methods at server side for this validation?

1 reply
Ivanna
@cherryvanna
Hi,
for the Output Triggered by Input Scenario, besides describing in Contract that sending a message to one topic will trigger sending out another message to another topic, do I need to do anything else? Output message is not received as it is null. And I see the app code itself (were forwarding is done) is not triggered in debug.
1 reply
prapurna-manda
@prapurna-manda
Hello, I am trying to write SCC tests using Spring kafka and Spring-kafka-test. Is this a correct approach or do i need to use something else? I keep getting error with contractVerifierKafkaMessageExchange .NullPointerException: Cannot invoke "org.springframework.boot.autoconfigure.kafka.KafkaProperties$Consumer.getGroupId()". I have provided groupId in application-test.yml