Skip to content

Commit 4400c21

Browse files
authored
Merge pull request quarkusio#36280 from navinyashende/oracle-otel-test
Enable OracleOpenTelemetryJdbcInstrumentationTest
2 parents b6f8c74 + 7bf776a commit 4400c21

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed

integration-tests/opentelemetry-jdbc-instrumentation/pom.xml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,5 +326,86 @@
326326
</plugins>
327327
</build>
328328
</profile>
329+
<profile>
330+
<id>test-jdbc-instrumentation-docker-oracle</id>
331+
<activation>
332+
<property>
333+
<name>start-containers</name>
334+
</property>
335+
</activation>
336+
<build>
337+
<plugins>
338+
<plugin>
339+
<groupId>io.fabric8</groupId>
340+
<artifactId>docker-maven-plugin</artifactId>
341+
<configuration>
342+
<images>
343+
<image>
344+
<name>${oracle.image}</name>
345+
<run>
346+
<ports>
347+
<port>1521:1521</port>
348+
</ports>
349+
<env>
350+
<ORACLE_PASSWORD>quarkus</ORACLE_PASSWORD>
351+
</env>
352+
<log>
353+
<prefix>Oracle Database: </prefix>
354+
<date>default</date>
355+
<color>red</color>
356+
</log>
357+
<wait>
358+
<!-- good docs found at: https://dmp.fabric8.io/#build-healthcheck -->
359+
<!-- Unfortunately booting this is slow, needs to set a generous timeout: -->
360+
<time>60000</time>
361+
<!-- leverage the healthcheck in the image we use -->
362+
<healthy>yes</healthy>
363+
<!-- In case of any issues with the built-in healthcheck we can revert back to the original log check:-->
364+
<!--<log>DATABASE IS READY TO USE!</log>-->
365+
</wait>
366+
</run>
367+
</image>
368+
</images>
369+
<!--Stops all Oracle DB images currently running, not just those we just started.
370+
Useful to stop processes still running from a previously failed integration test run -->
371+
<allContainers>true</allContainers>
372+
</configuration>
373+
<executions>
374+
<execution>
375+
<id>docker-start</id>
376+
<phase>compile</phase>
377+
<goals>
378+
<goal>stop</goal>
379+
<goal>start</goal>
380+
</goals>
381+
</execution>
382+
<execution>
383+
<id>docker-stop</id>
384+
<phase>post-integration-test</phase>
385+
<goals>
386+
<goal>stop</goal>
387+
</goals>
388+
</execution>
389+
</executions>
390+
</plugin>
391+
<plugin>
392+
<groupId>org.codehaus.mojo</groupId>
393+
<artifactId>exec-maven-plugin</artifactId>
394+
<executions>
395+
<execution>
396+
<id>docker-prune</id>
397+
<phase>generate-resources</phase>
398+
<goals>
399+
<goal>exec</goal>
400+
</goals>
401+
<configuration>
402+
<executable>${docker-prune.location}</executable>
403+
</configuration>
404+
</execution>
405+
</executions>
406+
</plugin>
407+
</plugins>
408+
</build>
409+
</profile>
329410
</profiles>
330411
</project>
Lines changed: 30 additions & 0 deletions
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:oracle:thin:@localhost:1521/FREEPDB1");
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+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package io.quarkus.it.opentelemetry;
2+
3+
import io.quarkus.test.junit.QuarkusIntegrationTest;
4+
5+
@QuarkusIntegrationTest
6+
public class OracleOpenTelemetryJdbcInstrumentationIT extends OracleOpenTelemetryJdbcInstrumentationTest {
7+
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.quarkus.it.opentelemetry;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import io.quarkus.test.common.QuarkusTestResource;
6+
import io.quarkus.test.junit.QuarkusTest;
7+
8+
@QuarkusTest
9+
@QuarkusTestResource(value = OracleLifecycleManager.class, restrictToAnnotatedClass = true)
10+
public class OracleOpenTelemetryJdbcInstrumentationTest extends OpenTelemetryJdbcInstrumentationTest {
11+
12+
@Test
13+
void testOracleQueryTraced() {
14+
testQueryTraced("oracle", "OracleHit");
15+
}
16+
17+
}

0 commit comments

Comments
 (0)