Skip to content

Commit

Permalink
Change otel context tests order
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamloe committed Dec 30, 2024
1 parent eb26870 commit 20a183e
Showing 1 changed file with 3 additions and 27 deletions.
30 changes: 3 additions & 27 deletions logzio-sender/src/test/java/io/logz/sender/LogzioSenderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ protected OpenTelemetry initOpenTelemetry() {
Runtime.getRuntime().addShutdownHook(new Thread(sdkTracerProvider::close));
return sdk;
}

@Test
public void testOpenTelemetryContextInjectionEnabledNoContext() throws Exception {
public void openTelemetryContextInjectionEnabledNoContext() throws Exception {
String token = "testToken";
String type = "testType";
int drainTimeout = 2;
Expand All @@ -142,7 +143,7 @@ public void testOpenTelemetryContextInjectionEnabledNoContext() throws Exception
}

@Test
public void testOpenTelemetryContextInjection() throws Exception {
public void openTelemetryContextInjection() throws Exception {
OpenTelemetry openTelemetry = initOpenTelemetry();
Tracer tracer = openTelemetry.getTracer("test");
Span span = tracer.spanBuilder("test").setSpanKind(SpanKind.CLIENT).startSpan();
Expand All @@ -168,31 +169,6 @@ public void testOpenTelemetryContextInjection() throws Exception {
}
}

@Test
public void testOpenTelemetryContextInjectionDisabled() throws Exception {
OpenTelemetry openTelemetry = initOpenTelemetry();
Tracer tracer = openTelemetry.getTracer("test");
Span span = tracer.spanBuilder("test").setSpanKind(SpanKind.CLIENT).startSpan();
try (Scope scope = span.makeCurrent()) {
String token = "testToken";
String type = "testType";
int drainTimeout = 2;
LogzioSender.Builder testSenderBuilder = getLogzioSenderBuilder(token, type, drainTimeout,
10 * 1000, 10 * 1000, tasks, false, false);
LogzioSender testSender = createLogzioSender(testSenderBuilder);

JsonObject jsonMessage = createJsonMessage("testLogger", "Test message");

testSender.send(jsonMessage);

assertFalse(jsonMessage.has("trace_id"));
assertFalse(jsonMessage.has("span_id"));
assertFalse(jsonMessage.has("service_name"));
} finally {
span.end();
}
}

@Test
public void simpleAppending() throws Exception {
String token = "aBcDeFgHiJkLmNoPqRsT";
Expand Down

0 comments on commit 20a183e

Please sign in to comment.