Last active
July 8, 2016 17:44
-
-
Save jabrena/2efa34a9a162041672a568b6072a96ef to your computer and use it in GitHub Desktop.
Spring Boot Test example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autowired | |
private DiscoveryClient discoveryClient; | |
@Value("${spring.application.name}") | |
private String microServiceName; | |
@Value("${eureka.instance.leaseRenewalIntervalInSeconds}") | |
private int leaseInternval; | |
@Test | |
public void eurekaHeartbeatTest() throws Exception { | |
//Force a heartbeat on Eureka | |
TimeUnit.SECONDS.sleep(leaseInternval); | |
final List<ServiceInstance> microServiceInstances = | |
discoveryClient.getInstances(microServiceName); | |
assertTrue(microServiceInstances.size() > 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment