Skip to content

Commit

Permalink
Adjust awaitility config.
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaMaciaszek committed Dec 11, 2024
1 parent 76e6104 commit 883ec87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -158,7 +159,8 @@ private static Tags tags(InstanceInfo instanceInfo) {
}

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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -91,7 +92,8 @@ private static Tags tags(InstanceInfo instanceInfo) {
}

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();
Expand Down

0 comments on commit 883ec87

Please sign in to comment.