Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run-compat-tests')
strategy:
matrix:
db: [ MARIADB ]
db: [ MARIADB, TIDB ]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Kapper is a lightweight, Dapper-inspired ORM (Object-Relational Mapping) library
![MSSQL](https://img.shields.io/badge/mssql-%23CC2927.svg?style=for-the-badge&logo=microsoftsqlserver&logoColor=white)
![DuckDB](https://img.shields.io/badge/duckdb-FFF000.svg?style=for-the-badge&logo=duckdb&logoColor=black)
![MariaDB](https://img.shields.io/badge/mariadb-003545.svg?style=for-the-badge&logo=mariadb&logoColor=white)
![TiDB](https://img.shields.io/badge/tidb-DD0031.svg?style=for-the-badge&logo=tidb&logoColor=white)

See [Kapper](https://driessamyn.github.io/kapper/) for more information.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import org.junit.jupiter.params.ParameterizedClass
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.Arguments.arguments
import org.junit.jupiter.params.provider.MethodSource
import org.testcontainers.containers.GenericContainer
import org.testcontainers.utility.DockerImageName
import org.testcontainers.containers.JdbcDatabaseContainer
import org.testcontainers.containers.MSSQLServerContainer
import org.testcontainers.containers.MariaDBContainer
Expand Down Expand Up @@ -57,6 +59,13 @@ abstract class AbstractDbTests {
MariaDBContainer("mariadb:11.7").also { it.start() }
}

private val tidb by lazy {
GenericContainer<Nothing>(DockerImageName.parse("pingcap/tidb:v8.5.1")).apply {
withExposedPorts(4000)
start()
}
}

private val msSqlServer by lazy {
MSSQLServerContainer("mcr.microsoft.com/mssql/server:2017-CU12")
.acceptLicense()
Expand Down Expand Up @@ -86,6 +95,11 @@ abstract class AbstractDbTests {
"MSSQLSERVER" to { getConnection(msSqlServer) },
"ORACLE" to { getConnection(oracle) },
"MARIADB" to { getConnection(mariadb) },
"TIDB" to {
DriverManager.getConnection(
"jdbc:mysql://${tidb.host}:${tidb.getMappedPort(4000)}/test?user=root&allowPublicKeyRetrieval=true&useSSL=false",
)
},
)

val dbs =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ fun Connection.getDbFlavour(): DbFlavour {
productName.contains("postgres", ignoreCase = true) ||
productName.contains("enterprisedb", ignoreCase = true) -> DbFlavour.POSTGRESQL
productName.contains("mysql", ignoreCase = true) ||
productName.contains("mariadb", ignoreCase = true) -> DbFlavour.MYSQL
productName.contains("mariadb", ignoreCase = true) ||
productName.contains("tidb", ignoreCase = true) -> DbFlavour.MYSQL
productName.contains("sqlite", ignoreCase = true) -> DbFlavour.SQLITE
productName.contains("oracle", ignoreCase = true) -> DbFlavour.ORACLE
productName.contains("sql server", ignoreCase = true) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class DbFlavourTest {
"MySQL Community Server",
"MySQL Enterprise Server",
"MariaDB",
"TiDB",
"TiDB Server",
],
)
fun `when databaseProductName is mysql then getDbFlavour returns MYSQL`(value: String) {
Expand Down
Loading