From c5ef9f8075a9dfd301d895c24cd22f44edd6d154 Mon Sep 17 00:00:00 2001 From: Nikita Konev Date: Sat, 23 Nov 2024 16:41:18 +0300 Subject: [PATCH] Update to Spring Boot 3.4.0, fix strang issues with MySQL and SQL Server, remove docker directory --- docker/docker-compose.yml | 64 ------------------- docker/mssql/mssql.conf | 7 -- .../docker-entrypoint-initdb.d/init-db.sql | 4 -- .../init-r2dbc-db.sql | 38 ----------- pom.xml | 5 +- r2dbc-migrate-core/pom.xml | 3 - .../core/MariadbTestcontainersTest.java | 4 +- ...ssqlTestcontainersConcurrentStartTest.java | 2 +- .../migrate/core/MssqlTestcontainersTest.java | 2 +- .../migrate/core/MysqlTestcontainersTest.java | 10 +-- .../core/PostgresTestcontainersTest.java | 2 +- .../docker-entrypoint-initdb.d/init-db.sql | 7 ++ .../docker/mariadb}/etc/mysql/conf.d/test.cnf | 0 .../docker-entrypoint-initdb.d/init-db.sql | 6 +- .../docker/mysql/etc/mysql/conf.d/test.cnf | 7 -- .../R2dbcMigrateAutoConfigurationTest.java | 2 +- 16 files changed, 22 insertions(+), 141 deletions(-) delete mode 100644 docker/docker-compose.yml delete mode 100644 docker/mssql/mssql.conf delete mode 100644 docker/mysql/docker-entrypoint-initdb.d/init-db.sql delete mode 100644 docker/postgresql/docker-entrypoint-initdb.d/init-r2dbc-db.sql create mode 100644 r2dbc-migrate-core/src/test/resources/docker/mariadb/docker-entrypoint-initdb.d/init-db.sql rename {docker/mysql => r2dbc-migrate-core/src/test/resources/docker/mariadb}/etc/mysql/conf.d/test.cnf (100%) delete mode 100644 r2dbc-migrate-core/src/test/resources/docker/mysql/etc/mysql/conf.d/test.cnf diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index d4d422aa..00000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,64 +0,0 @@ -# This file used for both developer and demo purposes. -# It contains environment -version: '3.2' - -services: - # https://hub.docker.com/_/microsoft-mssql-server - mssql: - image: mcr.microsoft.com/mssql/server:2019-CU12-ubuntu-16.04 - restart: unless-stopped - # https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-environment-variables?view=sql-server-2017 - environment: - ACCEPT_EULA: Y - SA_PASSWORD: "yourStrong(!)Password" - MSSQL_COLLATION: cyrillic_general_ci_as - ports: - - 1434:1433 - volumes: - # linux performance fix https://github.com/microsoft/mssql-docker/issues/355#issuecomment-530063302 - # this config is result of - # /opt/mssql/bin/mssql-conf traceflag 3979 on - # /opt/mssql/bin/mssql-conf set control.alternatewritethrough 0 - # /opt/mssql/bin/mssql-conf set control.writethrough 0 - - ./mssql/mssql.conf:/var/opt/mssql/mssql.conf - - mssql_data_dir:/var/opt/mssql - logging: - driver: "json-file" - options: - max-size: "50m" - max-file: "1" - postgresql: - image: postgres:13.4 - restart: unless-stopped - ports: - - 25433:5432 - environment: - - POSTGRES_PASSWORD=postgresqlPassword - volumes: - - ./postgresql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d - - postgresql_data_dir:/var/lib/postgresql/data - logging: - driver: "json-file" - options: - max-size: "50m" - max-file: "1" - mysql: - image: mysql:5.7 - restart: unless-stopped - ports: - - 33306:3306 - environment: - - MYSQL_ALLOW_EMPTY_PASSWORD=true - volumes : - - ./mysql/etc/mysql/conf.d:/etc/mysql/conf.d - - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d - - mysql_data_dir:/var/lib/mysql - logging: - driver: "json-file" - options: - max-size: "50m" - max-file: "1" -volumes: - mssql_data_dir: - postgresql_data_dir: - mysql_data_dir: \ No newline at end of file diff --git a/docker/mssql/mssql.conf b/docker/mssql/mssql.conf deleted file mode 100644 index 0ebdcb16..00000000 --- a/docker/mssql/mssql.conf +++ /dev/null @@ -1,7 +0,0 @@ -[traceflag] -traceflag0 = 3979 - -[control] -alternatewritethrough = 0 -writethrough = 0 - diff --git a/docker/mysql/docker-entrypoint-initdb.d/init-db.sql b/docker/mysql/docker-entrypoint-initdb.d/init-db.sql deleted file mode 100644 index ce3bcab5..00000000 --- a/docker/mysql/docker-entrypoint-initdb.d/init-db.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE DATABASE r2dbc; -use r2dbc; - -GRANT ALL PRIVILEGES ON r2dbc.* TO 'mysql-user'@'%' IDENTIFIED BY 'mysql-password'; \ No newline at end of file diff --git a/docker/postgresql/docker-entrypoint-initdb.d/init-r2dbc-db.sql b/docker/postgresql/docker-entrypoint-initdb.d/init-r2dbc-db.sql deleted file mode 100644 index 366c58fb..00000000 --- a/docker/postgresql/docker-entrypoint-initdb.d/init-r2dbc-db.sql +++ /dev/null @@ -1,38 +0,0 @@ --- ALTER SYSTEM SET max_connections = 400; --- Uncomment if you need to view the full postgres logs (SQL statements, ...) via `docker logs -f postgresql-test` -ALTER SYSTEM SET log_statement = 'all'; -ALTER SYSTEM SET synchronous_commit = 'off'; -- https://postgrespro.ru/docs/postgrespro/9.5/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT -ALTER SYSTEM SET shared_buffers='512MB'; -ALTER SYSTEM SET fsync=FALSE; -ALTER SYSTEM SET full_page_writes=FALSE; -ALTER SYSTEM SET commit_delay=100000; -ALTER SYSTEM SET commit_siblings=10; -ALTER SYSTEM SET work_mem='256MB'; - -create user r2dbc with password 'r2dbcPazZw0rd'; -create database r2dbc with owner r2dbc; - -\connect r2dbc; - - --- https://www.endpoint.com/blog/2012/10/30/postgresql-autoexplain-module --- ALTER SYSTEM set client_min_messages = notice; --- ALTER SYSTEM set log_min_messages = notice; --- ALTER SYSTEM set log_min_duration_statement = -1; --- ALTER SYSTEM set log_connections = on; --- ALTER SYSTEM set log_disconnections = on; --- ALTER SYSTEM set log_duration = on; - --- - -/*LOAD 'auto_explain'; -ALTER SYSTEM set shared_preload_libraries = 'auto_explain'; -ALTER SYSTEM SET auto_explain.log_min_duration=0; -ALTER SYSTEM set auto_explain.log_analyze=true; -ALTER SYSTEM set auto_explain.log_buffers=true; -ALTER SYSTEM set auto_explain.log_timing=true; -ALTER SYSTEM set auto_explain.log_verbose=true; -ALTER SYSTEM set auto_explain.log_nested_statements=true; -*/ - -\connect r2dbc r2dbc; diff --git a/pom.xml b/pom.xml index b91c63f2..0a1b4d9b 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ 17 - 3.2.0 + 3.4.0 3.0.0-M7 UTF-8 UTF-8 @@ -50,9 +50,6 @@ 0.3.0 3.0.1 0.10.2 - 1.0.1.RELEASE - 1.0.1 - 1.1.4 2.9.0 diff --git a/r2dbc-migrate-core/pom.xml b/r2dbc-migrate-core/pom.xml index 81b84855..3b172338 100644 --- a/r2dbc-migrate-core/pom.xml +++ b/r2dbc-migrate-core/pom.xml @@ -48,7 +48,6 @@ io.r2dbc r2dbc-mssql - ${mssql.driver.version} test @@ -59,7 +58,6 @@ io.asyncer r2dbc-mysql - ${mysql.driver.version} test @@ -75,7 +73,6 @@ org.mariadb r2dbc-mariadb - ${mariadb.driver.version} test diff --git a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MariadbTestcontainersTest.java b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MariadbTestcontainersTest.java index c7f7aad8..f71de75c 100644 --- a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MariadbTestcontainersTest.java +++ b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MariadbTestcontainersTest.java @@ -26,8 +26,8 @@ public class MariadbTestcontainersTest extends AbstractMysqlLikeTestcontainersTe @BeforeEach public void beforeEach() { container = new GenericContainer("mariadb:10.5.8-focal") - .withClasspathResourceMapping("/docker/mysql/etc/mysql/conf.d", "/etc/mysql/conf.d", BindMode.READ_ONLY) - .withClasspathResourceMapping("/docker/mysql/docker-entrypoint-initdb.d", "/docker-entrypoint-initdb.d", BindMode.READ_ONLY) + .withClasspathResourceMapping("/docker/mariadb/etc/mysql/conf.d", "/etc/mysql/conf.d", BindMode.READ_ONLY) + .withClasspathResourceMapping("/docker/mariadb/docker-entrypoint-initdb.d", "/docker-entrypoint-initdb.d", BindMode.READ_ONLY) .withEnv("MYSQL_ALLOW_EMPTY_PASSWORD", "true") .withExposedPorts(MYSQL_PORT) .withStartupTimeout(Duration.ofSeconds(waitTestcontainersSeconds)); diff --git a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MssqlTestcontainersConcurrentStartTest.java b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MssqlTestcontainersConcurrentStartTest.java index ae224ca2..f94b376d 100644 --- a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MssqlTestcontainersConcurrentStartTest.java +++ b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MssqlTestcontainersConcurrentStartTest.java @@ -102,7 +102,7 @@ public void testThatMigratorCanHandleSituationWhenDatabaseStillStarting() { Thread thread = new Thread(() -> { LOGGER.info("Sleeping random {} seconds before start the container", randomInteger); Uninterruptibles.sleepUninterruptibly(randomInteger, TimeUnit.SECONDS); - container = new GenericContainer("mcr.microsoft.com/mssql/server:2019-CU12-ubuntu-16.04") + container = new GenericContainer("mcr.microsoft.com/mssql/server:2022-CU16-ubuntu-22.04") .withExposedPorts(MSSQL_HARDCODED_PORT) .withEnv("ACCEPT_EULA", "Y") .withEnv("SA_PASSWORD", password) diff --git a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MssqlTestcontainersTest.java b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MssqlTestcontainersTest.java index 6dddd67d..c2b3e19d 100644 --- a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MssqlTestcontainersTest.java +++ b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MssqlTestcontainersTest.java @@ -38,7 +38,7 @@ public class MssqlTestcontainersTest { @BeforeEach public void beforeEach() { - container = new GenericContainer("mcr.microsoft.com/mssql/server:2017-CU22-ubuntu-16.04") + container = new GenericContainer("mcr.microsoft.com/mssql/server:2022-CU16-ubuntu-22.04") .withExposedPorts(MSSQL_PORT) .withEnv("ACCEPT_EULA", "Y") .withEnv("SA_PASSWORD", password) diff --git a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MysqlTestcontainersTest.java b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MysqlTestcontainersTest.java index e575fd33..de200098 100644 --- a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MysqlTestcontainersTest.java +++ b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/MysqlTestcontainersTest.java @@ -22,16 +22,16 @@ public class MysqlTestcontainersTest extends AbstractMysqlLikeTestcontainersTest private GenericContainer container; - final static String user = "mysql-user"; - final static String password = "mysql-password"; + final static String user = "root"; + final static String password = "my-secret-pw"; @BeforeEach public void beforeEach() { - container = new GenericContainer("mysql:5.7") - .withClasspathResourceMapping("/docker/mysql/etc/mysql/conf.d", "/etc/mysql/conf.d", BindMode.READ_ONLY) + container = new GenericContainer("mysql:8.4.3") .withClasspathResourceMapping("/docker/mysql/docker-entrypoint-initdb.d", "/docker-entrypoint-initdb.d", BindMode.READ_ONLY) - .withEnv("MYSQL_ALLOW_EMPTY_PASSWORD", "true") + .withEnv("MYSQL_ROOT_PASSWORD", password) .withExposedPorts(MYSQL_PORT) + .withCommand("--character-set-server=utf8", "--collation-server=utf8_unicode_ci", "--mysql-native-password=ON") .withStartupTimeout(Duration.ofSeconds(waitTestcontainersSeconds)); container.start(); diff --git a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/PostgresTestcontainersTest.java b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/PostgresTestcontainersTest.java index 99ad6c52..8c6ef802 100644 --- a/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/PostgresTestcontainersTest.java +++ b/r2dbc-migrate-core/src/test/java/name/nkonev/r2dbc/migrate/core/PostgresTestcontainersTest.java @@ -43,7 +43,7 @@ public class PostgresTestcontainersTest { @BeforeEach public void beforeEach() { - container = new GenericContainer("postgres:13.4") + container = new GenericContainer("postgres:14.1-alpine3.14") .withExposedPorts(POSTGRESQL_PORT) .withEnv("POSTGRES_PASSWORD", "postgresqlPassword") .withClasspathResourceMapping("/docker/postgresql/docker-entrypoint-initdb.d", "/docker-entrypoint-initdb.d", BindMode.READ_ONLY) diff --git a/r2dbc-migrate-core/src/test/resources/docker/mariadb/docker-entrypoint-initdb.d/init-db.sql b/r2dbc-migrate-core/src/test/resources/docker/mariadb/docker-entrypoint-initdb.d/init-db.sql new file mode 100644 index 00000000..feb055c9 --- /dev/null +++ b/r2dbc-migrate-core/src/test/resources/docker/mariadb/docker-entrypoint-initdb.d/init-db.sql @@ -0,0 +1,7 @@ +CREATE DATABASE r2dbc; +use r2dbc; +GRANT ALL PRIVILEGES ON r2dbc.* TO 'mysql-user'@'%' IDENTIFIED BY 'mysql-password'; + +create database `my scheme`; +use `my scheme`; +GRANT ALL PRIVILEGES ON `my scheme`.* TO 'mysql-user'@'%' IDENTIFIED BY 'mysql-password'; \ No newline at end of file diff --git a/docker/mysql/etc/mysql/conf.d/test.cnf b/r2dbc-migrate-core/src/test/resources/docker/mariadb/etc/mysql/conf.d/test.cnf similarity index 100% rename from docker/mysql/etc/mysql/conf.d/test.cnf rename to r2dbc-migrate-core/src/test/resources/docker/mariadb/etc/mysql/conf.d/test.cnf diff --git a/r2dbc-migrate-core/src/test/resources/docker/mysql/docker-entrypoint-initdb.d/init-db.sql b/r2dbc-migrate-core/src/test/resources/docker/mysql/docker-entrypoint-initdb.d/init-db.sql index d4953572..a2a0eba9 100644 --- a/r2dbc-migrate-core/src/test/resources/docker/mysql/docker-entrypoint-initdb.d/init-db.sql +++ b/r2dbc-migrate-core/src/test/resources/docker/mysql/docker-entrypoint-initdb.d/init-db.sql @@ -1,7 +1,7 @@ +ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'my-secret-pw'; + CREATE DATABASE r2dbc; use r2dbc; -GRANT ALL PRIVILEGES ON r2dbc.* TO 'mysql-user'@'%' IDENTIFIED BY 'mysql-password'; create database `my scheme`; -use `my scheme`; -GRANT ALL PRIVILEGES ON `my scheme`.* TO 'mysql-user'@'%' IDENTIFIED BY 'mysql-password'; +use `my scheme`; \ No newline at end of file diff --git a/r2dbc-migrate-core/src/test/resources/docker/mysql/etc/mysql/conf.d/test.cnf b/r2dbc-migrate-core/src/test/resources/docker/mysql/etc/mysql/conf.d/test.cnf deleted file mode 100644 index 1885d83c..00000000 --- a/r2dbc-migrate-core/src/test/resources/docker/mysql/etc/mysql/conf.d/test.cnf +++ /dev/null @@ -1,7 +0,0 @@ -[mysqld] -init_connect='SET collation_connection = utf8_unicode_ci' -character-set-server = utf8 -collation-server = utf8_unicode_ci - -[client] -default-character-set = utf8 \ No newline at end of file diff --git a/r2dbc-migrate-spring-boot-starter/src/test/java/name/nkonev/r2dbc/migrate/autoconfigure/R2dbcMigrateAutoConfigurationTest.java b/r2dbc-migrate-spring-boot-starter/src/test/java/name/nkonev/r2dbc/migrate/autoconfigure/R2dbcMigrateAutoConfigurationTest.java index 5a486058..665a3a0f 100644 --- a/r2dbc-migrate-spring-boot-starter/src/test/java/name/nkonev/r2dbc/migrate/autoconfigure/R2dbcMigrateAutoConfigurationTest.java +++ b/r2dbc-migrate-spring-boot-starter/src/test/java/name/nkonev/r2dbc/migrate/autoconfigure/R2dbcMigrateAutoConfigurationTest.java @@ -38,7 +38,7 @@ public class R2dbcMigrateAutoConfigurationTest { @BeforeEach public void beforeEach() { - container = new GenericContainer("postgres:13.4") + container = new GenericContainer("postgres:14.1-alpine3.14") .withExposedPorts(POSTGRESQL_PORT) .withEnv("POSTGRES_PASSWORD", POSTGRESQL_PASSWORD) .waitingFor(new LogMessageWaitStrategy().withRegEx(".*database system is ready to accept connections.*\\s")