I have a micro-service , which include eureka client and spring cloud config client, but when I execute a junit test, there are many errors like cannot find eureka server, spring cloud server, what should I do of the unit test? and must I start up the eureka server and spring cloud config server?
Comment From: OlgaMaciaszek
It entirely depends on which tests you are writing. If you are writing unit tests, you would usually not want to test that layer and instead of starting the entire boot context or using @SpringBootTest, you would just test single classes, methods and components. If you want to run end-to-end tests, you probably should have an environment set up, including Eureka Server and Config Server (in order to make it easier you could use docker images (you can find our official images here: https://hub.docker.com/u/springcloud?page=1). You can also use them for integration tests with @TestContainers.