Skip to content

Commit 3b720fa

Browse files
committed
Use health check to detect startup and skip volume modifier on M1
1 parent 748908f commit 3b720fa

File tree

8 files changed

+200
-59
lines changed

8 files changed

+200
-59
lines changed

build-parent/pom.xml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
<!-- Antlr is used by the PanacheQL parser-->
7676
<antlr.version>4.9.2</antlr.version>
7777

78+
<!-- SELinux access label, used when mounting local volumes into containers in tests -->
79+
<volume.access.modifier>:Z</volume.access.modifier>
80+
7881
<!-- Defaults for integration tests -->
7982
<elasticsearch-server.version>7.16.3</elasticsearch-server.version>
8083
<elasticsearch.image>docker.io/elastic/elasticsearch:${elasticsearch-server.version}</elasticsearch.image>
@@ -102,7 +105,7 @@
102105
<keycloak.version>18.0.0</keycloak.version>
103106
<keycloak.docker.image>quay.io/keycloak/keycloak:${keycloak.version}</keycloak.docker.image>
104107
<keycloak.docker.legacy.image>quay.io/keycloak/keycloak:${keycloak.version}-legacy</keycloak.docker.legacy.image>
105-
108+
106109
<unboundid-ldap.version>6.0.5</unboundid-ldap.version>
107110

108111
<assertj.version>3.22.0</assertj.version>
@@ -141,7 +144,7 @@
141144
<build-helper-plugin.version>1.9.1</build-helper-plugin.version>
142145
<revapi-reporter-text.version>0.14.5</revapi-reporter-text.version>
143146
<revapi-reporter-json.version>0.4.5</revapi-reporter-json.version>
144-
<!-- Latest release to be used by api-compatibility-check to check backwards compatibility of the Quarkus API. -->
147+
<!-- Latest release to be used by api-compatibility-check to check backwards compatibility of the Quarkus API. -->
145148
<revapi.oldVersion>1.6.0.Final</revapi.oldVersion>
146149
<revapi.newVersion>${project.version}</revapi.newVersion>
147150
<!-- severity Possible values: equivalent, nonBreaking, potentiallyBreaking, breaking -->
@@ -363,8 +366,8 @@
363366
<scope>test</scope>
364367
<exclusions>
365368
<exclusion>
366-
<groupId>org.apache.activemq</groupId>
367-
<artifactId>artemis-server</artifactId>
369+
<groupId>org.apache.activemq</groupId>
370+
<artifactId>artemis-server</artifactId>
368371
</exclusion>
369372
<!-- Excluding the API jar as the impl jar also contains the API -->
370373
<exclusion>
@@ -673,7 +676,7 @@
673676
<groupId>io.quarkus</groupId>
674677
<version>${project.version}</version>
675678
</dependency>
676-
</dependencies>
679+
</dependencies>
677680
<configuration>
678681
<!-- store outside of target to speed up formatting when mvn clean is used -->
679682
<cachedir>.cache/formatter-maven-plugin-${formatter-maven-plugin.version}</cachedir>
@@ -1228,6 +1231,19 @@
12281231
</properties>
12291232
</profile>
12301233

1234+
<profile>
1235+
<id>mac-m1</id>
1236+
<activation>
1237+
<os>
1238+
<arch>aarch64</arch>
1239+
</os>
1240+
</activation>
1241+
<properties>
1242+
<!-- Podman compatibility. Currently, mac file systems based on Plan 9 does not support SELinux labeling z and Z should not be used. When they transition to use virtiofsd, it should support SELinux labeling, and then we can use it for better container separation on the Mac.-->
1243+
<volume.access.modifier></volume.access.modifier>
1244+
</properties>
1245+
</profile>
1246+
12311247
<profile>
12321248
<id>jakarta-rewrite</id>
12331249
<activation>

extensions/reactive-mysql-client/deployment/pom.xml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
~ under the License.
1616
-->
1717

