Skip to content

Commit

Permalink
chore: Reuse Containers in tests; Add Test parameters (#1853)
Browse files Browse the repository at this point in the history
* Make all build scripts indexed, cleanup unused plugin

* Update dependencies

* Add explicit SERVICE_HOST to avoid network issues with Docker 20.* on linux

* Do not log ignored tests

* Prevent db containers to restart in tests

* Cleanup docker plugin usages

* Fix db credentials

* Add test name to parameters

* Reduce columns iteration time

* Reduce date time test time

* Migrate to faster oracle container

* Force drop table before test
  • Loading branch information
e5l authored Sep 12, 2023
1 parent 4b5b04a commit 28404d7
Show file tree
Hide file tree
Showing 86 changed files with 2,406 additions and 1,861 deletions.
120 changes: 113 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.report.ReportMergeTask
import org.jetbrains.exposed.gradle.*
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
kotlin("jvm") apply true
id("io.github.gradle-nexus.publish-plugin") apply true
id("io.gitlab.arturbosch.detekt")
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"

id("com.avast.gradle.docker-compose")
}

repositories {
mavenLocal()
mavenCentral()
}

allprojects {
apply(from = rootProject.file("buildScripts/gradle/checkstyle.gradle.kts"))
configureDetekt()

if (this.name != "exposed-tests" && this.name != "exposed-bom" && this != rootProject) {
apply(from = rootProject.file("buildScripts/gradle/publishing.gradle.kts"))
configurePublishing()
}
}

Expand All @@ -30,12 +37,14 @@ subprojects {
detektPlugins("io.gitlab.arturbosch.detekt", "detekt-formatting", "1.21.0")
}
tasks.withType<Detekt>().configureEach detekt@{
enabled = this@subprojects.name !== "exposed-tests"
onlyIf { this@subprojects.name !== "exposed-tests" }

finalizedBy(reportMerge)
reportMerge.configure {
input.from(this@detekt.xmlReportFile)
}
}

tasks.withType<KotlinJvmCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
Expand All @@ -45,7 +54,104 @@ subprojects {
}
}

