Skip to content

Commit 54d7f39

Browse files
Cheesebsideupkivieweddumelendez
authored
Add TiDB module (#5511)
Co-authored-by: Sergei Egorov <[email protected]> Co-authored-by: Kevin Wittek <[email protected]> Co-authored-by: Eddú Meléndez Gonzales <[email protected]>
1 parent 7c70a8a commit 54d7f39

File tree

18 files changed

+327
-0
lines changed

18 files changed

+327
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ body:
4343
- RabbitMQ
4444
- Selenium
4545
- Solr
46+
- TiDB
4647
- ToxiProxy
4748
- Trino
4849
- Vault

.github/ISSUE_TEMPLATE/enhancement.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ body:
4343
- RabbitMQ
4444
- Selenium
4545
- Solr
46+
- TiDB
4647
- ToxiProxy
4748
- Trino
4849
- Vault

.github/ISSUE_TEMPLATE/feature.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ body:
4343
- RabbitMQ
4444
- Selenium
4545
- Solr
46+
- TiDB
4647
- ToxiProxy
4748
- Trino
4849
- Vault

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ updates:
197197
schedule:
198198
interval: "monthly"
199199
open-pull-requests-limit: 10
200+
- package-ecosystem: "gradle"
201+
directory: "/modules/tidb"
202+
schedule:
203+
interval: "monthly"
204+
open-pull-requests-limit: 10
200205
- package-ecosystem: "gradle"
201206
directory: "/modules/toxiproxy"
202207
schedule:

.github/labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
- modules/solr/*
7474
"modules/spock":
7575
- modules/spock/*
76+
"modules/tidb":
77+
- modules/tidb/*
7678
"modules/toxiproxy":
7779
- modules/toxiproxy/*
7880
"modules/trino":

docs/modules/databases/jdbc.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ Insert `tc:` after `jdbc:` as follows. Note that the hostname, port and database
5151

5252
`jdbc:tc:cockroach:v21.2.3:///databasename`
5353

54+
#### Using TiDB
55+
56+
`jdbc:tc:tidb:v6.1.0:///databasename`
57+
5458
### Using a classpath init script
5559

5660
Testcontainers can run an init script after the database container is started, but before your code is given a connection to it. The script must be on the classpath, and is referenced as follows:

docs/modules/databases/tidb.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# TiDB Module
2+
3+
See [Database containers](./index.md) for documentation and usage that is common to all relational database container types.
4+
5+
## Adding this module to your project dependencies
6+
7+
Add the following dependency to your `pom.xml`/`build.gradle` file:
8+
9+
=== "Gradle"
10+
```groovy
11+
testImplementation "org.testcontainers:tidb:{{latest_version}}"
12+
```
13+
14+
=== "Maven"
15+
```xml
16+
<dependency>
17+
<groupId>org.testcontainers</groupId>
18+
<artifactId>tidb</artifactId>
19+
<version>{{latest_version}}</version>
20+
<scope>test</scope>
21+
</dependency>
22+
```
23+
24+
!!! hint
25+
Adding this Testcontainers library JAR will not automatically add a database driver JAR to your project. You should ensure that your project also has a suitable database driver as a dependency.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ nav:
6363
- modules/databases/orientdb.md
6464
- modules/databases/postgres.md
6565
- modules/databases/presto.md
66+
- modules/databases/tidb.md
6667
- modules/databases/trino.md
6768
- modules/azure.md
6869
- modules/docker_compose.md

modules/tidb/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
description = "Testcontainers :: JDBC :: TiDB"
2+
3+
dependencies {
4+
api project(':jdbc')
5+
6+
testImplementation project(':jdbc-test')
7+
testImplementation 'mysql:mysql-connector-java:8.0.29'
8+
9+
compileOnly 'org.jetbrains:annotations:23.0.0'
10+
}

modules/tidb/sql/init_mysql.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CREATE TABLE bar (
2+
foo VARCHAR(255)
3+
);
4+
5+
INSERT INTO bar (foo) VALUES ('hello world');

0 commit comments

Comments
 (0)