Merge remote-tracking branch 'origin/release/os/4.5' into adel/merge-from-4.5-17-Sept

This commit is contained in:
Adel El-Beik 2020-09-17 10:34:01 +01:00
commit 01cd8d6415
8 changed files with 54 additions and 10 deletions

View File

@ -342,7 +342,7 @@ allprojects {
} }
tasks.withType(Test).configureEach { tasks.withType(Test).configureEach {
forkEvery = 10 forkEvery = 20
ignoreFailures = project.hasProperty('tests.ignoreFailures') ? project.property('tests.ignoreFailures').toBoolean() : false ignoreFailures = project.hasProperty('tests.ignoreFailures') ? project.property('tests.ignoreFailures').toBoolean() : false
failFast = project.hasProperty('tests.failFast') ? project.property('tests.failFast').toBoolean() : false failFast = project.hasProperty('tests.failFast') ? project.property('tests.failFast').toBoolean() : false

View File

@ -20,7 +20,7 @@ quasarVersion11=0.8.1_r3
jdkClassifier11=jdk11 jdkClassifier11=jdk11
proguardVersion=6.1.1 proguardVersion=6.1.1
bouncycastleVersion=1.66 bouncycastleVersion=1.66
classgraphVersion=4.8.89 classgraphVersion=4.8.90
disruptorVersion=3.4.2 disruptorVersion=3.4.2
typesafeConfigVersion=1.3.4 typesafeConfigVersion=1.3.4
jsr305Version=3.0.2 jsr305Version=3.0.2

View File

@ -2,6 +2,7 @@ package net.corda.coretests.indentity
import com.google.common.jimfs.Configuration.unix import com.google.common.jimfs.Configuration.unix
import com.google.common.jimfs.Jimfs import com.google.common.jimfs.Jimfs
import net.corda.core.crypto.Crypto
import net.corda.core.crypto.entropyToKeyPair import net.corda.core.crypto.entropyToKeyPair
import net.corda.core.identity.CordaX500Name import net.corda.core.identity.CordaX500Name
import net.corda.core.identity.Party import net.corda.core.identity.Party
@ -14,6 +15,7 @@ import net.corda.testing.core.SerializationEnvironmentRule
import net.corda.testing.core.getTestPartyAndCertificate import net.corda.testing.core.getTestPartyAndCertificate
import net.corda.coretesting.internal.DEV_ROOT_CA import net.corda.coretesting.internal.DEV_ROOT_CA
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.junit.Before
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
import java.math.BigInteger import java.math.BigInteger
@ -24,6 +26,13 @@ class PartyAndCertificateTest {
@JvmField @JvmField
val testSerialization = SerializationEnvironmentRule() val testSerialization = SerializationEnvironmentRule()
@Before
fun setUp() {
// Register providers before creating Jimfs filesystem. JimFs creates an SSHD instance which
// register BouncyCastle and EdDSA provider separately, which wrecks havoc.
Crypto.registerProviders()
}
@Test(timeout=300_000) @Test(timeout=300_000)
fun `reject a path with no roles`() { fun `reject a path with no roles`() {
val path = X509Utilities.buildCertPath(DEV_ROOT_CA.certificate) val path = X509Utilities.buildCertPath(DEV_ROOT_CA.certificate)

View File

@ -64,6 +64,8 @@ import org.junit.Test
import rx.schedulers.TestScheduler import rx.schedulers.TestScheduler
import java.io.IOException import java.io.IOException
import java.net.URL import java.net.URL
import java.nio.file.FileSystem
import java.nio.file.Path
import java.security.KeyPair import java.security.KeyPair
import java.time.Instant import java.time.Instant
import java.time.temporal.ChronoUnit import java.time.temporal.ChronoUnit
@ -80,11 +82,12 @@ class NetworkMapUpdaterTest {
val testSerialization = SerializationEnvironmentRule(true) val testSerialization = SerializationEnvironmentRule(true)
private val cacheExpiryMs = 1000 private val cacheExpiryMs = 1000
private val privateNetUUID = UUID.randomUUID() private val privateNetUUID = UUID.randomUUID()
private val fs = Jimfs.newFileSystem(unix()) private lateinit var fs: FileSystem
private val baseDir = fs.getPath("/node") private lateinit var baseDir: Path
private val nodeInfoDir = baseDir / NODE_INFO_DIRECTORY private val nodeInfoDir
get() = baseDir / NODE_INFO_DIRECTORY
private val scheduler = TestScheduler() private val scheduler = TestScheduler()
private val fileWatcher = NodeInfoWatcher(baseDir, scheduler) private lateinit var fileWatcher: NodeInfoWatcher
private val nodeReadyFuture = openFuture<Void?>() private val nodeReadyFuture = openFuture<Void?>()
private val networkMapCache = createMockNetworkMapCache() private val networkMapCache = createMockNetworkMapCache()
private lateinit var ourKeyPair: KeyPair private lateinit var ourKeyPair: KeyPair
@ -96,6 +99,14 @@ class NetworkMapUpdaterTest {
@Before @Before
fun setUp() { fun setUp() {
// Register providers before creating Jimfs filesystem. JimFs creates an SSHD instance which
// register BouncyCastle and EdDSA provider separately, which wrecks havoc.
Crypto.registerProviders()
fs = Jimfs.newFileSystem(unix())
baseDir = fs.getPath("/node")
fileWatcher = NodeInfoWatcher(baseDir, scheduler)
ourKeyPair = Crypto.generateKeyPair(X509Utilities.DEFAULT_TLS_SIGNATURE_SCHEME) ourKeyPair = Crypto.generateKeyPair(X509Utilities.DEFAULT_TLS_SIGNATURE_SCHEME)
ourNodeInfo = createNodeInfoAndSigned("Our info", ourKeyPair).signed ourNodeInfo = createNodeInfoAndSigned("Our info", ourKeyPair).signed
server = NetworkMapServer(cacheExpiryMs.millis) server = NetworkMapServer(cacheExpiryMs.millis)

View File

@ -3,6 +3,7 @@ package net.corda.node.services.network
import com.google.common.jimfs.Configuration import com.google.common.jimfs.Configuration
import com.google.common.jimfs.Jimfs import com.google.common.jimfs.Jimfs
import net.corda.core.identity.CordaX500Name import net.corda.core.identity.CordaX500Name
import net.corda.core.crypto.Crypto
import net.corda.core.internal.* import net.corda.core.internal.*
import net.corda.core.serialization.deserialize import net.corda.core.serialization.deserialize
import net.corda.core.utilities.days import net.corda.core.utilities.days
@ -37,7 +38,7 @@ class NetworkParametersReaderTest {
@JvmField @JvmField
val testSerialization = SerializationEnvironmentRule(true) val testSerialization = SerializationEnvironmentRule(true)
private val fs: FileSystem = Jimfs.newFileSystem(Configuration.unix()) private lateinit var fs: FileSystem
private val cacheTimeout = 100000.seconds private val cacheTimeout = 100000.seconds
private lateinit var server: NetworkMapServer private lateinit var server: NetworkMapServer
@ -45,6 +46,11 @@ class NetworkParametersReaderTest {
@Before @Before
fun setUp() { fun setUp() {
// Register providers before creating Jimfs filesystem. JimFs creates an SSHD instance which
// register BouncyCastle and EdDSA provider separately, which wrecks havoc.
Crypto.registerProviders()
fs = Jimfs.newFileSystem(Configuration.unix())
server = NetworkMapServer(cacheTimeout) server = NetworkMapServer(cacheTimeout)
val address = server.start() val address = server.start()
networkMapClient = NetworkMapClient(URL("http://$address"), VersionInfo(1, "TEST", "TEST", "TEST")) networkMapClient = NetworkMapClient(URL("http://$address"), VersionInfo(1, "TEST", "TEST", "TEST"))
@ -112,3 +118,4 @@ class NetworkParametersReaderTest {
} }
} }
} }

View File

@ -2,6 +2,7 @@ package net.corda.node.services.network
import com.google.common.jimfs.Configuration import com.google.common.jimfs.Configuration
import com.google.common.jimfs.Jimfs import com.google.common.jimfs.Jimfs
import net.corda.core.crypto.Crypto
import net.corda.core.internal.NODE_INFO_DIRECTORY import net.corda.core.internal.NODE_INFO_DIRECTORY
import net.corda.core.internal.createDirectories import net.corda.core.internal.createDirectories
import net.corda.core.internal.div import net.corda.core.internal.div
@ -49,6 +50,10 @@ class NodeInfoWatcherTest {
@Before @Before
fun start() { fun start() {
// Register providers before creating Jimfs filesystem. JimFs creates an SSHD instance which
// register BouncyCastle and EdDSA provider separately, which wrecks havoc.
Crypto.registerProviders()
nodeInfoAndSigned = createNodeInfoAndSigned(ALICE_NAME) nodeInfoAndSigned = createNodeInfoAndSigned(ALICE_NAME)
val identityService = makeTestIdentityService() val identityService = makeTestIdentityService()
keyManagementService = MockKeyManagementService(identityService) keyManagementService = MockKeyManagementService(identityService)

View File

@ -7,6 +7,7 @@ import com.google.common.jimfs.Jimfs
import com.nhaarman.mockito_kotlin.doReturn import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.whenever import com.nhaarman.mockito_kotlin.whenever
import net.corda.core.contracts.ContractAttachment import net.corda.core.contracts.ContractAttachment
import net.corda.core.crypto.Crypto
import net.corda.core.crypto.SecureHash import net.corda.core.crypto.SecureHash
import net.corda.core.crypto.sha256 import net.corda.core.crypto.sha256
import net.corda.core.flows.FlowLogic import net.corda.core.flows.FlowLogic
@ -67,6 +68,10 @@ class NodeAttachmentServiceTest {
@Before @Before
fun setUp() { fun setUp() {
// Register providers before creating Jimfs filesystem. JimFs creates an SSHD instance which
// register BouncyCastle and EdDSA provider separately, which wrecks havoc.
Crypto.registerProviders()
LogHelper.setLevel(PersistentUniquenessProvider::class) LogHelper.setLevel(PersistentUniquenessProvider::class)
val dataSourceProperties = makeTestDataSourceProperties() val dataSourceProperties = makeTestDataSourceProperties()
@ -90,6 +95,7 @@ class NodeAttachmentServiceTest {
@After @After
fun tearDown() { fun tearDown() {
database.close() database.close()
fs.close()
} }
@Test(timeout=300_000) @Test(timeout=300_000)

View File

@ -41,6 +41,7 @@ import org.junit.Before
import org.junit.Test import org.junit.Test
import java.lang.IllegalStateException import java.lang.IllegalStateException
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.FileSystem
import java.security.PublicKey import java.security.PublicKey
import java.security.cert.CertPathValidatorException import java.security.cert.CertPathValidatorException
import java.security.cert.X509Certificate import java.security.cert.X509Certificate
@ -50,7 +51,7 @@ import kotlin.test.assertFalse
import kotlin.test.assertTrue import kotlin.test.assertTrue
class NetworkRegistrationHelperTest { class NetworkRegistrationHelperTest {
private val fs = Jimfs.newFileSystem(unix()) private lateinit var fs: FileSystem
private val nodeLegalName = ALICE_NAME private val nodeLegalName = ALICE_NAME
private lateinit var config: NodeConfiguration private lateinit var config: NodeConfiguration
@ -59,6 +60,11 @@ class NetworkRegistrationHelperTest {
@Before @Before
fun init() { fun init() {
// Register providers before creating Jimfs filesystem. JimFs creates an SSHD instance which
// register BouncyCastle and EdDSA provider separately, which wrecks havoc.
Crypto.registerProviders()
fs = Jimfs.newFileSystem(unix())
val baseDirectory = fs.getPath("/baseDir").createDirectories() val baseDirectory = fs.getPath("/baseDir").createDirectories()
abstract class AbstractNodeConfiguration : NodeConfiguration abstract class AbstractNodeConfiguration : NodeConfiguration