Skip to content

Commit 501d5cc

Browse files
authored
Upgrade to Vert.x 4.5 (#532)
* updated vertx to version 4.5 * native image fix * re-enabled timeout resilience tests with HTTP/2 * test fix * fixed native tests on Liberica NIK * resilience tests: wait after enabling and disabling endpoints * CI: fixed native tests * removed duplicated resilience tests
1 parent 835807b commit 501d5cc

File tree

15 files changed

+48
-225
lines changed

15 files changed

+48
-225
lines changed

Diff for: .github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ jobs:
132132
db-ext-names:
133133
- false
134134
java-version:
135-
- 11
135+
- 21
136136
user-language:
137137
- en
138138

Diff for: driver/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
<dependency>
187187
<groupId>org.graalvm.sdk</groupId>
188188
<artifactId>graal-sdk</artifactId>
189-
<version>22.3.3</version>
189+
<version>${graalvm.version}</version>
190190
<scope>test</scope>
191191
</dependency>
192192
<dependency>

Diff for: driver/src/test/java/com/arangodb/ArangoCollectionAsyncTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2987,7 +2987,7 @@ void grantAccessRW(ArangoCollectionAsync collection) throws ExecutionException,
29872987
ArangoDBAsync arangoDB = collection.db().arango();
29882988
try {
29892989
arangoDB.createUser("user1", "1234", null).get();
2990-
collection.grantAccess("user1", Permissions.RW);
2990+
collection.grantAccess("user1", Permissions.RW).get();
29912991
} finally {
29922992
arangoDB.deleteUser("user1").get();
29932993
}

Diff for: driver/src/test/java/graal/BrotliSubstitutions.java

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package graal;
2+
3+
import com.oracle.svm.core.annotate.Substitute;
4+
import com.oracle.svm.core.annotate.TargetClass;
5+
6+
7+
@TargetClass(className = "io.netty.handler.codec.compression.Brotli")
8+
final class Target_com_arangodb_shaded_netty_handler_codec_compression_Brotli {
9+
@Substitute
10+
public static boolean isAvailable() {
11+
return false;
12+
}
13+
14+
@Substitute
15+
public static void ensureAvailability() throws Throwable {
16+
throw new UnsupportedOperationException();
17+
}
18+
}
19+
20+
public class BrotliSubstitutions {
21+
22+
}

Diff for: driver/src/test/java/graal/VertxSubstitutions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void close(Promise<Void> promise) {
8282
}
8383

8484
@Substitute
85-
public MessageImpl createMessage(boolean send, String address, MultiMap headers, Object body, String codecName) {
85+
public MessageImpl createMessage(boolean send, boolean isLocal, String address, MultiMap headers, Object body, String codecName) {
8686
throw new RuntimeException("Not Implemented");
8787
}
8888

Diff for: pom.xml

+5-10
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<sonar.organization>arangodb-1</sonar.organization>
4040
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
4141
<adb.jackson.version>2.16.0</adb.jackson.version>
42+
<graalvm.version>23.1.1</graalvm.version>
4243
<moduleName/>
4344
<SslTest/>
4445
</properties>
@@ -105,7 +106,7 @@
105106
<dependency>
106107
<groupId>org.junit</groupId>
107108
<artifactId>junit-bom</artifactId>
108-
<version>5.10.0</version>
109+
<version>5.10.1</version>
109110
<type>pom</type>
110111
<scope>import</scope>
111112
</dependency>
@@ -182,7 +183,7 @@
182183
<dependency>
183184
<groupId>com.tngtech.archunit</groupId>
184185
<artifactId>archunit-junit5</artifactId>
185-
<version>1.1.0</version>
186+
<version>1.2.1</version>
186187
</dependency>
187188
<dependency>
188189
<groupId>org.eclipse</groupId>
@@ -192,7 +193,7 @@
192193
<dependency>
193194
<groupId>io.vertx</groupId>
194195
<artifactId>vertx-stack-depchain</artifactId>
195-
<version>4.4.2</version>
196+
<version>4.5.1</version>
196197
<type>pom</type>
197198
<scope>import</scope>
198199
</dependency>
@@ -405,7 +406,7 @@
405406
<plugin>
406407
<groupId>org.graalvm.buildtools</groupId>
407408
<artifactId>native-maven-plugin</artifactId>
408-
<version>0.9.27</version>
409+
<version>0.9.28</version>
409410
<extensions>true</extensions>
410411
<executions>
411412
<execution>
@@ -432,12 +433,6 @@
432433
</plugins>
433434
</build>
434435
<dependencies>
435-
<dependency>
436-
<groupId>com.aayushatharva.brotli4j</groupId>
437-
<artifactId>brotli4j</artifactId>
438-
<version>1.11.0</version>
439-
<scope>test</scope>
440-
</dependency>
441436
<dependency>
442437
<groupId>javax.annotation</groupId>
443438
<artifactId>javax.annotation-api</artifactId>

Diff for: resilience-tests/src/test/java/resilience/ActiveFailoverTest.java

-66
This file was deleted.

Diff for: resilience-tests/src/test/java/resilience/ClusterTest.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ static void afterAll() throws IOException {
5050
}
5151

5252
@BeforeEach
53-
void beforeEach() throws IOException {
54-
for (Endpoint endpoint : endpoints) {
55-
endpoint.getProxy().enable();
56-
}
53+
void beforeEach() {
54+
enableAllEndpoints();
5755
}
5856

5957
protected static List<Endpoint> getEndpoints() {

Diff for: resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceNoneClusterTest.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.arangodb.entity.LoadBalancingStrategy;
88
import eu.rekawek.toxiproxy.model.ToxicDirection;
99
import eu.rekawek.toxiproxy.model.toxic.Latency;
10-
import org.junit.jupiter.api.Disabled;
1110
import org.junit.jupiter.params.ParameterizedTest;
1211
import org.junit.jupiter.params.provider.MethodSource;
1312
import resilience.ClusterTest;
@@ -55,41 +54,41 @@ void loadBalancingAsync(ArangoDBAsync arangoDB) {
5554

5655
@ParameterizedTest(name = "{index}")
5756
@MethodSource("arangoProvider")
58-
void failover(ArangoDB arangoDB) throws IOException {
57+
void failover(ArangoDB arangoDB) {
5958
List<Endpoint> endpoints = getEndpoints();
6059

61-
endpoints.get(0).getProxy().disable();
60+
endpoints.get(0).disable();
6261
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId());
6362
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId());
6463
enableAllEndpoints();
6564

66-
endpoints.get(1).getProxy().disable();
65+
endpoints.get(1).disable();
6766
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId());
6867
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId());
6968
enableAllEndpoints();
7069

71-
endpoints.get(2).getProxy().disable();
70+
endpoints.get(2).disable();
7271
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId());
7372
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId());
7473
enableAllEndpoints();
7574
}
7675

