Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Reuse Containers in tests; Add Test parameters #1853

Merged
merged 16 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = [email protected] !== "exposed-tests"
onlyIf { [email protected] !== "exposed-tests" }

finalizedBy(reportMerge)
reportMerge.configure {
input.from([email protected])
}
}

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
Loading