Skip to content

Commit 271f56c

Browse files
Merge pull request #51090 from holly-cummins/convert-mariadb-tests-to-devservices
Switch MariaDB tests to use dev services
2 parents 50478ab + f86ba5d commit 271f56c

File tree

5 files changed

+3
-218
lines changed

5 files changed

+3
-218
lines changed

integration-tests/hibernate-reactive-mariadb/pom.xml

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -150,109 +150,6 @@
150150
</plugins>
151151
</build>
152152
</profile>
153-
154-
<profile>
155-
<id>docker-mariadb</id>
156-
<activation>
157-
<property>
158-
<name>start-containers</name>
159-
</property>
160-
</activation>
161-
<build>
162-
<plugins>
163-
<plugin>
164-
<groupId>io.fabric8</groupId>
165-
<artifactId>docker-maven-plugin</artifactId>
166-
<configuration>
167-
<images>
168-
<image>
169-
<name>healthcheck-${mariadb.image}</name>
170-
<alias>quarkus-test-mariadb</alias>
171-
<build>
172-
<from>${mariadb.image}</from>
173-
<healthCheck>
174-
<!-- The exact values for these aren't very important, but it is important they are there -->
175-
<interval>5s</interval>
176-
<timeout>3s</timeout>
177-
<startPeriod>5s</startPeriod>
178-
<retries>5</retries>
179-
<!-- We could also use /usr/local/bin/healthcheck.sh but it seemed complicated to get the right level.
180-
Note that mysqladmin ping returns 0 even if the password is wrong so we don't need to pass in a password, but it makes the logs cleaner-->
181-
<cmd>
182-
<shell>mysqladmin ping -h localhost -u root -psecret|| exit 1</shell>
183-
</cmd>
184-
</healthCheck>
185-
</build>
186-
<run>
187-
<network>
188-
<mode>bridge</mode>
189-
</network>
190-
<ports>
191-
<port>3308:3306</port>
192-
</ports>
193-
<env>
194-
<MYSQL_USER>hibernate_orm_test</MYSQL_USER>
195-
<MYSQL_PASSWORD>hibernate_orm_test</MYSQL_PASSWORD>
196-
<MYSQL_DATABASE>hibernate_orm_test</MYSQL_DATABASE>
197-
<MYSQL_RANDOM_ROOT_PASSWORD>true</MYSQL_RANDOM_ROOT_PASSWORD>
198-
</env>
199-
<log>
200-
<prefix>MariaDB:</prefix>
201-
<date>default</date>
202-
<color>cyan</color>
203-
</log>
204-
<!-- Speed things up a bit by not actually flushing writes to disk -->
205-
<tmpfs>/var/lib/mysql</tmpfs>
206-
<wait>
207-
<!-- good docs found at: https://dmp.fabric8.io/#start-wait -->
208-
<time>20000</time>
209-
<healthy>true</healthy>
210-
</wait>
211-
</run>
212-
</image>
213-
</images>
214-
<!--Stops all mariadb images currently running, not just those we just started.
215-
Useful to stop processes still running from a previously failed integration test run -->
216-
<allContainers>true</allContainers>
217-
</configuration>
218-
<executions>
219-
<execution>
220-
<id>docker-start</id>
221-
<phase>compile</phase>
222-
<goals>
223-
<goal>stop</goal>
224-
<goal>build</goal>
225-
<goal>start</goal>
226-
</goals>
227-
</execution>
228-
<execution>
229-
<id>docker-stop</id>
230-
<phase>post-integration-test</phase>
231-
<goals>
232-
<goal>stop</goal>
233-
</goals>
234-
</execution>
235-
</executions>
236-
</plugin>
237-
<plugin>
238-
<groupId>org.codehaus.mojo</groupId>
239-
<artifactId>exec-maven-plugin</artifactId>
240-
<executions>
241-
<execution>
242-
<id>docker-prune</id>
243-
<phase>generate-resources</phase>
244-
<goals>
245-
<goal>exec</goal>
246-
</goals>
247-
<configuration>
248-
<executable>${docker-prune.location}</executable>
249-
</configuration>
250-
</execution>
251-
</executions>
252-
</plugin>
253-
</plugins>
254-
</build>
255-
</profile>
256153
</profiles>
257154

258155

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
quarkus.datasource.db-kind=mariadb
2-
quarkus.datasource.username=hibernate_orm_test
3-
quarkus.datasource.password=hibernate_orm_test
42

53
# Hibernate config
64
#quarkus.hibernate-orm.log.sql=true
75
quarkus.hibernate-orm.schema-management.strategy=drop-and-create
86

97
# Reactive config
108
quarkus.datasource.reactive=true
11-
quarkus.datasource.reactive.url=${reactive-mariadb.url}

integration-tests/jpa-mariadb/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
By default, the tests of this module are disabled.
66

7-
To run the tests in a standard JVM with MariaDB started as a Docker container, you can run the following command:
7+
To run the tests in a standard JVM with MariaDB started as a Dev Service, you can run the following command:
88

99
```
1010
mvn clean install -Dtest-containers -Dstart-containers
@@ -19,15 +19,15 @@ Additionally, you can generate a native image and run the tests for this native
1919
mvn clean install -Dtest-containers -Dstart-containers -Dnative
2020
```
2121

