简体   繁体   中英

Problems with the online / offline mode of the Spring Cloud contract tests

We are using Spring Cloud contract testing in a few projects because it has nice features and all our projects use Spring. However these tests are becoming quite unstable and the devs are just disabling them because they break the build even when there isn't any change on the interfaces.

We have the tests configured for Jenkins in online mode so they download the stubs from Artifactory. However quite often (at least twice per month) the tests crash because the stubs are already in the repository. We don't have access to the remote repository for deleting the stubs manually so we change the configuration for running them on offline mode. This works until the version of the provider changes as the tests cannot find the stubs for the new version locally and they crash again, and we change them again to the online mode.

As you may imagine this is not ideal and we are also worried because the local stubs may be for an outdate copy of the current version and we are not going to detect when the provider has breaking changes.

Is there a better way to configure the tests? It would be great if we could configure them so they always download the stubs and override the local ones.

Duplicate of Spring Cloud Contract remote artifact download clashes with local, how to make it temporary?

Let me copy the answer here too:

This problem might (it doesn't always happen) occur in CI systems when you have a shared .m2. In the next release (1.2.x and 2.0.0), thanks to closing of this issue https://github.com/spring-cloud/spring-cloud-contract/issues/545 , you'll be able to pass stubrunner.snapshot-check-skip system property or STUBRUNNER_SNAPSHOT_CHECK_SKIP environment variable or set the plugin property (for 2.0.0 only) to disable the check.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM