Use Awaitility in our own tests
Closes gh-18227
This commit is contained in:
@@ -18,8 +18,10 @@ package org.springframework.boot.actuate.management;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest;
|
||||
@@ -31,7 +33,7 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link HeapDumpWebEndpoint} exposed by Jersey, Spring MVC, and
|
||||
@@ -64,11 +66,7 @@ class HeapDumpWebEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
private void assertHeapDumpFileIsDeleted() throws InterruptedException {
|
||||
long end = System.currentTimeMillis() + 5000;
|
||||
while (System.currentTimeMillis() < end && this.endpoint.file.exists()) {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
assertThat(this.endpoint.file.exists()).isFalse();
|
||||
Awaitility.waitAtMost(Duration.ofSeconds(5)).until(this.endpoint.file::exists, is(false));
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
||||
Reference in New Issue
Block a user