18+
1819
<project xmlns="http://maven.apache.org/POM/4.0.0"
1920
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2021
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -153,8 +154,24 @@
153154
<configuration>
154155
<images>
155156
<image>
156-
<name>${mariadb.image}</name>
157+
<!-- Be aware when testing healthcheck scripts, caching of named images can cause apparently non-deterministic behaviour.
158+
Change the name if making changes. -->
159+
<name>healthcheck-${mariadb.image}</name>
157160
<alias>quarkus-test-mariadb</alias>
161+
<build>
162+
<from>${mariadb.image}</from>
163+
<healthCheck>
164+
<!-- The exact values for these aren't very important, but it is important they are there -->
165+
<interval>5s</interval>
166+
<timeout>3s</timeout>
167+
<startPeriod>5s</startPeriod>
168+
<retries>5</retries>
169+
<!-- Note that mysqladmin ping returns 0 even if the password is wrong-->
170+
<cmd>
171+
<shell>mysqladmin ping -h localhost || exit 1</shell>
172+
</cmd>
173+
</healthCheck>
174+
</build>
158175
<run>
159176
<network>
160177
<mode>bridge</mode>
@@ -176,26 +193,25 @@
176193
<!-- Speed things up a bit by not actually flushing writes to disk -->
177194
<tmpfs>/var/lib/mysql</tmpfs>
178195
<wait>
179-
<!-- good docs found at: http://dmp.fabric8.io/#build-healthcheck -->
180-
<tcp>
181-
<mode>direct</mode>
182-
<ports>
183-
<port>3306</port>
184-
</ports>
185-
</tcp>
196+
<!-- good docs found at: http://dmp.fabric8.io/#start-wait -->
197+
<!-- the sqladmin check seems more reliable than a tcp check, especially with
198+
diverse container runtimes -->
199+
<healthy>true</healthy>
186200
<!-- Unfortunately booting MariaDB is slow, needs to set a generous timeout: -->
187201
<time>40000</time>
188202
</wait>
189203
<volumes>
190204
<bind>
191-
<volume>${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d:Z</volume>
205+
<volume>
206+
${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d${volume.access.modifier}
207+
</volume>
192208
</bind>
193209
</volumes>
194210
</run>
195211
</image>
196212
</images>
197-
<!--Stops all mariadb images currently running, not just those we just started.
198-
Useful to stop processes still running from a previously failed integration test run -->
213+
<!-- Stops all mariadb images currently running, not just those we just started.
214+
Useful to stop processes still running from a previously failed integration test run -->
199215
<allContainers>true</allContainers>
200216
</configuration>
201217
<executions>
@@ -204,6 +220,7 @@
204220
<phase>compile</phase>
205221
<goals>
206222
<goal>stop</goal>
223+
<goal>build</goal>
207224
<goal>start</goal>
208225
</goals>
209226
</execution>

integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/pom.xml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
55

66
<parent>
77
<artifactId>quarkus-integration-test-hibernate-orm-tenancy</artifactId>
@@ -12,7 +12,9 @@
1212

1313
<artifactId>quarkus-integration-test-hibernate-orm-tenancy-connection-resolver-legacy-qualifiers</artifactId>
1414
<name>Quarkus - Integration Tests - Hibernate - Tenancy - Connection</name>
15-
<description>Tests for Hibernate ORM Multitenancy using a custom connection resolver and tenant resolver with legacy CDI qualifiers (@Default or @PersistenceUnit), running with the MariaDB database</description>
15+
<description>Tests for Hibernate ORM Multitenancy using a custom connection resolver and tenant resolver with legacy CDI qualifiers (@Default or @PersistenceUnit), running with the MariaDB
16+
database
17+
</description>
1618

1719
<properties>
1820
<mariadb.base_url>jdbc:mariadb://localhost:3306</mariadb.base_url>
@@ -198,8 +200,24 @@
198200
<configuration>
199201
<images>
200202
<image>
201-
<name>${mariadb.image}</name>
203+
<name>init-healthcheck-${mariadb.image}</name>
202204
<alias>quarkus-test-mariadb</alias>
205+
<build>
206+
<from>${mariadb.image}</from>
207+
<healthCheck>
208+
<!-- The exact values for these aren't very important, but it is important they are there -->
209+
<!-- The exact values for these aren't very important, but it is important they are there -->
210+
<interval>5s</interval>
211+
<timeout>3s</timeout>
212+
<startPeriod>5s</startPeriod>
213+
<retries>5</retries>
214+
<!-- We could also use /usr/local/bin/healthcheck.sh but it seemed complicated to get the right level.
215+
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-->
216+
<cmd>
217+
<shell>mysqladmin ping -h localhost -u root -psecret|| exit 1</shell>
218+
</cmd>
219+
</healthCheck>
220+
</build>
203221
<run>
204222
<ports>
205223
<port>3308:3306</port>
@@ -217,21 +235,24 @@
217235
<tmpfs>/var/lib/mysql</tmpfs>
218236
<wait>
219237
<time>20000</time>
238+
<healthy>true</healthy>
220239
<exec>
221240
<breakOnError>true</breakOnError>
222241
<postStart>bash -c eval\ ${@} -- mysql -h localhost -uroot -psecret &lt;/etc/mysql/conf.d/init.sql</postStart>
223242
</exec>
224243
</wait>
225244
<volumes>
226245
<bind>
227-
<volume>${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d:Z</volume>
246+
<volume>
247+
${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d${volume.access.modifier}
248+
</volume>
228249
</bind>
229250
</volumes>
230251
</run>
231252
</image>
232253
</images>
233254
<!--Stops all mariadb images currently running, not just those
234-
we just started. Useful to stop processes still running from a previously
255+
we just started. Useful to stop processes still running from a previously
235256
failed integration test run -->
236257
<allContainers>true</allContainers>
237258
</configuration>
@@ -241,6 +262,7 @@
241262
<phase>compile</phase>
242263
<goals>
243264
<goal>stop</goal>
265+
<goal>build</goal>
244266
<goal>start</goal>
245267
</goals>
246268
</execution>

integration-tests/hibernate-orm-tenancy/connection-resolver/pom.xml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
55

66
<parent>
77
<artifactId>quarkus-integration-test-hibernate-orm-tenancy</artifactId>
@@ -198,8 +198,24 @@
198198
<configuration>
199199
<images>
200200
<image>
201-
<name>${mariadb.image}</name>
201+
<name>init-healthcheck-${mariadb.image}</name>
202202
<alias>quarkus-test-mariadb</alias>
203+
<build>
204+
<from>${mariadb.image}</from>
205+
<healthCheck>
206+
<!-- The exact values for these aren't very important, but it is important they are there -->
207+
<!-- The exact values for these aren't very important, but it is important they are there -->
208+
<interval>5s</interval>
209+
<timeout>3s</timeout>
210+
<startPeriod>5s</startPeriod>
211+
<retries>5</retries>
212+
<!-- We could also use /usr/local/bin/healthcheck.sh but it seemed complicated to get the right level.
213+
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-->
214+
<cmd>
215+
<shell>mysqladmin ping -h localhost -u root -psecret|| exit 1</shell>
216+
</cmd>
217+
</healthCheck>
218+
</build>
203219
<run>
204220
<ports>
205221
<port>3308:3306</port>
@@ -217,21 +233,24 @@
217233
<tmpfs>/var/lib/mysql</tmpfs>
218234
<wait>
219235
<time>20000</time>
236+
<healthy>true</healthy>
220237
<exec>
221238
<breakOnError>true</breakOnError>
222239
<postStart>bash -c eval\ ${@} -- mysql -h localhost -uroot -psecret &lt;/etc/mysql/conf.d/init.sql</postStart>
223240
</exec>
224241
</wait>
225242
<volumes>
226243
<bind>
227-
<volume>${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d:Z</volume>
244+
<volume>
245+
${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d${volume.access.modifier}
246+
</volume>
228247
</bind>
229248
</volumes>
230249
</run>
231250
</image>
232251
</images>
233252
<!--Stops all mariadb images currently running, not just those
234-
we just started. Useful to stop processes still running from a previously
253+
we just started. Useful to stop processes still running from a previously
235254
failed integration test run -->
236255
<allContainers>true</allContainers>
237256
</configuration>
@@ -241,6 +260,7 @@
241260
<phase>compile</phase>
242261
<goals>
243262
<goal>stop</goal>
263+
<goal>build</goal>
244264
<goal>start</goal>
245265
</goals>
246266
</execution>

0 commit comments

Comments
 (0)