7776
@ParameterizedTest(name = "{index}")
7877
@MethodSource("asyncArangoProvider")
79-
void failoverAsync(ArangoDBAsync arangoDB) throws IOException {
78+
void failoverAsync(ArangoDBAsync arangoDB) {
8079
List<Endpoint> endpoints = getEndpoints();
8180

82-
endpoints.get(0).getProxy().disable();
81+
endpoints.get(0).disable();
8382
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId());
8483
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId());
8584
enableAllEndpoints();
8685

87-
endpoints.get(1).getProxy().disable();
86+
endpoints.get(1).disable();
8887
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId());
8988
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId());
9089
enableAllEndpoints();
9190

92-
endpoints.get(2).getProxy().disable();
91+
endpoints.get(2).disable();
9392
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId());
9493
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId());
9594
enableAllEndpoints();

Diff for: resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceRoundRobinClusterTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,22 @@ void loadBalancingAsync(ArangoDBAsync arangoDB) {
5959

6060
@ParameterizedTest(name = "{index}")
6161
@MethodSource("arangoProvider")
62-
void failover(ArangoDB arangoDB) throws IOException {
62+
void failover(ArangoDB arangoDB) {
6363
List<Endpoint> endpoints = getEndpoints();
64-
endpoints.get(0).getProxy().disable();
64+
endpoints.get(0).disable();
6565
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId());
66-
endpoints.get(0).getProxy().enable();
66+
endpoints.get(0).enable();
6767
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId());
6868
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId());
6969
}
7070

7171
@ParameterizedTest(name = "{index}")
7272
@MethodSource("asyncArangoProvider")
73-
void failoverAsync(ArangoDBAsync arangoDB) throws IOException {
73+
void failoverAsync(ArangoDBAsync arangoDB) {
7474
List<Endpoint> endpoints = getEndpoints();
75-
endpoints.get(0).getProxy().disable();
75+
endpoints.get(0).disable();
7676
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId());
77-
endpoints.get(0).getProxy().enable();
77+
endpoints.get(0).enable();
7878
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId());
7979
assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId());
8080
}

Diff for: resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java

-89
Original file line numberDiff line numberDiff line change
@@ -136,93 +136,6 @@ void unreachableHostFailoverAsync(ArangoDBAsync arangoDB) throws ExecutionExcept
136136
arangoDB.shutdown();
137137
}
138138

