Skip to content

Commit 08522ad

Browse files
committed
retry for 10 seconds
1 parent 0e2f217 commit 08522ad

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/JmxConnectionTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,17 @@ private static void checkConnectionLogs(JmxScraperContainer scraper, boolean exp
192192
}
193193

194194
private static void waitTerminated(GenericContainer<?> container) {
195-
int retries = 10;
196-
while (retries > 0 && container.isRunning()) {
197-
retries--;
195+
long retryUntil = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(10);
196+
while (container.isRunning() && System.currentTimeMillis() < retryUntil) {
198197
try {
199198
TimeUnit.MILLISECONDS.sleep(100);
200199
} catch (InterruptedException e) {
201200
throw new RuntimeException(e);
202201
}
203202
}
204-
assertThat(retries)
203+
assertThat(container.isRunning())
205204
.describedAs("container should stop when testing connection")
206-
.isNotEqualTo(0);
205+
.isFalse();
207206
}
208207

209208
private static JmxScraperContainer scraperContainer() {

0 commit comments

Comments
 (0)