Created
January 17, 2019 07:39
-
-
Save oshai/1a15f70854d45d27eb95bea680f90f68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun `"Simple query with 1 nanosec timeout"`() { | |
withConfigurablePool(shortTimeoutConfiguration()) { pool -> | |
{ | |
val connection = pool.take().get(10, TimeUnit.SECONDS) | |
assertThat(connection.isTimeout()).isEqualTo(false) | |
assertThat(connection.isConnected()).isEqualTo(true) | |
val queryResultFuture = connection.sendQuery("select sleep(1)") | |
verifyException(TimeoutException::class.java) { | |
queryResultFuture.get(10, TimeUnit.SECONDS) | |
} | |
assertThat(connection.isTimeout()).isEqualTo(true) | |
pool.giveBack(connection).get(10, TimeUnit.SECONDS) | |
assertThat(pool.availables().size).isEqualTo(0) // connection removed from pool) | |
// we do not know when the connection will be closed. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment