Skip to content

Commit

Permalink
Unit test for null endpoint serviceName
Browse files Browse the repository at this point in the history
  • Loading branch information
z-oo committed Sep 13, 2019
1 parent 48777fb commit 844e245
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ public void testEndpointIsSetIpv6() {
assertThat(clientLabels).doesNotContainKeys("endpoint.ipv4", "endpoint.ipv6");
}

@Test
public void testEndpointWithNullServiceName() {
Endpoint.Builder serverEndpointBuilder = Endpoint.newBuilder().port(80);
Endpoint serverEndpoint = serverEndpointBuilder.build();
Span serverSpan =
Span.newBuilder()
.kind(Kind.SERVER)
.traceId("4")
.name("test-span")
.id("5")
.localEndpoint(serverEndpoint)
.build();

AttributesExtractor extractor = new AttributesExtractor(Collections.emptyMap());
Map<String, AttributeValue> serverLabels = extractor.extract(serverSpan).getAttributeMapMap();
assertThat(serverLabels).doesNotContainKey("endpoint.serviceName");
}

@Test
public void testComponentLabelIsSet() {
AttributesExtractor extractor = new AttributesExtractor(Collections.emptyMap());
Expand Down

0 comments on commit 844e245

Please sign in to comment.