NIFI-10014 Upgraded Registry Test JDBC Drivers

- Upgraded MySQL from 8.0.15 to 8.0.29
- Upgraded MariabDB from 2.4.1 to 3.0.4
- Upgraded PostgreSQL from 42.2.19 to 42.3.5
- Removed unsupported database version references from project README.md
- Added MariaDB 10.3 to list of Registry examples

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #6033.
This commit is contained in:
exceptionfactory 2022-05-10 14:25:00 -05:00 committed by Pierre Villard
parent e826aca8f2
commit eecdf38158
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
3 changed files with 11 additions and 31 deletions

View File

@ -280,31 +280,13 @@ If no profile is specified then an H2 DataSource will be used by default and no
Assuming Docker is running on the system where the build is running, then the following commands can be run:
| Target Database | Build Command |
| --------------- | ------------- |
| All supported | `mvn verify -Ptest-all-dbs` |
| H2 (default) | `mvn verify` |
| PostgreSQL 9.x | `mvn verify -Dspring.profiles.active=postgres` |
| PostgreSQL 10.x | `mvn verify -Dspring.profiles.active=postgres-10` |
| MySQL 5.6 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-56` |
| MySQL 5.7 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-57` |
| MySQL 8 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-8` |
When one of the Testcontainer profiles is activated, the test output should show logs that indicate a container has been started, such as the following:
2019-05-15 16:14:45.078 INFO 66091 --- [ main] 🐳 [mysql:5.7] : Creating container for image: mysql:5.7
2019-05-15 16:14:45.145 INFO 66091 --- [ main] o.t.utility.RegistryAuthLocator : Credentials not found for host (index.docker.io) when using credential helper/store (docker-credential-osxkeychain)
2019-05-15 16:14:45.646 INFO 66091 --- [ main] 🐳 [mysql:5.7] : Starting container with ID: ca85c8c5a1990d2a898fad04c5897ddcdb3a9405e695cc11259f50f2ebe67c5f
2019-05-15 16:14:46.437 INFO 66091 --- [ main] 🐳 [mysql:5.7] : Container mysql:5.7 is starting: ca85c8c5a1990d2a898fad04c5897ddcdb3a9405e695cc11259f50f2ebe67c5f
2019-05-15 16:14:46.479 INFO 66091 --- [ main] 🐳 [mysql:5.7] : Waiting for database connection to become available at jdbc:mysql://localhost:33051/test?useSSL=false&allowPublicKeyRetrieval=true using query 'SELECT 1'
The Flyway connection should also indicate the given database:
2019-05-15 16:15:02.114 INFO 66091 --- [ main] o.a.n.r.db.CustomFlywayConfiguration : Determined database type is MYSQL
2019-05-15 16:15:02.115 INFO 66091 --- [ main] o.a.n.r.db.CustomFlywayConfiguration : Setting migration locations to [classpath:db/migration/common, classpath:db/migration/mysql]
2019-05-15 16:15:02.373 INFO 66091 --- [ main] o.a.n.r.d.CustomFlywayMigrationStrategy : First time initializing database...
2019-05-15 16:15:02.380 INFO 66091 --- [ main] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 5.2.1 by Boxfuse
2019-05-15 16:15:02.403 INFO 66091 --- [ main] o.f.c.internal.database.DatabaseFactory : Database: jdbc:mysql://localhost:33051/test (MySQL 5.7)
| Target Database | Build Command |
|-----------------|--------------------------------------------------------------------|
| All supported | `mvn verify -Ptest-all-dbs` |
| H2 (default) | `mvn verify` |
| MariaDB 10.3 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mariadb-10-3` |
| MySQL 8 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-8` |
| PostgreSQL 10 | `mvn verify -Dspring.profiles.active=postgres-10` |
For a full list of the available DataSource factories, consult the `nifi-registry-test` module.

View File

@ -57,17 +57,17 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
<version>8.0.29</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.4.1</version>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.19</version>
<version>42.3.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>

View File

@ -22,7 +22,6 @@ import org.testcontainers.delegate.DatabaseDelegate;
import org.testcontainers.jdbc.JdbcDatabaseDelegate;
import javax.annotation.PostConstruct;
import javax.script.ScriptException;
import javax.sql.DataSource;
import java.sql.SQLException;
@ -38,7 +37,6 @@ public abstract class MariaDBDataSourceFactory extends TestDataSourceFactory {
dataSource.setUrl(container.getJdbcUrl());
dataSource.setUser(container.getUsername());
dataSource.setPassword(container.getPassword());
dataSource.setDatabaseName(container.getDatabaseName());
return dataSource;
} catch (SQLException e) {
throw new RuntimeException("Unable to create MariaDB DataSource", e);
@ -46,7 +44,7 @@ public abstract class MariaDBDataSourceFactory extends TestDataSourceFactory {
}
@PostConstruct
public void initDatabase() throws SQLException, ScriptException {
public void initDatabase() {
DatabaseDelegate databaseDelegate = new JdbcDatabaseDelegate(mariaDBContainer(), "");
databaseDelegate.execute("DROP DATABASE test; CREATE DATABASE test;", "", 0, false, true);
}