139-
/**
140-
* on delayed response:
141-
* - ArangoDBException with cause TimeoutException
142-
* <p>
143-
* once the delay is removed:
144-
* - the subsequent requests should be successful
145-
*/
146-
@ParameterizedTest
147-
@EnumSource(Protocol.class)
148-
void connectionTimeout(Protocol protocol) throws IOException, InterruptedException {
149-
// https://github.com/vert-x3/vertx-web/issues/2296
150-
// WebClient: HTTP/2 request timeout does not throw TimeoutException
151-
assumeTrue(protocol != Protocol.HTTP2_VPACK);
152-
assumeTrue(protocol != Protocol.HTTP2_JSON);
153-
154-
ArangoDB arangoDB = dbBuilder()
155-
.timeout(1_000)
156-
.protocol(protocol)
157-
.build();
158-
159-
arangoDB.getVersion();
160-
161-
// slow down the driver connection
162-
Latency toxic = getEndpoints().get(0).getProxy().toxics().latency("latency", ToxicDirection.DOWNSTREAM, 10_000);
163-
Thread.sleep(100);
164-
165-
// no failover for TimeoutException
166-
for (int i = 0; i < 2; i++) {
167-
Throwable thrown = catchThrowable(arangoDB::getVersion);
168-
thrown.printStackTrace();
169-
assertThat(thrown)
170-
.isInstanceOf(ArangoDBException.class)
171-
.extracting(Throwable::getCause)
172-
.isInstanceOf(TimeoutException.class);
173-
}
174-
175-
toxic.remove();
176-
Thread.sleep(100);
177-
178-
arangoDB.getVersion();
179-
arangoDB.shutdown();
180-
}
181-
182-
/**
183-
* on delayed response:
184-
* - ArangoDBException with cause TimeoutException
185-
* <p>
186-
* once the delay is removed:
187-
* - the subsequent requests should be successful
188-
*/
189-
@ParameterizedTest
190-
@EnumSource(Protocol.class)
191-
void connectionTimeoutAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException {
192-
// https://github.com/vert-x3/vertx-web/issues/2296
193-
// WebClient: HTTP/2 request timeout does not throw TimeoutException
194-
assumeTrue(protocol != Protocol.HTTP2_VPACK);
195-
assumeTrue(protocol != Protocol.HTTP2_JSON);
196-
197-
ArangoDBAsync arangoDB = dbBuilder()
198-
.timeout(1_000)
199-
.protocol(protocol)
200-
.build()
201-
.async();
202-
203-
arangoDB.getVersion().get();
204-
205-
// slow down the driver connection
206-
Latency toxic = getEndpoints().get(0).getProxy().toxics().latency("latency", ToxicDirection.DOWNSTREAM, 10_000);
207-
Thread.sleep(100);
208-
209-
// no failover for TimeoutException
210-
for (int i = 0; i < 2; i++) {
211-
Throwable thrown = catchThrowable(() -> arangoDB.getVersion().get()).getCause();
212-
thrown.printStackTrace();
213-
assertThat(thrown)
214-
.isInstanceOf(ArangoDBException.class)
215-
.extracting(Throwable::getCause)
216-
.isInstanceOf(TimeoutException.class);
217-
}
218-
219-
toxic.remove();
220-
Thread.sleep(100);
221-
222-
arangoDB.getVersion().get();
223-
arangoDB.shutdown();
224-
}
225-
226139

227140
@ParameterizedTest
228141
@EnumSource(Protocol.class)
@@ -306,7 +219,6 @@ void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, Inter
306219
es.schedule(() -> getEndpoints().get(0).disable(), 300, TimeUnit.MILLISECONDS);
307220

308221
Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class));
309-
thrown.printStackTrace();
310222
assertThat(thrown).isInstanceOf(ArangoDBException.class);
311223
assertThat(thrown.getCause()).isInstanceOf(IOException.class);
312224
if (protocol != Protocol.VST) {
@@ -344,7 +256,6 @@ void notRetryPostOnClosedConnectionAsync(Protocol protocol) throws IOException,
344256
es.schedule(() -> getEndpoints().get(0).disable(), 300, TimeUnit.MILLISECONDS);
345257

346258
Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class).get()).getCause();
347-
thrown.printStackTrace();
348259
assertThat(thrown).isInstanceOf(ArangoDBException.class);
349260
assertThat(thrown.getCause()).isInstanceOf(IOException.class);
350261
if (protocol != Protocol.VST) {

0 commit comments

Comments
 (0)