builder
This commit is contained in:
parent
2634880026
commit
5c55b5b23a
|
|
@ -15,11 +15,7 @@ class AgentDebugLoggingTest extends JavaSmokeTest {
|
|||
|
||||
public AgentDebugLoggingTest() {
|
||||
super(
|
||||
SmokeTestTarget.builder(
|
||||
jdk ->
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
||||
+ jdk
|
||||
+ "-20250915.17728045097")
|
||||
SmokeTestTarget.springBoot()
|
||||
.waitStrategy(
|
||||
new TargetWaitStrategy.Log(
|
||||
Duration.ofMinutes(1),
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@ import io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes;
|
|||
import io.opentelemetry.semconv.incubating.HostIncubatingAttributes;
|
||||
import io.opentelemetry.semconv.incubating.ProcessIncubatingAttributes;
|
||||
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.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
|
@ -24,19 +21,10 @@ class DeclarativeConfigurationSmokeTest extends JavaSmokeTest {
|
|||
|
||||
public DeclarativeConfigurationSmokeTest() {
|
||||
super(
|
||||
SmokeTestTarget.builder(
|
||||
jdk ->
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
||||
+ jdk
|
||||
+ "-20241021.11448062567")
|
||||
.waitStrategy(new TargetWaitStrategy.Log(
|
||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*"))
|
||||
.env("OTEL_EXPERIMENTAL_CONFIG_FILE", "declarative-config.yaml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ResourceMapping> getExtraResources() {
|
||||
return List.of(ResourceMapping.of("declarative-config.yaml", "/declarative-config.yaml"));
|
||||
SmokeTestTarget.springBoot()
|
||||
.env("OTEL_EXPERIMENTAL_CONFIG_FILE", "declarative-config.yaml")
|
||||
.extraResources(
|
||||
ResourceMapping.of("declarative-config.yaml", "/declarative-config.yaml")));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
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 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.smoketest.windows.WindowsTestContainerManager;
|
||||
import io.opentelemetry.testing.internal.armeria.client.WebClient;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
@ -65,7 +61,7 @@ public abstract class JavaSmokeTest implements TelemetryRetrieverProvider {
|
|||
}
|
||||
|
||||
protected Consumer<OutputFrame> startTarget(String jdk, String serverVersion, boolean windows) {
|
||||
String targetImage = target.getGetTargetImage(jdk, serverVersion, windows);
|
||||
String targetImage = target.getTargetImage(jdk, serverVersion, windows);
|
||||
autoCleanup.deferCleanup(() -> containerManager.stopTarget());
|
||||
|
||||
return containerManager.startTarget(
|
||||
|
|
|
|||
|
|
@ -5,29 +5,19 @@
|
|||
|
||||
package io.opentelemetry.smoketest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.sdk.logs.data.LogRecordData;
|
||||
import java.util.Collection;
|
||||
import org.junit.jupiter.api.condition.DisabledIf;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||
class LogsSmokeTest extends JavaSmokeTest {
|
||||
|
||||
public LogsSmokeTest() {
|
||||
super(
|
||||
SmokeTestTarget.builder(
|
||||
jdk ->
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
||||
+ jdk
|
||||
+ "-20211213.1570880324")
|
||||
.waitStrategy(
|
||||
new TargetWaitStrategy.Log(
|
||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*")));
|
||||
super(SmokeTestTarget.springBoot());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
|
|
|||
|
|
@ -16,21 +16,16 @@ import org.junit.jupiter.params.provider.ValueSource;
|
|||
|
||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||
class QuarkusSmokeTest extends JavaSmokeTest {
|
||||
@Override
|
||||
protected String getTargetImage(String jdk) {
|
||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-quarkus:jdk"
|
||||
|
||||
public QuarkusSmokeTest() {
|
||||
super(
|
||||
SmokeTestTarget.builder(
|
||||
jdk ->
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-quarkus:jdk"
|
||||
+ jdk
|
||||
+ "-20250915.17728045126";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TargetWaitStrategy getWaitStrategy() {
|
||||
return new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Listening on.*");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getSetServiceName() {
|
||||
return false;
|
||||
+ "-20250915.17728045126")
|
||||
.waitStrategy(new TargetWaitStrategy.Log(Duration.ofMinutes(1), ".*Listening on.*"))
|
||||
.setServiceName(false));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ package io.opentelemetry.smoketest;
|
|||
|
||||
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
|
|
@ -18,16 +17,9 @@ import org.testcontainers.containers.output.OutputFrame;
|
|||
|
||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||
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
|
||||
protected Map<String, String> getExtraEnv() {
|
||||
return Map.of("OTEL_SDK_DISABLED", "true");
|
||||
public SdkDisabledSmokeTest() {
|
||||
super(SmokeTestTarget.springBoot().env("OTEL_SDK_DISABLED", "true"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
package io.opentelemetry.smoketest;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.condition.DisabledIf;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
|
@ -14,17 +12,14 @@ import org.junit.jupiter.params.provider.ValueSource;
|
|||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||
class SecurityManagerSmokeTest extends JavaSmokeTest {
|
||||
|
||||
@Override
|
||||
protected String getTargetImage(String jdk) {
|
||||
return "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-security-manager:jdk"
|
||||
public SecurityManagerSmokeTest() {
|
||||
super(
|
||||
SmokeTestTarget.builder(
|
||||
jdk ->
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-security-manager:jdk"
|
||||
+ jdk
|
||||
+ "-20250915.17728045123";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getExtraEnv() {
|
||||
return Collections.singletonMap(
|
||||
"OTEL_JAVAAGENT_EXPERIMENTAL_SECURITY_MANAGER_SUPPORT_ENABLED", "true");
|
||||
+ "-20250915.17728045123")
|
||||
.env("OTEL_JAVAAGENT_EXPERIMENTAL_SECURITY_MANAGER_SUPPORT_ENABLED", "true"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@
|
|||
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 static java.util.Collections.emptyMap;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class SmokeTestTarget {
|
||||
|
||||
@FunctionalInterface
|
||||
interface GetTargetImage {
|
||||
public interface GetTargetImage {
|
||||
String getTargetImage(String jdk, String serverVersion, boolean windows);
|
||||
}
|
||||
|
||||
|
|
@ -48,8 +48,8 @@ public class SmokeTestTarget {
|
|||
this.extraPorts = extraPorts;
|
||||
}
|
||||
|
||||
public GetTargetImage getGetTargetImage() {
|
||||
return getTargetImage;
|
||||
public String getTargetImage(String jdk, String serverVersion, boolean windows) {
|
||||
return getTargetImage.getTargetImage(jdk, serverVersion, windows);
|
||||
}
|
||||
|
||||
public String[] getCommand() {
|
||||
|
|
@ -101,7 +101,7 @@ public class SmokeTestTarget {
|
|||
jdk ->
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
||||
+ jdk
|
||||
+ "-20211213.1570880324")
|
||||
+ "-20250915.17728045097")
|
||||
.waitStrategy(
|
||||
new TargetWaitStrategy.Log(
|
||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*"));
|
||||
|
|
@ -112,14 +112,13 @@ public class SmokeTestTarget {
|
|||
private String[] command;
|
||||
private String jvmArgsEnvVarName = "JAVA_TOOL_OPTIONS";
|
||||
private boolean setServiceName = true;
|
||||
private Map<String, String> extraEnv;
|
||||
private List<ResourceMapping> extraResources;
|
||||
private final Map<String, String> extraEnv = new HashMap<>();
|
||||
private List<ResourceMapping> extraResources = List.of();
|
||||
private TargetWaitStrategy waitStrategy;
|
||||
private List<Integer> extraPorts;
|
||||
private List<Integer> extraPorts = List.of();
|
||||
|
||||
private Builder(GetTargetImage getTargetImage) {
|
||||
this.getTargetImage = getTargetImage;
|
||||
this.extraEnv = emptyMap();
|
||||
}
|
||||
|
||||
public Builder command(String... command) {
|
||||
|
|
@ -147,7 +146,7 @@ public class SmokeTestTarget {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder waitStrategy(TargetWaitStrategy waitStrategy) {
|
||||
public Builder waitStrategy(@Nullable TargetWaitStrategy waitStrategy) {
|
||||
this.waitStrategy = waitStrategy;
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ import io.opentelemetry.semconv.ServiceAttributes;
|
|||
import io.opentelemetry.semconv.incubating.OsIncubatingAttributes;
|
||||
import io.opentelemetry.semconv.incubating.TelemetryIncubatingAttributes;
|
||||
import io.opentelemetry.semconv.incubating.ThreadIncubatingAttributes;
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.jar.Attributes;
|
||||
|
|
@ -29,27 +27,13 @@ import org.testcontainers.containers.output.OutputFrame;
|
|||
|
||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||
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
|
||||
protected boolean getSetServiceName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
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.*");
|
||||
public SpringBootSmokeTest() {
|
||||
super(
|
||||
SmokeTestTarget.springBoot()
|
||||
.setServiceName(false)
|
||||
.env("OTEL_METRICS_EXPORTER", "otlp")
|
||||
.env("OTEL_RESOURCE_ATTRIBUTES", "foo=bar"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
|
|
|||
|
|
@ -5,31 +5,19 @@
|
|||
|
||||
package io.opentelemetry.smoketest.propagation;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.smoketest.JavaSmokeTest;
|
||||
import io.opentelemetry.smoketest.SmokeTestTarget;
|
||||
import io.opentelemetry.smoketest.TargetWaitStrategy;
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledIf;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@DisabledIf("io.opentelemetry.smoketest.TestContainerManager#useWindowsContainers")
|
||||
class OtTracePropagationTest extends JavaSmokeTest {
|
||||
|
||||
public OtTracePropagationTest() {
|
||||
super(
|
||||
SmokeTestTarget.builder(
|
||||
jdk ->
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
||||
+ jdk
|
||||
+ "-20211213.1570880324")
|
||||
.waitStrategy(
|
||||
new TargetWaitStrategy.Log(
|
||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*"))
|
||||
.env("otel.propagators", "ottrace"));
|
||||
super(SmokeTestTarget.springBoot().env("otel.propagators", "ottrace"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -9,23 +9,13 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
import io.opentelemetry.smoketest.JavaSmokeTest;
|
||||
import io.opentelemetry.smoketest.SmokeTestTarget;
|
||||
import io.opentelemetry.smoketest.TargetWaitStrategy;
|
||||
import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse;
|
||||
import java.time.Duration;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public abstract class PropagationTest extends JavaSmokeTest {
|
||||
|
||||
public PropagationTest() {
|
||||
super(
|
||||
SmokeTestTarget.builder(
|
||||
jdk ->
|
||||
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-spring-boot:jdk"
|
||||
+ jdk
|
||||
+ "-20211213.1570880324")
|
||||
.waitStrategy(
|
||||
new TargetWaitStrategy.Log(
|
||||
Duration.ofMinutes(1), ".*Started SpringbootApplication in.*")));
|
||||
super(SmokeTestTarget.springBoot());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue