Skip to content

Commit

Permalink
Remove collector from smoke tests (#4186)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored and github-actions committed Sep 29, 2021
1 parent 5684d39 commit 84bc413
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 331 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-smoke-test-fake-backend-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ jobs:
key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('smoke-tests/fake-backend/gradle/wrapper/gradle-wrapper.properties') }}

- name: Build Docker Image
run: ./gradlew windowsBackendImageBuild windowsCollectorImageBuild
run: ./gradlew windowsBackendImageBuild
working-directory: smoke-tests/fake-backend
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class DemoPropertySource implements ConfigPropertySource {
@Override
public Map<String, String> getProperties() {
return Map.of(
"otel.exporter.otlp.endpoint", "http://collector:4317",
"otel.exporter.otlp.endpoint", "http://backend:8080",
"otel.exporter.otlp.insecure", "true",
"otel.config.max.attrs", "16");
}
Expand Down
3 changes: 1 addition & 2 deletions examples/distro/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
rootProject.name = 'opentelemetry-java-instrumentation-demo'
rootProject.name = 'opentelemetry-java-instrumentation-distro-demo'

include "agent"
include "custom"
include "instrumentation"
include "instrumentation:servlet-3"
include "smoke-tests"

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ protected Map<String, String> getExtraEnv() {
}

private static GenericContainer backend;
private static GenericContainer collector;

@BeforeAll
static void setupSpec() {
Expand All @@ -60,17 +59,6 @@ static void setupSpec() {
.withNetworkAliases("backend")
.withLogConsumer(new Slf4jLogConsumer(logger));
backend.start();

collector =
new GenericContainer<>("otel/opentelemetry-collector-contrib:latest")
.dependsOn(backend)
.withNetwork(network)
.withNetworkAliases("collector")
.withLogConsumer(new Slf4jLogConsumer(logger))
.withCopyFileToContainer(
MountableFile.forClasspathResource("/otel.yaml"), "/etc/otel.yaml")
.withCommand("--config /etc/otel.yaml");
collector.start();
}

protected GenericContainer target;
Expand Down Expand Up @@ -109,7 +97,6 @@ void stopTarget() {
@AfterAll
static void cleanupSpec() {
backend.stop();
collector.stop();
}

protected static int countResourcesByValue(
Expand Down
30 changes: 0 additions & 30 deletions examples/distro/smoke-tests/src/test/resources/otel.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DemoPropertySource implements ConfigPropertySource {
@Override
public Map<String, String> getProperties() {
return Map.of(
"otel.exporter.otlp.endpoint", "http://collector:4317",
"otel.exporter.otlp.endpoint", "http://backend:8080",
"otel.exporter.otlp.insecure", "true",
"otel.config.max.attrs", "16");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ protected Map<String, String> getExtraEnv() {
}

private static GenericContainer backend;
private static GenericContainer collector;

@BeforeAll
static void setupSpec() {
Expand All @@ -65,17 +64,6 @@ static void setupSpec() {
.withNetworkAliases("backend")
.withLogConsumer(new Slf4jLogConsumer(logger));
backend.start();

collector =
new GenericContainer<>("otel/opentelemetry-collector-contrib:latest")
.dependsOn(backend)
.withNetwork(network)
.withNetworkAliases("collector")
.withLogConsumer(new Slf4jLogConsumer(logger))
.withCopyFileToContainer(
MountableFile.forClasspathResource("/otel.yaml"), "/etc/otel.yaml")
.withCommand("--config /etc/otel.yaml");
collector.start();
}

protected GenericContainer<?> target;
Expand Down Expand Up @@ -136,7 +124,6 @@ void stopTarget() {
@AfterAll
static void cleanupSpec() {
backend.stop();
collector.stop();
}

protected static int countResourcesByValue(
Expand Down
30 changes: 0 additions & 30 deletions examples/extension/src/test/resources/otel.yaml

This file was deleted.

35 changes: 2 additions & 33 deletions smoke-tests/fake-backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,40 +62,9 @@ task windowsBackendImageBuild(type: DockerBuildImage) {
it.dockerFile = new File(backendDockerBuildDir, "windows.dockerfile")
}

def collectorDockerBuildDir = new File(project.buildDir, "docker-collector")

task windowsCollectorBinaryDownload(type: Download) {
doFirst {
collectorDockerBuildDir.mkdirs()
}

// TODO (trask) update this to point to new opentelemetry-collector-releases repo
// this involves making two further changes:
// * all the artifacts in the new repo now have version in their name (so no single url for "latest")
// * the artifacts are now tar.gz format, so need to extract the exe
// note: version is hardcoded below because that is last version in the collector repo that has the releases attached
src("https://github.com/open-telemetry/opentelemetry-collector/releases/download/v0.33.0/otelcol_windows_amd64.exe")
dest(collectorDockerBuildDir)
}

task windowsCollectorImagePrepare(type: Copy) {
dependsOn(windowsCollectorBinaryDownload)
into(collectorDockerBuildDir)
from("src/docker/collector")
}

task windowsCollectorImageBuild(type: DockerBuildImage) {
dependsOn(windowsCollectorImagePrepare)
inputDir = collectorDockerBuildDir

it.images.add "ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-collector-windows:$extraTag"
it.dockerFile = new File(collectorDockerBuildDir, "windows.dockerfile")
}

tasks.create("dockerPush", DockerPushImage) {
group = "publishing"
description = "Push all Docker images for the test backend"
dependsOn(windowsBackendImageBuild, windowsCollectorImageBuild)
images.set(["ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend-windows:$extraTag",
"ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-collector-windows:$extraTag"])
dependsOn(windowsBackendImageBuild)
images.set(["ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend-windows:$extraTag"])
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public abstract class AbstractTestContainerManager implements TestContainerManag
protected static final int BACKEND_PORT = 8080;

protected static final String BACKEND_ALIAS = "backend";
protected static final String COLLECTOR_ALIAS = "collector";
protected static final String TARGET_AGENT_FILENAME = "opentelemetry-javaagent.jar";
protected static final String COLLECTOR_CONFIG_RESOURCE = "/otel.yaml";

Expand All @@ -28,7 +27,7 @@ protected Map<String, String> getAgentEnvironment(String jvmArgsEnvVarName) {
environment.put("OTEL_BSP_MAX_EXPORT_BATCH_SIZE", "1");
environment.put("OTEL_BSP_SCHEDULE_DELAY", "10ms");
environment.put("OTEL_IMR_EXPORT_INTERVAL", "1000");
environment.put("OTEL_EXPORTER_OTLP_ENDPOINT", "http://" + COLLECTOR_ALIAS + ":4317");
environment.put("OTEL_EXPORTER_OTLP_ENDPOINT", "http://" + BACKEND_ALIAS + ":8080");
environment.put("OTEL_RESOURCE_ATTRIBUTES", "service.name=smoke-test");
environment.put("OTEL_JAVAAGENT_DEBUG", "true");
return environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@

public class LinuxTestContainerManager extends AbstractTestContainerManager {
private static final Logger logger = LoggerFactory.getLogger(LinuxTestContainerManager.class);
private static final Logger collectorLogger = LoggerFactory.getLogger("Collector");
private static final Logger backendLogger = LoggerFactory.getLogger("Backend");

private final Network network = Network.newNetwork();
private GenericContainer<?> backend = null;
private GenericContainer<?> collector = null;
private GenericContainer<?> target = null;

@Override
Expand All @@ -42,17 +40,6 @@ protected void startEnvironment() {
.withNetworkAliases(BACKEND_ALIAS)
.withLogConsumer(new Slf4jLogConsumer(backendLogger));
backend.start();

collector =
new GenericContainer<>(DockerImageName.parse("otel/opentelemetry-collector-contrib:latest"))
.dependsOn(backend)
.withNetwork(network)
.withNetworkAliases(COLLECTOR_ALIAS)
.withLogConsumer(new Slf4jLogConsumer(collectorLogger))
.withCopyFileToContainer(
MountableFile.forClasspathResource(COLLECTOR_CONFIG_RESOURCE), "/etc/otel.yaml")
.withCommand("--config /etc/otel.yaml");
collector.start();
}

@Override
Expand All @@ -62,11 +49,6 @@ protected void stopEnvironment() {
backend = null;
}

if (collector != null) {
collector.stop();
collector = null;
}

network.close();
}

Expand Down
Loading

0 comments on commit 84bc413

Please sign in to comment.