diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorTests.java index eec1cca7e..7d63a2e25 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorTests.java @@ -31,6 +31,7 @@ import org.springframework.cloud.netflix.eureka.server.metrics.EurekaInstanceMonitor; import org.springframework.context.annotation.Configuration; +import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; @@ -158,7 +159,8 @@ private static Tags tags(InstanceInfo instanceInfo) { } private void assertEurekaInstance(Map meterRegistryCounts) { - await().atMost(10, SECONDS) + await().pollDelay(5, MILLISECONDS) + .atMost(10, SECONDS) .pollInterval(fibonacci()) .untilAsserted(() -> meterRegistryCounts.forEach((tags, count) -> assertThat((long) meterRegistry.get("eureka.server.instances").tags(tags).gauge().value()) diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorWithCustomTagsProviderTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorWithCustomTagsProviderTests.java index d86e7a271..fac5c604c 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorWithCustomTagsProviderTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorWithCustomTagsProviderTests.java @@ -33,6 +33,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.awaitility.Awaitility.await; @@ -91,7 +92,8 @@ private static Tags tags(InstanceInfo instanceInfo) { } private void assertEurekaInstance(Map meterRegistryCounts) { - await().atMost(5, SECONDS) + await().pollDelay(5, MILLISECONDS) + .atMost(5, SECONDS) .pollInterval(fibonacci()) .untilAsserted(() -> meterRegistryCounts.forEach((tags, count) -> { SoftAssertions softAssertions = new SoftAssertions();