diff --git a/node/src/integration-test/kotlin/net/corda/node/NodeKeystoreCheckTest.kt b/node/src/integration-test/kotlin/net/corda/node/NodeKeystoreCheckTest.kt index ca1a3e9792..b0601f1c11 100644 --- a/node/src/integration-test/kotlin/net/corda/node/NodeKeystoreCheckTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/NodeKeystoreCheckTest.kt @@ -8,15 +8,21 @@ import net.corda.core.utilities.getOrThrow import net.corda.node.services.config.configureDevKeyAndTrustStores import net.corda.nodeapi.internal.config.SSLConfiguration import net.corda.nodeapi.internal.crypto.* -import net.corda.testing.ALICE_NAME +import net.corda.testing.* import net.corda.testing.driver.driver +import org.junit.ClassRule import org.junit.Test import java.nio.file.Path import kotlin.test.assertEquals import kotlin.test.assertFailsWith import kotlin.test.assertTrue -class NodeKeystoreCheckTest { +class NodeKeystoreCheckTest : IntegrationTest() { + companion object { + @ClassRule @JvmField + val databaseSchemas = IntegrationTestSchemas(ALICE.toDatabaseSchemaName()) + } + @Test fun `node should throw exception if cert path doesn't chain to the trust root`() { driver(startNodesInProcess = true) { diff --git a/node/src/integration-test/kotlin/net/corda/node/services/UserAuthServiceTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/UserAuthServiceTests.kt index 3b212e705d..263fce9f75 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/UserAuthServiceTests.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/UserAuthServiceTests.kt @@ -21,6 +21,7 @@ import net.corda.testing.* import org.apache.activemq.artemis.api.core.ActiveMQSecurityException import org.junit.After import org.junit.Before +import org.junit.ClassRule import org.junit.Test import java.sql.DriverManager import java.sql.Statement @@ -28,6 +29,10 @@ import java.util.* import kotlin.test.assertFailsWith abstract class UserAuthServiceTest : NodeBasedTest() { + companion object { + @ClassRule @JvmField + val databaseSchemas = IntegrationTestSchemas(ALICE.toDatabaseSchemaName()) + } protected lateinit var node: StartedNode protected lateinit var client: CordaRPCClient diff --git a/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-global-setup.sql b/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-global-setup.sql index d1bc41c273..2c361c7ded 100644 --- a/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-global-setup.sql +++ b/testing/test-utils/src/main/resources/database-scripts/azure-sql/db-global-setup.sql @@ -1,4 +1,4 @@ -CREATE SCHEMA ${schema}; -CREATE USER ${schema} FOR LOGIN ${schema} WITH DEFAULT_SCHEMA = ${schema}; +IF NOT EXISTS (SELECT schema_name FROM information_schema.schemata WHERE schema_name = '${schema}') EXEC('CREATE SCHEMA ${schema}'); +IF NOT EXISTS (SELECT * FROM sys.sysusers WHERE name='${schema}') CREATE USER ${schema} FOR LOGIN ${schema} WITH DEFAULT_SCHEMA = ${schema}; GRANT ALTER, DELETE, EXECUTE, INSERT, REFERENCES, SELECT, UPDATE, VIEW DEFINITION ON SCHEMA::${schema} TO ${schema}; GRANT CREATE TABLE, CREATE PROCEDURE, CREATE FUNCTION, CREATE VIEW TO ${schema}; \ No newline at end of file