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

Add -Ddocker option to spin a Redis Server container automatically when launching Redis IT test #11686

Merged
merged 1 commit into from
Aug 27, 2020
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
22 changes: 19 additions & 3 deletions integration-tests/redis-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,36 @@

## 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:

```
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
```
82 changes: 82 additions & 0 deletions integration-tests/redis-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,88 @@
</plugins>
</build>
</profile>
<profile>
<id>docker-redis</id>
<activation>
<property>
<name>docker</name>
</property>
</activation>
<properties>
<redis.url>localhost:6379</redis.url>
</properties>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>redis:5.0.8-alpine</name>
<alias>quarkus-test-redis</alias>
<run>
<ports>
<port>6379:6379</port>
</ports>
<log>
<prefix>Redis:</prefix>
<date>default</date>
<color>cyan</color>
</log>
<!-- Speed things up a bit by not actually flushing writes to disk -->
<wait>
<!-- good docs found at: http://dmp.fabric8.io/#start-wait -->
<time>20000</time>
<!-- wait until Redis is actually up by checking if we can ping the server-->
<exec>
<postStart>redis-cli PING</postStart>
</exec>
</wait>
</run>
</image>
</images>
<!--Stops all redis images currently running, not just those we just started.
Useful to stop processes still running from a previously failed integration test run -->
<allContainers>true</allContainers>
</configuration>
<executions>
<execution>
<id>docker-start</id>
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>docker-stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>docker-prune</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/../../.github/docker-prune.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>native-image</id>
Expand Down