This is an automated email from the ASF dual-hosted git repository. aboda pushed a commit to branch NIFIREG-371-RC1 in repository https://gitbox.apache.org/repos/asf/nifi-registry.git
commit e171ba9ca5c7f512e991418ab77955fec1735e6e Author: Kevin Doran <[email protected]> AuthorDate: Wed Oct 16 13:01:22 2019 -0400 NIFIREG-329 Add build profile that tests all DBs This closes #240. Signed-off-by: Bryan Bende <[email protected]> --- README.md | 34 +++++++++-------------- nifi-registry-core/pom.xml | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 98868bf..4999a69 100644 --- a/README.md +++ b/README.md @@ -64,31 +64,23 @@ Registry—a subproject of Apache NiFi—is a complementary application that pro ## Database Testing -In order to ensure that NiFi Registry works correctly against different relational databases, the existing integration tests can be run against different databases by leveraging the [Testcontainers framework](https://www.testcontainers.org/). +In order to ensure that NiFi Registry works correctly against different relational databases, +the existing integration tests can be run against different databases by leveraging the [Testcontainers framework](https://www.testcontainers.org/). -Spring profiles are used to control the DataSource factory that will be made available to the Spring application context. DataSource factories are provided that use the Testcontainers framework to start a Docker container for a given database and create a corresponding DataSource. If no profile is specified then an H2 DataSource will be used by default and no Docker containers are required. +Spring profiles are used to control the DataSource factory that will be made available to the Spring application context. +DataSource factories are provided that use the Testcontainers framework to start a Docker container for a given database and create a corresponding DataSource. +If no profile is specified then an H2 DataSource will be used by default and no Docker containers are required. Assuming Docker is running on the system where the build is running, then the following commands can be run: -* H2 (default) - - mvn clean install -Pcontrib-check,integration-tests - -* Postgres - - mvn clean install -Pcontrib-check,integration-tests -Dspring.profiles.active=postgres - -* MySQL 5.6 - - mvn clean install -Pcontrib-check,integration-tests -Dspring.profiles.active=mysql-56 - -* MySQL 5.7 - - mvn clean install -Pcontrib-check,integration-tests -Dspring.profiles.active=mysql-57 - -* MySQL 8.0 - - mvn clean install -Pcontrib-check,integration-tests -Dspring.profiles.active=mysql-8 +| Target Database | Build Command | +| --------------- | ------------- | +| All supported | `mvn verify -Ptest-all-dbs` | +| H2 (default) | `mvn verify` | +| PostgreSQL | `mvn verify -Dspring.profiles.active=postgres` | +| 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: diff --git a/nifi-registry-core/pom.xml b/nifi-registry-core/pom.xml index 570c695..b69059e 100644 --- a/nifi-registry-core/pom.xml +++ b/nifi-registry-core/pom.xml @@ -146,4 +146,72 @@ </dependencies> </dependencyManagement> + <profiles> + <profile> + <id>test-all-dbs</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <executions> + <execution> + <id>mysql5.6-test</id> + <phase>verify</phase> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + <configuration> + <systemPropertyVariables> + <spring.profiles.active>mysql-56</spring.profiles.active> + </systemPropertyVariables> + </configuration> + </execution> + <execution> + <id>mysql5.7-test</id> + <phase>verify</phase> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + <configuration> + <systemPropertyVariables> + <spring.profiles.active>mysql-57</spring.profiles.active> + </systemPropertyVariables> + </configuration> + </execution> + <execution> + <id>mysql58-test</id> + <phase>verify</phase> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + <configuration> + <systemPropertyVariables> + <spring.profiles.active>mysql-8</spring.profiles.active> + </systemPropertyVariables> + </configuration> + </execution> + <execution> + <id>postgres-test</id> + <phase>verify</phase> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + <configuration> + <systemPropertyVariables> + <spring.profiles.active>postgres</spring.profiles.active> + </systemPropertyVariables> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + </project>
