Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Jul 1, 2024
1 parent a02f122 commit 24a1302
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 deletions.
2 changes: 1 addition & 1 deletion advanced/advanced-01-open-telemetry/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
- "29194:29194"
environment:
EDC_HOSTNAME: consumer
OTEL_SERVICE_NAME: provider
OTEL_SERVICE_NAME: consumer
OTEL_LOGS_EXPORTER: none
OTEL_JAVAAGENT_EXTENSIONS: /app/opentelemetry-exporter-otlp.jar
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM openjdk:17-slim

WORKDIR /app
COPY build/libs/opentelemetry-javaagent-2.4.0.jar /app/opentelemetry-javaagent.jar
COPY build/libs/opentelemetry-javaagent-2.5.0.jar /app/opentelemetry-javaagent.jar
COPY build/libs/opentelemetry-exporter-otlp-1.39.0.jar /app/opentelemetry-exporter-otlp.jar
COPY build/libs/connector.jar /app/connector.jar
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,14 @@

package org.eclipse.edc.samples.advanced;

import org.apache.http.HttpStatus;
import org.eclipse.edc.junit.annotations.EndToEndTest;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.ComposeContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static io.restassured.RestAssured.given;
import static org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcessStates.STARTED;
import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath;
import static org.eclipse.edc.samples.common.FileTransferCommon.getFileFromRelativePath;
Expand All @@ -54,16 +47,11 @@ public class Advanced01openTelemetryTest {
private static final String JAEGER_URL = "http://localhost:16686";

@Container
public static ComposeContainer environment =
public ComposeContainer environment =
new ComposeContainer(getFileFromRelativePath(DOCKER_COMPOSE_YAML))
.withLocalCompose(true)
.waitingFor("consumer", Wait.forLogMessage(".*ready.*", 1));

@BeforeAll
static void setUp() {
environment.start();
}

@Test
void runSampleSteps() {
createAsset();
Expand All @@ -75,16 +63,11 @@ void runSampleSteps() {
var transferRequest = getFileContentFromRelativePath(START_TRANSFER_FILE_PATH);
var transferProcessId = startTransfer(transferRequest, contractAgreementId);
checkTransferStatus(transferProcessId, STARTED);
assertJaegerState();
}

private void assertJaegerState() {
try {
var url = new URL(JAEGER_URL);
var huc = (HttpURLConnection) url.openConnection();
assertThat(huc.getResponseCode()).isEqualTo(HttpStatus.SC_OK);
} catch (IOException e) {
fail("Unable to assert Jaeger state", e);
}
given()
.baseUri(JAEGER_URL)
.get()
.then()
.statusCode(200);
}
}

0 comments on commit 24a1302

Please sign in to comment.