简体   繁体   中英

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. If zookeeper is not running the test throws an exception.

Here is simple project where you can reproduce the problem https://github.com/DenisGlot/disable-zookeeper-when-testing

How can I make the test skip connecting to zookeeper part?

Added bootstrap.properties in test/java/resources and put there

spring.cloud.service-registry.auto-registration.enabled=false
spring.cloud.zookeeper.discovery.enabled=false
spring.cloud.zookeeper.discovery.register=false

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