Skip to content

Instantly share code, notes, and snippets.

@Yyukan
Created April 24, 2018 06:01
Show Gist options
  • Save Yyukan/3e5fca99e09e0bf1cd32704e24765c04 to your computer and use it in GitHub Desktop.
Save Yyukan/3e5fca99e09e0bf1cd32704e24765c04 to your computer and use it in GitHub Desktop.
Setup for IT tests in Maven via docker plugin
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<configuration>
<startParallel>true</startParallel>
</configuration>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<images>
<image>
<name>registry/postgres</name>
<run>
<env>
</env>
<ports>
<port>pg.port:5432</port>
</ports>
<wait>
<time>60000</time>
<log>PostgreSQL init process complete; ready for start up</log>
</wait>
<log>
<prefix>POSTGRES&gt;</prefix>
<date>ISO8601</date>
<color>blue</color>
</log>
</run>
</image>
</images>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<database.host>
jdbc:postgresql://${docker.host.address}:${pg.port}/db?currentSchema=schema
</database.host>
<spring.main.banner-mode>off</spring.main.banner-mode>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment