Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.mockito.junit.jupiter.MockitoExtension;

@ExtendWith(MockitoExtension.class)
public class EksResourceTest {
class EksResourceTest {

@Mock private DockerHelper mockDockerHelper;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.LinkedHashMap;
import org.junit.jupiter.api.Test;

public class AwsXrayCompositePropagatorTest extends AwsXrayPropagatorTest {
class AwsXrayCompositePropagatorTest extends AwsXrayPropagatorTest {

@Override
TextMapPropagator propagator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void setup() {
}

@Test
public void testAttributesPropagation() {
void testAttributesPropagation() {
Span spanWithAppOnly = tracer.spanBuilder("parent").startSpan();
spanWithAppOnly.setAttribute(testKey1, "testValue1");
validateSpanAttributesInheritance(spanWithAppOnly, null, "testValue1", null);
Expand All @@ -57,7 +57,7 @@ public void testAttributesPropagation() {
}

@Test
public void testOverrideAttributes() {
void testOverrideAttributes() {
Span parentSpan = tracer.spanBuilder("parent").startSpan();
parentSpan.setAttribute(testKey1, "testValue1");
parentSpan.setAttribute(testKey2, "testValue2");
Expand All @@ -75,13 +75,13 @@ public void testOverrideAttributes() {
}

@Test
public void testAttributesDoNotExist() {
void testAttributesDoNotExist() {
Span span = tracer.spanBuilder("parent").startSpan();
validateSpanAttributesInheritance(span, null, null, null);
}

@Test
public void testSpanNamePropagationBySpanKind() {
void testSpanNamePropagationBySpanKind() {
for (SpanKind value : SpanKind.values()) {
Span span = tracer.spanBuilder("parent").setSpanKind(value).startSpan();
if (value == SpanKind.SERVER || value == SpanKind.CONSUMER) {
Expand All @@ -93,7 +93,7 @@ public void testSpanNamePropagationBySpanKind() {
}

@Test
public void testSpanNamePropagationWithRemoteParentSpan() {
void testSpanNamePropagationWithRemoteParentSpan() {
Span remoteParent =
Span.wrap(
SpanContext.createFromRemoteParent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void setUpMocks() {
}

@Test
public void testConsumerSpanWithoutAttributes() {
void testConsumerSpanWithoutAttributes() {
Attributes expectedAttributes =
Attributes.of(
AWS_SPAN_KIND, SpanKind.CONSUMER.name(),
Expand All @@ -89,7 +89,7 @@ public void testConsumerSpanWithoutAttributes() {
}

@Test
public void testServerSpanWithoutAttributes() {
void testServerSpanWithoutAttributes() {
Attributes expectedAttributes =
Attributes.of(
AWS_SPAN_KIND, SpanKind.SERVER.name(),
Expand All @@ -99,7 +99,7 @@ public void testServerSpanWithoutAttributes() {
}

@Test
public void testProducerSpanWithoutAttributes() {
void testProducerSpanWithoutAttributes() {
Attributes expectedAttributes =
Attributes.of(
AWS_SPAN_KIND, SpanKind.PRODUCER.name(),
Expand All @@ -111,7 +111,7 @@ public void testProducerSpanWithoutAttributes() {
}

@Test
public void testClientSpanWithoutAttributes() {
void testClientSpanWithoutAttributes() {
Attributes expectedAttributes =
Attributes.of(
AWS_SPAN_KIND, SpanKind.CLIENT.name(),
Expand All @@ -123,13 +123,13 @@ public void testClientSpanWithoutAttributes() {
}

@Test
public void testInternalSpan() {
void testInternalSpan() {
// Spans with internal span kind should not produce any attributes.
validateAttributesProducedForSpanOfKind(Attributes.empty(), SpanKind.INTERNAL);
}

@Test
public void testConsumerSpanWithAttributes() {
void testConsumerSpanWithAttributes() {
updateResourceWithServiceName();
when(spanDataMock.getName()).thenReturn(SPAN_NAME_VALUE);

Expand All @@ -142,7 +142,7 @@ public void testConsumerSpanWithAttributes() {
}

@Test
public void testServerSpanWithAttributes() {
void testServerSpanWithAttributes() {
updateResourceWithServiceName();
when(spanDataMock.getName()).thenReturn(SPAN_NAME_VALUE);

Expand All @@ -155,7 +155,7 @@ public void testServerSpanWithAttributes() {
}

@Test
public void testServerSpanWithNullSpanName() {
void testServerSpanWithNullSpanName() {
updateResourceWithServiceName();
when(spanDataMock.getName()).thenReturn(null);

Expand All @@ -168,7 +168,7 @@ public void testServerSpanWithNullSpanName() {
}

@Test
public void testServerSpanWithSpanNameAsHttpMethod() {
void testServerSpanWithSpanNameAsHttpMethod() {
updateResourceWithServiceName();
when(spanDataMock.getName()).thenReturn("GET");
mockAttribute(HTTP_METHOD, "GET");
Expand All @@ -183,7 +183,7 @@ public void testServerSpanWithSpanNameAsHttpMethod() {
}

@Test
public void testServerSpanWithSpanNameWithHttpTarget() {
void testServerSpanWithSpanNameWithHttpTarget() {
updateResourceWithServiceName();
when(spanDataMock.getName()).thenReturn("POST");
mockAttribute(HTTP_METHOD, "POST");
Expand All @@ -203,7 +203,7 @@ public void testServerSpanWithSpanNameWithHttpTarget() {
}

@Test
public void testProducerSpanWithAttributes() {
void testProducerSpanWithAttributes() {
updateResourceWithServiceName();
mockAttribute(AWS_LOCAL_OPERATION, AWS_LOCAL_OPERATION_VALUE);
mockAttribute(AWS_REMOTE_SERVICE, AWS_REMOTE_SERVICE_VALUE);
Expand All @@ -220,7 +220,7 @@ public void testProducerSpanWithAttributes() {
}

@Test
public void testClientSpanWithAttributes() {
void testClientSpanWithAttributes() {
updateResourceWithServiceName();
mockAttribute(AWS_LOCAL_OPERATION, AWS_LOCAL_OPERATION_VALUE);
mockAttribute(AWS_REMOTE_SERVICE, AWS_REMOTE_SERVICE_VALUE);
Expand All @@ -237,7 +237,7 @@ public void testClientSpanWithAttributes() {
}

@Test
public void testRemoteAttributesCombinations() {
void testRemoteAttributesCombinations() {
// Set all expected fields to a test string, we will overwrite them in descending order to test
// the priority-order logic in AwsMetricAttributeGenerator remote attribute methods.
mockAttribute(AWS_REMOTE_SERVICE, "TestString");
Expand Down Expand Up @@ -333,7 +333,7 @@ public void testRemoteAttributesCombinations() {
}

@Test
public void testPeerServiceDoesOverrideOtherRemoteServices() {
void testPeerServiceDoesOverrideOtherRemoteServices() {
validatePeerServiceDoesOverride(RPC_SERVICE);
validatePeerServiceDoesOverride(DB_SYSTEM);
validatePeerServiceDoesOverride(FAAS_INVOKED_PROVIDER);
Expand All @@ -346,7 +346,7 @@ public void testPeerServiceDoesOverrideOtherRemoteServices() {
}

@Test
public void testPeerServiceDoesNotOverrideAwsRemoteService() {
void testPeerServiceDoesNotOverrideAwsRemoteService() {
mockAttribute(AWS_REMOTE_SERVICE, "TestString");
mockAttribute(PEER_SERVICE, "PeerService");

Expand All @@ -357,7 +357,7 @@ public void testPeerServiceDoesNotOverrideAwsRemoteService() {
}

@Test
public void testClientSpanWithRemoteTargetAttributes() {
void testClientSpanWithRemoteTargetAttributes() {
// Validate behaviour of aws bucket name attribute, then remove it.
mockAttribute(AWS_BUCKET_NAME, "aws_s3_bucket_name");
validateRemoteTargetAttributes(AWS_REMOTE_TARGET, "aws_s3_bucket_name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void setUpMocks() {
}

@Test
public void testPassthroughDelegations() {
void testPassthroughDelegations() {
awsMetricAttributesSpanExporter.flush();
awsMetricAttributesSpanExporter.shutdown();
awsMetricAttributesSpanExporter.close();
Expand All @@ -72,7 +72,7 @@ public void testPassthroughDelegations() {
}

@Test
public void testExportDelegationWithoutAttributeOrModification() {
void testExportDelegationWithoutAttributeOrModification() {
Attributes spanAttributes = buildSpanAttributes(CONTAINS_NO_ATTRIBUTES);
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
Attributes metricAttributes = buildMetricAttributes(CONTAINS_NO_ATTRIBUTES);
Expand All @@ -88,7 +88,7 @@ public void testExportDelegationWithoutAttributeOrModification() {
}

@Test
public void testExportDelegationWithAttributeButWithoutModification() {
void testExportDelegationWithAttributeButWithoutModification() {
Attributes spanAttributes = buildSpanAttributes(CONTAINS_ATTRIBUTES);
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
Attributes metricAttributes = buildMetricAttributes(CONTAINS_NO_ATTRIBUTES);
Expand All @@ -104,7 +104,7 @@ public void testExportDelegationWithAttributeButWithoutModification() {
}

@Test
public void testExportDelegationWithoutAttributeButWithModification() {
void testExportDelegationWithoutAttributeButWithModification() {
Attributes spanAttributes = buildSpanAttributes(CONTAINS_NO_ATTRIBUTES);
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
Expand All @@ -124,7 +124,7 @@ public void testExportDelegationWithoutAttributeButWithModification() {
}

@Test
public void testExportDelegationWithAttributeAndModification() {
void testExportDelegationWithAttributeAndModification() {
Attributes spanAttributes = buildSpanAttributes(CONTAINS_ATTRIBUTES);
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
Expand All @@ -146,7 +146,7 @@ public void testExportDelegationWithAttributeAndModification() {
}

@Test
public void testExportDelegationWithMultipleSpans() {
void testExportDelegationWithMultipleSpans() {
Attributes spanAttributes1 = buildSpanAttributes(CONTAINS_NO_ATTRIBUTES);
SpanData spanDataMock1 = buildSpanDataMock(spanAttributes1);
Attributes metricAttributes1 = buildMetricAttributes(CONTAINS_NO_ATTRIBUTES);
Expand Down Expand Up @@ -185,7 +185,7 @@ public void testExportDelegationWithMultipleSpans() {
}

@Test
public void testOverridenAttributes() {
void testOverridenAttributes() {
Attributes spanAttributes =
Attributes.of(
AttributeKey.stringKey("key1"),
Expand Down Expand Up @@ -217,7 +217,7 @@ public void testOverridenAttributes() {
}

@Test
public void testExportDelegatingSpanDataBehaviour() {
void testExportDelegatingSpanDataBehaviour() {
Attributes spanAttributes = buildSpanAttributes(CONTAINS_ATTRIBUTES);
SpanData spanDataMock = buildSpanDataMock(spanAttributes);
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,21 @@ public void setUpMocks() {
}

@Test
public void testIsRequired() {
void testIsRequired() {
assertThat(awsSpanMetricsProcessor.isStartRequired()).isFalse();
assertThat(awsSpanMetricsProcessor.isEndRequired()).isTrue();
}

@Test
public void testStartDoesNothingToSpan() {
void testStartDoesNothingToSpan() {
Context parentContextMock = mock(Context.class);
ReadWriteSpan spanMock = mock(ReadWriteSpan.class);
awsSpanMetricsProcessor.onStart(parentContextMock, spanMock);
verifyNoInteractions(parentContextMock, spanMock);
}

@Test
public void testTearDown() {
void testTearDown() {
assertThat(awsSpanMetricsProcessor.shutdown()).isEqualTo(CompletableResultCode.ofSuccess());
assertThat(awsSpanMetricsProcessor.forceFlush()).isEqualTo(CompletableResultCode.ofSuccess());

Expand All @@ -128,7 +128,7 @@ public void testTearDown() {
* AwsSpanMetricsProcessor's onEnd method pertaining to metrics generation.
*/
@Test
public void testOnEndMetricsGenerationWithoutSpanAttributes() {
void testOnEndMetricsGenerationWithoutSpanAttributes() {
Attributes spanAttributes = buildSpanAttributes(CONTAINS_NO_ATTRIBUTES);
ReadableSpan readableSpanMock = buildReadableSpanMock(spanAttributes);
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
Expand All @@ -141,7 +141,7 @@ public void testOnEndMetricsGenerationWithoutSpanAttributes() {
}

@Test
public void testOnEndMetricsGenerationWithoutMetricAttributes() {
void testOnEndMetricsGenerationWithoutMetricAttributes() {
Attributes spanAttributes = Attributes.of(HTTP_STATUS_CODE, 500L);
ReadableSpan readableSpanMock = buildReadableSpanMock(spanAttributes);
Attributes metricAttributes = buildMetricAttributes(CONTAINS_NO_ATTRIBUTES);
Expand All @@ -154,7 +154,7 @@ public void testOnEndMetricsGenerationWithoutMetricAttributes() {
}

@Test
public void testOnEndMetricsGenerationWithoutEndRequired() {
void testOnEndMetricsGenerationWithoutEndRequired() {
Attributes spanAttributes = Attributes.of(HTTP_STATUS_CODE, 500L);
ReadableSpan readableSpanMock = buildReadableSpanMock(spanAttributes);
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
Expand All @@ -167,7 +167,7 @@ public void testOnEndMetricsGenerationWithoutEndRequired() {
}

@Test
public void testOnEndMetricsGenerationWithLatency() {
void testOnEndMetricsGenerationWithLatency() {
Attributes spanAttributes = Attributes.of(HTTP_STATUS_CODE, 200L);
ReadableSpan readableSpanMock = buildReadableSpanMock(spanAttributes);
Attributes metricAttributes = buildMetricAttributes(CONTAINS_ATTRIBUTES);
Expand All @@ -182,7 +182,7 @@ public void testOnEndMetricsGenerationWithLatency() {
}

@Test
public void testOnEndMetricsGenerationWithAwsStatusCodes() {
void testOnEndMetricsGenerationWithAwsStatusCodes() {
validateMetricsGeneratedForAwsStatusCode(399L, ExpectedStatusMetric.NEITHER);
validateMetricsGeneratedForAwsStatusCode(400L, ExpectedStatusMetric.ERROR);
validateMetricsGeneratedForAwsStatusCode(499L, ExpectedStatusMetric.ERROR);
Expand All @@ -192,7 +192,7 @@ public void testOnEndMetricsGenerationWithAwsStatusCodes() {
}

@Test
public void testOnEndMetricsGenerationWithStatusCodes() {
void testOnEndMetricsGenerationWithStatusCodes() {
// Invalid HTTP status codes
validateMetricsGeneratedForHttpStatusCode(null, ExpectedStatusMetric.NEITHER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* Unit tests for {@link ResourceHolder}. Note that there isn't a great way to test the "default"
* fallback logic, as when the test suite is run, the customize logic appears to be invoked.
*/
public class ResourceHolderTest {
class ResourceHolderTest {

@Test
@SuppressWarnings("unchecked")
public void testCustomized() {
void testCustomized() {
Resource customizedResource = Resource.create(Attributes.empty());
AutoConfigurationCustomizer mockCustomizer = mock(AutoConfigurationCustomizer.class);
ResourceHolder resourceHolder = new ResourceHolder();
Expand Down
Loading
Loading