Merge eb5157b662 into 9332f4d5aa
This commit is contained in:
commit
a5cdc9f6a1
|
|
@ -12,17 +12,14 @@ import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class AgentDebugLoggingTest extends JavaSmokeTest {
|
class AgentDebugLoggingTest extends JavaSmokeTest {
|
||||||
@Override
|
|
||||||
protected String getTargetImage(String jdk) {
|
|
||||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
|
||||||
+ jdk
|
|
||||||
+ "-20250915.17728045097";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public AgentDebugLoggingTest() {
|
||||||
protected TargetWaitStrategy getWaitStrategy() {
|
super(
|
||||||
return new TargetWaitStrategy.Log(
|
SmokeTestTarget.springBoot("20250915.17728045097")
|
||||||
Duration.ofMinutes(1), ".*DEBUG io.opentelemetry.javaagent.tooling.VersionLogger.*");
|
.waitStrategy(
|
||||||
|
new TargetWaitStrategy.Log(
|
||||||
|
Duration.ofMinutes(1),
|
||||||
|
".*DEBUG io.opentelemetry.javaagent.tooling.VersionLogger.*")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("verifies that debug logging is working by checking for a debug log on startup")
|
@DisplayName("verifies that debug logging is working by checking for a debug log on startup")
|
||||||
|
|
|
||||||
|
|
@ -12,36 +12,19 @@ import io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes;
|
||||||
import io.opentelemetry.semconv.incubating.HostIncubatingAttributes;
|
import io.opentelemetry.semconv.incubating.HostIncubatingAttributes;
|
||||||
import io.opentelemetry.semconv.incubating.ProcessIncubatingAttributes;
|
import io.opentelemetry.semconv.incubating.ProcessIncubatingAttributes;
|
||||||
import io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes;
|
import io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes;
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class DeclarativeConfigurationSmokeTest extends JavaSmokeTest {
|
class DeclarativeConfigurationSmokeTest extends JavaSmokeTest {
|
||||||
@Override
|
|
||||||
protected String getTargetImage(String jdk) {
|
|
||||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
|
||||||
+ jdk
|
|
||||||
+ "-20241021.11448062567";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public DeclarativeConfigurationSmokeTest() {
|
||||||
protected List<ResourceMapping> getExtraResources() {
|
super(
|
||||||
return List.of(ResourceMapping.of("declarative-config.yaml", "/declarative-config.yaml"));
|
SmokeTestTarget.springBoot("20241021.11448062567")
|
||||||
}
|
.env("OTEL_EXPERIMENTAL_CONFIG_FILE", "declarative-config.yaml")
|
||||||
|
.extraResources(
|
||||||
@Override
|
ResourceMapping.of("declarative-config.yaml", "/declarative-config.yaml")));
|
||||||
protected Map<String, String> getExtraEnv() {
|
|
||||||
return Map.of("OTEL_EXPERIMENTAL_CONFIG_FILE", "declarative-config.yaml");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TargetWaitStrategy getWaitStrategy() {
|
|
||||||
return new TargetWaitStrategy.Log(
|
|
||||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
package io.opentelemetry.smoketest;
|
package io.opentelemetry.smoketest;
|
||||||
|
|
||||||
import static java.util.Collections.emptyList;
|
|
||||||
import static java.util.Collections.emptyMap;
|
|
||||||
import static java.util.stream.Collectors.toSet;
|
import static java.util.stream.Collectors.toSet;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
|
@ -14,8 +12,6 @@ import io.opentelemetry.instrumentation.testing.internal.AutoCleanupExtension;
|
||||||
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
|
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
|
||||||
import io.opentelemetry.smoketest.windows.WindowsTestContainerManager;
|
import io.opentelemetry.smoketest.windows.WindowsTestContainerManager;
|
||||||
import io.opentelemetry.testing.internal.armeria.client.WebClient;
|
import io.opentelemetry.testing.internal.armeria.client.WebClient;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
@ -33,6 +29,8 @@ public abstract class JavaSmokeTest implements TelemetryRetrieverProvider {
|
||||||
private static final Pattern TRACE_ID_PATTERN =
|
private static final Pattern TRACE_ID_PATTERN =
|
||||||
Pattern.compile(".*trace_id=(?<traceId>[a-zA-Z0-9]+).*");
|
Pattern.compile(".*trace_id=(?<traceId>[a-zA-Z0-9]+).*");
|
||||||
protected static final TestContainerManager containerManager = createContainerManager();
|
protected static final TestContainerManager containerManager = createContainerManager();
|
||||||
|
|
||||||
|
private final SmokeTestTarget target;
|
||||||
private static TelemetryRetriever telemetryRetriever;
|
private static TelemetryRetriever telemetryRetriever;
|
||||||
|
|
||||||
protected String agentPath =
|
protected String agentPath =
|
||||||
|
|
@ -40,38 +38,18 @@ public abstract class JavaSmokeTest implements TelemetryRetrieverProvider {
|
||||||
|
|
||||||
@RegisterExtension static final AutoCleanupExtension autoCleanup = AutoCleanupExtension.create();
|
@RegisterExtension static final AutoCleanupExtension autoCleanup = AutoCleanupExtension.create();
|
||||||
|
|
||||||
protected WebClient client() {
|
public JavaSmokeTest(SmokeTestTarget.Builder builder) {
|
||||||
|
this.target = customize(builder).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SmokeTestTarget.Builder customize(SmokeTestTarget.Builder builder) {
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WebClient client() {
|
||||||
return WebClient.of("h1c://localhost:" + containerManager.getTargetMappedPort(8080));
|
return WebClient.of("h1c://localhost:" + containerManager.getTargetMappedPort(8080));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Subclasses can override this method to pass jvm arguments in another environment variable */
|
|
||||||
protected String getJvmArgsEnvVarName() {
|
|
||||||
return "JAVA_TOOL_OPTIONS";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Subclasses can override this method to customise target application's environment */
|
|
||||||
protected Map<String, String> getExtraEnv() {
|
|
||||||
return emptyMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Subclasses can override this method to disable setting default service name */
|
|
||||||
protected boolean getSetServiceName() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Subclasses can override this method to provide additional files to copy to target container */
|
|
||||||
protected List<ResourceMapping> getExtraResources() {
|
|
||||||
return emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subclasses can override this method to provide additional ports that should be exposed from the
|
|
||||||
* target container
|
|
||||||
*/
|
|
||||||
protected List<Integer> getExtraPorts() {
|
|
||||||
return emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void setUp() {
|
static void setUp() {
|
||||||
containerManager.startEnvironmentOnce();
|
containerManager.startEnvironmentOnce();
|
||||||
|
|
@ -83,33 +61,19 @@ public abstract class JavaSmokeTest implements TelemetryRetrieverProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Consumer<OutputFrame> startTarget(String jdk, String serverVersion, boolean windows) {
|
protected Consumer<OutputFrame> startTarget(String jdk, String serverVersion, boolean windows) {
|
||||||
String targetImage = getTargetImage(jdk, serverVersion, windows);
|
String targetImage = target.getTargetImage(jdk, serverVersion, windows);
|
||||||
autoCleanup.deferCleanup(() -> containerManager.stopTarget());
|
autoCleanup.deferCleanup(() -> containerManager.stopTarget());
|
||||||
|
|
||||||
return containerManager.startTarget(
|
return containerManager.startTarget(
|
||||||
targetImage,
|
targetImage,
|
||||||
agentPath,
|
agentPath,
|
||||||
getJvmArgsEnvVarName(),
|
target.getJvmArgsEnvVarName(),
|
||||||
getExtraEnv(),
|
target.getExtraEnv(),
|
||||||
getSetServiceName(),
|
target.getSetServiceName(),
|
||||||
getExtraResources(),
|
target.getExtraResources(),
|
||||||
getExtraPorts(),
|
target.getExtraPorts(),
|
||||||
getWaitStrategy(),
|
target.getWaitStrategy(),
|
||||||
getCommand());
|
target.getCommand());
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract String getTargetImage(String jdk);
|
|
||||||
|
|
||||||
protected String getTargetImage(String jdk, String serverVersion, boolean windows) {
|
|
||||||
return getTargetImage(jdk);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected TargetWaitStrategy getWaitStrategy() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String[] getCommand() {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void assertVersionLogged(Consumer<OutputFrame> output, String version) {
|
protected static void assertVersionLogged(Consumer<OutputFrame> output, String version) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ package io.opentelemetry.smoketest;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import io.opentelemetry.sdk.logs.data.LogRecordData;
|
import io.opentelemetry.sdk.logs.data.LogRecordData;
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
|
@ -16,17 +15,9 @@ import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class LogsSmokeTest extends JavaSmokeTest {
|
class LogsSmokeTest extends JavaSmokeTest {
|
||||||
@Override
|
|
||||||
protected String getTargetImage(String jdk) {
|
|
||||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
|
||||||
+ jdk
|
|
||||||
+ "-20211213.1570880324";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public LogsSmokeTest() {
|
||||||
protected TargetWaitStrategy getWaitStrategy() {
|
super(SmokeTestTarget.springBoot("20211213.1570880324"));
|
||||||
return new TargetWaitStrategy.Log(
|
|
||||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
|
|
|
||||||
|
|
@ -16,21 +16,16 @@ import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class QuarkusSmokeTest extends JavaSmokeTest {
|
class QuarkusSmokeTest extends JavaSmokeTest {
|
||||||
@Override
|
|
||||||
protected String getTargetImage(String jdk) {
|
|
||||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-quarkus:jdk"
|
|
||||||
+ jdk
|
|
||||||
+ "-20250915.17728045126";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public QuarkusSmokeTest() {
|
||||||
protected TargetWaitStrategy getWaitStrategy() {
|
super(
|
||||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Listening on.*");
|
SmokeTestTarget.builder(
|
||||||
}
|
jdk ->
|
||||||
|
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-quarkus:jdk"
|
||||||
@Override
|
+ jdk
|
||||||
protected boolean getSetServiceName() {
|
+ "-20250915.17728045126")
|
||||||
return false;
|
.waitStrategy(new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Listening on.*"))
|
||||||
|
.setServiceName(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ package io.opentelemetry.smoketest;
|
||||||
|
|
||||||
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
|
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.jar.Attributes;
|
import java.util.jar.Attributes;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
|
@ -18,16 +17,9 @@ import org.testcontainers.containers.output.OutputFrame;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class SdkDisabledSmokeTest extends JavaSmokeTest {
|
class SdkDisabledSmokeTest extends JavaSmokeTest {
|
||||||
@Override
|
|
||||||
protected String getTargetImage(String jdk) {
|
|
||||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
|
||||||
+ jdk
|
|
||||||
+ "-20211213.1570880324";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public SdkDisabledSmokeTest() {
|
||||||
protected Map<String, String> getExtraEnv() {
|
super(SmokeTestTarget.springBoot("20211213.1570880324").env("OTEL_SDK_DISABLED", "true"));
|
||||||
return Map.of("OTEL_SDK_DISABLED", "true");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
package io.opentelemetry.smoketest;
|
package io.opentelemetry.smoketest;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
@ -14,17 +12,14 @@ import org.junit.jupiter.params.provider.ValueSource;
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class SecurityManagerSmokeTest extends JavaSmokeTest {
|
class SecurityManagerSmokeTest extends JavaSmokeTest {
|
||||||
|
|
||||||
@Override
|
public SecurityManagerSmokeTest() {
|
||||||
protected String getTargetImage(String jdk) {
|
super(
|
||||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-security-manager:jdk"
|
SmokeTestTarget.builder(
|
||||||
+ jdk
|
jdk ->
|
||||||
+ "-20250915.17728045123";
|
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-security-manager:jdk"
|
||||||
}
|
+ jdk
|
||||||
|
+ "-20250915.17728045123")
|
||||||
@Override
|
.env("OTEL_JAVAAGENT_EXPERIMENTAL_SECURITY_MANAGER_SUPPORT_ENABLED", "true"));
|
||||||
protected Map<String, String> getExtraEnv() {
|
|
||||||
return Collections.singletonMap(
|
|
||||||
"OTEL_JAVAAGENT_EXPERIMENTAL_SECURITY_MANAGER_SUPPORT_ENABLED", "true");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,171 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.smoketest;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class SmokeTestTarget {
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface GetTargetImage {
|
||||||
|
String getTargetImage(String jdk, String serverVersion, boolean windows);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final GetTargetImage getTargetImage;
|
||||||
|
|
||||||
|
private final String[] command;
|
||||||
|
private final String jvmArgsEnvVarName;
|
||||||
|
private final boolean setServiceName;
|
||||||
|
private final Map<String, String> extraEnv;
|
||||||
|
private final List<ResourceMapping> extraResources;
|
||||||
|
private final TargetWaitStrategy waitStrategy;
|
||||||
|
private final List<Integer> extraPorts;
|
||||||
|
|
||||||
|
public SmokeTestTarget(
|
||||||
|
GetTargetImage getTargetImage,
|
||||||
|
String[] command,
|
||||||
|
String jvmArgsEnvVarName,
|
||||||
|
boolean setServiceName,
|
||||||
|
Map<String, String> extraEnv,
|
||||||
|
List<ResourceMapping> extraResources,
|
||||||
|
TargetWaitStrategy waitStrategy,
|
||||||
|
List<Integer> extraPorts) {
|
||||||
|
this.getTargetImage = getTargetImage;
|
||||||
|
this.command = command;
|
||||||
|
this.jvmArgsEnvVarName = jvmArgsEnvVarName;
|
||||||
|
this.setServiceName = setServiceName;
|
||||||
|
this.extraEnv = extraEnv;
|
||||||
|
this.extraResources = extraResources;
|
||||||
|
this.waitStrategy = waitStrategy;
|
||||||
|
this.extraPorts = extraPorts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTargetImage(String jdk, String serverVersion, boolean windows) {
|
||||||
|
return getTargetImage.getTargetImage(jdk, serverVersion, windows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getCommand() {
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Subclasses can override this method to pass jvm arguments in another environment variable */
|
||||||
|
public String getJvmArgsEnvVarName() {
|
||||||
|
return jvmArgsEnvVarName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Subclasses can override this method to customise target application's environment */
|
||||||
|
public Map<String, String> getExtraEnv() {
|
||||||
|
return extraEnv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Subclasses can override this method to disable setting default service name */
|
||||||
|
public boolean getSetServiceName() {
|
||||||
|
return setServiceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Subclasses can override this method to provide additional files to copy to target container */
|
||||||
|
public List<ResourceMapping> getExtraResources() {
|
||||||
|
return extraResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subclasses can override this method to provide additional ports that should be exposed from the
|
||||||
|
* target container
|
||||||
|
*/
|
||||||
|
public List<Integer> getExtraPorts() {
|
||||||
|
return extraPorts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TargetWaitStrategy getWaitStrategy() {
|
||||||
|
return waitStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder(Function<String, String> getTargetImage) {
|
||||||
|
return builder((jdk, serverVersion, windows) -> getTargetImage.apply(jdk));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder(GetTargetImage getTargetImage) {
|
||||||
|
return new Builder(getTargetImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder springBoot(String imageTag) {
|
||||||
|
return builder(
|
||||||
|
jdk ->
|
||||||
|
String.format(
|
||||||
|
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk%s-%s",
|
||||||
|
jdk, imageTag))
|
||||||
|
.waitStrategy(
|
||||||
|
new TargetWaitStrategy.Log(
|
||||||
|
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private final GetTargetImage getTargetImage;
|
||||||
|
private String[] command;
|
||||||
|
private String jvmArgsEnvVarName = "JAVA_TOOL_OPTIONS";
|
||||||
|
private boolean setServiceName = true;
|
||||||
|
private final Map<String, String> extraEnv = new HashMap<>();
|
||||||
|
private List<ResourceMapping> extraResources = List.of();
|
||||||
|
private TargetWaitStrategy waitStrategy;
|
||||||
|
private List<Integer> extraPorts = List.of();
|
||||||
|
|
||||||
|
private Builder(GetTargetImage getTargetImage) {
|
||||||
|
this.getTargetImage = getTargetImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder command(String... command) {
|
||||||
|
this.command = command;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder jvmArgsEnvVarName(String jvmArgsEnvVarName) {
|
||||||
|
this.jvmArgsEnvVarName = jvmArgsEnvVarName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setServiceName(boolean setServiceName) {
|
||||||
|
this.setServiceName = setServiceName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder env(String key, String value) {
|
||||||
|
this.extraEnv.put(key, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder extraResources(ResourceMapping... resources) {
|
||||||
|
this.extraResources = List.of(resources);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder waitStrategy(@Nullable TargetWaitStrategy waitStrategy) {
|
||||||
|
this.waitStrategy = waitStrategy;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder extraPorts(Integer... ports) {
|
||||||
|
this.extraPorts = List.of(ports);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SmokeTestTarget build() {
|
||||||
|
return new SmokeTestTarget(
|
||||||
|
getTargetImage,
|
||||||
|
command,
|
||||||
|
jvmArgsEnvVarName,
|
||||||
|
setServiceName,
|
||||||
|
extraEnv,
|
||||||
|
extraResources,
|
||||||
|
waitStrategy,
|
||||||
|
extraPorts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,9 +14,7 @@ import io.opentelemetry.semconv.ServiceAttributes;
|
||||||
import io.opentelemetry.semconv.incubating.OsIncubatingAttributes;
|
import io.opentelemetry.semconv.incubating.OsIncubatingAttributes;
|
||||||
import io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes;
|
import io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes;
|
||||||
import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes;
|
import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes;
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.jar.Attributes;
|
import java.util.jar.Attributes;
|
||||||
|
|
@ -29,27 +27,13 @@ import org.testcontainers.containers.output.OutputFrame;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class SpringBootSmokeTest extends JavaSmokeTest {
|
class SpringBootSmokeTest extends JavaSmokeTest {
|
||||||
@Override
|
|
||||||
protected String getTargetImage(String jdk) {
|
|
||||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
|
||||||
+ jdk
|
|
||||||
+ "-20241021.11448062567";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public SpringBootSmokeTest() {
|
||||||
protected boolean getSetServiceName() {
|
super(
|
||||||
return false;
|
SmokeTestTarget.springBoot("20241021.11448062567")
|
||||||
}
|
.setServiceName(false)
|
||||||
|
.env("OTEL_METRICS_EXPORTER", "otlp")
|
||||||
@Override
|
.env("OTEL_RESOURCE_ATTRIBUTES", "foo=bar"));
|
||||||
protected Map<String, String> getExtraEnv() {
|
|
||||||
return Map.of("OTEL_METRICS_EXPORTER", "otlp", "OTEL_RESOURCE_ATTRIBUTES", "foo=bar");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TargetWaitStrategy getWaitStrategy() {
|
|
||||||
return new TargetWaitStrategy.Log(
|
|
||||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@
|
||||||
|
|
||||||
package io.opentelemetry.smoketest.propagation;
|
package io.opentelemetry.smoketest.propagation;
|
||||||
|
|
||||||
import java.util.Map;
|
import io.opentelemetry.smoketest.SmokeTestTarget;
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class B3MultiPropagationTest extends PropagationTest {
|
class B3MultiPropagationTest extends PropagationTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> getExtraEnv() {
|
protected SmokeTestTarget.Builder customize(SmokeTestTarget.Builder builder) {
|
||||||
return Map.of("otel.propagators", "b3multi");
|
return builder.env("otel.propagators", "b3multi");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@
|
||||||
|
|
||||||
package io.opentelemetry.smoketest.propagation;
|
package io.opentelemetry.smoketest.propagation;
|
||||||
|
|
||||||
import java.util.Map;
|
import io.opentelemetry.smoketest.SmokeTestTarget;
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class B3PropagationTest extends PropagationTest {
|
class B3PropagationTest extends PropagationTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> getExtraEnv() {
|
protected SmokeTestTarget.Builder customize(SmokeTestTarget.Builder builder) {
|
||||||
return Map.of("otel.propagators", "b3");
|
return builder.env("otel.propagators", "b3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,26 +8,16 @@ package io.opentelemetry.smoketest.propagation;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import io.opentelemetry.smoketest.JavaSmokeTest;
|
import io.opentelemetry.smoketest.JavaSmokeTest;
|
||||||
import io.opentelemetry.smoketest.TargetWaitStrategy;
|
import io.opentelemetry.smoketest.SmokeTestTarget;
|
||||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse;
|
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse;
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class OtTracePropagationTest extends JavaSmokeTest {
|
class OtTracePropagationTest extends JavaSmokeTest {
|
||||||
@Override
|
|
||||||
protected String getTargetImage(String jdk) {
|
|
||||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
|
||||||
+ jdk
|
|
||||||
+ "-20211213.1570880324";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public OtTracePropagationTest() {
|
||||||
protected TargetWaitStrategy getWaitStrategy() {
|
super(SmokeTestTarget.springBoot("20211213.1570880324").env("otel.propagators", "ottrace"));
|
||||||
return new TargetWaitStrategy.Log(
|
|
||||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -38,9 +28,4 @@ class OtTracePropagationTest extends JavaSmokeTest {
|
||||||
|
|
||||||
assertThat(response.contentUtf8()).matches("[0-9a-f]{16}" + traceId + ";[0]{16}" + traceId);
|
assertThat(response.contentUtf8()).matches("[0-9a-f]{16}" + traceId + ";[0]{16}" + traceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, String> getExtraEnv() {
|
|
||||||
return Map.of("otel.propagators", "ottrace");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,24 +8,14 @@ package io.opentelemetry.smoketest.propagation;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import io.opentelemetry.smoketest.JavaSmokeTest;
|
import io.opentelemetry.smoketest.JavaSmokeTest;
|
||||||
import io.opentelemetry.smoketest.TargetWaitStrategy;
|
import io.opentelemetry.smoketest.SmokeTestTarget;
|
||||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse;
|
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse;
|
||||||
import java.time.Duration;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public abstract class PropagationTest extends JavaSmokeTest {
|
public abstract class PropagationTest extends JavaSmokeTest {
|
||||||
|
|
||||||
@Override
|
public PropagationTest() {
|
||||||
protected String getTargetImage(String jdk) {
|
super(SmokeTestTarget.springBoot("20211213.1570880324"));
|
||||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
|
||||||
+ jdk
|
|
||||||
+ "-20211213.1570880324";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TargetWaitStrategy getWaitStrategy() {
|
|
||||||
return new TargetWaitStrategy.Log(
|
|
||||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@
|
||||||
|
|
||||||
package io.opentelemetry.smoketest.propagation;
|
package io.opentelemetry.smoketest.propagation;
|
||||||
|
|
||||||
import java.util.Map;
|
import io.opentelemetry.smoketest.SmokeTestTarget;
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class W3CPropagationTest extends PropagationTest {
|
class W3CPropagationTest extends PropagationTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> getExtraEnv() {
|
protected SmokeTestTarget.Builder customize(SmokeTestTarget.Builder builder) {
|
||||||
return Map.of("otel.propagators", "tracecontext");
|
return builder.env("otel.propagators", "tracecontext");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@
|
||||||
|
|
||||||
package io.opentelemetry.smoketest.propagation;
|
package io.opentelemetry.smoketest.propagation;
|
||||||
|
|
||||||
import java.util.Map;
|
import io.opentelemetry.smoketest.SmokeTestTarget;
|
||||||
import org.junit.jupiter.api.condition.DisabledIf;
|
import org.junit.jupiter.api.condition.DisabledIf;
|
||||||
|
|
||||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||||
class XRayPropagationTest extends PropagationTest {
|
class XRayPropagationTest extends PropagationTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> getExtraEnv() {
|
protected SmokeTestTarget.Builder customize(SmokeTestTarget.Builder builder) {
|
||||||
return Map.of("otel.propagators", "xray");
|
return builder.env("otel.propagators", "xray");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue