Skip to content

Commit 308b193

Browse files
committed
fix: Remove incorrect OS-specific logic in Ratpack 1.7 tests
1 parent ff36da1 commit 308b193

File tree

1 file changed

+4
-6
lines changed
  • instrumentation/ratpack/ratpack-1.7/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/v1_7/client

1 file changed

+4
-6
lines changed

instrumentation/ratpack/ratpack-1.7/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/ratpack/v1_7/client/RatpackTestUtils.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import io.opentelemetry.instrumentation.testing.junit.http.HttpClientTestOptions;
1212
import java.net.URI;
1313
import java.nio.channels.ClosedChannelException;
14-
import org.junit.jupiter.api.condition.OS;
1514
import ratpack.http.client.HttpClientReadTimeoutException;
1615

1716
public final class RatpackTestUtils {
@@ -25,20 +24,19 @@ public static Throwable ratpackClientSpanErrorMapper(URI uri, Throwable exceptio
2524
}
2625
if (isNonRoutableAddress(uri)) {
2726
if (exception instanceof ClosedChannelException) {
28-
return OS.WINDOWS.isCurrentOs() ? exception : new PrematureChannelClosureException();
27+
return new PrematureChannelClosureException();
2928
}
3029
return new ConnectTimeoutException("Connect timeout (PT2S) connecting to " + uri);
3130
}
32-
if (OS.WINDOWS.isCurrentOs() && isUnopenedPort(uri)) {
31+
if (isUnopenedPort(uri)) {
3332
return exception;
3433
}
3534
return exception;
3635
}
3736

3837
public static String ratpackExpectedClientSpanNameMapper(URI uri, String method) {
39-
// Windows still emits CONNECT spans when dialing non-routable addresses, while Linux uses the
40-
// HTTP method. Toggle expectations accordingly to keep the tests portable.
41-
if (OS.WINDOWS.isCurrentOs() && "GET".equals(method) && isNonRoutableAddress(uri)) {
38+
// Both Windows and Linux emit CONNECT spans when dialing non-routable addresses.
39+
if ("GET".equals(method) && isNonRoutableAddress(uri)) {
4240
return "CONNECT";
4341
}
4442
return HttpClientTestOptions.DEFAULT_EXPECTED_CLIENT_SPAN_NAME_MAPPER.apply(uri, method);

0 commit comments

Comments
 (0)