NOTICK - OS 4.6 to 4.7 merge 2020-10-30

This commit is contained in:
Ross Nicoll 2020-11-02 15:15:23 +00:00 committed by GitHub
commit 74c5470627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 99 additions and 32 deletions

View File

@ -1,39 +1,87 @@
import static com.r3.build.BuildControl.killAllExistingBuildsForJob
@Library('existing-build-control')
import static com.r3.build.BuildControl.killAllExistingBuildsForJob
#!groovy
/**
* Jenkins pipeline to build Corda OS release branches and tags.
* PLEASE NOTE: we DO want to run a build for each commit!!!
*/
killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger())
/**
* Sense environment
*/
boolean isReleaseTag = (env.TAG_NAME =~ /^release-.*JDK11$/)
boolean isInternalRelease = (env.TAG_NAME =~ /^internal-release-.*JDK11$/)
boolean isReleaseCandidate = (env.TAG_NAME =~ /^release-.*(RC|HC).*JDK11$/)
/**
* Common Gradle arguments for all Gradle executions
*/
String COMMON_GRADLE_PARAMS = [
'--no-daemon',
'--stacktrace',
'--info',
'-Pcompilation.warningsAsErrors=false',
'-Ptests.failFast=true',
].join(' ')
pipeline {
agent { label 'open-j9' }
agent { label 'open-j9 && os' }
/*
* List options in alphabetical order
*/
options {
timestamps()
buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14'))
timeout(time: 10, unit: 'HOURS')
timestamps()
}
/*
* List environment variables in alphabetical order
*/
environment {
EXECUTOR_NUMBER = "${env.EXECUTOR_NUMBER}"
ARTIFACTORY_BUILD_NAME = "Corda OS OpenJ9 :: Publish :: Publish Release to Artifactory :: ${env.BRANCH_NAME}"
ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials')
CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}"
CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}"
}
stages {
stage('Unit Tests') {
steps {
sh "./gradlew clean --continue test --info"
sh "./gradlew clean --continue test --info -Ptests.failFast=true"
}
}
stage('Integration Tests') {
steps {
sh "./gradlew clean --continue integrationTest --info"
sh "./gradlew clean --continue integrationTest --info -Ptests.failFast=true"
}
}
stage('Smoke Tests') {
steps {
sh "./gradlew clean --continue smokeTest --info"
sh "./gradlew clean --continue smokeTest --info -Ptests.failFast=true"
}
}
stage('Slow Integration Tests') {
steps {
sh "./gradlew clean --continue slowIntegrationTest --info"
sh "./gradlew clean --continue slowIntegrationTest --info -Ptests.failFast=true"
}
}
stage('Publish Release to Docker Hub') {
when {
expression { isReleaseTag && !isInternalRelease && !isReleaseCandidate}
}
steps {
withCredentials([
usernamePassword(credentialsId: 'corda-publisher-docker-hub-credentials',
usernameVariable: 'DOCKER_USERNAME',
passwordVariable: 'DOCKER_PASSWORD')
]) {
sh script: [
'./gradlew',
COMMON_GRADLE_PARAMS,
'docker:buildAndPushDockerhubImages'
].join(' ')
}
}
}
}
@ -46,4 +94,4 @@ pipeline {
deleteDir() /* clean up our workspace */
}
}
}
}

View File

