Spring-cloud-contract: Bug in the spring-cloud-contract-gradle-plugin v1.1.3.RELEASE

Created on 30 Aug 2017  路  5Comments  路  Source: spring-cloud/spring-cloud-contract

Hello,
I'm using the spring-cloud-contract on a gradle project and I aim to generate a contract for an async web-service.

Here are the dependencies I use.

dependencies {
        ...
        classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:1.1.3.RELEASE"
}
apply plugin: 'spring-cloud-contract'

dependencyManagement {
    imports {
        mavenBom 'org.springframework.cloud:spring-cloud-contract-dependencies:1.1.3.RELEASE'
    }
}

I can have the plugin generate the contract tests using the async() method from the groovy DSL, but it seems that the fixedDelayMilliseconds() DSL method does not work as I would expect.

Here is my groovy contract file.

...
response {
        status 200
        async()
        fixedDelayMilliseconds(10000)
        body([
...

And here is the generated test.
...

// when:
            ResponseOptions response = given().spec(request)
                    .when().async()
                    .post(...

The plugin does not make use of the fixedDelayMilliseconds(10000) and does not add the expected .timeout(10000) in the generated unit test code.

So my test fails with a timeout error : "... throws

 java.util.concurrent.ExecutionException,java.lang.InterruptedException] was not set during the specified timeToWait=1000"

If I add the .timeout(10000) in the unit test code myself then the test passes.

Would you please take a look at that issue in the gradle plugin as it seems there is a bug there ?

bug

All 5 comments

Thanks for the issue! I've updated your text with proper formatting. Thanks a lot for the extensive description. I actually think that the bug is there also for the Maven plugin. With the data you've provided it should be easy to reproduce!

The fix works currently only for the RestAssured based communication. So JaxRs case won't work.

Thank you!

No problem, could you test the snapshots in your spare time?

I could make sure it does work now when using both the gradle and maven plugins with version 1.1.4.BUILD-SNAPSHOT.
Good job! Thanks again!

Was this page helpful?
0 / 5 - 0 ratings