Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
breedx-splk committed Nov 19, 2024
1 parent b143a8d commit a02b00f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static io.opentelemetry.api.common.AttributeKey.stringKey;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
import static io.opentelemetry.semconv.incubating.SessionIncubatingAttributes.SESSION_ID;
import static org.awaitility.Awaitility.await;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyCollection;
Expand Down Expand Up @@ -69,7 +70,6 @@
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import io.opentelemetry.semconv.incubating.SessionIncubatingAttributes;
import java.io.IOException;
import java.time.Duration;
import java.util.Arrays;
Expand Down Expand Up @@ -154,8 +154,7 @@ public void shouldBuildTracerProvider() {
.hasName("test span")
.hasResource(resource)
.hasAttributesSatisfyingExactly(
equalTo(SessionIncubatingAttributes.SESSION_ID, sessionId),
equalTo(SCREEN_NAME_KEY, "unknown"));
equalTo(SESSION_ID, sessionId), equalTo(SCREEN_NAME_KEY, "unknown"));
}

@Test
Expand All @@ -180,6 +179,7 @@ public void shouldBuildLogRecordProvider() {
assertThat(logs).hasSize(1);
assertThat(logs.get(0))
.hasAttributesSatisfyingExactly(
equalTo(SESSION_ID, openTelemetryRum.getRumSessionId()),
equalTo(stringKey("event.name"), "test.event"),
equalTo(stringKey("mega"), "hit"))
.hasResource(resource);
Expand Down Expand Up @@ -310,7 +310,9 @@ public void setLogRecordExporterCustomizer() {
assertThat(logs).hasSize(1);
assertThat(logs.iterator().next())
.hasBody("foo")
.hasAttributesSatisfyingExactly(equalTo(stringKey("bing"), "bang"))
.hasAttributesSatisfyingExactly(
equalTo(stringKey("bing"), "bang"),
equalTo(SESSION_ID, rum.getRumSessionId()))
.hasSeverity(Severity.FATAL3);
}

Expand Down Expand Up @@ -420,6 +422,7 @@ public void verifyGlobalAttrsForLogs() {
OpenTelemetryAssertions.assertThat(logRecordData)
.hasAttributes(
Attributes.builder()
.put(SESSION_ID, rum.getRumSessionId())
.put("someGlobalKey", "someGlobalValue")
.put("localAttrKey", "localAttrValue")
.build());
Expand Down

0 comments on commit a02b00f

Please sign in to comment.