22-
If you don't want to run MariaDB as a Docker container, you can start your own MariaDB server. It needs to listen on port 3308 and have a database called `hibernate_orm_test` accessible to the user `hibernate_orm_test` with the password `hibernate_orm_test`.
22+
If you don't want to run MariaDB as a Dev Service, you can start your own MariaDB server. It needs to listen on port 3308 and have a database called `hibernate_orm_test` accessible to the user `hibernate_orm_test` with the password `hibernate_orm_test`.
2323

2424
You can then run the tests as follows (either with `-Dnative` or not):
2525

2626
```
2727
mvn clean install -Dtest-containers
2828
```
2929

30-
If you have specific requirements, you can define a specific connection URL with `-Dmariadb.url=jdbc:mariadb://...`.
30+
You should then define a specific connection URL with `-Dmariadb.url=jdbc:mariadb://...`.
3131

3232
To run the MariaDB server "manually" via command line for testing, the following command line could be useful:
3333

integration-tests/jpa-mariadb/pom.xml

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -155,112 +155,6 @@
155155
</build>
156156
</profile>
157157

158-
<profile>
159-
<id>docker-mariadb</id>
160-
<activation>
161-
<property>
162-
<name>start-containers</name>
163-
</property>
164-
</activation>
165-
<build>
166-
<plugins>
167-
<plugin>
168-
<groupId>io.fabric8</groupId>
169-
<artifactId>docker-maven-plugin</artifactId>
170-
<configuration>
171-
<images>
172-
<image>
173-
<name>healthcheck-${mariadb.image}</name>
174-
<alias>quarkus-test-mariadb</alias>
175-
<build>
176-
<from>${mariadb.image}</from>
177-
<healthCheck>
178-
<!-- The exact values for these aren't very important, but it is important they are there -->
179-
<interval>5s</interval>
180-
<timeout>3s</timeout>
181-
<startPeriod>5s</startPeriod>
182-
<retries>5</retries>
183-
<!-- We could also use /usr/local/bin/healthcheck.sh but it seemed complicated to get the right level.
184-
Note that mysqladmin ping returns 0 even if the password is wrong so we don't need to pass in a password, but it makes the logs cleaner-->
185-
<cmd>
186-
<shell>mysqladmin ping -h localhost -u root -psecret|| exit 1</shell>
187-
</cmd>
188-
</healthCheck>
189-
</build>
190-
<run>
191-
<ports>
192-
<port>3308:3306</port>
193-
</ports>
194-
<env>
195-
<MYSQL_USER>hibernate_orm_test</MYSQL_USER>
196-
<MYSQL_PASSWORD>hibernate_orm_test</MYSQL_PASSWORD>
197-
<MYSQL_DATABASE>hibernate_orm_test</MYSQL_DATABASE>
198-
<MYSQL_RANDOM_ROOT_PASSWORD>true</MYSQL_RANDOM_ROOT_PASSWORD>
199-
</env>
200-
<log>
201-
<prefix>MariaDB:</prefix>
202-
<date>default</date>
203-
<color>cyan</color>
204-
</log>
205-
<!-- Speed things up a bit by not actually flushing writes to disk -->
206-
<tmpfs>/var/lib/mysql</tmpfs>
207-
<wait>
208-
<time>20000</time>
209-
<healthy>true</healthy>
210-
</wait>
211-
<volumes>
212-
<bind>
213-
<volume>
214-
${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d${volume.access.modifier}
215-
</volume>
216-
</bind>
217-
</volumes>
218-
</run>
219-
</image>
220-
</images>
221-
<!--Stops all mariadb images currently running, not just those we just started.
222-
Useful to stop processes still running from a previously failed integration test run -->
223-
<allContainers>true</allContainers>
224-
</configuration>
225-
<executions>
226-
<execution>
227-
<id>docker-start</id>
228-
<phase>compile</phase>
229-
<goals>
230-
<goal>stop</goal>
231-
<goal>build</goal>
232-
<goal>start</goal>
233-
</goals>
234-
</execution>
235-
<execution>
236-
<id>docker-stop</id>
237-
<phase>post-integration-test</phase>
238-
<goals>
239-
<goal>stop</goal>
240-
</goals>
241-
</execution>
242-
</executions>
243-
</plugin>
244-
<plugin>
245-
<groupId>org.codehaus.mojo</groupId>
246-
<artifactId>exec-maven-plugin</artifactId>
247-
<executions>
248-
<execution>
249-
<id>docker-prune</id>
250-
<phase>generate-resources</phase>
251-
<goals>
252-
<goal>exec</goal>
253-
</goals>
254-
<configuration>
255-
<executable>${docker-prune.location}</executable>
256-
</configuration>
257-
</execution>
258-
</executions>
259-
</plugin>
260-
</plugins>
261-
</build>
262-
</profile>
263-
264158
</profiles>
265159

266160
</project>

integration-tests/jpa-mariadb/src/main/resources/application.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
quarkus.datasource.db-kind=mariadb
2-
quarkus.datasource.username=hibernate_orm_test
3-
quarkus.datasource.password=hibernate_orm_test
4-
quarkus.datasource.jdbc.url=${mariadb.url}
52
quarkus.datasource.jdbc.max-size=2
63
quarkus.hibernate-orm.schema-management.strategy=drop-and-create
74
quarkus.hibernate-orm.packages=io.quarkus.it.jpa.mariadb

0 commit comments

Comments
 (0)