Merge branch 'release/os/4.5' of https://github.com/corda/corda into razvan-os-4.5-to-4.6-merge

This commit is contained in:
Schife 2020-06-05 07:55:48 +01:00
commit fb184839f4
6 changed files with 123 additions and 61 deletions

View File

@ -1,9 +1,13 @@
@Library('corda-shared-build-pipeline-steps')
import static com.r3.build.BuildControl.killAllExistingBuildsForJob
killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger())
pipeline {
agent { label 'k8s' }
options {
timestamps()
buildDiscarder(logRotator(daysToKeepStr: '7', artifactDaysToKeepStr: '7'))
disableConcurrentBuilds()
timeout(time: 3, unit: 'HOURS')
}
@ -57,36 +61,6 @@ pipeline {
" allParallelSlowIntegrationTest --stacktrace"
}
}
stage('Generate sonarqube report') {
steps {
script {
try {
// running this step here is the only way to not majorly affect the distributed test plugin,
// as now that neither returns build files nor runs jacoco reports
sh "./gradlew --no-daemon build jacocoRootReport --stacktrace"
withSonarQubeEnv('sq01') {
sh "./gradlew --no-daemon sonarqube -x test --stacktrace"
}
timeout(time: 3, unit: 'MINUTES') {
script {
try {
def qg = waitForQualityGate();
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
println('No sonarqube webhook response within timeout. Please check the webhook configuration in sonarqube.')
// continue the pipeline
}
}
}
} catch (err) {
println('Error while trying to execute sonarqube analysis, will be skipped.')
}
}
}
}
}
}
}

View File

@ -1,4 +1,4 @@
errorTemplate = Target versionId attribute {0} not specified. Please specify a whole number starting from 1.
errorTemplate = Version identifier {0} was not specified. Please specify a whole number starting from 1.
shortDescription = A required version attribute was not specified in the manifest of the CorDapp JAR.
actionsToFix = Investigate the logs to find out which version attribute was not specified, and add that version attribute to the CorDapp manifest.
aliases = 1nskd37

View File

@ -1,3 +1,3 @@
errorTemplate = Target versionId attribute {0} not specified. Please specify a whole number starting from 1.
errorTemplate = Version identifier {0} was not specified. Please specify a whole number starting from 1.
shortDescription = A required version attribute was not specified in the manifest of the CorDapp JAR.
actionsToFix = Investigate the logs to find out which version attribute was not specified, and add that version attribute to the CorDapp manifest.

View File

