|
| 1 | +/* |
| 2 | + * Copyright The OpenTelemetry Authors |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
| 6 | +package io.opentelemetry.smoketest; |
| 7 | + |
| 8 | +import io.opentelemetry.semconv.ServiceAttributes; |
| 9 | +import java.time.Duration; |
| 10 | +import java.util.jar.Attributes; |
| 11 | +import java.util.jar.JarFile; |
| 12 | +import io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes; |
| 13 | +import org.junit.jupiter.api.condition.DisabledIf; |
| 14 | +import org.junit.jupiter.params.ParameterizedTest; |
| 15 | +import org.junit.jupiter.params.provider.ValueSource; |
| 16 | + |
| 17 | +import static io.opentelemetry.sdk.testing.assertj.TracesAssert.assertThat; |
| 18 | + |
| 19 | +@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers") |
| 20 | +class QuarkusSmokeTest extends JavaSmokeTest { |
| 21 | + @Override |
| 22 | + protected String getTargetImage(String jdk) { |
| 23 | + return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-quarkus:jdk" |
| 24 | + + jdk |
| 25 | + + "-20241105.11678591860"; |
| 26 | + } |
| 27 | + |
| 28 | + @Override |
| 29 | + protected TargetWaitStrategy getWaitStrategy() { |
| 30 | + return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Listening on.*"); |
| 31 | + } |
| 32 | + |
| 33 | + @Override |
| 34 | + protected boolean getSetServiceName() { |
| 35 | + return false; |
| 36 | + } |
| 37 | + |
| 38 | + @ParameterizedTest |
| 39 | + @ValueSource(ints = {17, 21, 23}) // Quarkus 3.7+ requires Java 17+ |
| 40 | + void quarkus_smoke_test_on_JDK__jdk(int jdk) throws Exception { |
| 41 | + startTarget(jdk); |
| 42 | + String currentAgentVersion; |
| 43 | + try (JarFile agentJar = new JarFile(agentPath)) { |
| 44 | + currentAgentVersion = |
| 45 | + agentJar |
| 46 | + .getManifest() |
| 47 | + .getMainAttributes() |
| 48 | + .getValue(Attributes.Name.IMPLEMENTATION_VERSION); |
| 49 | + } |
| 50 | + |
| 51 | + client().get("/hello").aggregate().join(); |
| 52 | + |
| 53 | + assertThat(waitForTraces()) |
| 54 | + .hasTracesSatisfyingExactly( |
| 55 | + trace -> |
| 56 | + trace.hasSpansSatisfyingExactly( |
| 57 | + span -> |
| 58 | + span.hasName("GET /hello") |
| 59 | + .hasResourceSatisfying( |
| 60 | + resource -> { |
| 61 | + resource |
| 62 | + .hasAttribute( |
| 63 | + TelemetryIncubatingAttributes.TELEMETRY_DISTRO_VERSION, |
| 64 | + currentAgentVersion) |
| 65 | + .hasAttribute(ServiceAttributes.SERVICE_NAME, "quarkus"); |
| 66 | + }))); |
| 67 | + |
| 68 | + stopTarget(); |
| 69 | + } |
| 70 | +} |
0 commit comments