0

During the maven package phase I build a docker image of my application:

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>dockerfile-maven-plugin</artifactId>
    <version>${version.dockerfile-plugin}</version>
    <executions>
        <execution>
            <id>default</id>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <repository>archetype/thorntail</repository>
        <tag>${project.version}</tag>
        <buildArgs>
            <JAR_FILE>${project.build.finalName}-thorntail.jar</JAR_FILE>
        </buildArgs>
    </configuration>
</plugin>

In my integration test I use this image of my app as follows:

@Container
private static GenericContainer apiContainer =
        new GenericContainer("archetype/thorntail:0")
                .withExposedPorts(THORNTAIL_WEB_PORT)
                .waitingFor(
                        Wait.forHttp("/base/api/hello")
                );

My question: How can I signal my container that it is running in an integration test and should therefore use a different database e.g. H2?

Sasha Shpota
  • 9,436
  • 14
  • 75
  • 148
jwi
  • 1,116
  • 1
  • 18
  • 38
  • Do you use `spring` or something similar or is it just a plain java? – Sergii Bishyr Aug 13 '19 at 07:22
  • @SergiiBishyr I use thorntail (https://thorntail.io). – jwi Aug 13 '19 at 07:24
  • I can see that thornail, as well as `spring` have the profiles: https://docs.thorntail.io/4.0.0-SNAPSHOT/#_configuration. You can use them to run different configurations for integration tests and production – Sergii Bishyr Aug 13 '19 at 08:04

0 Answers0