Skip to content

Commit 8eedb75

Browse files
committed
Init global variable to GitHub Actions instead
- Change the MySQL setup to use docker-compose - Add init options of `mysqld` - Remove global variable initialization from the test code
1 parent a2668e4 commit 8eedb75

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

.github/workflows/ci-integration-tests.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ jobs:
2222
- name: Shutdown the Default MySQL
2323
run: sudo service mysql stop
2424
- name: Set up MySQL ${{ matrix.mysql-version }}
25-
uses: asyncer-io/mysql-action@trunk
26-
with:
27-
mysql version: ${{ matrix.mysql-version }}
28-
mysql database: r2dbc
29-
mysql root password: r2dbc-password!@
25+
env:
26+
MYSQL_DATABASE: r2dbc
27+
MYSQL_ROOT_PASSWORD: r2dbc-password!@
28+
MYSQL_VERSION: ${{ matrix.mysql-version }}
29+
run: docker-compose -f ${{ github.workspace }}/containers/mysql-compose.yml up -d
3030
- name: Integration test with MySQL ${{ matrix.mysql-version }}
31-
run: ./mvnw -B verify -Dmaven.javadoc.skip=true -Dmaven.surefire.skip=true -Dtest.mysql.password=r2dbc-password!@ -Dtest.mysql.version=${{ matrix.mysql-version }} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
31+
run: |
32+
./mvnw -B verify -Dmaven.javadoc.skip=true \
33+
-Dmaven.surefire.skip=true \
34+
-Dtest.mysql.password=r2dbc-password!@ \
35+
-Dtest.mysql.version=${{ matrix.mysql-version }} \
36+
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN

containers/mysql-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "3"
2+
3+
services:
4+
mariadb:
5+
image: mysql:${MYSQL_VERSION}
6+
container_name: mysql_${MYSQL_VERSION}
7+
environment:
8+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
9+
MYSQL_DATABASE: ${MYSQL_DATABASE}
10+
command: mysqld --local-infile=true --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
11+
ports:
12+
- "3306:3306"

src/test/java/io/asyncer/r2dbc/mysql/ConnectionIntegrationTest.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import io.r2dbc.spi.ColumnMetadata;
2020
import io.r2dbc.spi.R2dbcPermissionDeniedException;
21-
import org.junit.jupiter.api.BeforeAll;
2221
import org.junit.jupiter.api.Test;
2322
import org.junit.jupiter.params.ParameterizedTest;
2423
import org.junit.jupiter.params.provider.ValueSource;
@@ -28,7 +27,6 @@
2827
import org.testcontainers.shaded.com.fasterxml.jackson.databind.node.ObjectNode;
2928
import reactor.core.publisher.Flux;
3029
import reactor.core.publisher.Mono;
31-
import reactor.test.StepVerifier;
3230

3331
import java.io.IOException;
3432
import java.net.URISyntaxException;
@@ -62,20 +60,6 @@ class ConnectionIntegrationTest extends IntegrationTestSupport {
6260
super(config);
6361
}
6462

65-
@BeforeAll
66-
static void initGlobalVariables() {
67-
// TODO: move it to GitHub Actions instead of test code
68-
MySqlConnectionFactory.from(config)
69-
.create()
70-
.flatMap(conn -> conn.createStatement("SET GLOBAL local_infile=ON")
71-
.execute()
72-
.flatMap(MySqlResult::getRowsUpdated)
73-
.then(conn.close())
74-
.onErrorResume(e -> conn.close().then(Mono.error(e))))
75-
.as(StepVerifier::create)
76-
.verifyComplete();
77-
}
78-
7963
@Test
8064
void isInTransaction() {
8165
complete(connection -> Mono.<Void>fromRunnable(() -> assertThat(connection.isInTransaction())

0 commit comments

Comments
 (0)