@ -77,7 +77,7 @@ internal object V1NodeConfigurationSpec : Configuration.Specification<NodeConfig
val messagingServerExternal = config[messagingServerExternal] ?: Defaults.messagingServerExternal(config[messagingServerAddress])
val database = config[database] ?: Defaults.database(config[devMode])
val baseDirectoryPath = config[baseDirectory]
val cordappDirectories = config[cordappDirectories] ?: Defaults.cordappsDirectories(baseDirectoryPath)
val cordappDirectories = config[cordappDirectories]?.map { baseDirectoryPath.resolve(it) } ?: Defaults.cordappsDirectories(baseDirectoryPath)
val result = try {
valid<NodeConfigurationImpl, Configuration.Validation.Error>(NodeConfigurationImpl(
baseDirectory = baseDirectoryPath,
@ -127,7 +127,7 @@ internal object V1NodeConfigurationSpec : Configuration.Specification<NodeConfig
attachmentContentCacheSizeMegaBytes = config[attachmentContentCacheSizeMegaBytes],
h2port = config[h2port],
jarDirs = config[jarDirs],
cordappDirectories = cordappDirectories.map { baseDirectoryPath.resolve(it) },
cordappDirectories = cordappDirectories,
cordappSignerKeyFingerprintBlacklist = config[cordappSignerKeyFingerprintBlacklist],
blacklistedAttachmentSigningKeys = config[blacklistedAttachmentSigningKeys],
networkParameterAcceptanceSettings = config[networkParameterAcceptanceSettings],

View File

@ -21,6 +21,7 @@ import org.junit.Assert.assertNotNull
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import java.io.File
import java.net.URI
import java.net.URL
import java.nio.file.Paths
@ -34,7 +35,7 @@ class NodeConfigurationImplTest {
@JvmField
val tempFolder = TemporaryFolder()
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `can't have dev mode options if not in dev mode`() {
val debugOptions = DevModeOptions()
configDebugOptions(true, debugOptions)
@ -43,7 +44,7 @@ class NodeConfigurationImplTest {
configDebugOptions(false, null)
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `can't have tlsCertCrlDistPoint null when tlsCertCrlIssuer is given`() {
val configValidationResult = configTlsCertCrlOptions(null, "C=US, L=New York, OU=Corda, O=R3 HoldCo LLC, CN=Corda Root CA").validate()
assertTrue { configValidationResult.isNotEmpty() }
@ -51,7 +52,7 @@ class NodeConfigurationImplTest {
assertThat(configValidationResult.first()).contains("tlsCertCrlIssuer")
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `can't have tlsCertCrlDistPoint null when crlCheckSoftFail is false`() {
val configValidationResult = configTlsCertCrlOptions(null, null, false).validate()
assertTrue { configValidationResult.isNotEmpty() }
@ -59,7 +60,7 @@ class NodeConfigurationImplTest {
assertThat(configValidationResult.first()).contains("crlCheckSoftFail")
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `check devModeOptions flag helper`() {
assertTrue { configDebugOptions(true, null).shouldCheckCheckpoints() }
assertTrue { configDebugOptions(true, DevModeOptions()).shouldCheckCheckpoints() }
@ -67,7 +68,7 @@ class NodeConfigurationImplTest {
assertFalse { configDebugOptions(true, DevModeOptions(true)).shouldCheckCheckpoints() }
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `check crashShell flags helper`() {
assertFalse { testConfiguration.copy(sshd = null).shouldStartSSHDaemon() }
assertTrue { testConfiguration.copy(sshd = SSHDConfiguration(1234)).shouldStartSSHDaemon() }
@ -79,7 +80,7 @@ class NodeConfigurationImplTest {
assertFalse { testConfiguration.copy(noLocalShell = true, sshd = null).shouldInitCrashShell() }
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `Dev mode is autodetected correctly`() {
val os = System.getProperty("os.name")
@ -102,20 +103,20 @@ class NodeConfigurationImplTest {
System.setProperty("os.name", os)
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `Dev mode is read from the config over the autodetect logic`() {
assertTrue(getConfig("test-config-DevMode.conf").getBooleanCaseInsensitive("devMode"))
assertFalse(getConfig("test-config-noDevMode.conf").getBooleanCaseInsensitive("devMode"))
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `Dev mode is true if overriden`() {
assertTrue(getConfig("test-config-DevMode.conf", ConfigFactory.parseMap(mapOf("devMode" to true))).getBooleanCaseInsensitive("devMode"))
assertTrue(getConfig("test-config-noDevMode.conf", ConfigFactory.parseMap(mapOf("devMode" to true))).getBooleanCaseInsensitive("devMode"))
assertTrue(getConfig("test-config-empty.conf", ConfigFactory.parseMap(mapOf("devMode" to true))).getBooleanCaseInsensitive("devMode"))
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `Dev mode is false if overriden`() {
assertFalse(getConfig("test-config-DevMode.conf", ConfigFactory.parseMap(mapOf("devMode" to false))).getBooleanCaseInsensitive("devMode"))
assertFalse(getConfig("test-config-noDevMode.conf", ConfigFactory.parseMap(mapOf("devMode" to false))).getBooleanCaseInsensitive("devMode"))
@ -131,7 +132,7 @@ class NodeConfigurationImplTest {
)
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `validation has error when compatibilityZoneURL is present and devMode is true`() {
val configuration = testConfiguration.copy(
devMode = true,
@ -142,7 +143,7 @@ class NodeConfigurationImplTest {
assertThat(errors).hasOnlyOneElementSatisfying { error -> error.contains("compatibilityZoneURL") && error.contains("devMode") }
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `validation succeeds when compatibilityZoneURL is present and devMode is true and allowCompatibilityZoneURL is set`() {
val configuration = testConfiguration.copy(
devMode = true,
@ -153,7 +154,7 @@ class NodeConfigurationImplTest {
assertThat(errors).isEmpty()
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `errors for nested config keys contain path`() {
var rawConfig = ConfigFactory.parseResources("working-config.conf", ConfigParseOptions.defaults().setAllowMissing(false))
val missingPropertyPath = "rpcSettings.address"
@ -165,7 +166,7 @@ class NodeConfigurationImplTest {
}
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `validation has error when compatibilityZone is present and devMode is true`() {
val configuration = testConfiguration.copy(devMode = true, networkServices = NetworkServicesConfig(
URL("https://r3.com.doorman"),
@ -176,7 +177,7 @@ class NodeConfigurationImplTest {
assertThat(errors).hasOnlyOneElementSatisfying { error -> error.contains("networkServices") && error.contains("devMode") }
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `validation has error when both compatibilityZoneURL and networkServices are configured`() {
val configuration = testConfiguration.copy(
devMode = false,
@ -192,7 +193,7 @@ class NodeConfigurationImplTest {
}
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `rpcAddress and rpcSettings_address are equivalent`() {
var rawConfig = ConfigFactory.parseResources("working-config.conf", ConfigParseOptions.defaults().setAllowMissing(false))
rawConfig = rawConfig.withoutPath("rpcSettings.address")
@ -201,8 +202,8 @@ class NodeConfigurationImplTest {
assertThat(rawConfig.parseAsNodeConfiguration().isValid).isTrue()
}
@Test(timeout=300_000)
fun `relative path correctly parsed`() {
@Test(timeout=3_000)
fun `absolute base directory leads to correct cordapp directories`() {
val rawConfig = ConfigFactory.parseResources("working-config.conf", ConfigParseOptions.defaults().setAllowMissing(false))
// Override base directory to have predictable experience on diff OSes
@ -213,13 +214,69 @@ class NodeConfigurationImplTest {
.resolve()
val nodeConfiguration = finalConfig.parseAsNodeConfiguration()
assertThat(nodeConfiguration.isValid).isTrue()
assertTrue(nodeConfiguration.isValid)
val baseDirPath = tempFolder.root.toPath()
assertEquals(listOf(baseDirPath / "./myCorDapps1", baseDirPath / "./myCorDapps2"), nodeConfiguration.value().cordappDirectories)
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `absolute base directory leads to correct default cordapp directory`() {
val rawConfig = ConfigFactory.parseResources("working-config-no-cordapps.conf", ConfigParseOptions.defaults().setAllowMissing(false))
// Override base directory to have predictable experience on diff OSes
val finalConfig = configOf(
// Add substitution values here
"baseDirectory" to tempFolder.root.canonicalPath)
.withFallback(rawConfig)
.resolve()
val nodeConfiguration = finalConfig.parseAsNodeConfiguration()
assertTrue(nodeConfiguration.isValid)
val baseDirPath = tempFolder.root.toPath()
assertEquals(listOf(baseDirPath / "cordapps"), nodeConfiguration.value().cordappDirectories)
}
@Test(timeout=3_000)
fun `relative base dir leads to correct cordapp directories`() {
val rawConfig = ConfigFactory.parseResources("working-config.conf", ConfigParseOptions.defaults().setAllowMissing(false))
val path = tempFolder.root.relativeTo(tempFolder.root.parentFile).toString()
val fullPath = File(".").resolve(path).toString()
// Override base directory to have predictable experience on diff OSes
val finalConfig = configOf(
// Add substitution values here
"baseDirectory" to fullPath)
.withFallback(rawConfig)
.resolve()
val nodeConfiguration = finalConfig.parseAsNodeConfiguration()
assertTrue(nodeConfiguration.isValid)
assertEquals(listOf(fullPath / "./myCorDapps1", fullPath / "./myCorDapps2"), nodeConfiguration.value().cordappDirectories)
}
@Test(timeout=3_000)
fun `relative base dir leads to correct default cordapp directory`() {
val rawConfig = ConfigFactory.parseResources("working-config-no-cordapps.conf", ConfigParseOptions.defaults().setAllowMissing(false))
val path = tempFolder.root.relativeTo(tempFolder.root.parentFile).toString()
val fullPath = File(".").resolve(path).toString()
// Override base directory to have predictable experience on diff OSes
val finalConfig = configOf(
// Add substitution values here
"baseDirectory" to fullPath)
.withFallback(rawConfig)
.resolve()
val nodeConfiguration = finalConfig.parseAsNodeConfiguration()
assertTrue(nodeConfiguration.isValid)
assertEquals(listOf(fullPath / "cordapps"), nodeConfiguration.value().cordappDirectories)
}
@Test(timeout=3_000)
fun `missing rpcSettings_adminAddress cause a graceful failure`() {
var rawConfig = ConfigFactory.parseResources("working-config.conf", ConfigParseOptions.defaults().setAllowMissing(false))
rawConfig = rawConfig.withoutPath("rpcSettings.adminAddress")
@ -229,7 +286,7 @@ class NodeConfigurationImplTest {
assertThat(config.errors.asSequence().map(Configuration.Validation.Error::message).filter { it.contains("rpcSettings.adminAddress") }.toList()).isNotEmpty
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `compatibilityZoneURL populates NetworkServices`() {
val compatibilityZoneURL = URI.create("https://r3.com").toURL()
val configuration = testConfiguration.copy(
@ -241,14 +298,14 @@ class NodeConfigurationImplTest {
assertEquals(compatibilityZoneURL, configuration.networkServices!!.networkMapURL)
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `jmxReporterType is null and defaults to Jokolia`() {
val rawConfig = getConfig("working-config.conf", ConfigFactory.parseMap(mapOf("devMode" to true)))
val nodeConfig = rawConfig.parseAsNodeConfiguration().value()
assertEquals(JmxReporterType.JOLOKIA.toString(), nodeConfig.jmxReporterType.toString())
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `jmxReporterType is not null and is set to New Relic`() {
var rawConfig = getConfig("working-config.conf", ConfigFactory.parseMap(mapOf("devMode" to true)))
rawConfig = rawConfig.withValue("jmxReporterType", ConfigValueFactory.fromAnyRef("NEW_RELIC"))
@ -256,7 +313,7 @@ class NodeConfigurationImplTest {
assertEquals(JmxReporterType.NEW_RELIC.toString(), nodeConfig.jmxReporterType.toString())
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `jmxReporterType is not null and set to Jokolia`() {
var rawConfig = getConfig("working-config.conf", ConfigFactory.parseMap(mapOf("devMode" to true)))
rawConfig = rawConfig.withValue("jmxReporterType", ConfigValueFactory.fromAnyRef("JOLOKIA"))
@ -264,7 +321,7 @@ class NodeConfigurationImplTest {
assertEquals(JmxReporterType.JOLOKIA.toString(), nodeConfig.jmxReporterType.toString())
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `network services`() {
val rawConfig = getConfig("test-config-with-networkservices.conf")
val nodeConfig = rawConfig.parseAsNodeConfiguration().value()
@ -276,7 +333,7 @@ class NodeConfigurationImplTest {
}
}
@Test(timeout=300_000)
@Test(timeout=3_000)
fun `check crlCheckArtemisServer flag`() {
assertFalse(getConfig("working-config.conf").parseAsNodeConfiguration().value().crlCheckArtemisServer)
val rawConfig = getConfig("working-config.conf", ConfigFactory.parseMap(mapOf("crlCheckArtemisServer" to true)))

View File

@ -0,0 +1,31 @@
myLegalName = "O=Alice Corp, L=Madrid, C=ES"
emailAddress = "admin@company.com"
keyStorePassword = "cordacadevpass"
trustStorePassword = "trustpass"
crlCheckSoftFail = true
baseDirectory = "/opt/corda"
dataSourceProperties = {
dataSourceClassName = org.h2.jdbcx.JdbcDataSource
dataSource.url = "jdbc:h2:file:blah"
dataSource.user = "sa"
dataSource.password = ""
}
database = {
transactionIsolationLevel = "REPEATABLE_READ"
exportHibernateJMXStatistics = "false"
}
p2pAddress = "localhost:2233"
h2port = 0
useTestClock = false
verifierType = InMemory
rpcSettings = {
address = "locahost:3418"
adminAddress = "localhost:3419"
useSsl = false
standAloneBroker = false
}
flowTimeout {
timeout = 30 seconds
maxRestartCount = 3
backoffBase = 2.0
}