Skip to content

Instantly share code, notes, and snippets.

@Marthym
Created November 5, 2014 10:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Wait until database is correctly started
/* Using a mysql inside docker for executing test, I need to wait for MySQL is completly started before running test */
Awaitility.await().atMost(5, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
try (Connection conn = ds.getConnection()) {
return true;
} catch (Exception e) {
System.out.println(e.getClass() + ": " + e.getLocalizedMessage());
return false;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment