From 7dd94e118f32f533f8d4da403bd8ae238663778b Mon Sep 17 00:00:00 2001 From: Manyanda Chitimbo Date: Thu, 27 Aug 2020 22:11:13 +0200 Subject: [PATCH] chore(redis): add -Ddocker option to spin a Redis Server container automatically when launching test --- integration-tests/redis-client/README.md | 22 ++++++- integration-tests/redis-client/pom.xml | 82 ++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/integration-tests/redis-client/README.md b/integration-tests/redis-client/README.md index d943e88df2ca1..49ca9cce84971 100644 --- a/integration-tests/redis-client/README.md +++ b/integration-tests/redis-client/README.md @@ -2,7 +2,13 @@ ## Running the tests -By default, the tests of this module are disabled. +By default, the tests of this module are disabled. To activate the test, use the `-Dtest-redis` option. + +NB: Tests in this module will attempt a connection to a local Redis listening on the default port. +If you have specific requirements, you can define a specific connection URL with `-Dquarkus.redis.hosts=host:port`. +Or, you can use the `-Ddocker` option to start the Redis Server container automatically. + +### Running tests in JVM mode To run, you can run the following command: @@ -10,12 +16,22 @@ To run, you can run the following command: mvn clean install -Dtest-redis ``` -NB: Tests in this module will attempt a connection to a local Redis listening on the default port. -If you have specific requirements, you can define a specific connection URL with `-Dquarkus.redis.hosts=host:port`. +Alternatively, to run the tests in JVM mode with Redis Server started as a Docker container, you can run the following command: +``` +mvn clean install -Dtest-redis -Ddocker +``` + +### Running tests in native mode Additionally, you can generate a native image and run the tests for this native image by adding `-Dnative`: ``` mvn clean install -Dtest-redis -Dnative ``` + +You can also use the `-Ddocker` system property (as shown below), if you want the Redis Server container to be started automatically. + +``` +mvn clean install -Dtest-redis -Dnative -Ddocker +``` diff --git a/integration-tests/redis-client/pom.xml b/integration-tests/redis-client/pom.xml index 32f6240a0a865..fa7fc6a0116e8 100644 --- a/integration-tests/redis-client/pom.xml +++ b/integration-tests/redis-client/pom.xml @@ -142,6 +142,88 @@ + + docker-redis + + + docker + + + + localhost:6379 + + + + + io.fabric8 + docker-maven-plugin + + + + redis:5.0.8-alpine + quarkus-test-redis + + + 6379:6379 + + + Redis: + default + cyan + + + + + + + + redis-cli PING + + + + + + + true + + + + docker-start + compile + + stop + start + + + + docker-stop + post-integration-test + + stop + + + + + + org.codehaus.mojo + exec-maven-plugin + + + docker-prune + generate-resources + + exec + + + ${basedir}/../../.github/docker-prune.sh + + + + + + + native-image