diff --git a/.github/workflows/ci-4.x.yml b/.github/workflows/ci-4.x.yml index 2a079cb6f..b5d752219 100644 --- a/.github/workflows/ci-4.x.yml +++ b/.github/workflows/ci-4.x.yml @@ -5,62 +5,79 @@ on: jobs: CI: strategy: + fail-fast: false matrix: include: - os: ubuntu-latest jdk: 8 profile: 'PostgreSQL-9' + module: 'vertx-pg-client' - os: ubuntu-latest jdk: 8 profile: 'PostgreSQL-10' + module: 'vertx-pg-client' - os: ubuntu-latest jdk: 8 profile: 'PostgreSQL-11' + module: 'vertx-pg-client' - os: ubuntu-latest jdk: 8 profile: 'MySQL-8.0' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 8 profile: 'MySQL-5.6' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 8 profile: 'MySQL-5.7' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 8 profile: 'MariaDB-10.4' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 8 profile: 'MSSQL-2017-latest' + module: 'vertx-mssql-client' - os: ubuntu-latest jdk: 8 profile: 'MSSQL-2019-latest' + module: 'vertx-mssql-client' - os: ubuntu-latest jdk: 8 profile: 'DB2-11.5' + module: 'vertx-db2-client' - os: ubuntu-latest jdk: 8 - profile: 'SQL-templates' + module: 'vertx-sql-client-templates' - os: ubuntu-latest jdk: 25 profile: 'PostgreSQL-11' + module: 'vertx-pg-client' - os: ubuntu-latest jdk: 25 profile: 'MySQL-5.7' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 25 profile: 'MariaDB-10.4' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 25 profile: 'MSSQL-2019-latest' + module: 'vertx-mssql-client' - os: ubuntu-latest jdk: 25 profile: 'Oracle-23' + module: 'vertx-oracle-client' uses: ./.github/workflows/ci.yml with: branch: 4.x jdk: ${{ matrix.jdk }} os: ${{ matrix.os }} profile: ${{ matrix.profile }} + module: ${{ matrix.module }} deploy: ${{ matrix.jdk == '8' && matrix.os == 'ubuntu-latest' }} secrets: inherit Deploy: diff --git a/.github/workflows/ci-matrix-5.x.yml b/.github/workflows/ci-matrix-5.x.yml index 530386ea7..8cab8a507 100644 --- a/.github/workflows/ci-matrix-5.x.yml +++ b/.github/workflows/ci-matrix-5.x.yml @@ -8,62 +8,79 @@ on: jobs: CI: strategy: + fail-fast: false matrix: include: - os: ubuntu-latest jdk: 11 profile: 'PostgreSQL-9' + module: 'vertx-pg-client' - os: ubuntu-latest jdk: 11 profile: 'PostgreSQL-10' + module: 'vertx-pg-client' - os: ubuntu-latest jdk: 11 profile: 'PostgreSQL-11' + module: 'vertx-pg-client' - os: ubuntu-latest jdk: 11 profile: 'MySQL-8.0' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 11 profile: 'MySQL-5.6' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 11 profile: 'MySQL-5.7' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 11 profile: 'MariaDB-10.4' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 11 profile: 'MSSQL-2017-latest' + module: 'vertx-mssql-client' - os: ubuntu-latest jdk: 11 profile: 'MSSQL-2019-latest' + module: 'vertx-mssql-client' - os: ubuntu-latest jdk: 11 profile: 'DB2-11.5' + module: 'vertx-db2-client' - os: ubuntu-latest jdk: 11 - profile: 'SQL-templates' + module: 'vertx-sql-client-templates' - os: ubuntu-latest jdk: 25 profile: 'PostgreSQL-11' + module: 'vertx-pg-client' - os: ubuntu-latest jdk: 25 profile: 'MySQL-5.7' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 25 profile: 'MariaDB-10.4' + module: 'vertx-mysql-client' - os: ubuntu-latest jdk: 25 profile: 'MSSQL-2019-latest' + module: 'vertx-mssql-client' - os: ubuntu-latest jdk: 25 profile: 'Oracle-23' + module: 'vertx-oracle-client' uses: ./.github/workflows/ci.yml with: branch: ${{ inputs.branch }} jdk: ${{ matrix.jdk }} os: ${{ matrix.os }} profile: ${{ matrix.profile }} + module: ${{ matrix.module }} deploy: ${{ matrix.jdk == '8' && matrix.os == 'ubuntu-latest' }} secrets: inherit Deploy: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7c72cf36..1cf4e1e11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,9 @@ on: type: string profile: type: string + module: + required: true + type: string deploy: type: boolean jobs: @@ -30,4 +33,6 @@ jobs: java-version: ${{ inputs.jdk }} distribution: temurin - name: Run tests - run: mvn -s .github/maven-ci-settings.xml -q clean verify -B -DskipDefault -P ${{ inputs.profile }} + run: | + PROFILE_ARG="${{ inputs.profile && format('-P {0}', inputs.profile) || '' }}" + mvn -s .github/maven-ci-settings.xml -q clean verify -B $PROFILE_ARG -pl :${{ inputs.module }} -am diff --git a/pom.xml b/pom.xml index f3ee98911..e5b6bca17 100644 --- a/pom.xml +++ b/pom.xml @@ -173,145 +173,14 @@ - - - default - - - skipDefault - !true - - - - vertx-sql-client - vertx-pg-client - vertx-mysql-client - vertx-mssql-client - vertx-db2-client - vertx-sql-client-templates - vertx-oracle-client - - - - PostgreSQL-9 - - 9.6 - - - vertx-sql-client - vertx-pg-client - - - - PostgreSQL-10 - - 10.6 - - - vertx-sql-client - vertx-pg-client - - - - PostgreSQL-11 - - 11.5 - - - vertx-sql-client - vertx-pg-client - - - - MySQL-8.0 - - mysql - 8.0 - - - vertx-sql-client - vertx-mysql-client - - - - MySQL-5.6 - - mysql - 5.6 - - - vertx-sql-client - vertx-mysql-client - - - - MySQL-5.7 - - mysql - 5.7 - - - vertx-sql-client - vertx-mysql-client - - - - MariaDB-10.4 - - mariadb - 10.4 - - - vertx-sql-client - vertx-mysql-client - - - - MSSQL-2017-latest - - 2017-latest - - - vertx-sql-client - vertx-mssql-client - - - - MSSQL-2019-latest - - 2019-latest - - - vertx-sql-client - vertx-mssql-client - - - - DB2-11.5 - - vertx-sql-client - vertx-db2-client - - - - SQL-templates - - vertx-sql-client - vertx-pg-client - vertx-mysql-client - vertx-sql-client-templates - - - - Oracle-23 - - 23.3-slim-faststart - - - vertx-sql-client - vertx-oracle-client - - - + + vertx-sql-client + vertx-pg-client + vertx-mysql-client + vertx-mssql-client + vertx-db2-client + vertx-sql-client-templates + vertx-oracle-client + - \ No newline at end of file + diff --git a/vertx-db2-client/pom.xml b/vertx-db2-client/pom.xml index a0b064290..9c744f225 100644 --- a/vertx-db2-client/pom.xml +++ b/vertx-db2-client/pom.xml @@ -77,25 +77,21 @@ - - - - maven-surefire-plugin - - -Xmx1024M - true - false - - ${project.build.directory} - - ${project.basedir}/src/test/java.security - - - - - + + maven-surefire-plugin + + -Xmx1024M + true + false + + ${project.build.directory} + + ${project.basedir}/src/test/java.security + + + + + ${project.basedir}/src/main/asciidoc/*.adoc,${project.basedir}/../vertx-sql-client/src/main/asciidoc/*.adoc @@ -49,4 +52,37 @@ + + + + maven-surefire-plugin + + -Xmx1024M + + ${project.build.directory} + ${mssql-container.version} + ${connection.uri} + ${tls.connection.uri} + ${force.encryption.connection.uri} + + + + + + + + + MSSQL-2017-latest + + 2017-latest + + + + MSSQL-2019-latest + + 2019-latest + + + + diff --git a/vertx-mssql-client/src/test/java/io/vertx/tests/mssqlclient/junit/MSSQLRule.java b/vertx-mssql-client/src/test/java/io/vertx/tests/mssqlclient/junit/MSSQLRule.java index 4491959d4..62ff636d0 100644 --- a/vertx-mssql-client/src/test/java/io/vertx/tests/mssqlclient/junit/MSSQLRule.java +++ b/vertx-mssql-client/src/test/java/io/vertx/tests/mssqlclient/junit/MSSQLRule.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.Objects; +import java.util.stream.Stream; import static io.vertx.mssqlclient.MSSQLConnectOptions.DEFAULT_PORT; import static io.vertx.tests.mssqlclient.junit.MSSQLRule.Config.STANDARD; @@ -41,6 +42,42 @@ public enum Config { } } + private enum ServerVersion { + MSSQL_2017("2017-latest", "/opt/mssql-tools/bin/sqlcmd", false), + MSSQL_2019("2019-latest", "/opt/mssql-tools18/bin/sqlcmd", true); + + private final String dockerImageTag; + private final String sqlcmdPath; + private final boolean supportsTrustServerCertificate; + + ServerVersion(String dockerImageTag, String sqlcmdPath, boolean supportsTrustServerCertificate) { + this.dockerImageTag = dockerImageTag; + this.sqlcmdPath = sqlcmdPath; + this.supportsTrustServerCertificate = supportsTrustServerCertificate; + } + + public String getSqlcmdPath() { + return sqlcmdPath; + } + + public boolean supportsTrustServerCertificate() { + return supportsTrustServerCertificate; + } + + public static ServerVersion fromDockerTag(String dockerImageTag) { + if (dockerImageTag == null || dockerImageTag.isEmpty()) { + return MSSQL_2019; + } + if (dockerImageTag.equals("2017-latest")) { + return MSSQL_2017; + } else if (dockerImageTag.equals("2019-latest")) { + return MSSQL_2019; + } else { + throw new IllegalArgumentException("Unsupported SQL Server version: " + dockerImageTag); + } + } + } + public static final MSSQLRule SHARED_INSTANCE = new MSSQLRule(STANDARD); private static final String USER = "SA"; @@ -51,6 +88,7 @@ public enum Config { private ServerContainer server; private MSSQLConnectOptions options; + private ServerVersion serverVersion; public MSSQLRule(Config config) { this.config = Objects.requireNonNull(config); @@ -80,15 +118,15 @@ protected void after() { private MSSQLConnectOptions startMSSQL() throws IOException { String containerVersion = System.getProperty("mssql-container.version"); - if (isNullOrEmpty(containerVersion)) { - containerVersion = "2019-latest"; - } - server = new ServerContainer<>("mcr.microsoft.com/mssql/server:" + containerVersion) + serverVersion = ServerVersion.fromDockerTag(containerVersion); + String dockerImageTag = serverVersion.dockerImageTag; + + server = new ServerContainer<>("mcr.microsoft.com/mssql/server:" + dockerImageTag) .withEnv("ACCEPT_EULA", "Y") .withEnv("TZ", "UTC") .withEnv("SA_PASSWORD", PASSWORD) .withClasspathResourceMapping("init.sql", INIT_SQL, READ_ONLY) - .waitingFor(Wait.forLogMessage(".*The tempdb database has \\d+ data file\\(s\\).*\\n", 2)); + .waitingFor(Wait.forLogMessage(".*SQL Server is now ready for client connections.*\\n", 1)); if (System.getProperties().containsKey("containerFixedPort")) { server.withFixedExposedPort(DEFAULT_PORT, DEFAULT_PORT); @@ -114,14 +152,7 @@ private MSSQLConnectOptions startMSSQL() throws IOException { private void initDb() throws IOException { try { - ExecResult execResult = server.execInContainer( - "/opt/mssql-tools18/bin/sqlcmd", - "-S", "localhost", - "-U", USER, - "-P", PASSWORD, - "-i", INIT_SQL, - "-C", "-No" - ); + ExecResult execResult = server.execInContainer(cmdArgs()); if (execResult.getExitCode() != 0) { throw new RuntimeException(String.format("Failure while initializing database%nstdout:%s%nstderr:%s%n", execResult.getStdout(), execResult.getStderr())); } @@ -131,6 +162,21 @@ private void initDb() throws IOException { } } + private String[] cmdArgs() { + Stream.Builder builder = Stream.builder(); + builder.add(serverVersion.getSqlcmdPath()); + builder.add("-S").add("localhost"); + builder.add("-U").add(USER); + builder.add("-P").add(PASSWORD); + builder.add("-i").add(INIT_SQL); + if (serverVersion.supportsTrustServerCertificate()) { + // SQL Server 2019+: use -C (trust certificate) and -No (disable output formatting) + builder.add("-C"); + builder.add("-No"); + } + return builder.build().toArray(String[]::new); + } + private void stopMSSQL() { if (server != null) { try { diff --git a/vertx-mysql-client/pom.xml b/vertx-mysql-client/pom.xml index e02cbcf04..b1cec1339 100644 --- a/vertx-mysql-client/pom.xml +++ b/vertx-mysql-client/pom.xml @@ -32,6 +32,9 @@ The Reactive MySQL Client + + + ${project.basedir}/src/main/asciidoc/*.adoc,${project.basedir}/../vertx-sql-client/src/main/asciidoc/*.adoc @@ -65,23 +68,52 @@ - - - - maven-surefire-plugin - - -Xmx1024M - - ${project.build.directory} - - - - - + + + maven-surefire-plugin + + -Xmx1024M + + ${project.build.directory} + ${testing.mysql.database.server} + ${testing.mysql.database.version} + ${connection.uri} + ${tls.connection.uri} + + + + - + + MySQL-5.6 + + mysql + 5.6 + + + + MySQL-5.7 + + mysql + 5.7 + + + + MySQL-8.0 + + mysql + 8.0 + + + + MariaDB-10.4 + + mariadb + 10.4 + + diff --git a/vertx-mysql-client/src/test/java/io/vertx/tests/mysqlclient/MySQLTLSTest.java b/vertx-mysql-client/src/test/java/io/vertx/tests/mysqlclient/MySQLTLSTest.java index e1541fa0c..08acf9b1b 100644 --- a/vertx-mysql-client/src/test/java/io/vertx/tests/mysqlclient/MySQLTLSTest.java +++ b/vertx-mysql-client/src/test/java/io/vertx/tests/mysqlclient/MySQLTLSTest.java @@ -22,14 +22,11 @@ import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import io.vertx.mysqlclient.*; -import io.vertx.tests.mysqlclient.junit.MySQLRule; import io.vertx.sqlclient.Pool; import io.vertx.sqlclient.PoolOptions; import io.vertx.sqlclient.Row; -import org.junit.After; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; +import io.vertx.tests.mysqlclient.junit.MySQLRule; +import org.junit.*; import org.junit.runner.RunWith; @RunWith(VertxUnitRunner.class) @@ -45,6 +42,12 @@ public class MySQLTLSTest { MySQLConnectOptions options; MySQLConnectOptions nonTlsOptions; + @BeforeClass + public static void checkMySQLVersion() { + // MySQL 5.6 only supports TLS 1.0/1.1 which are disabled in Java 11+ + Assume.assumeFalse("TLS tests are not supported on MySQL 5.6 with Java 11+", rule.isUsingMySQL5_6()); + } + @Before public void setup() { vertx = Vertx.vertx(); diff --git a/vertx-oracle-client/README.adoc b/vertx-oracle-client/README.adoc index c9b1fb85e..8e48458a2 100644 --- a/vertx-oracle-client/README.adoc +++ b/vertx-oracle-client/README.adoc @@ -18,6 +18,22 @@ Nevertheless, you can force the usage of the standard Oracle port (1521) with a mvn test -DcontainerFixedPort ---- +==== Testing with different Oracle versions + +You can test with different Oracle container versions by using Maven profiles: + +[source,bash] +---- +mvn test -P Oracle-23 +---- + +Or by passing the version property directly: + +[source,bash] +---- +mvn test -Doracle-container.version=23.3-slim-faststart +---- + ==== Testing on OSX Mx chips - stop Docker engine diff --git a/vertx-oracle-client/pom.xml b/vertx-oracle-client/pom.xml index 2ba9fee32..b2a0bba5e 100644 --- a/vertx-oracle-client/pom.xml +++ b/vertx-oracle-client/pom.xml @@ -33,6 +33,8 @@ The Reactive Oracle Client + + 23.4.0.24.05 ${project.basedir}/src/main/asciidoc/*.adoc,${project.basedir}/../vertx-sql-client/src/main/asciidoc/*.adoc @@ -74,19 +76,28 @@ - - - - maven-surefire-plugin - - -Xmx1024M - - ${project.build.directory} - - - - - + + + maven-surefire-plugin + + -Xmx1024M + + ${project.build.directory} + ${oracle-container.version} + ${connection.uri} + + + + + + + Oracle-23 + + 23.3-slim-faststart + + + + diff --git a/vertx-pg-client/pom.xml b/vertx-pg-client/pom.xml index 583cfe6d6..4afce8974 100644 --- a/vertx-pg-client/pom.xml +++ b/vertx-pg-client/pom.xml @@ -33,7 +33,7 @@ - + ${project.basedir}/src/main/asciidoc/*.adoc,${project.basedir}/../vertx-sql-client/src/main/asciidoc/*.adoc @@ -98,28 +98,24 @@ - - - - maven-surefire-plugin - - -Xmx1024M - - ${project.build.directory} - ${embedded.postgres.version} - ${connection.uri} - ${tls.connection.uri} - ${unix.socket.directory} - ${unix.socket.port} - - - io/vertx/tests/pgclient/it/** - - - - - + + maven-surefire-plugin + + -Xmx1024M + + ${project.build.directory} + ${embedded.postgres.version} + ${connection.uri} + ${tls.connection.uri} + ${unix.socket.directory} + ${unix.socket.port} + + + io/vertx/tests/pgclient/it/** + + + maven-failsafe-plugin 2.21.0 @@ -165,6 +161,24 @@ + + PostgreSQL-9 + + 9.6 + + + + PostgreSQL-10 + + 10.6 + + + + PostgreSQL-11 + + 11.5 + + benchmarks diff --git a/vertx-pg-client/src/test/java/io/vertx/tests/pgclient/tck/PgNullValueEncodeTest.java b/vertx-pg-client/src/test/java/io/vertx/tests/pgclient/tck/PgNullValueEncodeTest.java index f8e86f143..5ed3fca54 100644 --- a/vertx-pg-client/src/test/java/io/vertx/tests/pgclient/tck/PgNullValueEncodeTest.java +++ b/vertx-pg-client/src/test/java/io/vertx/tests/pgclient/tck/PgNullValueEncodeTest.java @@ -11,10 +11,13 @@ package io.vertx.tests.pgclient.tck; +import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import io.vertx.tests.pgclient.junit.ContainerPgRule; import io.vertx.tests.sqlclient.tck.NullValueEncodeTestBase; +import org.junit.Assume; import org.junit.ClassRule; +import org.junit.Test; import org.junit.runner.RunWith; @RunWith(VertxUnitRunner.class) @@ -28,6 +31,62 @@ protected void initConnector() { connector = ClientConfig.CONNECT.connect(vertx, rule.options()); } + @Test + @Override + public void testEncodeNullBigDecimal(TestContext ctx) { + Assume.assumeTrue("PostgreSQL 9 cannot determine data type for NULL BigDecimal", ContainerPgRule.isAtLeastPg10()); + super.testEncodeNullBigDecimal(ctx); + } + + @Test + @Override + public void testEncodeNullLocalTime(TestContext ctx) { + Assume.assumeTrue("PostgreSQL 9 cannot determine data type for NULL LocalTime", ContainerPgRule.isAtLeastPg10()); + super.testEncodeNullLocalTime(ctx); + } + + @Test + @Override + public void testEncodeNullOffsetTime(TestContext ctx) { + Assume.assumeTrue("PostgreSQL 9 cannot determine data type for NULL OffsetTime", ContainerPgRule.isAtLeastPg10()); + super.testEncodeNullOffsetTime(ctx); + } + + @Test + @Override + public void testEncodeNullTemporal(TestContext ctx) { + Assume.assumeTrue("PostgreSQL 9 cannot determine data type for NULL Temporal", ContainerPgRule.isAtLeastPg10()); + super.testEncodeNullTemporal(ctx); + } + + @Test + @Override + public void testEncodeNullArrayOfBigDecimal(TestContext ctx) { + Assume.assumeTrue("PostgreSQL 9 cannot determine data type for NULL BigDecimal[]", ContainerPgRule.isAtLeastPg10()); + super.testEncodeNullArrayOfBigDecimal(ctx); + } + + @Test + @Override + public void testEncodeNullArrayOfLocalTime(TestContext ctx) { + Assume.assumeTrue("PostgreSQL 9 cannot determine data type for NULL LocalTime[]", ContainerPgRule.isAtLeastPg10()); + super.testEncodeNullArrayOfLocalTime(ctx); + } + + @Test + @Override + public void testEncodeNullArrayOfOffsetTime(TestContext ctx) { + Assume.assumeTrue("PostgreSQL 9 cannot determine data type for NULL OffsetTime[]", ContainerPgRule.isAtLeastPg10()); + super.testEncodeNullArrayOfOffsetTime(ctx); + } + + @Test + @Override + public void testEncodeNullArrayOfTemporal(TestContext ctx) { + Assume.assumeTrue("PostgreSQL 9 cannot determine data type for NULL Temporal[]", ContainerPgRule.isAtLeastPg10()); + super.testEncodeNullArrayOfTemporal(ctx); + } + @Override protected String statement(String... parts) { StringBuilder sb = new StringBuilder();