Skip to content

Commit dd5df41

Browse files
authored
Fix smoke test (#292)
* Fix smoke test Signed-off-by: Pavol Loffay <[email protected]> * fmt Signed-off-by: Pavol Loffay <[email protected]>
1 parent 2c4a33d commit dd5df41

File tree

4 files changed

+12
-40
lines changed

4 files changed

+12
-40
lines changed

smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/SmokeTest.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract class SmokeTest extends Specification {
4242
private Backend backend = Backend.getInstance()
4343

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

4848
@Shared

smoke-tests/src/test/java/org/hypertrace/agent/smoketest/AbstractSmokeTest.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,20 @@
4040
import org.testcontainers.containers.GenericContainer;
4141
import org.testcontainers.containers.Network;
4242
import org.testcontainers.containers.output.Slf4jLogConsumer;
43+
import org.testcontainers.containers.wait.strategy.Wait;
44+
import org.testcontainers.images.PullPolicy;
4345
import org.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException;
4446
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
4547
import org.testcontainers.utility.DockerImageName;
4648
import org.testcontainers.utility.MountableFile;
4749

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

@@ -76,22 +78,24 @@ public abstract class AbstractSmokeTest {
7678
public static void beforeAll() {
7779
openTelemetryStorage =
7880
new OpenTelemetryStorage(MOCK_BACKEND_IMAGE)
81+
.withImagePullPolicy(PullPolicy.alwaysPull())
82+
.withExposedPorts(8080)
83+
.waitingFor(Wait.forHttp("/health").forPort(8080))
7984
.withNetwork(network)
8085
.withNetworkAliases(NETWORK_ALIAS_OTEL_MOCK_STORAGE)
8186
.withLogConsumer(new Slf4jLogConsumer(log));
8287
openTelemetryStorage.start();
8388

8489
collector =
8590
new OpenTelemetryCollector(OTEL_COLLECTOR_IMAGE)
91+
.withImagePullPolicy(PullPolicy.alwaysPull())
8692
.withNetwork(network)
8793
.withNetworkAliases(NETWORK_ALIAS_OTEL_COLLECTOR)
8894
.withLogConsumer(new Slf4jLogConsumer(log))
8995
.dependsOn(openTelemetryStorage)
9096
.withCopyFileToContainer(
91-
MountableFile.forClasspathResource("/otelcol-config.yaml"),
92-
"/etc/otelcol-config.yaml")
93-
.withLogConsumer(new Slf4jLogConsumer(log))
94-
.withCommand("--config /etc/otelcol-config.yaml");
97+
MountableFile.forClasspathResource("/otel.yaml"), "/etc/otel.yaml")
98+
.withCommand("--config /etc/otel.yaml");
9599
collector.start();
96100
}
97101

smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootSmokeTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// key = "SMOKETEST_JAVAAGENT_PATH",
3636
// value =
3737
//
38-
// "/Users/ploffay/projects/hypertrace/javaagent/javaagent/build/libs/hypertrace-agent-0.10.4-SNAPSHOT-all.jar")
38+
// "/Users/ploffay/projects/hypertrace/javaagent/javaagent/build/libs/hypertrace-agent-1.0.1-SNAPSHOT-all.jar")
3939
public class SpringBootSmokeTest extends AbstractSmokeTest {
4040

4141
@Override
@@ -79,7 +79,6 @@ public void get() throws IOException, InterruptedException {
7979
.getMainAttributes()
8080
.get(Attributes.Name.IMPLEMENTATION_VERSION);
8181

82-
Assertions.assertEquals(1, traces.size());
8382
Assertions.assertEquals(
8483
ResourceAttributes.SERVICE_NAME.getKey(),
8584
traces.get(0).getResourceSpans(0).getResource().getAttributes(0).getKey());

smoke-tests/src/test/resources/otelcol-config.yaml

-31
This file was deleted.

0 commit comments

Comments
 (0)