repositories {
mavenLocal()
mavenCentral()
subprojects {
if (name == "exposed-bom") return@subprojects

apply(plugin = "org.jetbrains.kotlin.jvm")

testDb("h2") {
withContainer = false
dialects("H2", "H2_MYSQL", "H2_PSQL", "H2_MARIADB", "H2_ORACLE", "H2_SQLSERVER")

dependencies {
dependency("com.h2database:h2:${Versions.h2_v2}")
}
}

testDb("h2_v1") {
withContainer = false
dialects("H2", "H2_MYSQL")

dependencies {
dependency("com.h2database:h2:${Versions.h2}")
}
}

testDb("sqlite") {
withContainer = false
dialects("sqlite")

dependencies {
dependency("org.xerial:sqlite-jdbc:${Versions.sqlLite3}")
}
}

testDb("mysql") {
port = 3001
dialects("mysql")
dependencies {
dependency("mysql:mysql-connector-java:${Versions.mysql51}")
}
}

testDb("mysql8") {
port = 3002
dialects("mysql")
dependencies {
dependency("mysql:mysql-connector-java:${Versions.mysql80}")
}
}

testDb("mariadb_v2") {
dialects("mariadb")
container = "mariadb"
port = 3000
dependencies {
dependency("org.mariadb.jdbc:mariadb-java-client:${Versions.mariaDB_v2}")
}
}

testDb("mariadb_v3") {
dialects("mariadb")
container = "mariadb"
port = 3000
dependencies {
dependency("org.mariadb.jdbc:mariadb-java-client:${Versions.mariaDB_v3}")
}
}

testDb("oracle") {
port = 3003
colima = true
dialects("oracle")
dependencies {
dependency("com.oracle.database.jdbc:ojdbc8:${Versions.oracle12}")
}
}

testDb("postgres") {
port = 3004
dialects("postgresql")
dependencies {
dependency("org.postgresql:postgresql:${Versions.postgre}")
}
}

testDb("postgresNG") {
port = 3004
dialects("postgresqlng")
container = "postgres"
dependencies {
dependency("org.postgresql:postgresql:${Versions.postgre}")
dependency("com.impossibl.pgjdbc-ng:pgjdbc-ng:${Versions.postgreNG}")
}
}

testDb("sqlserver") {
port = 3005
dialects("sqlserver")
dependencies {
dependency("com.microsoft.sqlserver:mssql-jdbc:${Versions.sqlserver}")
}
}
}
16 changes: 8 additions & 8 deletions buildScripts/docker/docker-compose-mariadb.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: '3.1'

services:
mariadb:
image: mariadb
restart: always
ports:
- "3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: 'testdb'
mariadb:
image: mariadb
restart: always
ports:
- "3000:3306"
environment:
MYSQL_ROOT_PASSWORD: "Exposed_password_1!"
MYSQL_DATABASE: "testdb"
20 changes: 10 additions & 10 deletions buildScripts/docker/docker-compose-mysql.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: '3.1'
version: "3.1"

services:
mysql:
platform: linux/x86_64
image: mysql:5.7
restart: always
ports:
- "3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: 'testdb'
mysql:
platform: linux/x86_64
restart: always
image: mysql:5.7
ports:
- "3001:3306"
environment:
MYSQL_ROOT_PASSWORD: "Exposed_password_1!"
MYSQL_DATABASE: "testdb"
16 changes: 8 additions & 8 deletions buildScripts/docker/docker-compose-mysql8.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: '3.1'

services:
mysql8:
image: mysql:8.0
restart: always
ports:
- "3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_DATABASE: 'testdb'
mysql8:
image: mysql:8.0
restart: always
ports:
- "3002:3306"
environment:
MYSQL_ROOT_PASSWORD: "Exposed_password_1!"
MYSQL_DATABASE: "testdb"
18 changes: 8 additions & 10 deletions buildScripts/docker/docker-compose-oracle.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
version: '3.1'

services:
oracle:
container_name: oracleDB
image: quillbuilduser/oracle-18-xe:latest
ports:
- "1521"
environment:
WEB_CONSOLE: "true"
DBCA_TOTAL_MEMORY: 1024
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
USE_UTF8_IF_CHARSET_EMPTY: "true"
oracle:
container_name: oracleDB
restart: always
image: gvenzl/oracle-xe:18-slim-faststart
ports:
- "3003:1521"
environment:
ORACLE_PASSWORD: "Oracle18"
11 changes: 11 additions & 0 deletions buildScripts/docker/docker-compose-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.1'

services:
postgres:
image: postgres
restart: always
ports:
- "3004:5432"
environment:
POSTGRES_USER: "root"
POSTGRES_PASSWORD: "Exposed_password_1!"
5 changes: 3 additions & 2 deletions buildScripts/docker/docker-compose-sqlserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ version: '3.1'
services:
sqlserver:
container_name: SQLServer
restart: always
image: mcr.microsoft.com/azure-sql-edge:1.0.7
ports:
- "1433:1433"
- "3005:1433"
environment:
ACCEPT_EULA: "1"
SA_PASSWORD: "yourStrong(!)Password"
SA_PASSWORD: "Exposed_password_1!"
20 changes: 0 additions & 20 deletions buildScripts/gradle/checkstyle.gradle.kts

This file was deleted.

41 changes: 0 additions & 41 deletions buildScripts/gradle/publishing.gradle.kts

This file was deleted.

5 changes: 2 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ repositories {

dependencies {
gradleApi()
implementation("org.jetbrains.kotlin.jvm", "org.jetbrains.kotlin.jvm.gradle.plugin", "1.9.0")
implementation("com.avast.gradle", "gradle-docker-compose-plugin", "0.14.9")
implementation("io.github.gradle-nexus", "publish-plugin", "1.0.0")
implementation("org.jetbrains.kotlin.jvm", "org.jetbrains.kotlin.jvm.gradle.plugin", "1.9.10")
implementation("com.avast.gradle", "gradle-docker-compose-plugin", "0.17.4")
implementation("io.gitlab.arturbosch.detekt", "detekt-gradle-plugin", "1.21.0")
}

Expand Down
10 changes: 0 additions & 10 deletions buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/Accessors.kt

This file was deleted.

Loading

0 comments on commit 28404d7

Please sign in to comment.