Skip to content

Commit

Permalink
Only run HttpTest with domain socket when it's available
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj authored and franz1981 committed Feb 22, 2023
1 parent 946fbb2 commit cfa29b8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static void setPendingFastOpenRequestsThreshold(int value) {
}

EpollTransport() {
super(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public static void setPendingFastOpenRequestsThreshold(int value) {
pendingFastOpenRequestsThreshold = value;
}

IOUringTransport() {
super(false);
}

@Override
public boolean supportFileRegion() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
class KQueueTransport extends Transport {

KQueueTransport() {
super(true);
}

@Override
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/io/vertx/core/net/impl/transport/Transport.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class Transport {
/**
* The JDK transport, always there.
*/
public static Transport JDK = new Transport();
public static Transport JDK = new Transport(false);

public boolean supportFileRegion() {
return true;
Expand Down Expand Up @@ -104,7 +104,18 @@ public static Transport transport(boolean preferNative) {
}
}

private final boolean supportsDomainSockets;

protected Transport() {
this(false);
}

protected Transport(boolean supportsDomainSockets) {
this.supportsDomainSockets = supportsDomainSockets;
}

public boolean supportsDomainSockets() {
return supportsDomainSockets;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/io/vertx/core/http/HttpTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import io.vertx.core.http.impl.ServerCookie;
import io.vertx.core.http.impl.headers.HeadersMultiMap;
import io.vertx.core.impl.Utils;
import io.vertx.core.impl.VertxInternal;
import io.vertx.core.net.NetClient;
import io.vertx.core.net.NetClientOptions;
import io.vertx.core.net.NetServerOptions;
Expand Down Expand Up @@ -176,6 +177,7 @@ public void testListenSocketAddress() {
public void testListenDomainSocketAddress() throws Exception {
Vertx vx = Vertx.vertx(new VertxOptions().setPreferNativeTransport(true));
Assume.assumeTrue("Native transport must be enabled", vx.isNativeTransportEnabled());
Assume.assumeTrue("Transport must support domain sockets", ((VertxInternal) vx).transport().supportsDomainSockets());
int len = 3;
waitFor(len * len);
List<SocketAddress> addresses = new ArrayList<>();
Expand Down

0 comments on commit cfa29b8

Please sign in to comment.