简体   繁体   English

Spring Cloud合约测试的在线/离线模式存在问题

[英]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.

相关问题 生成的测试在Spring Cloud Contract中失败 - Generated tests fail in Spring Cloud Contract Spring Cloud Contract 在合约文件中使用 bodyFromFile 生成弱测试 - Spring Cloud Contract generates weak tests using bodyFromFile in contract file 使用spring-cloud-contract-oa3和spring cloud contract gradle插件时无法生成合约测试 - Unable to generate contract tests when using spring-cloud-contract-oa3 and spring cloud contract gradle plugin 如何在 spring-cloud-gateway 合约测试中从 spring-cloud-contract 中设置带有 StubRunner 端口的 url - How to set urls with port of StubRunner from spring-cloud-contract in spring-cloud-gateway contract tests Spring Cloud Contract 测试是否应该实际调用外部服务? - Should Spring Cloud Contract tests actually call an external service? Spring Cloud Contract 测试适用于 Maven,但不适用于 JUnit - Spring Cloud Contract tests work with Maven but not when run with JUnit Spring 云合约:基于合约的测试根本不会在生产者端生成 - Spring cloud contract: tests based on contracts are not generated on producer side at all 使用maven时Spring Cloud Contract编译问题 - Spring Cloud Contract compilation problems when using maven 如何在不构建项目中的所有单元和合同测试的情况下生成和运行单个合同测试? Java Spring Cloud 合约验证器 - 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 无法将 RestAssured 的 RQ/RS of Spring Cloud Contract 的测试附加到 Allure 报告 - Can't attach RestAssured's RQ/RS of Spring Cloud Contract's tests to Allure report
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM