Compose tests excluded my default

This commit is contained in:
Tapac
2019-08-25 14:31:32 +03:00
parent c3d931b682
commit 2f85ff6fd7
4 changed files with 60 additions and 27 deletions

View File

@@ -7,32 +7,33 @@ import java.io.File
import java.time.Duration import java.time.Duration
fun Project.setupDialectTest(dialect: String) { fun Project.setupDialectTest(dialect: String) {
applyPluginSafely("com.avast.gradle.docker-compose") if (dialect != "none") {
val dialectTest = tasks.create("exposedDialectTestWithDocker", Test::class) { applyPluginSafely("com.avast.gradle.docker-compose")
group = "verification" val dialectTest = tasks.create("exposedDialectTestWithDocker", Test::class) {
systemProperties["exposed.test.dialects"] = dialect group = "verification"
systemProperties["exposed.test.dialects"] = dialect
doFirst { doFirst {
_dockerCompose { _dockerCompose {
val containerInfo = servicesInfos[dialect]!! val containerInfo = servicesInfos[dialect]!!
systemProperty("exposed.test.$dialect.host", containerInfo.host) systemProperty("exposed.test.$dialect.host", containerInfo.host)
systemProperty("exposed.test.oracle.port", containerInfo.ports[1521] ?: -1) systemProperty("exposed.test.oracle.port", containerInfo.ports[1521] ?: -1)
systemProperty("exposed.test.sqlserver.port", containerInfo.ports[1433] ?: -1) systemProperty("exposed.test.sqlserver.port", containerInfo.ports[1433] ?: -1)
systemProperty("exposed.test.mariadb.port", containerInfo.ports[3306] ?: -1) systemProperty("exposed.test.mariadb.port", containerInfo.ports[3306] ?: -1)
systemProperty("exposed.test.mysql.port", containerInfo.ports[3306] ?: -1) systemProperty("exposed.test.mysql.port", containerInfo.ports[3306] ?: -1)
systemProperty("exposed.test.mysql8.port", containerInfo.ports[3306] ?: -1) systemProperty("exposed.test.mysql8.port", containerInfo.ports[3306] ?: -1)
}
} }
} }
_dockerCompose.isRequiredBy(dialectTest)
_dockerCompose {
useComposeFiles = listOf(File(project.rootProject.projectDir, "buildScripts/docker/docker-compose-$dialect.yml").absolutePath)
captureContainersOutput = true
removeVolumes = true
environment["COMPOSE_CONVERT_WINDOWS_PATHS"] = true
waitForHealthyStateTimeout = Duration.ofMinutes(60)
}
} }
_dockerCompose.isRequiredBy(dialectTest)
_dockerCompose {
useComposeFiles = listOf(File(project.rootProject.projectDir, "buildScripts/docker/docker-compose-$dialect.yml").absolutePath)
captureContainersOutput = true
removeVolumes = true
environment["COMPOSE_CONVERT_WINDOWS_PATHS"] = true
waitForHealthyStateTimeout = Duration.ofMinutes(60)
}
} }

View File

@@ -1,3 +1,6 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.exposed.gradle.setupDialectTest
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
import tanvd.kosogor.proxy.publishJar import tanvd.kosogor.proxy.publishJar
@@ -41,4 +44,17 @@ publishJar {
license = "Apache-2.0" license = "Apache-2.0"
} }
} }
} }
tasks.withType(Test::class.java) {
jvmArgs = listOf("-XX:MaxPermSize=256m")
testLogging {
events.addAll(listOf(TestLogEvent.PASSED, TestLogEvent.FAILED, TestLogEvent.SKIPPED))
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL
}
}
val dialect: String by project
setupDialectTest(dialect)

View File

@@ -1,3 +1,6 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.exposed.gradle.setupDialectTest
import tanvd.kosogor.proxy.publishJar import tanvd.kosogor.proxy.publishJar
plugins { plugins {
@@ -29,4 +32,17 @@ publishJar {
license = "Apache-2.0" license = "Apache-2.0"
} }
} }
} }
tasks.withType(Test::class.java) {
jvmArgs = listOf("-XX:MaxPermSize=256m")
testLogging {
events.addAll(listOf(TestLogEvent.PASSED, TestLogEvent.FAILED, TestLogEvent.SKIPPED))
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL
}
}
val dialect: String by project
setupDialectTest(dialect)

View File

@@ -3,4 +3,4 @@ org.gradle.jvmargs=-Dfile.encoding=UTF-8
group=org.jetbrains.exposed group=org.jetbrains.exposed
version=0.17.1 version=0.17.1
dialect=mariadb dialect=none