deregister service when test is done
@@ -82,6 +82,7 @@ public class ConsulServiceRegistryCheckTtlTests {
@Test
public void contextLoads() throws NoSuchFieldException, IllegalAccessException {
ConsulRegistration httpRegistration = createHttpRegistration();
+ try {
this.consulServiceRegistry.register(httpRegistration);
Field serviceHeartbeatsField = TtlScheduler.class
.getDeclaredField("serviceHeartbeats");
@@ -93,6 +94,10 @@ public class ConsulServiceRegistryCheckTtlTests {
assertThat(serviceHeartbeats.keySet().contains(httpRegistration.getInstanceId()))
.as("Service with HTTP check registered in TTL scheduler").isFalse();
}
+ finally {
+ this.consulServiceRegistry.deregister(httpRegistration);
+ }
+ }
@Configuration(proxyBeanMethods = false)
@EnableAutoConfiguration
