[英]How to disable spring cloud zookeeper when executing integration test
The integration test tries to connect to zookeeper, when I test my code with TestRestTemplate
and spring-cloud-zookeeper-discovery
dependency. 当我使用
TestRestTemplate
和spring-cloud-zookeeper-discovery
依赖性测试代码时,集成测试会尝试连接到zookeeper。 If zookeeper is not running the test throws an exception. 如果zookeeper未运行,则测试将引发异常。
Here is simple project where you can reproduce the problem https://github.com/DenisGlot/disable-zookeeper-when-testing 这是一个简单的项目,您可以在其中重现问题https://github.com/DenisGlot/disable-zookeeper-when-testing
How can I make the test skip connecting to zookeeper part? 如何使测试跳过连接到Zookeeper的一部分?
Added bootstrap.properties
in test/java/resources and put there 在test / java / resources中添加了
bootstrap.properties
并放置在那里
spring.cloud.service-registry.auto-registration.enabled=false
spring.cloud.zookeeper.discovery.enabled=false
spring.cloud.zookeeper.discovery.register=false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.