Skip to content

Commit 3be8d5b

Browse files
committed
Fix a UT failure unrelated to this PR
This unit test failure is not caused by this PR. The same failure occurred in April 2025 and was partially addressed in PR-1049: #1049. https://github.com/aws-observability/aws-otel-java-instrumentation/blob/release/v2.11.x/exporters/aws-distro-opentelemetry-xray-udp-span-exporter/src/test/java/software/amazon/distro/opentelemetry/exporter/xray/udp/trace/AwsXrayUdpSpanExporterTest.java#L42-L44 PR-1049 fixed the failure in one location but missed another instance. This PR addresses the remaining failure in the test: UdpExporterTest.java
1 parent 045ebef commit 3be8d5b

File tree

1 file changed

+5
-2
lines changed
  • awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers

1 file changed

+5
-2
lines changed

awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/UdpExporterTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
1919
import static org.assertj.core.api.Assertions.assertThatThrownBy;
20+
import static org.junit.jupiter.api.Assertions.assertTrue;
2021
import static org.mockito.Mockito.*;
2122

2223
import io.opentelemetry.api.common.AttributeKey;
@@ -36,8 +37,10 @@ public class UdpExporterTest {
3637
public void testUdpExporterWithDefaults() {
3738
OtlpUdpSpanExporter exporter = new OtlpUdpSpanExporterBuilder().build();
3839
UdpSender sender = exporter.getSender();
39-
assertThat(sender.getEndpoint().getHostName())
40-
.isEqualTo("localhost"); // getHostName implicitly converts 127.0.0.1 to localhost
40+
String senderEndpointHostName = sender.getEndpoint().getHostName();
41+
// getHostName may or may not convert 127.0.0.1 to localhost
42+
assertTrue(
43+
senderEndpointHostName.equals("localhost") || senderEndpointHostName.equals("127.0.0.1"));
4144
assertThat(sender.getEndpoint().getPort()).isEqualTo(2000);
4245
assertThat(exporter.getPayloadPrefix()).endsWith("T1S");
4346
}

0 commit comments

Comments
 (0)