Adjust awaitility config.

This commit is contained in:
Olga Maciaszek-Sharma
2024-12-11 14:19:27 +01:00
parent 76e6104b4b
commit 883ec871ab
2 changed files with 6 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ import org.springframework.boot.test.context.SpringBootTest;
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 @@ class EurekaInstanceMonitorTests {
}
private void assertEurekaInstance(Map<Tags, Long> 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())

View File

@@ -33,6 +33,7 @@ import org.springframework.cloud.netflix.eureka.server.metrics.EurekaInstanceTag
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 @@ class EurekaInstanceMonitorWithCustomTagsProviderTests {
}
private void assertEurekaInstance(Map<Tags, Long> meterRegistryCounts) {
await().atMost(5, SECONDS)
await().pollDelay(5, MILLISECONDS)
.atMost(5, SECONDS)
.pollInterval(fibonacci())
.untilAsserted(() -> meterRegistryCounts.forEach((tags, count) -> {
SoftAssertions softAssertions = new SoftAssertions();