Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix smoke test #292

Merged
merged 2 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract class SmokeTest extends Specification {
private Backend backend = Backend.getInstance()

@Shared
// protected String agentPath = "/Users/ploffay/projects/hypertrace/javaagent/javaagent/build/libs/hypertrace-agent-0.11.2-SNAPSHOT-all.jar"// System.getProperty("smoketest.javaagent.path")
// protected String agentPath = "/Users/ploffay/projects/hypertrace/javaagent/javaagent/build/libs/hypertrace-agent-1.0.1-SNAPSHOT-all.jar"
protected String agentPath = System.getProperty("smoketest.javaagent.path")

@Shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.images.PullPolicy;
import org.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;

public abstract class AbstractSmokeTest {
private static final Logger log = LoggerFactory.getLogger(OpenTelemetryStorage.class);
private static final String OTEL_COLLECTOR_IMAGE = "otel/opentelemetry-collector:latest";
private static final String OTEL_COLLECTOR_IMAGE = "otel/opentelemetry-collector:0.21.0";
private static final String MOCK_BACKEND_IMAGE =
"ghcr.io/open-telemetry/java-test-containers:smoke-fake-backend-20201128.1734635";
private static final String NETWORK_ALIAS_OTEL_COLLECTOR = "collector";
private static final String NETWORK_ALIAS_OTEL_MOCK_STORAGE = "storage";
private static final String NETWORK_ALIAS_OTEL_MOCK_STORAGE = "backend";
private static final String OTEL_EXPORTER_ENDPOINT =
String.format("http://%s:9411/api/v2/spans", NETWORK_ALIAS_OTEL_COLLECTOR);

Expand All @@ -76,22 +78,24 @@ public abstract class AbstractSmokeTest {
public static void beforeAll() {
openTelemetryStorage =
new OpenTelemetryStorage(MOCK_BACKEND_IMAGE)
.withImagePullPolicy(PullPolicy.alwaysPull())
.withExposedPorts(8080)
.waitingFor(Wait.forHttp("/health").forPort(8080))
.withNetwork(network)
.withNetworkAliases(NETWORK_ALIAS_OTEL_MOCK_STORAGE)
.withLogConsumer(new Slf4jLogConsumer(log));
openTelemetryStorage.start();

collector =
new OpenTelemetryCollector(OTEL_COLLECTOR_IMAGE)
.withImagePullPolicy(PullPolicy.alwaysPull())
.withNetwork(network)
.withNetworkAliases(NETWORK_ALIAS_OTEL_COLLECTOR)
.withLogConsumer(new Slf4jLogConsumer(log))
.dependsOn(openTelemetryStorage)
.withCopyFileToContainer(
MountableFile.forClasspathResource("/otelcol-config.yaml"),
"/etc/otelcol-config.yaml")
.withLogConsumer(new Slf4jLogConsumer(log))
.withCommand("--config /etc/otelcol-config.yaml");
MountableFile.forClasspathResource("/otel.yaml"), "/etc/otel.yaml")
.withCommand("--config /etc/otel.yaml");
collector.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
// key = "SMOKETEST_JAVAAGENT_PATH",
// value =
//
// "/Users/ploffay/projects/hypertrace/javaagent/javaagent/build/libs/hypertrace-agent-0.10.4-SNAPSHOT-all.jar")
// "/Users/ploffay/projects/hypertrace/javaagent/javaagent/build/libs/hypertrace-agent-1.0.1-SNAPSHOT-all.jar")
public class SpringBootSmokeTest extends AbstractSmokeTest {

@Override
Expand Down Expand Up @@ -79,7 +79,6 @@ public void get() throws IOException, InterruptedException {
.getMainAttributes()
.get(Attributes.Name.IMPLEMENTATION_VERSION);

Assertions.assertEquals(1, traces.size());
Assertions.assertEquals(
ResourceAttributes.SERVICE_NAME.getKey(),
traces.get(0).getResourceSpans(0).getResource().getAttributes(0).getKey());
Expand Down
31 changes: 0 additions & 31 deletions smoke-tests/src/test/resources/otelcol-config.yaml

This file was deleted.