use of org.awaitility.core.ConditionFactory in project testcontainers-java by testcontainers.
the class ResourceReaperTest method assertCleanup.
private void assertCleanup(Map<String, String> labels) {
DockerClient client = DockerClientFactory.instance().client();
ConditionFactory awaitFactory = Awaitility.await().atMost(Duration.ofMinutes(1)).pollInterval(Duration.ofSeconds(1));
List<String> labelValues = labels.entrySet().stream().map(it -> it.getKey() + "=" + it.getValue()).collect(Collectors.toList());
awaitFactory.untilAsserted(() -> {
assertThat(client.listContainersCmd().withFilter("label", labelValues).withShowAll(true).exec()).isEmpty();
});
awaitFactory.untilAsserted(() -> {
assertThat(client.listNetworksCmd().withFilter("label", labelValues).exec()).isEmpty();
});
awaitFactory.untilAsserted(() -> {
assertThat(client.listVolumesCmd().withFilter("label", labelValues).exec().getVolumes()).isEmpty();
});
}
use of org.awaitility.core.ConditionFactory in project besu by hyperledger.
the class EthProtocolManagerTest method doNotDisconnectOnValidMessage.
@Test
public void doNotDisconnectOnValidMessage() {
try (final EthProtocolManager ethManager = EthProtocolManagerTestUtil.create(blockchain, () -> false, protocolContext.getWorldStateArchive(), transactionPool, EthProtocolConfiguration.defaultConfig())) {
final MessageData messageData = GetBlockBodiesMessage.create(Collections.singletonList(gen.hash()));
final MockPeerConnection peer = setupPeer(ethManager, (cap, msg, conn) -> {
});
ethManager.processMessage(EthProtocol.ETH63, new DefaultMessage(peer, messageData));
final ConditionFactory waitDisconnect = Awaitility.await().catchUncaughtExceptions().atMost(200, TimeUnit.MILLISECONDS);
assertThatThrownBy(() -> waitDisconnect.until(peer::isDisconnected)).isInstanceOf(ConditionTimeoutException.class);
}
}
use of org.awaitility.core.ConditionFactory in project java-operator-sdk by java-operator-sdk.
the class TimerEventSourceTest method untilAsserted.
private void untilAsserted(long initialDelay, long interval, ThrowingRunnable assertion) {
long delay = INITIAL_DELAY;
long period = PERIOD;
ConditionFactory cf = Awaitility.await();
if (initialDelay > 0) {
delay = initialDelay;
cf = cf.pollDelay(initialDelay, TimeUnit.MILLISECONDS);
}
if (interval > 0) {
period = interval;
cf = cf.pollInterval(interval, TimeUnit.MILLISECONDS);
}
cf = cf.atMost(delay + (period * 3), TimeUnit.MILLISECONDS);
cf.untilAsserted(assertion);
}
use of org.awaitility.core.ConditionFactory in project selenium-webdriver-java by bonigarcia.
the class DownloadChromeJUnit4Test method testDownloadChrome.
@Test
public void testDownloadChrome() {
driver.get("https://bonigarcia.dev/selenium-webdriver-java/download.html");
driver.findElement(By.xpath("(//a)[2]")).click();
driver.findElement(By.xpath("(//a)[3]")).click();
ConditionFactory await = Awaitility.await().atMost(Duration.ofSeconds(5));
File wdmLogo = new File(targetFolder, "webdrivermanager.png");
await.until(() -> wdmLogo.exists());
File wdmDoc = new File(targetFolder, "webdrivermanager.pdf");
await.until(() -> wdmDoc.exists());
}
use of org.awaitility.core.ConditionFactory in project selenium-webdriver-java by bonigarcia.
the class DownloadFirefoxJUnit4Test method testDownloadFirefox.
@Test
public void testDownloadFirefox() {
driver.get("https://bonigarcia.dev/selenium-webdriver-java/download.html");
driver.findElement(By.xpath("(//a)[2]")).click();
driver.findElement(By.xpath("(//a)[3]")).click();
ConditionFactory await = Awaitility.await().atMost(Duration.ofSeconds(5));
File wdmLogo = new File(targetFolder, "webdrivermanager.png");
await.until(() -> wdmLogo.exists());
File wdmDoc = new File(targetFolder, "webdrivermanager.pdf");
await.until(() -> wdmDoc.exists());
}
Aggregations