[英]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. 我们在几个项目中使用Spring Cloud合同测试,因为它具有不错的功能,并且我们所有的项目都使用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. 我们已经以在线模式为Jenkins配置了测试,因此他们从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? Spring Cloud Contract远程工件下载副本与本地冲突,如何使其临时?
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.
当您拥有共享的.m2时,CI系统中可能会(并非总是发生)此问题。 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.
在下一个版本(1.2.x和2.0.0)中,由于结束了此问题https://github.com/spring-cloud/spring-cloud-contract/issues/545 ,您将能够通过stubrunner .snapshot-check-skip系统属性或STUBRUNNER_SNAPSHOT_CHECK_SKIP环境变量,或设置插件属性(仅适用于2.0.0)以禁用检查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.