Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable and fix MySQL JDBC-based tests in FIPS-enabled environment and correct FIPS-disabling comment on MySQL reactive tests #1782

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@

import org.apache.http.HttpStatus;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.services.QuarkusApplication;
import io.quarkus.ts.scheduling.quartz.failover.ExecutionEntity;

@Tag("fips-incompatible") // native-mode
@QuarkusScenario
public class AnnotationScheduledJobsMySqlQuartzIT extends BaseMySqlQuartzIT {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.apache.http.HttpStatus;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.services.QuarkusApplication;

@Tag("fips-incompatible") // native-mode
@QuarkusScenario
public class BasicMySqlQuartzIT extends BaseMySqlQuartzIT {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.quarkus.ts.hibernate.search;

import org.junit.jupiter.api.Tag;

import io.quarkus.test.bootstrap.DefaultService;
import io.quarkus.test.bootstrap.MySqlService;
import io.quarkus.test.bootstrap.Protocol;
Expand All @@ -10,8 +8,6 @@
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") // native-mode
@QuarkusScenario
public class MysqlMultitenantHibernateSearchIT extends AbstractMultitenantHibernateSearchIT {
static final int ELASTIC_PORT = 9200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") // native-mode
@Tag("fips-incompatible") // TODO: enable when the https://github.com/eclipse-vertx/vertx-sql-client/issues/1436 is fixed
@QuarkusScenario
public class MySQLDatabaseHibernateReactiveIT extends AbstractDatabaseHibernateReactiveIT {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import java.io.IOException;

import org.junit.jupiter.api.Tag;
import org.testcontainers.containers.GenericContainer;

import io.quarkus.test.bootstrap.MySqlService;
Expand All @@ -14,8 +13,6 @@
import io.quarkus.test.services.QuarkusApplication;
import io.quarkus.ts.transactions.recovery.TransactionExecutor;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") // native-mode
@QuarkusScenario
public class MysqlTransactionGeneralUsageIT extends TransactionCommons {

Expand Down
5 changes: 0 additions & 5 deletions sql-db/panache-flyway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-elytron-security-properties-file</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus.qe</groupId>
<artifactId>quarkus-test-service-database</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.apache.http.HttpStatus;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.quarkus.test.scenarios.QuarkusScenario;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") // native-mode
@QuarkusScenario
class CRUDAllInPanacheWithFlywayIT extends PanacheWithFlywayBaseIT {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@

import org.apache.http.HttpStatus;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.quarkus.test.scenarios.QuarkusScenario;
import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") // native-mode
@QuarkusScenario
public class CRUDPanacheWithFlywayIT extends PanacheWithFlywayBaseIT {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
import static org.hamcrest.Matchers.is;

import org.apache.http.HttpStatus;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.quarkus.test.scenarios.QuarkusScenario;
import io.restassured.specification.RequestSpecification;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") //native-mode
@QuarkusScenario
public class DataSourceConfigPanacheWithFlywayIT extends PanacheWithFlywayBaseIT {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.agroal.api.AgroalDataSource;
Expand All @@ -46,7 +45,6 @@
* Some of these tests required some extra load, in order to reproduce concurrency issues.
*/
@EnabledWhenLinuxContainersAvailable
@Tag("fips-incompatible") // native-mode
@QuarkusTest
@TestProfile(AgroalTestProfile.class)
public class AgroalPoolTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public List<TestResourceEntry> testResources() {
public Map<String, String> getConfigOverrides() {
Map<String, String> config = new HashMap<>();
config.put("quarkus.datasource.devservices.enabled", "false");
config.put("quarkus.datasource.with-xa.devservices", "false");
config.put("quarkus.datasource.with-xa.devservices.enabled", "false");
return config;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import org.apache.commons.lang3.StringUtils;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import org.testcontainers.utility.DockerImageName;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
Expand All @@ -20,25 +20,39 @@ public class MySqlDatabaseTestResource implements QuarkusTestResourceLifecycleMa
private static final String DEFAULT_SCHEMA = "test";
private static final String MYSQL = "mysql";
private static final String WITH_XA_PROFILE = ".with-xa";
private static final String USER_PROPERTY = "MYSQL_USER";
private static final String PASSWORD_PROPERTY = "MYSQL_PASSWORD";
private static final String PASSWORD_ROOT_PROPERTY = "MYSQL_ROOT_PASSWORD";
private static final String DATABASE_PROPERTY = "MYSQL_DATABASE";
private static final String USER = "user";

private MySQLContainer<?> container;
private GenericContainer<?> container;

@Override
public Map<String, String> start() {
String image = System.getProperty("mysql.80.image");

container = new MySQLContainer<>(
// we used managed version of 'org.testcontainers:mysql' and version '1.19.7' failed in FIPS-enabled environment
// over 'SA/ECB/OAEPWithSHA-1AndMGF1Padding' cipher as SunJCE provider was not available in FIPS
// hence for now, we use GenericContainer which allows to override waiting strategy that works in FIPS
container = new GenericContainer<>(
michalvavrik marked this conversation as resolved.
Show resolved Hide resolved
DockerImageName.parse(image).asCompatibleSubstituteFor(MYSQL));
container.withUrlParam("currentSchema", DEFAULT_SCHEMA);
container.waitingFor(new LogMessageWaitStrategy().withRegEx(".*Only MySQL server logs after this point.*\\s"));
container.withExposedPorts(3306);
container.withEnv(USER_PROPERTY, USER);
container.withEnv(PASSWORD_PROPERTY, USER);
container.withEnv(PASSWORD_ROOT_PROPERTY, USER);
container.withEnv(DATABASE_PROPERTY, DEFAULT_SCHEMA);
container.start();

var jdbcUrl = "jdbc:mysql://localhost:%d/%s".formatted(container.getMappedPort(3306), DEFAULT_SCHEMA);
Map<String, String> config = new HashMap<>();
config.put(defaultDataSource(QUARKUS_DB_JDBC_URL), container.getJdbcUrl());
config.put(defaultDataSource(QUARKUS_DB_USER), container.getUsername());
config.put(defaultDataSource(QUARKUS_DB_PASSWORD), container.getPassword());
config.put(withXaDataSource(QUARKUS_DB_JDBC_URL), container.getJdbcUrl());
config.put(withXaDataSource(QUARKUS_DB_USER), container.getUsername());
config.put(withXaDataSource(QUARKUS_DB_PASSWORD), container.getPassword());
config.put(defaultDataSource(QUARKUS_DB_JDBC_URL), jdbcUrl);
config.put(defaultDataSource(QUARKUS_DB_USER), USER);
config.put(defaultDataSource(QUARKUS_DB_PASSWORD), USER);
config.put(withXaDataSource(QUARKUS_DB_JDBC_URL), jdbcUrl);
config.put(withXaDataSource(QUARKUS_DB_USER), USER);
config.put(withXaDataSource(QUARKUS_DB_PASSWORD), USER);

return Collections.unmodifiableMap(config);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") // native-mode
@Tag("fips-incompatible") // TODO: enable when the https://github.com/eclipse-vertx/vertx-sql-client/issues/1436 is fixed
@QuarkusScenario
public class MySqlPanacheResourceIT extends AbstractPanacheResourceIT {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package io.quarkus.ts.sqldb.compatibility;

import org.junit.jupiter.api.Tag;

import io.quarkus.test.bootstrap.MySqlService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.scenarios.annotations.DisabledOnNative;
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") // native-mode
@QuarkusScenario
@DisabledOnNative(reason = "Compatibility mode check in JVM mode is enough for this DB")
public class MySqlDatabaseIT extends AbstractSqlDatabaseIT {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package io.quarkus.ts.sqldb.sqlapp;

import org.junit.jupiter.api.Tag;

import io.quarkus.test.bootstrap.MySqlService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") // native-mode
@QuarkusScenario
public class MySqlDatabaseIT extends AbstractSqlDatabaseIT {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;

// TODO https://github.com/quarkus-qe/quarkus-test-suite/issues/756
@Tag("fips-incompatible") // native-mode
@Tag("fips-incompatible") // TODO: enable when the https://github.com/eclipse-vertx/vertx-sql-client/issues/1436 is fixed
@QuarkusScenario
public class MysqlHandlerIT extends CommonTestCases {
private static final String DATABASE = "amadeus";
Expand Down
Loading