Skip to content

Commit 30d7be6

Browse files
authored
Merge pull request quarkusio#35837 from yrodiere/hr-mysql-it-fix
Separate Hibernate Reactive tests against MariaDB / MySQL
2 parents c19faac + f41cc80 commit 30d7be6

File tree

10 files changed

+522
-41
lines changed

10 files changed

+522
-41
lines changed

.github/native-tests.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
{
4646
"category": "Data7",
4747
"timeout": 85,
48-
"test-modules": "reactive-oracle-client, reactive-mysql-client, reactive-db2-client, hibernate-reactive-db2, hibernate-reactive-mysql, hibernate-reactive-mysql-agroal-flyway, hibernate-reactive-panache, hibernate-reactive-panache-kotlin",
48+
"test-modules": "reactive-oracle-client, reactive-mysql-client, reactive-db2-client, hibernate-reactive-db2, hibernate-reactive-mariadb, hibernate-reactive-mysql, hibernate-reactive-mysql-agroal-flyway, hibernate-reactive-panache, hibernate-reactive-panache-kotlin",
4949
"os-name": "ubuntu-latest"
5050
},
5151
{
Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
5+
<parent>
6+
<artifactId>quarkus-integration-tests-parent</artifactId>
7+
<groupId>io.quarkus</groupId>
8+
<version>999-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>quarkus-integration-test-hibernate-reactive-mariadb</artifactId>
13+
<name>Quarkus - Integration Tests - Hibernate Reactive - MariaDB</name>
14+
<description>Hibernate Reactive related tests running with the MariaDB database</description>
15+
16+
<properties>
17+
<reactive-mariadb.url>vertx-reactive:mysql://localhost:3306/hibernate_orm_test</reactive-mariadb.url>
18+
</properties>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>io.quarkus</groupId>
23+
<artifactId>quarkus-hibernate-reactive</artifactId>
24+
</dependency>
25+
<dependency>
26+
<groupId>io.quarkus</groupId>
27+
<artifactId>quarkus-reactive-mysql-client</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>io.quarkus</groupId>
31+
<artifactId>quarkus-resteasy-reactive-jsonb</artifactId>
32+
</dependency>
33+
34+
<!-- test dependencies -->
35+
<dependency>
36+
<groupId>io.quarkus</groupId>
37+
<artifactId>quarkus-junit5</artifactId>
38+
<scope>test</scope>
39+
</dependency>
40+
<dependency>
41+
<groupId>io.rest-assured</groupId>
42+
<artifactId>rest-assured</artifactId>
43+
<scope>test</scope>
44+
</dependency>
45+
46+
<!-- Minimal test dependencies to *-deployment artifacts for consistent build order -->
47+
<dependency>
48+
<groupId>io.quarkus</groupId>
49+
<artifactId>quarkus-hibernate-reactive-deployment</artifactId>
50+
<version>${project.version}</version>
51+
<type>pom</type>
52+
<scope>test</scope>
53+
<exclusions>
54+
<exclusion>
55+
<groupId>*</groupId>
56+
<artifactId>*</artifactId>
57+
</exclusion>
58+
</exclusions>
59+
</dependency>
60+
<dependency>
61+
<groupId>io.quarkus</groupId>
62+
<artifactId>quarkus-reactive-mysql-client-deployment</artifactId>
63+
<version>${project.version}</version>
64+
<type>pom</type>
65+
<scope>test</scope>
66+
<exclusions>
67+
<exclusion>
68+
<groupId>*</groupId>
69+
<artifactId>*</artifactId>
70+
</exclusion>
71+
</exclusions>
72+
</dependency>
73+
<dependency>
74+
<groupId>io.quarkus</groupId>
75+
<artifactId>quarkus-resteasy-reactive-jsonb-deployment</artifactId>
76+
<version>${project.version}</version>
77+
<type>pom</type>
78+
<scope>test</scope>
79+
<exclusions>
80+
<exclusion>
81+
<groupId>*</groupId>
82+
<artifactId>*</artifactId>
83+
</exclusion>
84+
</exclusions>
85+
</dependency>
86+
</dependencies>
87+
88+
<build>
89+
<resources>
90+
<resource>
91+
<directory>src/main/resources</directory>
92+
<filtering>true</filtering>
93+
</resource>
94+
</resources>
95+
<plugins>
96+
<plugin>
97+
<artifactId>maven-surefire-plugin</artifactId>
98+
<configuration>
99+
<skip>true</skip>
100+
<systemPropertyVariables>
101+
<org.hibernate.reactive.common.InternalStateAssertions.ENFORCE>true</org.hibernate.reactive.common.InternalStateAssertions.ENFORCE>
102+
</systemPropertyVariables>
103+
</configuration>
104+
</plugin>
105+
<plugin>
106+
<artifactId>maven-failsafe-plugin</artifactId>
107+
<configuration>
108+
<skip>true</skip>
109+
<systemPropertyVariables>
110+
<org.hibernate.reactive.common.InternalStateAssertions.ENFORCE>true</org.hibernate.reactive.common.InternalStateAssertions.ENFORCE>
111+
</systemPropertyVariables>
112+
</configuration>
113+
</plugin>
114+
<plugin>
115+
<groupId>io.quarkus</groupId>
116+
<artifactId>quarkus-maven-plugin</artifactId>
117+
<executions>
118+
<execution>
119+
<goals>
120+
<goal>build</goal>
121+
</goals>
122+
</execution>
123+
</executions>
124+
</plugin>
125+
</plugins>
126+
</build>
127+
128+
<profiles>
129+
<profile>
130+
<id>test-mariadb</id>
131+
<activation>
132+
<property>
133+
<name>test-containers</name>
134+
</property>
135+
</activation>
136+
<build>
137+
<plugins>
138+
<plugin>
139+
<artifactId>maven-surefire-plugin</artifactId>
140+
<configuration>
141+
<skip>false</skip>
142+
</configuration>
143+
</plugin>
144+
<plugin>
145+
<artifactId>maven-failsafe-plugin</artifactId>
146+
<configuration>
147+
<skip>false</skip>
148+
</configuration>
149+
</plugin>
150+
</plugins>
151+
</build>
152+
</profile>
153+
154+
<profile>
155+
<id>docker-mariadb</id>
156+
<activation>
157+
<property>
158+
<name>start-containers</name>
159+
</property>
160+
</activation>
161+
<properties>
162+
<reactive-mariadb.url>vertx-reactive:mysql://localhost:3308/hibernate_orm_test</reactive-mariadb.url>
163+
</properties>
164+
<build>
165+
<plugins>
166+
<plugin>
167+
<groupId>io.fabric8</groupId>
168+
<artifactId>docker-maven-plugin</artifactId>
169+
<configuration>
170+
<images>
171+
<image>
172+
<name>healthcheck-${mariadb.image}</name>
173+
<alias>quarkus-test-mariadb</alias>
174+
<build>
175+
<from>${mariadb.image}</from>
176+
<healthCheck>
177+
<!-- The exact values for these aren't very important, but it is important they are there -->
178+
<interval>5s</interval>
179+
<timeout>3s</timeout>
180+
<startPeriod>5s</startPeriod>
181+
<retries>5</retries>
182+
<!-- We could also use /usr/local/bin/healthcheck.sh but it seemed complicated to get the right level.
183+
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-->
184+
<cmd>
185+
<shell>mysqladmin ping -h localhost -u root -psecret|| exit 1</shell>
186+
</cmd>
187+
</healthCheck>
188+
</build>
189+
<run>
190+
<network>
191+
<mode>bridge</mode>
192+
</network>
193+
<ports>
194+
<port>3308:3306</port>
195+
</ports>
196+
<env>
197+
<MYSQL_USER>hibernate_orm_test</MYSQL_USER>
198+
<MYSQL_PASSWORD>hibernate_orm_test</MYSQL_PASSWORD>
199+
<MYSQL_DATABASE>hibernate_orm_test</MYSQL_DATABASE>
200+
<MYSQL_RANDOM_ROOT_PASSWORD>true</MYSQL_RANDOM_ROOT_PASSWORD>
201+
</env>
202+
<log>
203+
<prefix>MariaDB:</prefix>
204+
<date>default</date>
205+
<color>cyan</color>
206+
</log>
207+
<!-- Speed things up a bit by not actually flushing writes to disk -->
208+
<tmpfs>/var/lib/mysql</tmpfs>
209+
<wait>
210+
<!-- good docs found at: https://dmp.fabric8.io/#start-wait -->
211+
<time>20000</time>
212+
<healthy>true</healthy>
213+
</wait>
214+
</run>
215+
</image>
216+
</images>
217+
<!--Stops all mariadb images currently running, not just those we just started.
218+
Useful to stop processes still running from a previously failed integration test run -->
219+
<allContainers>true</allContainers>
220+
</configuration>
221+
<executions>
222+
<execution>
223+
<id>docker-start</id>
224+
<phase>compile</phase>
225+
<goals>
226+
<goal>stop</goal>
227+
<goal>build</goal>
228+
<goal>start</goal>
229+
</goals>
230+
</execution>
231+
<execution>
232+
<id>docker-stop</id>
233+
<phase>post-integration-test</phase>
234+
<goals>
235+
<goal>stop</goal>
236+
</goals>
237+
</execution>
238+
</executions>
239+
</plugin>
240+
<plugin>
241+
<groupId>org.codehaus.mojo</groupId>
242+
<artifactId>exec-maven-plugin</artifactId>
243+
<executions>
244+
<execution>
245+
<id>docker-prune</id>
246+
<phase>generate-resources</phase>
247+
<goals>
248+
<goal>exec</goal>
249+
</goals>
250+
<configuration>
251+
<executable>${docker-prune.location}</executable>
252+
</configuration>
253+
</execution>
254+
</executions>
255+
</plugin>
256+
</plugins>
257+
</build>
258+
</profile>
259+
</profiles>
260+
261+
262+
</project>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package io.quarkus.it.hibernate.reactive.mariadb;
2+
3+
import java.util.Objects;
4+
5+
import jakarta.persistence.Entity;
6+
import jakarta.persistence.Id;
7+
import jakarta.persistence.Table;
8+
9+
@Entity
10+
@Table(name = "Pig")
11+
public class GuineaPig {
12+
13+
@Id
14+
private Integer id;
15+
private String name;
16+
17+
public GuineaPig() {
18+
}
19+
20+
public GuineaPig(Integer id, String name) {
21+
this.id = id;
22+
this.name = name;
23+
}
24+
25+
public Integer getId() {
26+
return id;
27+
}
28+
29+
public void setId(Integer id) {
30+
this.id = id;
31+
}
32+
33+
public String getName() {
34+
return name;
35+
}
36+
37+
public void setName(String name) {
38+
this.name = name;
39+
}
40+
41+
@Override
42+
public String toString() {
43+
return id + ": " + name;
44+
}
45+
46+
@Override
47+
public boolean equals(Object o) {
48+
if (this == o) {
49+
return true;
50+
}
51+
if (o == null || getClass() != o.getClass()) {
52+
return false;
53+
}
54+
GuineaPig guineaPig = (GuineaPig) o;
55+
return Objects.equals(name, guineaPig.name);
56+
}
57+
58+
@Override
59+
public int hashCode() {
60+
return Objects.hash(name);
61+
}
62+
}

0 commit comments

Comments
 (0)