ENT-3827: Temporarily disable the HSM timeouts (#5291)

This commit is contained in:
Ryan Fowler 2019-07-10 18:08:22 +01:00 committed by Shams Asari
parent 9bcaecfbe3
commit 76631132ca
2 changed files with 10 additions and 5 deletions

View File

@ -67,11 +67,13 @@ abstract class CryptoService(private val timeout: Duration? = null) : AutoClosea
* @throws TimedCryptoServiceException if we reach the timeout
*/
private fun <A> withTimeout(timeout: Duration?, func: () -> A) : A {
try {
return executor.submit(func).getOrThrow(timeout)
} catch (e: TimeoutException) {
throw TimedCryptoServiceException("Timed-out while waiting for ${timeout?.toMillis()} milliseconds")
}
return func()
// TODO: Bring back timeouts. (See ENT-3827 & ENT-3658)
// try {
// return executor.submit(func).getOrThrow(timeout)
// } catch (e: TimeoutException) {
// throw TimedCryptoServiceException("Timed-out while waiting for ${timeout?.toMillis()} milliseconds")
// }
}
/**

View File

@ -5,6 +5,7 @@ import net.corda.core.internal.times
import org.bouncycastle.operator.ContentSigner
import org.junit.After
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import java.security.PublicKey
import java.time.Duration
@ -53,12 +54,14 @@ class CryptoServiceTest {
}
}
@Ignore("When ENT-3658 is revisited")
@Test
fun `if no timeout is reached then correct value is returned`() {
sleepTime = Duration.ZERO
expect(true) { stub.containsKey("Test") }
}
@Ignore("When ENT-3658 is revisited")
@Test
fun `when timeout is reached the correct exception is thrown`() {
sleepTime = TEST_TIMEOUT.times(2)