Skip to content

Commit 82db071

Browse files
author
Guilherme Biff Zarelli
committed
refactor: better way to create docker in acceptance-test
1 parent ede206d commit 82db071

File tree

6 files changed

+22
-87
lines changed

6 files changed

+22
-87
lines changed

.maven-dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
acceptance-test/target/docker/**

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ RUN curl https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY
5555
&& chmod 540 /flyway/flyway
5656

5757
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
58-
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0"
58+
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
5959

6060
COPY app/quarkus-app/target/lib/* /deployments/lib/
6161
COPY app/quarkus-app/target/*-runner.jar /deployments/app.jar

acceptance-test/pom.xml

Lines changed: 9 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
<maven.compiler.target>11</maven.compiler.target>
1717
<mutation.skip>true</mutation.skip>
1818
<maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
19+
<maven-failsafe-plugin.version>2.22.0</maven-failsafe-plugin.version>
1920
<mysql-connector-java.version>8.0.23</mysql-connector-java.version>
20-
<docker-maven-plugin.version>0.34.1</docker-maven-plugin.version>
21+
<docker-maven-plugin.version>0.35.0</docker-maven-plugin.version>
2122
<run-java-sh.version>1.2.2</run-java-sh.version>
2223
<mutation.skip>true</mutation.skip>
2324
</properties>
@@ -96,47 +97,6 @@
9697

9798
<build>
9899
<plugins>
99-
<plugin>
100-
<artifactId>maven-resources-plugin</artifactId>
101-
<version>${maven-resources-plugin.version}</version>
102-
<executions>
103-
<execution>
104-
<id>copy-jar</id>
105-
<phase>generate-resources</phase>
106-
<goals>
107-
<goal>copy-resources</goal>
108-
</goals>
109-
<configuration>
110-
<outputDirectory>${basedir}/target/quarkus/</outputDirectory>
111-
<resources>
112-
<resource>
113-
<directory>../app/quarkus-app/target/</directory>
114-
<includes>
115-
<include>*-runner.jar</include>
116-
</includes>
117-
</resource>
118-
</resources>
119-
</configuration>
120-
</execution>
121-
122-
<execution>
123-
<id>copy-lib</id>
124-
<phase>generate-resources</phase>
125-
<goals>
126-
<goal>copy-resources</goal>
127-
</goals>
128-
<configuration>
129-
<outputDirectory>${basedir}/target/quarkus/lib</outputDirectory>
130-
<resources>
131-
<resource>
132-
<directory>../app/quarkus-app/target/lib</directory>
133-
<filtering>false</filtering>
134-
</resource>
135-
</resources>
136-
</configuration>
137-
</execution>
138-
</executions>
139-
</plugin>
140100
<plugin>
141101
<groupId>io.fabric8</groupId>
142102
<artifactId>docker-maven-plugin</artifactId>
@@ -155,14 +115,11 @@
155115
<name>app-test:integration</name>
156116
<alias>dockerfile</alias>
157117
<build>
158-
<contextDir>${project.basedir}/</contextDir>
159-
<assembly>
160-
<descriptorRef>rootWar</descriptorRef>
161-
</assembly>
118+
<contextDir>${project.parent.basedir}</contextDir>
119+
<dockerFile>${project.parent.basedir}/Dockerfile</dockerFile>
162120
</build>
163121
</image>
164122
</images>
165-
166123
</configuration>
167124
<dependencies>
168125
<dependency>
@@ -172,29 +129,17 @@
172129
</dependency>
173130
</dependencies>
174131
</plugin>
132+
175133
<plugin>
176134
<groupId>org.apache.maven.plugins</groupId>
177-
<artifactId>maven-surefire-plugin</artifactId>
178-
<configuration>
179-
<excludes>
180-
<exclude>**/*IT.java</exclude>
181-
</excludes>
182-
</configuration>
135+
<artifactId>maven-failsafe-plugin</artifactId>
136+
<version>${maven-failsafe-plugin.version}</version>
183137
<executions>
184138
<execution>
185-
<id>integration-test</id>
186139
<goals>
187-
<goal>test</goal>
140+
<goal>integration-test</goal>
141+
<goal>verify</goal>
188142
</goals>
189-
<phase>integration-test</phase>
190-
<configuration>
191-
<excludes>
192-
<exclude>none</exclude>
193-
</excludes>
194-
<includes>
195-
<include>**/*IT.java</include>
196-
</includes>
197-
</configuration>
198143
</execution>
199144
</executions>
200145
</plugin>

acceptance-test/src/test/java/br/com/helpdev/atdd/AbstractContainerBaseTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
abstract class AbstractContainerBaseTest {
1111

12-
private static final GenericContainer APP;
13-
private static final GenericContainer FLYWAY;
14-
private static final MySQLContainer MY_SQL_CONTAINER;
12+
private static final GenericContainer<?> APP;
13+
private static final GenericContainer<?> FLYWAY;
14+
private static final MySQLContainer<?> MY_SQL_CONTAINER;
1515

1616
static {
1717
final var network = Network.newNetwork();

acceptance-test/src/test/java/br/com/helpdev/atdd/ApplicationIT.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import java.time.ZonedDateTime;
1212
import org.junit.jupiter.api.Test;
1313

14-
public class ApplicationIT extends AbstractContainerBaseTest {
14+
class ApplicationIT extends AbstractContainerBaseTest {
1515

1616
@Test
17-
public void whenCreateNewScheduleThenReturn() {
17+
void whenCreateNewScheduleThenReturn() {
1818
var now = ZonedDateTime.now();
1919
Integer id = given()
2020
.contentType(ContentType.JSON)
@@ -31,7 +31,6 @@ public void whenCreateNewScheduleThenReturn() {
3131
.body("chats[0].status", equalTo("WAITING"))
3232
.extract()
3333
.path("id");
34-
3534
given()
3635
.when()
3736
.get("/v1/message/{id}", id)
@@ -48,7 +47,7 @@ public void whenCreateNewScheduleThenReturn() {
4847
}
4948

5049
@Test
51-
public void whenGetWithInvalidIdThenReturnError() {
50+
void whenGetWithInvalidIdThenReturnError() {
5251
given()
5352
.when()
5453
.get("/v1/message/{id}", "123123")
@@ -59,7 +58,7 @@ public void whenGetWithInvalidIdThenReturnError() {
5958
}
6059

6160
@Test
62-
public void whenDeleteMessageThenRemove() {
61+
void whenDeleteMessageThenRemove() {
6362
var now = ZonedDateTime.now();
6463
Integer id = given()
6564
.contentType(ContentType.JSON)
@@ -83,7 +82,7 @@ public void whenDeleteMessageThenRemove() {
8382
}
8483

8584
@Test
86-
public void whenDeleteWithInvalidIdThenReturnError() {
85+
void whenDeleteWithInvalidIdThenReturnError() {
8786
given()
8887
.when()
8988
.delete("/v1/message/{id}", "123123")
@@ -93,7 +92,7 @@ public void whenDeleteWithInvalidIdThenReturnError() {
9392
}
9493

9594
@Test
96-
public void whenCreateNewEmailScheduleThenReturn() {
95+
void whenCreateNewEmailScheduleThenReturn() {
9796
given()
9897
.contentType(ContentType.JSON)
9998
.body(buildMessage(ZonedDateTime.now(), CommunicationChannelDto.EMAIL))
@@ -108,7 +107,7 @@ public void whenCreateNewEmailScheduleThenReturn() {
108107
}
109108

110109
@Test
111-
public void whenCreateNewPushScheduleThenReturn() {
110+
void whenCreateNewPushScheduleThenReturn() {
112111
given()
113112
.contentType(ContentType.JSON)
114113
.body(buildMessage(ZonedDateTime.now(), CommunicationChannelDto.PUSH))
@@ -123,7 +122,7 @@ public void whenCreateNewPushScheduleThenReturn() {
123122
}
124123

125124
@Test
126-
public void whenCreateNewSmsScheduleThenReturn() {
125+
void whenCreateNewSmsScheduleThenReturn() {
127126
given()
128127
.contentType(ContentType.JSON)
129128
.body(buildMessage(ZonedDateTime.now(), CommunicationChannelDto.SMS))

pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,6 @@
314314
<argLine>@{argLine} -Xmx1024m -XX:MaxPermSize=256m</argLine>
315315
</configuration>
316316
</plugin>
317-
<plugin>
318-
<groupId>org.apache.maven.plugins</groupId>
319-
<artifactId>maven-release-plugin</artifactId>
320-
<version>${maven-release-plugin-version}</version>
321-
<configuration>
322-
<tagNameFormat>v@{project.version}</tagNameFormat>
323-
<updateWorkingCopyVersions>false</updateWorkingCopyVersions>
324-
<pushChanges>false</pushChanges>
325-
</configuration>
326-
</plugin>
327317
<plugin>
328318
<groupId>org.apache.maven.plugins</groupId>
329319
<artifactId>maven-checkstyle-plugin</artifactId>

0 commit comments

Comments
 (0)