@ -18,7 +18,7 @@ import net.corda.testing.core.BOB_NAME
import net.corda.testing.core.singleIdentity
import net.corda.testing.driver.DriverParameters
import net.corda.testing.driver.driver
import net.corda.testing.internal.IS_OPENJ9
import net.corda.testing.internal.IS_S390X
import org.junit.Assume
import org.junit.Test
import java.time.Duration
@ -29,7 +29,7 @@ class FlowSleepTest {
@Test(timeout = 300_000)
fun `flow can sleep`() {
Assume.assumeTrue(!IS_OPENJ9)
Assume.assumeFalse(IS_S390X)
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val (start, finish) = alice.rpc.startFlow(::SleepyFlow).returnValue.getOrThrow(1.minutes)
@ -41,6 +41,7 @@ class FlowSleepTest {
@Test(timeout = 300_000)
fun `flow can sleep multiple times`() {
Assume.assumeFalse(IS_S390X)
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val alice = startNode(providedName = ALICE_NAME).getOrThrow()
val (start, middle, finish) = alice.rpc.startFlow(::AnotherSleepyFlow).returnValue.getOrThrow(1.minutes)
@ -55,7 +56,7 @@ class FlowSleepTest {
@Test(timeout = 300_000)
fun `flow can sleep and perform other suspending functions`() {
Assume.assumeTrue(!IS_OPENJ9)
Assume.assumeFalse(IS_S390X)
// ensures that events received while the flow is sleeping are not processed
driver(DriverParameters(notarySpecs = emptyList(), startNodesInProcess = true)) {
val (alice, bob) = listOf(ALICE_NAME, BOB_NAME)

View File

@ -27,6 +27,7 @@ import org.bouncycastle.operator.ContentSigner
import org.bouncycastle.pqc.jcajce.provider.sphincs.BCSphincs256PrivateKey
import org.bouncycastle.pqc.jcajce.provider.sphincs.BCSphincs256PublicKey
import org.junit.Assert.assertNotEquals
import org.junit.Assume
import org.junit.Test
import java.math.BigInteger
import java.security.KeyPairGenerator
@ -934,6 +935,7 @@ class CryptoUtilsTest {
@Test(timeout=300_000)
fun `test default SecureRandom uses platformSecureRandom`() {
Assume.assumeFalse(IS_OPENJ9) // See CORDA-4055
// Note than in Corda, [CordaSecurityProvider] is registered as the first provider.
// Remove [CordaSecurityProvider] in case it is already registered.
@ -953,4 +955,5 @@ class CryptoUtilsTest {
val secureRandomRegisteredFirstCordaProvider = SecureRandom()
assertEquals(PlatformSecureRandomService.algorithm, secureRandomRegisteredFirstCordaProvider.algorithm)
}
private val IS_OPENJ9 = System.getProperty("java.vm.name").toLowerCase().contains("openj9")
}

View File

@ -14,11 +14,13 @@ import net.corda.node.internal.NodeWithInfo
import net.corda.node.services.Permissions
import net.corda.node.services.config.PasswordEncryption
import net.corda.testing.core.ALICE_NAME
import net.corda.testing.internal.IS_S390X
import net.corda.testing.node.internal.NodeBasedTest
import net.corda.testing.node.internal.cordappForClasses
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException
import org.apache.shiro.authc.credential.DefaultPasswordService
import org.junit.After
import org.junit.Assume
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@ -173,6 +175,7 @@ class AuthDBTests : NodeBasedTest(cordappPackages = CORDAPPS) {
@Test(timeout=300_000)
fun `Modify user permissions during RPC session`() {
Assume.assumeFalse(IS_S390X)
db.insert(UserAndRoles(
username = "user3",
password = encodePassword("bar"),

View File

@ -22,10 +22,12 @@ import net.corda.testing.core.BOB_NAME
import net.corda.testing.core.dummyCommand
import net.corda.testing.driver.DriverParameters
import net.corda.testing.driver.driver
import net.corda.testing.internal.IS_S390X
import net.corda.testing.node.User
import net.corda.testing.node.internal.DUMMY_CONTRACTS_CORDAPP
import net.corda.testing.node.internal.cordappWithPackages
import net.corda.testing.node.internal.enclosedCordapp
import org.junit.Assume
import org.junit.Test
import java.time.Instant
import java.util.*
@ -95,6 +97,7 @@ class ScheduledFlowIntegrationTests {
@Test(timeout=300_000)
fun `test that when states are being spent at the same time that schedules trigger everything is processed`() {
Assume.assumeFalse(IS_S390X)
driver(DriverParameters(
startNodesInProcess = false,
cordappsForAllNodes = listOf(DUMMY_CONTRACTS_CORDAPP, cordappWithPackages("net.corda.testMessage", "net.corda.testing.core"), enclosedCordapp())

View File

@ -435,9 +435,10 @@ class DBCheckpointStorage(
} else if (checkpoint.status == FlowStatus.FAILED) {
// We need to update only the 'flowState' to null, and we don't want to update the checkpoint state
// because we want to retain the last clean checkpoint state, therefore just use a query for that update.
val sqlQuery = "Update ${NODE_DATABASE_PREFIX}checkpoint_blobs set flow_state = null where flow_id = '$flowId'"
val query = currentDBSession().createNativeQuery(sqlQuery)
query.executeUpdate()
currentDBSession()
.createNativeQuery("Update ${NODE_DATABASE_PREFIX}checkpoint_blobs set flow_state = null where flow_id = :flow_id")
.setParameter("flow_id", flowId)
.executeUpdate()
null
} else {
checkpointPerformanceRecorder.record(serializedCheckpointState, serializedFlowState)
@ -491,12 +492,11 @@ class DBCheckpointStorage(
}
override fun markAllPaused() {
val session = currentDBSession()
val runnableOrdinals = RUNNABLE_CHECKPOINTS.map { "${it.ordinal}" }.joinToString { it }
val sqlQuery = "Update ${NODE_DATABASE_PREFIX}checkpoints set status = ${FlowStatus.PAUSED.ordinal} " +
"where status in ($runnableOrdinals)"
val query = session.createNativeQuery(sqlQuery)
query.executeUpdate()
currentDBSession()
.createNativeQuery("Update ${NODE_DATABASE_PREFIX}checkpoints set status = :paused_status where status in :runnable_statuses")
.setParameter("paused_status", FlowStatus.PAUSED.ordinal)
.setParameter("runnable_statuses", RUNNABLE_CHECKPOINTS.map { it.ordinal })
.executeUpdate()
}
@Suppress("MagicNumber")
@ -627,8 +627,11 @@ class DBCheckpointStorage(
}
override fun updateCompatible(runId: StateMachineRunId, compatible: Boolean) {
val update = "Update ${NODE_DATABASE_PREFIX}checkpoints set compatible = $compatible where flow_id = '${runId.uuid}'"
currentDBSession().createNativeQuery(update).executeUpdate()
currentDBSession()
.createNativeQuery("Update ${NODE_DATABASE_PREFIX}checkpoints set compatible = :compatible where flow_id = :flow_id")
.setParameter("compatible", compatible)
.setParameter("flow_id", runId.uuid.toString())
.executeUpdate()
}
private fun createDBFlowMetadata(flowId: String, checkpoint: Checkpoint, now: Instant): DBFlowMetadata {
@ -687,11 +690,11 @@ class DBCheckpointStorage(
}
private fun setDBFlowMetadataFinishTime(flowId: String, now: Instant) {
val session = currentDBSession()
val sqlQuery = "Update ${NODE_DATABASE_PREFIX}flow_metadata set finish_time = '$now' " +
"where flow_id = '$flowId'"
val query = session.createNativeQuery(sqlQuery)
query.executeUpdate()
currentDBSession()
.createNativeQuery("Update ${NODE_DATABASE_PREFIX}flow_metadata set finish_time = :finish_time where flow_id = :flow_id")
.setParameter("finish_time", now)
.setParameter("flow_id", flowId)
.executeUpdate()
}
private fun InvocationContext.getStartedType(): StartReason {

View File

@ -20,6 +20,7 @@ import net.corda.testing.internal.configureDatabase
import net.corda.coretesting.internal.doLookup
import net.corda.coretesting.internal.rigorousMock
import net.corda.coretesting.internal.spectator
import net.corda.testing.internal.IS_S390X
import net.corda.testing.node.MockServices
import net.corda.testing.node.TestClock
import org.junit.*
@ -294,6 +295,7 @@ class NodeSchedulerPersistenceTest : NodeSchedulerServiceTestBase() {
@Test(timeout=300_000)
fun `test that schedule is persisted`() {
Assume.assumeFalse(IS_S390X)
val dataSourceProps = MockServices.makeTestDataSourceProperties()
val timeInTheFuture = mark + 1.days
val stateRef = StateRef(SecureHash.zeroHash, 0)

View File

@ -254,4 +254,8 @@ fun isLocalPortBound(port: Int): Boolean {
}
}
val IS_OPENJ9 = System.getProperty("java.vm.name").toLowerCase().contains("openj9")
@JvmField
val IS_OPENJ9 = System.getProperty("java.vm.name").toLowerCase().contains("openj9")
@JvmField
val IS_S390X = System.getProperty("os.arch") == "s390x"