mirror of
https://github.com/corda/corda.git
synced 2025-01-12 07:52:38 +00:00
Merge pull request #6347 from corda/raz/os45to46
NOTICK: MERGE OS 4.5 -> OS 4.6
This commit is contained in:
commit
2a2f04e568
82
.ci/dev/nightly-regression/Jenkinsfile
vendored
82
.ci/dev/nightly-regression/Jenkinsfile
vendored
@ -23,51 +23,57 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Corda Pull Request - Generate Build Image') {
|
stage('Deploy Nodes') {
|
||||||
steps {
|
steps {
|
||||||
withCredentials([string(credentialsId: 'container_reg_passwd', variable: 'DOCKER_PUSH_PWD')]) {
|
sh "./gradlew --no-daemon jar deployNodes"
|
||||||
sh "./gradlew " +
|
|
||||||
"-Dkubenetize=true " +
|
|
||||||
"-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " +
|
|
||||||
"-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " +
|
|
||||||
"-Ddocker.build.tag=\"\${DOCKER_TAG_TO_USE}\"" +
|
|
||||||
" clean jar deployNodes install pushBuildImage --stacktrace"
|
|
||||||
}
|
|
||||||
sh "kubectl auth can-i get pods"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Testing phase') {
|
stage('Generate Build Image') {
|
||||||
parallel {
|
steps {
|
||||||
stage('Regression Test') {
|
withCredentials([string(credentialsId: 'container_reg_passwd', variable: 'DOCKER_PUSH_PWD')]) {
|
||||||
steps {
|
sh "./gradlew " +
|
||||||
sh "./gradlew " +
|
"-Dkubenetize=true " +
|
||||||
"-DbuildId=\"\${BUILD_ID}\" " +
|
"-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " +
|
||||||
"-Dkubenetize=true " +
|
"-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " +
|
||||||
"-Ddocker.run.tag=\"\${DOCKER_TAG_TO_USE}\" " +
|
"-Ddocker.build.tag=\"\${DOCKER_TAG_TO_USE}\"" +
|
||||||
"-Dartifactory.username=\"\${ARTIFACTORY_CREDENTIALS_USR}\" " +
|
" clean pushBuildImage --stacktrace"
|
||||||
"-Dartifactory.password=\"\${ARTIFACTORY_CREDENTIALS_PSW}\" " +
|
}
|
||||||
"-Dgit.branch=\"\${GIT_BRANCH}\" " +
|
sh "kubectl auth can-i get pods"
|
||||||
"-Dgit.target.branch=\"\${GIT_BRANCH}\" " +
|
}
|
||||||
" parallelRegressionTest --stacktrace"
|
}
|
||||||
}
|
|
||||||
|
stage('Testing phase') {
|
||||||
|
parallel {
|
||||||
|
stage('Regression Test') {
|
||||||
|
steps {
|
||||||
|
sh "./gradlew " +
|
||||||
|
"-DbuildId=\"\${BUILD_ID}\" " +
|
||||||
|
"-Dkubenetize=true " +
|
||||||
|
"-Ddocker.run.tag=\"\${DOCKER_TAG_TO_USE}\" " +
|
||||||
|
"-Dartifactory.username=\"\${ARTIFACTORY_CREDENTIALS_USR}\" " +
|
||||||
|
"-Dartifactory.password=\"\${ARTIFACTORY_CREDENTIALS_PSW}\" " +
|
||||||
|
"-Dgit.branch=\"\${GIT_BRANCH}\" " +
|
||||||
|
"-Dgit.target.branch=\"\${GIT_BRANCH}\" " +
|
||||||
|
" parallelRegressionTest --stacktrace"
|
||||||
}
|
}
|
||||||
stage('Slow Integration Test') {
|
}
|
||||||
steps {
|
stage('Slow Integration Test') {
|
||||||
sh "./gradlew " +
|
steps {
|
||||||
"-DbuildId=\"\${BUILD_ID}\" " +
|
sh "./gradlew " +
|
||||||
"-Dkubenetize=true " +
|
"-DbuildId=\"\${BUILD_ID}\" " +
|
||||||
"-Ddocker.run.tag=\"\${DOCKER_TAG_TO_USE}\" " +
|
"-Dkubenetize=true " +
|
||||||
"-Dartifactory.username=\"\${ARTIFACTORY_CREDENTIALS_USR}\" " +
|
"-Ddocker.run.tag=\"\${DOCKER_TAG_TO_USE}\" " +
|
||||||
"-Dartifactory.password=\"\${ARTIFACTORY_CREDENTIALS_PSW}\" " +
|
"-Dartifactory.username=\"\${ARTIFACTORY_CREDENTIALS_USR}\" " +
|
||||||
"-Dgit.branch=\"\${GIT_BRANCH}\" " +
|
"-Dartifactory.password=\"\${ARTIFACTORY_CREDENTIALS_PSW}\" " +
|
||||||
"-Dgit.target.branch=\"\${GIT_BRANCH}\" " +
|
"-Dgit.branch=\"\${GIT_BRANCH}\" " +
|
||||||
" allParallelSlowIntegrationTest --stacktrace"
|
"-Dgit.target.branch=\"\${GIT_BRANCH}\" " +
|
||||||
}
|
" allParallelSlowIntegrationTest --stacktrace"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
6
.ci/dev/pr-code-checks/Jenkinsfile
vendored
6
.ci/dev/pr-code-checks/Jenkinsfile
vendored
@ -40,6 +40,12 @@ pipeline {
|
|||||||
sh ".ci/check-api-changes.sh"
|
sh ".ci/check-api-changes.sh"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('Deploy Nodes') {
|
||||||
|
steps {
|
||||||
|
sh "./gradlew --no-daemon jar deployNodes"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
4
.ci/dev/regression/Jenkinsfile
vendored
4
.ci/dev/regression/Jenkinsfile
vendored
@ -15,7 +15,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Corda Pull Request - Generate Build Image') {
|
stage('Generate Build Image') {
|
||||||
steps {
|
steps {
|
||||||
withCredentials([string(credentialsId: 'container_reg_passwd', variable: 'DOCKER_PUSH_PWD')]) {
|
withCredentials([string(credentialsId: 'container_reg_passwd', variable: 'DOCKER_PUSH_PWD')]) {
|
||||||
sh "./gradlew " +
|
sh "./gradlew " +
|
||||||
@ -23,7 +23,7 @@ pipeline {
|
|||||||
"-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " +
|
"-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " +
|
||||||
"-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " +
|
"-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " +
|
||||||
"-Ddocker.build.tag=\"\${DOCKER_TAG_TO_USE}\"" +
|
"-Ddocker.build.tag=\"\${DOCKER_TAG_TO_USE}\"" +
|
||||||
" clean jar deployNodes install pushBuildImage --stacktrace"
|
" clean preAllocateForParallelRegressionTest preAllocateForAllSlowIntegrationTest pushBuildImage --stacktrace"
|
||||||
}
|
}
|
||||||
sh "kubectl auth can-i get pods"
|
sh "kubectl auth can-i get pods"
|
||||||
}
|
}
|
||||||
|
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -27,7 +27,7 @@ pipeline {
|
|||||||
"-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " +
|
"-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " +
|
||||||
"-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " +
|
"-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " +
|
||||||
"-Ddocker.build.tag=\"\${DOCKER_TAG_TO_USE}\"" +
|
"-Ddocker.build.tag=\"\${DOCKER_TAG_TO_USE}\"" +
|
||||||
" clean jar deployNodes pushBuildImage preAllocateForAllParallelIntegrationTest preAllocateForAllParallelIntegrationTest --stacktrace"
|
" clean preAllocateForAllParallelUnitTest preAllocateForAllParallelIntegrationTest pushBuildImage --stacktrace"
|
||||||
}
|
}
|
||||||
sh "kubectl auth can-i get pods"
|
sh "kubectl auth can-i get pods"
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,9 @@ fun Message.withErrorCodeFor(error: Throwable?, level: Level): Message {
|
|||||||
|
|
||||||
return when {
|
return when {
|
||||||
error != null && level.isInRange(Level.FATAL, Level.WARN) -> {
|
error != null && level.isInRange(Level.FATAL, Level.WARN) -> {
|
||||||
|
val logMessage = this.formattedMessage
|
||||||
val message = error.walkExceptionCausedByList().asSequence().mapNotNull(Throwable::message).joinToString(" - ")
|
val message = error.walkExceptionCausedByList().asSequence().mapNotNull(Throwable::message).joinToString(" - ")
|
||||||
CompositeMessage("$message [errorCode=${error.errorCode()}, moreInformationAt=${error.errorCodeLocationUrl()}]", format, parameters, throwable)
|
CompositeMessage("$logMessage - $message [errorCode=${error.errorCode()}, moreInformationAt=${error.errorCodeLocationUrl()}]", format, parameters, throwable)
|
||||||
}
|
}
|
||||||
else -> this
|
else -> this
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package net.corda.commmon.logging
|
||||||
|
|
||||||
|
import com.natpryce.hamkrest.assertion.assertThat
|
||||||
|
import com.natpryce.hamkrest.contains
|
||||||
|
import net.corda.common.logging.withErrorCodeFor
|
||||||
|
import org.apache.logging.log4j.Level
|
||||||
|
import org.apache.logging.log4j.message.SimpleMessage
|
||||||
|
import org.junit.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
class ExceptionsErrorCodeFunctionsTest {
|
||||||
|
|
||||||
|
@Test(timeout=3_000)
|
||||||
|
fun `error code for message prints out message and full stack trace`() {
|
||||||
|
val originalMessage = SimpleMessage("This is a test message")
|
||||||
|
var previous: Exception? = null
|
||||||
|
val throwables = (0..10).map {
|
||||||
|
val current = TestThrowable(it, previous)
|
||||||
|
previous = current
|
||||||
|
current
|
||||||
|
}
|
||||||
|
val exception = throwables.last()
|
||||||
|
val message = originalMessage.withErrorCodeFor(exception, Level.ERROR)
|
||||||
|
assertThat(message.formattedMessage, contains("This is a test message".toRegex()))
|
||||||
|
for (i in (0..10)) {
|
||||||
|
assertThat(message.formattedMessage, contains("This is exception $i".toRegex()))
|
||||||
|
}
|
||||||
|
assertEquals(message.format, originalMessage.format)
|
||||||
|
assertEquals(message.parameters, originalMessage.parameters)
|
||||||
|
assertEquals(message.throwable, originalMessage.throwable)
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestThrowable(index: Int, cause: Exception?) : Exception("This is exception $index", cause)
|
||||||
|
}
|
@ -7,6 +7,8 @@ import net.corda.core.internal.concurrent.openFuture
|
|||||||
import net.corda.core.node.services.CordaServiceCriticalFailureException
|
import net.corda.core.node.services.CordaServiceCriticalFailureException
|
||||||
import net.corda.core.utilities.Try
|
import net.corda.core.utilities.Try
|
||||||
import net.corda.core.utilities.contextLogger
|
import net.corda.core.utilities.contextLogger
|
||||||
|
import net.corda.nodeapi.internal.persistence.contextDatabase
|
||||||
|
import net.corda.nodeapi.internal.persistence.contextDatabaseOrNull
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
import java.util.Collections.singleton
|
import java.util.Collections.singleton
|
||||||
import java.util.LinkedList
|
import java.util.LinkedList
|
||||||
@ -93,7 +95,14 @@ class NodeLifecycleEventsDistributor : Closeable {
|
|||||||
log.warn("Not distributing $event as executor been already shutdown. Double close() case?")
|
log.warn("Not distributing $event as executor been already shutdown. Double close() case?")
|
||||||
result.set(null)
|
result.set(null)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
val passTheDbToTheThread = contextDatabaseOrNull
|
||||||
|
|
||||||
executor.execute {
|
executor.execute {
|
||||||
|
|
||||||
|
if (passTheDbToTheThread != null)
|
||||||
|
contextDatabase = passTheDbToTheThread
|
||||||
|
|
||||||
val orderedSnapshot = if (event.reversedPriority) snapshot.reversed() else snapshot
|
val orderedSnapshot = if (event.reversedPriority) snapshot.reversed() else snapshot
|
||||||
orderedSnapshot.forEach {
|
orderedSnapshot.forEach {
|
||||||
log.debug("Distributing event $event to: $it")
|
log.debug("Distributing event $event to: $it")
|
||||||
|
Loading…
Reference in New Issue
Block a user