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 3ae00c7
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@ 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();
assertThat(serverEndpoint.serviceName()).isNull();
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 3ae00c7

Please sign in to comment.