Questions tagged [spring-cloud-contract]
For questions related to Spring Cloud Contract project
408
questions
0
votes
1
answer
24
views
Spring Cloud Contract - Re-use path variable in request for repsonse
I'm currently trying to build a contract like this:
Contract.make {
description("""
Represents a successful scenario of getting an account
```
given:
account id
when:
api ...
0
votes
1
answer
18
views
Spring Cloud CDC separate base class configuration
I'm trying to set up a spring CDC configuration.
But I have a problem when I want to define separate base classes for mappings.
When I define it as
contracts {
contractsDslDir.set(file("src/...
0
votes
1
answer
24
views
Generated test can't read property from application.yml
Just trying hands with Spring Cloud Contract. While running the generated test on provider side and when the application context is instantiated, it is unable to read config values from application....
0
votes
2
answers
42
views
Spring cloud contract: tests based on contracts are not generated on producer side at all
Tests are not being generated based on contracts in java. I used gradle to configure spring-cloud-contract and used java for contracts. When I run ./gradlew clean build -x test, it throws illegal ...
0
votes
0
answers
25
views
Spring boot messaging consumer contract test loads test context twice and first time it fails
When I run https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/consumer_kafka_middleware, although it passes, it seems to load the test context twice, the first load fails ...
0
votes
1
answer
39
views
Spring Cloud Contract and Gradle Setup Question
I'm trying out Spring Cloud Contract but cannot get it to run properly.
I have followed a couple of tutorials and looked into the spring-provided repository. The outcome is always the same:
error: ...
0
votes
0
answers
48
views
No stubs found in maven local repository
I am trying to implement Consumer Driven Contracts. I followed the setup from official docs but can't make the consumer tests run after provider is build and stubs (should be generated).
Following ...
0
votes
1
answer
86
views
How to disable springSecurityFilterChain in test case?
Hi I have a spring project that has spring security to authenticate users using OAUTH provider, and I have to use Spring Cloud Contract to build up a mock server for consumer testing.
repo: https://...
0
votes
1
answer
99
views
Spring Cloud Contract Consumer side Cannot bind to DefaultKafkaConsumerFactory
I have a spring cloud contract consumer that has the following error. I don't understand why my test case cannot bind to EmbeddedKafka.
Repo: https://github.com/Isaacwhyuenac/spring-cloud-contract-poc/...
0
votes
0
answers
38
views
How to define a contract/stub for a particular test on the consumer side
Stubs on the consumer side overlap due to the same url and response body, WireMochk doesn't understand which stub to choose
I have to write contracts for an endpoint (api/topic/add/project/{...
0
votes
0
answers
20
views
Spring Cloud Contract with FHIR HAPI
I need to introduce Spring Cloud Contract to mock an FHIR HAPI.
Unfortunately I didn't found any documentation about such a particular integration case.
Can someone tell me:
Spring Cloud Contract is ...
0
votes
0
answers
18
views
Spring cloud contract not using test application.yml for contract verification in Gradle build
I have been trying to migrate a project from Maven to Gradle build. It has Spring Cloud Contracts and it work as expected in Maven build. During the contract verification phase, it uses the ...
0
votes
0
answers
52
views
Handling dynamic properties in protobuf body using Spring Cloud Contract
I am currently trying to test the integration between two services which communicate via gRPC and Protocol Buffers. To accomplish that I am using Spring Cloud Contract.
At the moment I am trying to ...
0
votes
0
answers
104
views
How properly describe multiple files in multipart section of yaml so array could be validated with spring cloud contract test
Spring cloud contract multipart - generates test with only one multiPart file despite yaml contains 11.
I am trying to test contract, which has restrictions for MultipartFile size.
@PostMapping(value =...
1
vote
0
answers
262
views
Request was not matched by Wiremock stub which was generated by Spring Cloud Contract
I am currently trying to build a contract testing test suite using Spring Cloud Contract. I need to test the integration between two services which communicate via gRPC and Protocol Buffers. Therefore,...
0
votes
0
answers
54
views
Spring Cloud Contract generates message verifier test from Groovy to YAML
Currently I'm using Spring Cloud Contract to test my publishing of events from one microservices to another. After the test run succesfully, I would publish the stubs to be use by other microservices.
...
0
votes
0
answers
538
views
Spring Boot [2.7.1] is not compatible with this Spring Cloud release train
Getting below error while using Springboot 2.7.1 with spring-cloud-version 2021.0.3 and Spring contract is 3.1.3
It is gradle project and using below configuration:-
("org.springframework.cloud:...
0
votes
1
answer
306
views
Spring Cloud Contract failed to start Stub Runner
I've made a Consumer side spring-cloud-contract test and it fails on starting the stub server. I see in the logs it is able to download and unpack the stub.jar but then it fails with the following ...
1
vote
1
answer
337
views
Spring Cloud Contract Tests with Gradle - publish stubs to local repository
I am making a Gradle project with several different technologies, one of which is Spring Cloud Contract.
According to this tutorial producer publishes stubs to local maven repository after executing :...
1
vote
0
answers
41
views
Spring Cloud Contract Stubs Without Priorities
Is there any way that Stubs created by Spring Cloud Contract match only if the request is exactly the same and not have to deal with priorities?
e.g. If there are 2 stubs with url /users?id=1&id=2 ...
0
votes
0
answers
592
views
Error creating bean with name 'embeddedKafka': Invocation of init method failed; nested exception is kafka.common.KafkaException:
I am using the spring cloud contrat to test a kafkaListsener of my service. I use EmbeddedKafka together with the spring cloud contract.
The listener in my service is implemeneted by @KafkaListener ...
0
votes
1
answer
405
views
Unable to generate contract tests when using spring-cloud-contract-oa3 and spring cloud contract gradle plugin
When when I specify the contract in an OA3 yml file and then build the project the build passes but it doesn't generate the contract tests . If I replace the OA3 yml contract file with a groovy ...
1
vote
1
answer
96
views
OpenAPI extension for spring cloud contract compatibility with later version of spring-cloud-contract-gradle-plugin
I am able to get OpenAPI extension (guru.springframework:spring-cloud-contract-oa3:2.1.2.0) to work spring cloud contract using gradle.
However, it works with up to org.springframework.cloud:spring-...
0
votes
0
answers
181
views
Spring-Cloud-Contract: Intellij IDEA, publishStubsToScm: Unable to determine git repository commit id ... Auth fail
./gradlew publishStubsToScm fails to push stubs to github repo.
Beyond that, I can pull/push via IDEA to stubs-repo, I can pull/push via the terminal to stubs-repo with passphrase.
Gradle ...
0
votes
2
answers
472
views
How to generate and run a single contract test without building all the unit and contract tests in the project? Java Spring Cloud Contract Verifier
I'm new to contract testing. To run tests I use maven command mvn clean test. It runs all the tests in my project, spring cloud generates contract test classes and whole process takes a lot of time. ...
0
votes
0
answers
86
views
Spring Contracts: Stubs are runnning on port -1 + Failed to construct kafka producer
I have the Consumer test set up with Embedded Kafka and local Maven stubs. Test props set either via application.properties file or @DynamicPropertySource.
@SpringBootTest(
webEnvironment = ...
1
vote
1
answer
135
views
contractVerifierMessaging.receive is null
I'm setting up contract tests for Kafka messaging with Test Containers in a way described in spring-cloud-contract-samples/producer_kafka_middleware/. Works good with Embedded Kafka but not with ...
0
votes
0
answers
720
views
Spring Cloud Contract with Wiremock - how to choose Scenario manually?
Im working in a project using Spring Cloud Contract and Wiremock to create integration tests. Everything was fine until we need to add multiple responses to the same request in Wiremock. Reading some ...
0
votes
0
answers
154
views
Spring Cloud Contract generated tests fails on empty responses from producer
I am trying to implement Spring Cloud Contract to my project. I am following instructions from this baeldung article:
https://www.baeldung.com/spring-cloud-contract
Dependencies are added
Plugin is ...
2
votes
0
answers
210
views
How to add multiple contracts for one method? Contract tests using Spring Cloud Contract Verifier + groovy
I'm trying to make 2 cases for one method: when response contains a list of elements and an empty list. I have BaseTestClass for both cases, but response body generation should differ depending on the ...
1
vote
1
answer
762
views
Embedded Kafka contract tests randomly failing
I am using the spring cloud contrat to test a kafkaListsener of my service.
I use EmbeddedKafka together with the spring cloud contract.
The listener in my service is implemeneted by @KafkaListener ...
0
votes
1
answer
103
views
Spring Cloud Contract with multiple requestparts
I'm trying to write a contract to test the following providers endpoint
@PostMapping(value = "/api/{id}/addFiles", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
ResponseEntity<Void> ...
0
votes
0
answers
53
views
Spring Contracts How to create a matcher for x-www-form-urlencoded
Problem:
spring-cloud-contracts version: 3.1.0
Having a Contract
request:
method: POST
url: /some/url
headers:
Content-Type: application/x-www-form-urlencoded
body: a=123&b=345&c=...
0
votes
1
answer
56
views
Spring Cloud Contract: common repository for all microservices
I am working on a microservice architecture system. I would like to setup a common repository with all the contracts of our microservices, using a consumer driven approach. I am taking this sample as ...
0
votes
0
answers
22
views
Spring cloud contract load active profiles
I have a contract like:
Contract.make {
ignoreForDevEnvironment() ? ignored() : ""
description ""
request {
method 'POST'
...
0
votes
1
answer
200
views
Spring Cloud Contract: how to prevent Producer to break consumers?
I am new to Spring Cloud Contracts and recently I was able to generate Producer contracts, and write a test on the consumer side using the stubs installed on my local maven repo.
If I break the ...
0
votes
1
answer
119
views
Spring Cloud Contract generates weak tests using bodyFromFile in contract file
I try to implement simple contract for get users REST Endpoit. I expect that Spring Cloud Contract generates test whitch checks json response more strongly. Can anyone know how to configure test ...
0
votes
0
answers
101
views
Spring Contract ignore test with message
I have the following code:
Contract.make {
ignoreTestBaseOnACondition() ? ignored() : ""
description "e"
request {
method '...
0
votes
3
answers
183
views
Generated test sources not getting invoked as part of the gradle build
Added Spring Cloud Contract plugin and configured it for baseClassMappings
Added Spring Cloud Contract verifier
Added required base classes for generated tests
Defined groovy contract
Using Test{...
0
votes
0
answers
14
views
Spring Cloud Contract - chaning contract on producer side
Please clarify one thing for me. Because what I understand SCC operating model starts on producer side. So I can have situation where I am able to modify contract definition then build and deploy ...
1
vote
0
answers
834
views
I'm getting error in upgrading the gradle version from 6.8 to 7.4
I tried building my project with gradle version 7.4, but I couldn't. It was working fine with the gradle version 6.8.
I'm using the spring-cloud-contract-verifier version : 3.1.1
I got this kind of ...
0
votes
1
answer
141
views
No label found exception on cloud contract testing on the consumer side
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
...
1
vote
2
answers
516
views
Do we need to do Consumer Driven Contract Testing Kafka Driven Micro-services when we have the Scheme Registry?
I am trying to understand if the concept of Consumer-Driven Contracts ( CDC ) is still valid in the context of Kafka based Event Driven Architecture.
In the RESTful world, Consumer-Driven Contract ...
0
votes
1
answer
403
views
Writing groovy contract for spring cloud contract testing
I am new to contract testing and want to write a groovy contract for a response which contains sub objects with strings list of dictionaries and so on.
I have a response like this:
{
"data&...
0
votes
1
answer
594
views
Spring Cloud Contract ContractVerifierTest.java not generated
So I'm trying to write contracts in Java, but the problem is that the verifying tests are not running at all. I've tried writing contracts in Groovy and it runs fine, I don't know what's the ...
0
votes
0
answers
63
views
Using contract in other modules in a multi-module maven project
I have a multi-module Maven project. structure look like this:
Parent
|-- ModuleA
|-- contracts
|-- ModuleB
|-- src/test
|-- B
The ...
0
votes
1
answer
41
views
spring cloud contract gerenate producer classes test
In producer side, I need to skip stubs generation (so I need only to generate classes tests). for that Change the maven plugin as follow:
<plugin>
<groupId>org.springframework.cloud</...
1
vote
0
answers
334
views
Pact vs Spring Cloud Contract vs Karate
I'm trying to figure out the best tool for the contract testing. My scenario is quite simple. I have to implement contract testing specifically for front end talking to backend APIs.(client to REST ...
1
vote
0
answers
2k
views
No qualifying bean of type 'org.springframework.cloud.stream.binder.test.OutputDestination' available
I am trying to use spring cloud contracts for messaging.
I have a producer and a consumer who is publishing and consuming from rabbitmq.
they are working fine when I run both these spring boot ...
0
votes
1
answer
206
views
Spring cloud contract with common contract repository
I Created a sperate repository to store the contract as descibed in this link:
https://github.com/spring-cloud/spring-cloud-contract/tree/main/samples/standalone/contracts
In the producer side, I ...