Skip to content

Commit 7ae199e

Browse files
committed
Native transport test profiles should work on aarch64 architectures (#4714)
The build assumes that when testing native transports x86_64 should be used. We should be able to run test with aarch64 as well. - Move native test dependency declaration to specific profiles activated by the OS and architecture. - Add the native transport unavailability cause failure when expecting native to be active. - Fix incorrect tests
1 parent da38e59 commit 7ae199e

4 files changed

Lines changed: 63 additions & 32 deletions

File tree

pom.xml

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -759,20 +759,6 @@
759759
<vertx.testNativeTransport>true</vertx.testNativeTransport>
760760
<vertx.testDomainSockets>false</vertx.testDomainSockets>
761761
</properties>
762-
<dependencies>
763-
<dependency>
764-
<groupId>io.netty</groupId>
765-
<artifactId>netty-transport-native-epoll</artifactId>
766-
<optional>true</optional>
767-
<classifier>linux-x86_64</classifier>
768-
</dependency>
769-
<dependency>
770-
<groupId>io.netty</groupId>
771-
<artifactId>netty-transport-native-kqueue</artifactId>
772-
<optional>true</optional>
773-
<classifier>osx-x86_64</classifier>
774-
</dependency>
775-
</dependencies>
776762
</profile>
777763

778764
<!-- Run tests with native transport and domain sockets -->
@@ -782,20 +768,6 @@
782768
<vertx.testNativeTransport>true</vertx.testNativeTransport>
783769
<vertx.testDomainSockets>true</vertx.testDomainSockets>
784770
</properties>
785-
<dependencies>
786-
<dependency>
787-
<groupId>io.netty</groupId>
788-
<artifactId>netty-transport-native-epoll</artifactId>
789-
<optional>true</optional>
790-
<classifier>linux-x86_64</classifier>
791-
</dependency>
792-
<dependency>
793-
<groupId>io.netty</groupId>
794-
<artifactId>netty-transport-native-kqueue</artifactId>
795-
<optional>true</optional>
796-
<classifier>osx-x86_64</classifier>
797-
</dependency>
798-
</dependencies>
799771
</profile>
800772

801773
<!-- Documentation generation : activate with -Pdocs -->
@@ -873,10 +845,28 @@
873845
</profile>
874846

875847
<profile>
876-
<id>mac</id>
848+
<id>linux</id>
849+
<activation>
850+
<os>
851+
<family>linux</family>
852+
</os>
853+
</activation>
854+
<dependencies>
855+
<dependency>
856+
<groupId>io.netty</groupId>
857+
<artifactId>netty-transport-native-epoll</artifactId>
858+
<classifier>linux-x86_64</classifier>
859+
<scope>test</scope>
860+
</dependency>
861+
</dependencies>
862+
</profile>
863+
864+
<profile>
865+
<id>osx-x86_64</id>
877866
<activation>
878867
<os>
879868
<family>mac</family>
869+
<arch>x86_64</arch>
880870
</os>
881871
</activation>
882872
<dependencies>
@@ -886,6 +876,36 @@
886876
<classifier>osx-x86_64</classifier>
887877
<scope>test</scope>
888878
</dependency>
879+
<dependency>
880+
<groupId>io.netty</groupId>
881+
<artifactId>netty-transport-native-kqueue</artifactId>
882+
<classifier>osx-x86_64</classifier>
883+
<scope>test</scope>
884+
</dependency>
885+
</dependencies>
886+
</profile>
887+
888+
<profile>
889+
<id>osx-aarch64</id>
890+
<activation>
891+
<os>
892+
<family>mac</family>
893+
<arch>aarch64</arch>
894+
</os>
895+
</activation>
896+
<dependencies>
897+
<dependency>
898+
<groupId>io.netty</groupId>
899+
<artifactId>netty-resolver-dns-native-macos</artifactId>
900+
<classifier>osx-aarch_64</classifier>
901+
<scope>test</scope>
902+
</dependency>
903+
<dependency>
904+
<groupId>io.netty</groupId>
905+
<artifactId>netty-transport-native-kqueue</artifactId>
906+
<classifier>osx-aarch_64</classifier>
907+
<scope>test</scope>
908+
</dependency>
889909
</dependencies>
890910
</profile>
891911

src/test/java/io/vertx/core/http/HttpTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,13 @@ public void testListenDomainSocketAddress() throws Exception {
178178
for (int i = 0;i < len;i++) {
179179
File sockFile = TestUtils.tmpFile(".sock");
180180
SocketAddress sockAddress = SocketAddress.domainSocketAddress(sockFile.getAbsolutePath());
181-
HttpServer server = vertx
181+
HttpServer server = vx
182182
.createHttpServer(createBaseServerOptions())
183183
.requestHandler(req -> req.response().end(sockAddress.path()));
184184
startServer(sockAddress, server);
185185
addresses.add(sockAddress);
186186
}
187+
HttpClient client = vx.createHttpClient(createBaseClientOptions());
187188
for (int i = 0;i < len;i++) {
188189
SocketAddress sockAddress = addresses.get(i);
189190
for (int j = 0;j < len;j++) {

src/test/java/io/vertx/core/net/NetTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1985,14 +1985,15 @@ public void testListenDomainSocketAddress() throws Exception {
19851985
for (int i = 0;i < len;i++) {
19861986
File sockFile = TestUtils.tmpFile(".sock");
19871987
SocketAddress sockAddress = SocketAddress.domainSocketAddress(sockFile.getAbsolutePath());
1988-
NetServer server = vertx
1988+
NetServer server = vx
19891989
.createNetServer()
19901990
.connectHandler(so -> {
19911991
so.end(Buffer.buffer(sockAddress.path()));
19921992
});
19931993
startServer(sockAddress, server);
19941994
addresses.add(sockAddress);
19951995
}
1996+
NetClient client = vx.createNetClient();
19961997
for (int i = 0;i < len;i++) {
19971998
for (int j = 0;j < len;j++) {
19981999
SocketAddress sockAddress = addresses.get(i);

src/test/java/io/vertx/test/core/VertxTestBase.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.vertx.core.spi.tracing.VertxTracer;
2020
import io.vertx.core.tracing.TracingOptions;
2121
import io.vertx.test.fakecluster.FakeClusterManager;
22+
import junit.framework.AssertionFailedError;
2223
import org.junit.Assert;
2324
import org.junit.Rule;
2425

@@ -64,7 +65,15 @@ public void setUp() throws Exception {
6465
VertxOptions options = getOptions();
6566
boolean nativeTransport = options.getPreferNativeTransport();
6667
vertx = vertx(options);
67-
if (nativeTransport) {
68+
if (nativeTransport && !vertx.isNativeTransportEnabled()) {
69+
if (!vertx.isNativeTransportEnabled()) {
70+
AssertionFailedError afe = new AssertionFailedError("Expected native transport");
71+
Throwable cause = vertx.unavailableNativeTransportCause();
72+
if (cause != null) {
73+
afe.initCause(cause);
74+
}
75+
throw afe;
76+
}
6877
assertTrue(vertx.isNativeTransportEnabled());
6978
}
7079
}

0 commit comments

Comments
 (0)