Skip to content

Commit 9da507f

Browse files
committed
Make sure PUs are active in PostgresOpenTelemetryJdbcInstrumentationIT
I have seen PostgresOpenTelemetryJdbcInstrumentationIT failing with all persistence units being disabled so trying to activate them explicitly as there might be some weird race conditions. Use lifecycle manager rather than test profile
1 parent 2139851 commit 9da507f

File tree

6 files changed

+35
-20
lines changed

6 files changed

+35
-20
lines changed

integration-tests/opentelemetry-jdbc-instrumentation/src/main/resources/application.properties

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,3 @@ quarkus.hibernate-orm.db2.database.generation=none
4141
quarkus.datasource.db2.db-kind=db2
4242
quarkus.datasource.db2.jdbc.driver=${driver}
4343
quarkus.datasource.db2.jdbc.max-size=1
44-
45-
# Oracle test profile properties
46-
%oracle-profile.quarkus.datasource."oracle".jdbc.url=jdbc:otel:oracle:thin:@localhost:1521/XE
47-
%oracle-profile.quarkus.datasource."oracle".password=quarkus
48-
%oracle-profile.quarkus.datasource."oracle".username=SYSTEM
49-
%oracle-profile.quarkus.hibernate-orm."oracle".database.generation=drop-and-create
50-
%oracle-profile.quarkus.hibernate-orm.mariadb.active=false
51-
%oracle-profile.quarkus.hibernate-orm.postgresql.active=false
52-
%oracle-profile.quarkus.hibernate-orm.db2.active=false

integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/Db2LifecycleManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public Map<String, String> start() {
2727
properties.put("quarkus.datasource.db2.password", QUARKUS);
2828
properties.put("quarkus.datasource.db2.username", QUARKUS);
2929
properties.put("quarkus.hibernate-orm.db2.database.generation", "drop-and-create");
30+
properties.put("quarkus.hibernate-orm.db2.active", "true");
3031
properties.put("quarkus.hibernate-orm.oracle.active", "false");
3132
properties.put("quarkus.hibernate-orm.postgresql.active", "false");
3233
properties.put("quarkus.hibernate-orm.mariadb.active", "false");

integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/MariaDbLifecycleManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public Map<String, String> start() {
2727
properties.put("quarkus.datasource.mariadb.password", QUARKUS);
2828
properties.put("quarkus.datasource.mariadb.username", QUARKUS);
2929
properties.put("quarkus.hibernate-orm.mariadb.database.generation", "drop-and-create");
30+
properties.put("quarkus.hibernate-orm.mariadb.active", "true");
3031
properties.put("quarkus.hibernate-orm.oracle.active", "false");
3132
properties.put("quarkus.hibernate-orm.postgresql.active", "false");
3233
properties.put("quarkus.hibernate-orm.db2.active", "false");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package io.quarkus.it.opentelemetry;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
7+
8+
public class OracleLifecycleManager implements QuarkusTestResourceLifecycleManager {
9+
10+
@Override
11+
public Map<String, String> start() {
12+
Map<String, String> properties = new HashMap<>();
13+
properties.put("quarkus.datasource.oracle.jdbc.url", "jdbc:otel:oracle:thin:@localhost:1521/XE");
14+
properties.put("quarkus.datasource.oracle.password", "quarkus");
15+
properties.put("quarkus.datasource.oracle.username", "SYSTEM");
16+
properties.put("quarkus.hibernate-orm.oracle.database.generation", "drop-and-create");
17+
properties.put("quarkus.hibernate-orm.oracle.active", "true");
18+
properties.put("quarkus.hibernate-orm.mariadb.active", "false");
19+
properties.put("quarkus.hibernate-orm.postgresql.active", "false");
20+
properties.put("quarkus.hibernate-orm.db2.active", "false");
21+
22+
return properties;
23+
}
24+
25+
@Override
26+
public void stop() {
27+
// EMPTY
28+
}
29+
30+
}

integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/OracleOpenTelemetryJdbcInstrumentationTest.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,16 @@
22

33
import org.junit.jupiter.api.Test;
44

5+
import io.quarkus.test.common.QuarkusTestResource;
56
import io.quarkus.test.junit.QuarkusTest;
6-
import io.quarkus.test.junit.QuarkusTestProfile;
7-
import io.quarkus.test.junit.TestProfile;
87

98
@QuarkusTest
10-
@TestProfile(OracleOpenTelemetryJdbcInstrumentationTest.OracleTestProfile.class)
9+
@QuarkusTestResource(value = OracleLifecycleManager.class, restrictToAnnotatedClass = true)
1110
public class OracleOpenTelemetryJdbcInstrumentationTest extends OpenTelemetryJdbcInstrumentationTest {
1211

1312
@Test
1413
void testOracleQueryTraced() {
1514
testQueryTraced("oracle", "OracleHit");
1615
}
1716

18-
public static class OracleTestProfile implements QuarkusTestProfile {
19-
20-
@Override
21-
public String getConfigProfile() {
22-
return "oracle-profile";
23-
}
24-
}
25-
2617
}

integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/PostgreSqlLifecycleManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public Map<String, String> start() {
2727
properties.put("quarkus.datasource.postgresql.password", QUARKUS);
2828
properties.put("quarkus.datasource.postgresql.username", QUARKUS);
2929
properties.put("quarkus.hibernate-orm.postgresql.database.generation", "drop-and-create");
30+
properties.put("quarkus.hibernate-orm.postgresql.active", "true");
3031
properties.put("quarkus.hibernate-orm.oracle.active", "false");
3132
properties.put("quarkus.hibernate-orm.mariadb.active", "false");
3233
properties.put("quarkus.hibernate-orm.db2.active", "false");

0 commit comments

Comments
 (0)