add timeouts to all tests (#5875)

This commit is contained in:
Stefano Franz
2020-02-11 10:14:05 +00:00
committed by GitHub
parent 1d0918cdde
commit b23af5f0d2
485 changed files with 5655 additions and 5625 deletions

View File

@ -93,8 +93,8 @@ class AttachmentsClassLoaderStaticContractTests {
.getLatestContractAttachments(AttachmentDummyContract.ATTACHMENT_PROGRAM_ID)
}
@Test
fun `test serialization of WireTransaction with statically loaded contract`() {
@Test(timeout=300_000)
fun `test serialization of WireTransaction with statically loaded contract`() {
val tx = AttachmentDummyContract().generateInitial(MEGA_CORP.ref(0), 42, DUMMY_NOTARY)
val wireTransaction = tx.toWireTransaction(serviceHub)
val bytes = wireTransaction.serialize()
@ -104,8 +104,8 @@ class AttachmentsClassLoaderStaticContractTests {
assertEquals(42, (copiedWireTransaction.outputs[0].data as AttachmentDummyContract.State).magicNumber)
}
@Test
fun `verify that contract DummyContract is in classPath`() {
@Test(timeout=300_000)
fun `verify that contract DummyContract is in classPath`() {
val contractClass = Class.forName(ATTACHMENT_PROGRAM_ID)
assertThat(contractClass.getDeclaredConstructor().newInstance()).isInstanceOf(Contract::class.java)
}

View File

@ -22,15 +22,15 @@ class CordaPersistenceTest {
database.close()
}
@Test
fun `onAllOpenTransactionsClosed with zero transactions calls back immediately`() {
@Test(timeout=300_000)
fun `onAllOpenTransactionsClosed with zero transactions calls back immediately`() {
val counter = AtomicInteger(0)
database.onAllOpenTransactionsClosed { counter.incrementAndGet() }
assertEquals(1, counter.get())
}
@Test
fun `onAllOpenTransactionsClosed with one transaction calls back after closing`() {
@Test(timeout=300_000)
fun `onAllOpenTransactionsClosed with one transaction calls back after closing`() {
val counter = AtomicInteger(0)
database.transaction {
database.onAllOpenTransactionsClosed { counter.incrementAndGet() }
@ -39,8 +39,8 @@ class CordaPersistenceTest {
assertEquals(1, counter.get())
}
@Test
fun `onAllOpenTransactionsClosed after one transaction has closed calls back immediately`() {
@Test(timeout=300_000)
fun `onAllOpenTransactionsClosed after one transaction has closed calls back immediately`() {
val counter = AtomicInteger(0)
database.transaction {
database.onAllOpenTransactionsClosed { counter.incrementAndGet() }
@ -51,8 +51,8 @@ class CordaPersistenceTest {
assertEquals(2, counter.get())
}
@Test
fun `onAllOpenTransactionsClosed with two transactions calls back after closing both`() {
@Test(timeout=300_000)
fun `onAllOpenTransactionsClosed with two transactions calls back after closing both`() {
val counter = AtomicInteger(0)
val phaser = openTransactionInOtherThreadAndCloseWhenISay()
// Wait for tx to be started.
@ -67,7 +67,7 @@ class CordaPersistenceTest {
assertEquals(1, counter.get())
}
@Test
@Test(timeout = 10_000)
fun `onAllOpenTransactionsClosed with two transactions calls back after closing both - instigator closes last`() {
val counter = AtomicInteger(0)
val phaser = openTransactionInOtherThreadAndCloseWhenISay()

View File

@ -28,23 +28,23 @@ class SignedNodeInfoTest {
private val nodeInfoBuilder = TestNodeInfoBuilder()
@Test
fun `verifying single identity`() {
@Test(timeout=300_000)
fun `verifying single identity`() {
nodeInfoBuilder.addLegalIdentity(ALICE_NAME)
val (nodeInfo, signedNodeInfo) = nodeInfoBuilder.buildWithSigned()
assertThat(signedNodeInfo.verified()).isEqualTo(nodeInfo)
}
@Test
fun `verifying multiple identities`() {
@Test(timeout=300_000)
fun `verifying multiple identities`() {
nodeInfoBuilder.addLegalIdentity(ALICE_NAME)
nodeInfoBuilder.addLegalIdentity(BOB_NAME)
val (nodeInfo, signedNodeInfo) = nodeInfoBuilder.buildWithSigned()
assertThat(signedNodeInfo.verified()).isEqualTo(nodeInfo)
}
@Test
fun `verifying missing signature`() {
@Test(timeout=300_000)
fun `verifying missing signature`() {
val (_, aliceKey) = nodeInfoBuilder.addLegalIdentity(ALICE_NAME)
nodeInfoBuilder.addLegalIdentity(BOB_NAME)
val nodeInfo = nodeInfoBuilder.build()
@ -54,8 +54,8 @@ class SignedNodeInfoTest {
.hasMessageContaining("Missing signatures")
}
@Test
fun `verifying composite keys only`() {
@Test(timeout=300_000)
fun `verifying composite keys only`() {
val aliceKeyPair = generateKeyPair()
val bobKeyPair = generateKeyPair()
val identityKeyPair = generateKeyPair()
@ -67,8 +67,8 @@ class SignedNodeInfoTest {
.hasMessageContaining("At least one identity with a non-composite key needs to be specified.")
}
@Test
fun `verifying extra signature`() {
@Test(timeout=300_000)
fun `verifying extra signature`() {
val (_, aliceKey) = nodeInfoBuilder.addLegalIdentity(ALICE_NAME)
val nodeInfo = nodeInfoBuilder.build()
val signedNodeInfo = nodeInfo.signWith(listOf(aliceKey, generateKeyPair().private))
@ -77,8 +77,8 @@ class SignedNodeInfoTest {
.hasMessageContaining("Extra signatures")
}
@Test
fun `verifying incorrect signature`() {
@Test(timeout=300_000)
fun `verifying incorrect signature`() {
nodeInfoBuilder.addLegalIdentity(ALICE_NAME)
val nodeInfo = nodeInfoBuilder.build()
val signedNodeInfo = nodeInfo.signWith(listOf(generateKeyPair().private))
@ -87,8 +87,8 @@ class SignedNodeInfoTest {
.hasMessageContaining(ALICE_NAME.toString())
}
@Test
fun `verifying with signatures in wrong order`() {
@Test(timeout=300_000)
fun `verifying with signatures in wrong order`() {
val (_, aliceKey) = nodeInfoBuilder.addLegalIdentity(ALICE_NAME)
val (_, bobKey) = nodeInfoBuilder.addLegalIdentity(BOB_NAME)
val nodeInfo = nodeInfoBuilder.build()

View File

@ -20,28 +20,28 @@ import javax.security.auth.x500.X500Principal
import kotlin.reflect.full.primaryConstructor
class ConfigParsingTest {
@Test
fun String() {
@Test(timeout=300_000)
fun String() {
testPropertyType<StringData, StringListData, String>("hello world!", "bye")
}
@Test
fun Int() {
@Test(timeout=300_000)
fun Int() {
testPropertyType<IntData, IntListData, Int>(1, 2)
}
@Test
fun Long() {
@Test(timeout=300_000)
fun Long() {
testPropertyType<LongData, LongListData, Long>(Long.MAX_VALUE, Long.MIN_VALUE)
}
@Test
fun Double() {
@Test(timeout=300_000)
fun Double() {
testPropertyType<DoubleData, DoubleListData, Double>(1.2, 3.4)
}
@Test
fun Boolean() {
@Test(timeout=300_000)
fun Boolean() {
testPropertyType<BooleanData, BooleanListData, Boolean>(true, false)
assertThat(config(Pair("value", "false")).parseAs<BooleanData>().value).isEqualTo(false)
assertThat(config(Pair("value", "False")).parseAs<BooleanData>().value).isEqualTo(false)
@ -53,60 +53,60 @@ class ConfigParsingTest {
.isInstanceOf(ConfigException.WrongType::class.java)
.hasMessageContaining("hardcoded value: value has type STRING rather than BOOLEAN")
}
@Test
fun Enum() {
@Test(timeout=300_000)
fun Enum() {
testPropertyType<EnumData, EnumListData, TestEnum>(TestEnum.Value2, TestEnum.Value1, valuesToString = true)
}
@Test
fun `unknown Enum`() {
@Test(timeout=300_000)
fun `unknown Enum`() {
val config = config("value" to "UnknownValue")
assertThatThrownBy { config.parseAs<EnumData>() }
.hasMessageContaining(TestEnum.Value1.name)
.hasMessageContaining(TestEnum.Value2.name)
}
@Test
fun LocalDate() {
@Test(timeout=300_000)
fun LocalDate() {
testPropertyType<LocalDateData, LocalDateListData, LocalDate>(LocalDate.now(), LocalDate.now().plusDays(1), valuesToString = true)
}
@Test
fun Instant() {
@Test(timeout=300_000)
fun Instant() {
testPropertyType<InstantData, InstantListData, Instant>(Instant.now(), Instant.now().plusMillis(100), valuesToString = true)
}
@Test
fun NetworkHostAndPort() {
@Test(timeout=300_000)
fun NetworkHostAndPort() {
testPropertyType<NetworkHostAndPortData, NetworkHostAndPortListData, NetworkHostAndPort>(
NetworkHostAndPort("localhost", 2223),
NetworkHostAndPort("localhost", 2225),
valuesToString = true)
}
@Test
fun Path() {
@Test(timeout=300_000)
fun Path() {
val path = "tmp" / "test"
testPropertyType<PathData, PathListData, Path>(path, path / "file", valuesToString = true)
}
@Test
fun URL() {
@Test(timeout=300_000)
fun URL() {
testPropertyType<URLData, URLListData, URL>(URL("http://localhost:1234"), URL("http://localhost:1235"), valuesToString = true)
}
@Test
fun X500Principal() {
@Test(timeout=300_000)
fun X500Principal() {
testPropertyType<X500PrincipalData, X500PrincipalListData, X500Principal>(X500Principal("C=US, L=New York, CN=Corda Root CA, OU=Corda, O=R3 HoldCo LLC"), X500Principal("O=Bank A,L=London,C=GB"), valuesToString = true)
}
@Test
fun UUID() {
@Test(timeout=300_000)
fun UUID() {
testPropertyType<UUIDData, UUIDListData, UUID>(UUID.randomUUID(), UUID.randomUUID(), valuesToString = true)
}
@Test
fun CordaX500Name() {
@Test(timeout=300_000)
fun CordaX500Name() {
val name1 = CordaX500Name(organisation = "Mock Party", locality = "London", country = "GB")
testPropertyType<CordaX500NameData, CordaX500NameListData, CordaX500Name>(
name1,
@ -118,31 +118,31 @@ class ConfigParsingTest {
assertThat(config.parseAs<CordaX500NameData>().value).isEqualTo(name1)
}
@Test
fun `flat Properties`() {
@Test(timeout=300_000)
fun `flat Properties`() {
val config = config("value" to mapOf("key" to "prop"))
val data = PropertiesData(Properties().apply { this["key"] = "prop" })
assertThat(config.parseAs<PropertiesData>()).isEqualTo(data)
assertThat(data.toConfig()).isEqualTo(config)
}
@Test
fun `Properties key with dot`() {
@Test(timeout=300_000)
fun `Properties key with dot`() {
val config = config("value" to mapOf("key.key2" to "prop"))
val data = PropertiesData(Properties().apply { this["key.key2"] = "prop" })
assertThat(config.parseAs<PropertiesData>().value).isEqualTo(data.value)
}
@Test
fun `nested Properties`() {
@Test(timeout=300_000)
fun `nested Properties`() {
val config = config("value" to mapOf("first" to mapOf("second" to "prop")))
val data = PropertiesData(Properties().apply { this["first.second"] = "prop" })
assertThat(config.parseAs<PropertiesData>().value).isEqualTo(data.value)
assertThat(data.toConfig()).isEqualTo(config)
}
@Test
fun `List of Properties`() {
@Test(timeout=300_000)
fun `List of Properties`() {
val config = config("values" to listOf(emptyMap(), mapOf("key" to "prop")))
val data = PropertiesListData(listOf(
Properties(),
@ -151,16 +151,16 @@ class ConfigParsingTest {
assertThat(data.toConfig()).isEqualTo(config)
}
@Test
fun Set() {
@Test(timeout=300_000)
fun Set() {
val data = StringSetData(setOf("a", "b"))
assertThat(config("values" to listOf("a", "a", "b")).parseAs<StringSetData>()).isEqualTo(data)
assertThat(data.toConfig()).isEqualTo(config("values" to listOf("a", "b")))
assertThat(empty().parseAs<StringSetData>().values).isEmpty()
}
@Test
fun `multi property data class`() {
@Test(timeout=300_000)
fun `multi property data class`() {
val config = config(
"b" to true,
"i" to 123,
@ -172,8 +172,8 @@ class ConfigParsingTest {
assertThat(data.toConfig()).isEqualTo(config)
}
@Test
fun `nested data classes`() {
@Test(timeout=300_000)
fun `nested data classes`() {
val config = config(
"first" to mapOf(
"value" to "nested"))
@ -182,8 +182,8 @@ class ConfigParsingTest {
assertThat(data.toConfig()).isEqualTo(config)
}
@Test
fun `List of data classes`() {
@Test(timeout=300_000)
fun `List of data classes`() {
val config = config(
"list" to listOf(
mapOf("value" to "1"),
@ -193,43 +193,43 @@ class ConfigParsingTest {
assertThat(data.toConfig()).isEqualTo(config)
}
@Test
fun `default value property`() {
@Test(timeout=300_000)
fun `default value property`() {
assertThat(config("a" to 3).parseAs<DefaultData>()).isEqualTo(DefaultData(3, 2))
assertThat(config("a" to 3, "defaultOfTwo" to 3).parseAs<DefaultData>()).isEqualTo(DefaultData(3, 3))
assertThat(DefaultData(3).toConfig()).isEqualTo(config("a" to 3, "defaultOfTwo" to 2))
}
@Test
fun `nullable property`() {
@Test(timeout=300_000)
fun `nullable property`() {
assertThat(empty().parseAs<NullableData>().nullable).isNull()
assertThat(config("nullable" to null).parseAs<NullableData>().nullable).isNull()
assertThat(config("nullable" to "not null").parseAs<NullableData>().nullable).isEqualTo("not null")
assertThat(NullableData(null).toConfig()).isEqualTo(empty())
}
@Test
fun `data class with checks`() {
@Test(timeout=300_000)
fun `data class with checks`() {
val config = config("positive" to -1)
assertThatExceptionOfType(IllegalArgumentException::class.java)
.isThrownBy { config.parseAs<PositiveData>() }
.withMessageContaining("-1")
}
@Test
fun `old config property`() {
@Test(timeout=300_000)
fun `old config property`() {
assertThat(config("oldValue" to "old").parseAs<OldData>().newValue).isEqualTo("old")
assertThat(config("newValue" to "new").parseAs<OldData>().newValue).isEqualTo("new")
assertThat(OldData("old").toConfig()).isEqualTo(config("newValue" to "old"))
}
@Test
fun `static field`() {
@Test(timeout=300_000)
fun `static field`() {
assertThat(DataWithCompanion(3).toConfig()).isEqualTo(config("value" to 3))
}
@Test
fun `unknown configuration keys raise exception`() {
@Test(timeout=300_000)
fun `unknown configuration keys raise exception`() {
// intentional typo here, parsing should throw rather than sneakily return default value
val knownKey = "mandatory"
@ -243,8 +243,8 @@ class ConfigParsingTest {
}
}
@Test
fun `parse with provided parser`() {
@Test(timeout=300_000)
fun `parse with provided parser`() {
val type1Config = mapOf("type" to "1", "value" to "type 1 value")
val type2Config = mapOf("type" to "2", "value" to "type 2 value")

View File

@ -14,8 +14,8 @@ class AliasPrivateKeyTest {
@JvmField
val tempFolder = TemporaryFolder()
@Test
fun `store AliasPrivateKey entry and cert to keystore`() {
@Test(timeout=300_000)
fun `store AliasPrivateKey entry and cert to keystore`() {
val alias = "01234567890"
val aliasPrivateKey = AliasPrivateKey(alias)
val certificatesDirectory = tempFolder.root.toPath()

View File

@ -18,8 +18,8 @@ class DevCertificatesTest {
@JvmField
val tempFolder = TemporaryFolder()
@Test
fun `create server certificate in keystore for SSL`() {
@Test(timeout=300_000)
fun `create server certificate in keystore for SSL`() {
// given
val newTrustStore = loadDevCaTrustStore()
val newTrustRoot = newTrustStore[X509Utilities.CORDA_ROOT_CA]

View File

@ -54,8 +54,8 @@ class TlsDiffAlgorithmsTest(private val serverAlgo: String, private val clientAl
@JvmField
val tempFolder = TemporaryFolder()
@Test
fun testClientServerTlsExchange() {
@Test(timeout=300_000)
fun testClientServerTlsExchange() {
//System.setProperty("javax.net.debug", "all")

View File

@ -83,8 +83,8 @@ class TlsDiffProtocolsTest(private val serverAlgo: String, private val clientAlg
@JvmField
val tempFolder = TemporaryFolder()
@Test
fun testClientServerTlsExchange() {
@Test(timeout=300_000)
fun testClientServerTlsExchange() {
//System.setProperty("javax.net.debug", "all")

View File

@ -105,8 +105,8 @@ class X509UtilitiesTest {
@JvmField
val tempFolder = TemporaryFolder()
@Test
fun `create valid self-signed CA certificate`() {
@Test(timeout=300_000)
fun `create valid self-signed CA certificate`() {
Crypto.supportedSignatureSchemes().filter { it != COMPOSITE_KEY }.forEach { validSelfSignedCertificate(it) }
}
@ -126,8 +126,8 @@ class X509UtilitiesTest {
}
}
@Test
fun `load and save a PEM file certificate`() {
@Test(timeout=300_000)
fun `load and save a PEM file certificate`() {
Crypto.supportedSignatureSchemes().filter { it != COMPOSITE_KEY }.forEach { loadSavePEMCert(it) }
}
@ -140,8 +140,8 @@ class X509UtilitiesTest {
assertEquals(caCert, readCertificate)
}
@Test
fun `create valid server certificate chain`() {
@Test(timeout=300_000)
fun `create valid server certificate chain`() {
certChainSchemeCombinations.forEach { createValidServerCertChain(it.first, it.second) }
}
@ -178,8 +178,8 @@ class X509UtilitiesTest {
return CaAndChildKeysCertsAndSubjects(caKeyPair, caCert, childKeyPair, childCert, rootSubject, childSubject)
}
@Test
fun `create valid server certificate chain includes CRL info`() {
@Test(timeout=300_000)
fun `create valid server certificate chain includes CRL info`() {
certChainSchemeCombinations.forEach { createValidServerCertIncludeCRL(it.first, it.second) }
}
@ -204,8 +204,8 @@ class X509UtilitiesTest {
}
}
@Test
fun `storing all supported key types in java keystore`() {
@Test(timeout=300_000)
fun `storing all supported key types in java keystore`() {
Crypto.supportedSignatureSchemes().filter { it != COMPOSITE_KEY }.forEach { storeKeyToKeystore(it) }
}
@ -234,8 +234,8 @@ class X509UtilitiesTest {
assertEquals(keyPair.private, reloadedPrivateKey)
}
@Test
fun `create server certificate in keystore for SSL`() {
@Test(timeout=300_000)
fun `create server certificate in keystore for SSL`() {
val certificatesDirectory = tempFolder.root.toPath()
val signingCertStore = CertificateStoreStubs.Signing.withCertificatesDirectory(certificatesDirectory, "serverstorepass")
val p2pSslConfig = CertificateStoreStubs.P2P.withCertificatesDirectory(certificatesDirectory, keyStorePassword = "serverstorepass")
@ -269,8 +269,8 @@ class X509UtilitiesTest {
assertTrue { Crypto.isValid(X509Utilities.DEFAULT_TLS_SIGNATURE_SCHEME, serverCert.publicKey, signature, testData) }
}
@Test
fun `create server cert and use in SSL socket`() {
@Test(timeout=300_000)
fun `create server cert and use in SSL socket`() {
val sslConfig = CertificateStoreStubs.P2P.withCertificatesDirectory(tempFolder.root.toPath(), keyStorePassword = "serverstorepass")
val (rootCa, intermediateCa) = createDevIntermediateCaCertPath()
@ -361,8 +361,8 @@ class X509UtilitiesTest {
assertTrue(done)
}
@Test
fun `create server cert and use in OpenSSL channel`() {
@Test(timeout=300_000)
fun `create server cert and use in OpenSSL channel`() {
val sslConfig = CertificateStoreStubs.P2P.withCertificatesDirectory(tempFolder.root.toPath(), keyStorePassword = "serverstorepass")
val (rootCa, intermediateCa) = createDevIntermediateCaCertPath()
@ -427,8 +427,8 @@ class X509UtilitiesTest {
trustStore[X509Utilities.CORDA_ROOT_CA] = rootCert
}
@Test
fun `get correct private key type from Keystore`() {
@Test(timeout=300_000)
fun `get correct private key type from Keystore`() {
schemeToKeyTypes.forEach { getCorrectKeyFromKeystore(it.first, it.second, it.third) }
}
@ -450,8 +450,8 @@ class X509UtilitiesTest {
return Pair(keyFromKeystore, keyFromKeystoreCasted)
}
@Test
fun `serialize - deserialize X509Certificate`() {
@Test(timeout=300_000)
fun `serialize - deserialize X509Certificate`() {
Crypto.supportedSignatureSchemes().filter { it != COMPOSITE_KEY }.forEach { serializeDeserializeX509Cert(it) }
}
@ -470,8 +470,8 @@ class X509UtilitiesTest {
assertEquals(expected, actual)
}
@Test
fun `serialize - deserialize X509CertPath`() {
@Test(timeout=300_000)
fun `serialize - deserialize X509CertPath`() {
Crypto.supportedSignatureSchemes().filter { it != COMPOSITE_KEY }.forEach { serializeDeserializeX509CertPath(it) }
}
@ -495,8 +495,8 @@ class X509UtilitiesTest {
assertEquals(expected, actual)
}
@Test
fun `signing a key type with another key type certificate then store and reload correctly from keystore`() {
@Test(timeout=300_000)
fun `signing a key type with another key type certificate then store and reload correctly from keystore`() {
certChainSchemeCombinations.forEach { signCertWithOtherKeyTypeAndTestKeystoreReload(it.first, it.second) }
}
@ -524,8 +524,8 @@ class X509UtilitiesTest {
assertEquals(childKeyPair.private, reloadedPrivateKey)
}
@Test
fun `check certificate validity or print warning if expiry is within 30 days`() {
@Test(timeout=300_000)
fun `check certificate validity or print warning if expiry is within 30 days`() {
val keyPair = generateKeyPair(DEFAULT_TLS_SIGNATURE_SCHEME)
val testName = X500Principal("CN=Test,O=R3 Ltd,L=London,C=GB")
val cert = X509Utilities.createSelfSignedCACertificate(testName, keyPair, 0.days to 50.days)

View File

@ -55,8 +55,8 @@ class BCCryptoServiceTests {
wrappingKeyStorePath = certificatesDirectory / "wrappingkeystore.pkcs12"
}
@Test
fun `BCCryptoService generate key pair and sign both data and cert`() {
@Test(timeout=300_000)
fun `BCCryptoService generate key pair and sign both data and cert`() {
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
// Testing every supported scheme.
Crypto.supportedSignatureSchemes().filter { it != Crypto.COMPOSITE_KEY }.forEach { generateKeyAndSignForScheme(cryptoService, it) }
@ -87,8 +87,8 @@ class BCCryptoServiceTests {
certificate.verify(pubKey)
}
@Test
fun `BCCryptoService generate key pair and sign with existing schemes`() {
@Test(timeout=300_000)
fun `BCCryptoService generate key pair and sign with existing schemes`() {
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
// Testing every supported scheme.
Crypto.supportedSignatureSchemes().filter { it != Crypto.COMPOSITE_KEY
@ -101,8 +101,8 @@ class BCCryptoServiceTests {
}
}
@Test
fun `BCCryptoService generate key pair and sign with passed signing algorithm`() {
@Test(timeout=300_000)
fun `BCCryptoService generate key pair and sign with passed signing algorithm`() {
assertTrue{signAndVerify(signAlgo = "NONEwithRSA", alias = "myKeyAlias", keyTypeAlgo = "RSA")}
assertTrue{signAndVerify(signAlgo = "MD2withRSA", alias = "myKeyAlias", keyTypeAlgo = "RSA")}
@ -163,8 +163,8 @@ class BCCryptoServiceTests {
certificateStoreFileName = keyStoreFilename)
}
@Test
fun `When key does not exist getPublicKey, sign and getSigner should throw`() {
@Test(timeout=300_000)
fun `When key does not exist getPublicKey, sign and getSigner should throw`() {
val nonExistingAlias = "nonExistingAlias"
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
assertFalse { cryptoService.containsKey(nonExistingAlias) }
@ -173,16 +173,16 @@ class BCCryptoServiceTests {
assertFailsWith<CryptoServiceException> { cryptoService.getSigner(nonExistingAlias) }
}
@Test
fun `cryptoService supports degraded mode of wrapping`() {
@Test(timeout=300_000)
fun `cryptoService supports degraded mode of wrapping`() {
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
val supportedMode = cryptoService.getWrappingMode()
assertThat(supportedMode).isEqualTo(WrappingMode.DEGRADED_WRAPPED)
}
@Test
fun `cryptoService does not fail when requested to create same wrapping key twice with failIfExists is false`() {
@Test(timeout=300_000)
fun `cryptoService does not fail when requested to create same wrapping key twice with failIfExists is false`() {
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
val keyAlias = UUID.randomUUID().toString()
@ -190,8 +190,8 @@ class BCCryptoServiceTests {
cryptoService.createWrappingKey(keyAlias, failIfExists = false)
}
@Test
fun `cryptoService does fail when requested to create same wrapping key twice with failIfExists is true`() {
@Test(timeout=300_000)
fun `cryptoService does fail when requested to create same wrapping key twice with failIfExists is true`() {
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
val keyAlias = UUID.randomUUID().toString()
@ -202,8 +202,8 @@ class BCCryptoServiceTests {
.hasMessage("There is an existing key with the alias: $keyAlias")
}
@Test
fun `cryptoService fails when asked to generate wrapped key pair or sign, but the master key specified does not exist`() {
@Test(timeout=300_000)
fun `cryptoService fails when asked to generate wrapped key pair or sign, but the master key specified does not exist`() {
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
val wrappingKeyAlias = UUID.randomUUID().toString()
@ -219,8 +219,8 @@ class BCCryptoServiceTests {
.hasMessage("There is no master key under the alias: $wrappingKeyAlias")
}
@Test
fun `cryptoService can generate wrapped key pair and sign with the private key successfully, using default algorithm`() {
@Test(timeout=300_000)
fun `cryptoService can generate wrapped key pair and sign with the private key successfully, using default algorithm`() {
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
val wrappingKeyAlias = UUID.randomUUID().toString()
@ -228,8 +228,8 @@ class BCCryptoServiceTests {
generateWrappedKeyPairSignAndVerify(cryptoService, wrappingKeyAlias)
}
@Test
fun `cryptoService can generate wrapped key pair and sign with the private key successfully`() {
@Test(timeout=300_000)
fun `cryptoService can generate wrapped key pair and sign with the private key successfully`() {
val cryptoService = BCCryptoService(ALICE_NAME.x500Principal, signingCertificateStore, wrappingKeyStorePath)
val wrappingKeyAlias = UUID.randomUUID().toString()

View File

@ -19,8 +19,8 @@ internal class NodeLifecycleEventsDistributorMultiThreadedTest {
private val eventsDeliveredCounter = AtomicLong()
@Test
fun addAndDistributeConcurrently() {
@Test(timeout=300_000)
fun addAndDistributeConcurrently() {
NodeLifecycleEventsDistributor().use { instance ->

View File

@ -107,15 +107,15 @@ class NetworkBootstrapperTest {
}
}
@Test
fun `empty dir`() {
@Test(timeout=300_000)
fun `empty dir`() {
assertThatThrownBy {
bootstrap()
}.hasMessage("No nodes found")
}
@Test
fun `single node conf file`() {
@Test(timeout=300_000)
fun `single node conf file`() {
createNodeConfFile("node1", bobConfig)
bootstrap()
val networkParameters = assertBootstrappedNetwork(fakeEmbeddedCorda, "node1" to bobConfig)
@ -126,31 +126,31 @@ class NetworkBootstrapperTest {
}
}
@Test
fun `node conf file and corda jar`() {
@Test(timeout=300_000)
fun `node conf file and corda jar`() {
createNodeConfFile("node1", bobConfig)
val fakeCordaJar = fakeFileBytes(rootDir / "corda.jar")
bootstrap()
assertBootstrappedNetwork(fakeCordaJar, "node1" to bobConfig)
}
@Test
fun `single node directory with just node conf file`() {
@Test(timeout=300_000)
fun `single node directory with just node conf file`() {
createNodeDir("bob", bobConfig)
bootstrap()
assertBootstrappedNetwork(fakeEmbeddedCorda, "bob" to bobConfig)
}
@Test
fun `single node directory with node conf file and corda jar`() {
@Test(timeout=300_000)
fun `single node directory with node conf file and corda jar`() {
val nodeDir = createNodeDir("bob", bobConfig)
val fakeCordaJar = fakeFileBytes(nodeDir / "corda.jar")
bootstrap()
assertBootstrappedNetwork(fakeCordaJar, "bob" to bobConfig)
}
@Test
fun `single node directory with just corda jar`() {
@Test(timeout=300_000)
fun `single node directory with just corda jar`() {
val nodeCordaJar = (rootDir / "alice").createDirectories() / "corda.jar"
val fakeCordaJar = fakeFileBytes(nodeCordaJar)
assertThatThrownBy {
@ -159,8 +159,8 @@ class NetworkBootstrapperTest {
assertThat(nodeCordaJar).hasBinaryContent(fakeCordaJar) // Make sure the corda.jar is left untouched
}
@Test
fun `two node conf files, one of which is a notary`() {
@Test(timeout=300_000)
fun `two node conf files, one of which is a notary`() {
createNodeConfFile("alice", aliceConfig)
createNodeConfFile("notary", notaryConfig)
bootstrap()
@ -168,8 +168,8 @@ class NetworkBootstrapperTest {
networkParameters.assertContainsNotary("notary")
}
@Test
fun `two node conf files with the same legal name`() {
@Test(timeout=300_000)
fun `two node conf files with the same legal name`() {
createNodeConfFile("node1", aliceConfig)
createNodeConfFile("node2", aliceConfig)
assertThatThrownBy {
@ -177,16 +177,16 @@ class NetworkBootstrapperTest {
}.hasMessageContaining("Nodes must have unique legal names")
}
@Test
fun `one node directory and one node conf file`() {
@Test(timeout=300_000)
fun `one node directory and one node conf file`() {
createNodeConfFile("alice", aliceConfig)
createNodeDir("bob", bobConfig)
bootstrap()
assertBootstrappedNetwork(fakeEmbeddedCorda, "alice" to aliceConfig, "bob" to bobConfig)
}
@Test
fun `node conf file and CorDapp jar`() {
@Test(timeout=300_000)
fun `node conf file and CorDapp jar`() {
createNodeConfFile("alice", aliceConfig)
val cordappBytes = createFakeCordappJar("sample-app", listOf("contract.class"))
bootstrap()
@ -197,8 +197,8 @@ class NetworkBootstrapperTest {
))
}
@Test
fun `no copy CorDapps`() {
@Test(timeout=300_000)
fun `no copy CorDapps`() {
createNodeConfFile("alice", aliceConfig)
val cordappBytes = createFakeCordappJar("sample-app", listOf("contract.class"))
bootstrap(copyCordapps = CopyCordapps.No)
@ -209,8 +209,8 @@ class NetworkBootstrapperTest {
))
}
@Test
fun `add node to existing network`() {
@Test(timeout=300_000)
fun `add node to existing network`() {
createNodeConfFile("alice", aliceConfig)
bootstrap()
val networkParameters1 = (rootDir / "alice").networkParameters
@ -220,8 +220,8 @@ class NetworkBootstrapperTest {
assertThat(networkParameters1).isEqualTo(networkParameters2)
}
@Test
fun `add notary to existing network`() {
@Test(timeout=300_000)
fun `add notary to existing network`() {
createNodeConfFile("alice", aliceConfig)
bootstrap()
createNodeConfFile("notary", notaryConfig)
@ -231,8 +231,8 @@ class NetworkBootstrapperTest {
assertThat(networkParameters.epoch).isEqualTo(2)
}
@Test
fun `network parameters overrides`() {
@Test(timeout=300_000)
fun `network parameters overrides`() {
createNodeConfFile("alice", aliceConfig)
val minimumPlatformVersion = 2
val maxMessageSize = 10000
@ -255,15 +255,15 @@ class NetworkBootstrapperTest {
private val alicePackageName = "com.example.alice"
private val bobPackageName = "com.example.bob"
@Test
fun `register new package namespace in existing network`() {
@Test(timeout=300_000)
fun `register new package namespace in existing network`() {
createNodeConfFile("alice", aliceConfig)
bootstrap(packageOwnership = mapOf(Pair(alicePackageName, ALICE.publicKey)))
assertContainsPackageOwner("alice", mapOf(Pair(alicePackageName, ALICE.publicKey)))
}
@Test
fun `register additional package namespace in existing network`() {
@Test(timeout=300_000)
fun `register additional package namespace in existing network`() {
createNodeConfFile("alice", aliceConfig)
bootstrap(packageOwnership = mapOf(Pair(alicePackageName, ALICE.publicKey)))
assertContainsPackageOwner("alice", mapOf(Pair(alicePackageName, ALICE.publicKey)))
@ -273,8 +273,8 @@ class NetworkBootstrapperTest {
assertContainsPackageOwner("bob", mapOf(Pair(alicePackageName, ALICE.publicKey), Pair(bobPackageName, BOB.publicKey)))
}
@Test
fun `attempt to register overlapping namespaces in existing network`() {
@Test(timeout=300_000)
fun `attempt to register overlapping namespaces in existing network`() {
createNodeConfFile("alice", aliceConfig)
val greedyNamespace = "com.example"
bootstrap(packageOwnership = mapOf(Pair(greedyNamespace, ALICE.publicKey)))
@ -286,8 +286,8 @@ class NetworkBootstrapperTest {
bootstrap(packageOwnership = mapOf(Pair(greedyNamespace, ALICE.publicKey), Pair(bobPackageName, BOB.publicKey)))
}
@Test
fun `unregister single package namespace in network of one`() {
@Test(timeout=300_000)
fun `unregister single package namespace in network of one`() {
createNodeConfFile("alice", aliceConfig)
bootstrap(packageOwnership = mapOf(Pair(alicePackageName, ALICE.publicKey)))
assertContainsPackageOwner("alice", mapOf(Pair(alicePackageName, ALICE.publicKey)))
@ -296,8 +296,8 @@ class NetworkBootstrapperTest {
assertContainsPackageOwner("alice", emptyMap())
}
@Test
fun `unregister single package namespace in network of many`() {
@Test(timeout=300_000)
fun `unregister single package namespace in network of many`() {
createNodeConfFile("alice", aliceConfig)
bootstrap(packageOwnership = mapOf(Pair(alicePackageName, ALICE.publicKey), Pair(bobPackageName, BOB.publicKey)))
// unregister package name
@ -305,8 +305,8 @@ class NetworkBootstrapperTest {
assertContainsPackageOwner("alice", mapOf(Pair(alicePackageName, ALICE.publicKey)))
}
@Test
fun `unregister all package namespaces in existing network`() {
@Test(timeout=300_000)
fun `unregister all package namespaces in existing network`() {
createNodeConfFile("alice", aliceConfig)
bootstrap(packageOwnership = mapOf(Pair(alicePackageName, ALICE.publicKey), Pair(bobPackageName, BOB.publicKey)))
// unregister all package names

View File

@ -48,8 +48,8 @@ class NodeInfoFilesCopierTest {
nodeInfoFilesCopier = NodeInfoFilesCopier(scheduler)
}
@Test
fun `files created before a node is started are copied to that node`() {
@Test(timeout=300_000)
fun `files created before a node is started are copied to that node`() {
// Configure the first node.
nodeInfoFilesCopier.addConfig(node1RootPath)
// Ensure directories are created.
@ -69,8 +69,8 @@ class NodeInfoFilesCopierTest {
}
}
@Test
fun `polling of running nodes`() {
@Test(timeout=300_000)
fun `polling of running nodes`() {
// Configure 2 nodes.
nodeInfoFilesCopier.addConfig(node1RootPath)
nodeInfoFilesCopier.addConfig(node2RootPath)
@ -87,8 +87,8 @@ class NodeInfoFilesCopierTest {
}
}
@Test
fun `remove nodes`() {
@Test(timeout=300_000)
fun `remove nodes`() {
// Configure 2 nodes.
nodeInfoFilesCopier.addConfig(node1RootPath)
nodeInfoFilesCopier.addConfig(node2RootPath)
@ -111,8 +111,8 @@ class NodeInfoFilesCopierTest {
}
}
@Test
fun clear() {
@Test(timeout=300_000)
fun clear() {
// Configure 2 nodes.
nodeInfoFilesCopier.addConfig(node1RootPath)
nodeInfoFilesCopier.addConfig(node2RootPath)

View File

@ -9,34 +9,34 @@ import org.assertj.core.api.Assertions.assertThatIllegalArgumentException
import org.junit.Test
class WhitelistGeneratorTest {
@Test
fun `no jars against empty whitelist`() {
@Test(timeout=300_000)
fun `no jars against empty whitelist`() {
val whitelist = generateWhitelist(emptyMap(), emptyList(), emptyList())
assertThat(whitelist).isEmpty()
}
@Test
fun `no jars against single whitelist`() {
@Test(timeout=300_000)
fun `no jars against single whitelist`() {
val existingWhitelist = mapOf("class1" to listOf(SecureHash.randomSHA256()))
val newWhitelist = generateWhitelist(existingWhitelist, emptyList(), emptyList())
assertThat(newWhitelist).isEqualTo(existingWhitelist)
}
@Test
fun `empty jar against empty whitelist`() {
@Test(timeout=300_000)
fun `empty jar against empty whitelist`() {
val whitelist = generateWhitelist(emptyMap(), emptyList(), listOf(TestContractsJar(contractClassNames = emptyList())))
assertThat(whitelist).isEmpty()
}
@Test
fun `empty jar against single whitelist`() {
@Test(timeout=300_000)
fun `empty jar against single whitelist`() {
val existingWhitelist = mapOf("class1" to listOf(SecureHash.randomSHA256()))
val newWhitelist = generateWhitelist(existingWhitelist, emptyList(), listOf(TestContractsJar(contractClassNames = emptyList())))
assertThat(newWhitelist).isEqualTo(existingWhitelist)
}
@Test
fun `jar with single contract against empty whitelist`() {
@Test(timeout=300_000)
fun `jar with single contract against empty whitelist`() {
val jar = TestContractsJar(contractClassNames = listOf("class1"))
val whitelist = generateWhitelist(emptyMap(), emptyList(), listOf(jar))
assertThat(whitelist).isEqualTo(mapOf(
@ -44,8 +44,8 @@ class WhitelistGeneratorTest {
))
}
@Test
fun `single contract jar against single whitelist of different contract`() {
@Test(timeout=300_000)
fun `single contract jar against single whitelist of different contract`() {
val class1JarHash = SecureHash.randomSHA256()
val existingWhitelist = mapOf("class1" to listOf(class1JarHash))
val jar = TestContractsJar(contractClassNames = listOf("class2"))
@ -56,8 +56,8 @@ class WhitelistGeneratorTest {
))
}
@Test
fun `same jar with single contract`() {
@Test(timeout=300_000)
fun `same jar with single contract`() {
val jarHash = SecureHash.randomSHA256()
val existingWhitelist = mapOf("class1" to listOf(jarHash))
val jar = TestContractsJar(hash = jarHash, contractClassNames = listOf("class1"))
@ -65,8 +65,8 @@ class WhitelistGeneratorTest {
assertThat(newWhitelist).isEqualTo(existingWhitelist)
}
@Test
fun `jar with updated contract`() {
@Test(timeout=300_000)
fun `jar with updated contract`() {
val previousJarHash = SecureHash.randomSHA256()
val existingWhitelist = mapOf("class1" to listOf(previousJarHash))
val newContractsJar = TestContractsJar(contractClassNames = listOf("class1"))
@ -76,8 +76,8 @@ class WhitelistGeneratorTest {
))
}
@Test
fun `jar with one existing contract and one new one`() {
@Test(timeout=300_000)
fun `jar with one existing contract and one new one`() {
val previousJarHash = SecureHash.randomSHA256()
val existingWhitelist = mapOf("class1" to listOf(previousJarHash))
val newContractsJar = TestContractsJar(contractClassNames = listOf("class1", "class2"))
@ -88,8 +88,8 @@ class WhitelistGeneratorTest {
))
}
@Test
fun `two versions of the same contract`() {
@Test(timeout=300_000)
fun `two versions of the same contract`() {
val version1Jar = TestContractsJar(contractClassNames = listOf("class1"))
val version2Jar = TestContractsJar(contractClassNames = listOf("class1"))
val newWhitelist = generateWhitelist(emptyMap(), emptyList(), listOf(version1Jar, version2Jar))
@ -98,15 +98,15 @@ class WhitelistGeneratorTest {
))
}
@Test
fun `jar with single new contract that's excluded`() {
@Test(timeout=300_000)
fun `jar with single new contract that's excluded`() {
val jar = TestContractsJar(contractClassNames = listOf("class1"))
val whitelist = generateWhitelist(emptyMap(), listOf("class1"), listOf(jar))
assertThat(whitelist).isEmpty()
}
@Test
fun `jar with two new contracts, one of which is excluded`() {
@Test(timeout=300_000)
fun `jar with two new contracts, one of which is excluded`() {
val jar = TestContractsJar(contractClassNames = listOf("class1", "class2"))
val whitelist = generateWhitelist(emptyMap(), listOf("class1"), listOf(jar))
assertThat(whitelist).isEqualTo(mapOf(
@ -114,8 +114,8 @@ class WhitelistGeneratorTest {
))
}
@Test
fun `jar with updated contract but it's excluded`() {
@Test(timeout=300_000)
fun `jar with updated contract but it's excluded`() {
val existingWhitelist = mapOf("class1" to listOf(SecureHash.randomSHA256()))
val jar = TestContractsJar(contractClassNames = listOf("class1"))
assertThatIllegalArgumentException().isThrownBy {

View File

@ -43,24 +43,24 @@ class MissingSchemaMigrationTest {
TestIdentity(ALICE_NAME, 70).name, forceThrowOnMissingMigration)
}
@Test
fun `test that an error is thrown when forceThrowOnMissingMigration is set and a mapped schema is missing a migration`() {
@Test(timeout=300_000)
fun `test that an error is thrown when forceThrowOnMissingMigration is set and a mapped schema is missing a migration`() {
assertThatThrownBy {
createSchemaMigration(setOf(GoodSchema), true)
.nodeStartup(dataSource.connection.use { DBCheckpointStorage().getCheckpointCount(it) != 0L })
}.isInstanceOf(MissingMigrationException::class.java)
}
@Test
fun `test that an error is not thrown when forceThrowOnMissingMigration is not set and a mapped schema is missing a migration`() {
@Test(timeout=300_000)
fun `test that an error is not thrown when forceThrowOnMissingMigration is not set and a mapped schema is missing a migration`() {
assertDoesNotThrow {
createSchemaMigration(setOf(GoodSchema), false)
.nodeStartup(dataSource.connection.use { DBCheckpointStorage().getCheckpointCount(it) != 0L })
}
}
@Test
fun `test that there are no missing migrations for the node`() {
@Test(timeout=300_000)
fun `test that there are no missing migrations for the node`() {
assertDoesNotThrow("This test failure indicates " +
"a new table has been added to the node without the appropriate migration scripts being present") {
createSchemaMigration(NodeSchemaService().internalSchemas(), false)

View File

@ -12,8 +12,8 @@ import javax.net.ssl.TrustManagerFactory
import kotlin.test.assertEquals
class SSLHelperTest {
@Test
fun `ensure SNI header in correct format`() {
@Test(timeout=300_000)
fun `ensure SNI header in correct format`() {
val legalName = CordaX500Name("Test", "London", "GB")
val sslConfig = configureTestSSL(legalName)