From 5cee6e927a66203254a054d6d9020bc803cc6612 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Wed, 20 Dec 2023 14:09:49 +0100 Subject: [PATCH 1/8] updated vertx to version 4.5 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 6201da70c..b9c7dcbd9 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ org.junit junit-bom - 5.10.0 + 5.10.1 pom import @@ -182,7 +182,7 @@ com.tngtech.archunit archunit-junit5 - 1.1.0 + 1.2.1 org.eclipse @@ -192,7 +192,7 @@ io.vertx vertx-stack-depchain - 4.4.2 + 4.5.1 pom import From 8b3d62a76dadf7c4ee27dbecdccdc71bfe374dff Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Fri, 12 Jan 2024 13:51:44 +0100 Subject: [PATCH 2/8] native image fix --- driver/pom.xml | 4 ++-- .../test/java/graal/BrotliSubstitutions.java | 22 +++++++++++++++++++ .../test/java/graal/VertxSubstitutions.java | 2 +- pom.xml | 8 +------ .../main/java/graal/VertxSubstitutions.java | 2 +- 5 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 driver/src/test/java/graal/BrotliSubstitutions.java diff --git a/driver/pom.xml b/driver/pom.xml index f730ed129..5720d49bc 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -186,8 +186,8 @@ org.graalvm.sdk graal-sdk - 22.3.3 - test + 23.1.1 + provided io.smallrye.config diff --git a/driver/src/test/java/graal/BrotliSubstitutions.java b/driver/src/test/java/graal/BrotliSubstitutions.java new file mode 100644 index 000000000..fee8b14a1 --- /dev/null +++ b/driver/src/test/java/graal/BrotliSubstitutions.java @@ -0,0 +1,22 @@ +package graal; + +import com.oracle.svm.core.annotate.Substitute; +import com.oracle.svm.core.annotate.TargetClass; + + +@TargetClass(className = "io.netty.handler.codec.compression.Brotli") +final class Target_com_arangodb_shaded_netty_handler_codec_compression_Brotli { + @Substitute + public static boolean isAvailable() { + return false; + } + + @Substitute + public static void ensureAvailability() throws Throwable { + throw new UnsupportedOperationException(); + } +} + +public class BrotliSubstitutions { + +} diff --git a/driver/src/test/java/graal/VertxSubstitutions.java b/driver/src/test/java/graal/VertxSubstitutions.java index 043815fbc..472a2e1c8 100644 --- a/driver/src/test/java/graal/VertxSubstitutions.java +++ b/driver/src/test/java/graal/VertxSubstitutions.java @@ -82,7 +82,7 @@ public void close(Promise promise) { } @Substitute - public MessageImpl createMessage(boolean send, String address, MultiMap headers, Object body, String codecName) { + public MessageImpl createMessage(boolean send, boolean isLocal, String address, MultiMap headers, Object body, String codecName) { throw new RuntimeException("Not Implemented"); } diff --git a/pom.xml b/pom.xml index b9c7dcbd9..115e8fb8a 100644 --- a/pom.xml +++ b/pom.xml @@ -405,7 +405,7 @@ org.graalvm.buildtools native-maven-plugin - 0.9.27 + 0.9.28 true @@ -432,12 +432,6 @@ - - com.aayushatharva.brotli4j - brotli4j - 1.11.0 - test - javax.annotation javax.annotation-api diff --git a/shaded/src/main/java/graal/VertxSubstitutions.java b/shaded/src/main/java/graal/VertxSubstitutions.java index 5e9eb9ff4..8b2daa98b 100644 --- a/shaded/src/main/java/graal/VertxSubstitutions.java +++ b/shaded/src/main/java/graal/VertxSubstitutions.java @@ -82,7 +82,7 @@ public void close(Promise promise) { } @Substitute - public MessageImpl createMessage(boolean send, String address, MultiMap headers, Object body, String codecName) { + public MessageImpl createMessage(boolean send, boolean isLocal, String address, MultiMap headers, Object body, String codecName) { throw new RuntimeException("Not Implemented"); } From e8ac4db2b165b74c67a01d5e287ed74393db6245 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Fri, 12 Jan 2024 14:11:57 +0100 Subject: [PATCH 3/8] re-enabled timeout resilience tests with HTTP/2 --- .../test/java/resilience/retry/RetryClusterTest.java | 10 ---------- .../src/test/java/resilience/retry/RetryTest.java | 10 ---------- .../java/resilience/timeout/TimeoutClusterTest.java | 10 ---------- .../src/test/java/resilience/timeout/TimeoutTest.java | 10 ---------- 4 files changed, 40 deletions(-) diff --git a/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java b/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java index ab76f27af..6cf0e1b75 100644 --- a/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java +++ b/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java @@ -146,11 +146,6 @@ void unreachableHostFailoverAsync(ArangoDBAsync arangoDB) throws ExecutionExcept @ParameterizedTest @EnumSource(Protocol.class) void connectionTimeout(Protocol protocol) throws IOException, InterruptedException { - // https://github.com/vert-x3/vertx-web/issues/2296 - // WebClient: HTTP/2 request timeout does not throw TimeoutException - assumeTrue(protocol != Protocol.HTTP2_VPACK); - assumeTrue(protocol != Protocol.HTTP2_JSON); - ArangoDB arangoDB = dbBuilder() .timeout(1_000) .protocol(protocol) @@ -189,11 +184,6 @@ void connectionTimeout(Protocol protocol) throws IOException, InterruptedExcepti @ParameterizedTest @EnumSource(Protocol.class) void connectionTimeoutAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException { - // https://github.com/vert-x3/vertx-web/issues/2296 - // WebClient: HTTP/2 request timeout does not throw TimeoutException - assumeTrue(protocol != Protocol.HTTP2_VPACK); - assumeTrue(protocol != Protocol.HTTP2_JSON); - ArangoDBAsync arangoDB = dbBuilder() .timeout(1_000) .protocol(protocol) diff --git a/resilience-tests/src/test/java/resilience/retry/RetryTest.java b/resilience-tests/src/test/java/resilience/retry/RetryTest.java index 0fce057c4..f45b7df22 100644 --- a/resilience-tests/src/test/java/resilience/retry/RetryTest.java +++ b/resilience-tests/src/test/java/resilience/retry/RetryTest.java @@ -113,11 +113,6 @@ void unreachableHostAsync(ArangoDBAsync arangoDB) throws ExecutionException, Int @ParameterizedTest @EnumSource(Protocol.class) void connectionTimeout(Protocol protocol) throws IOException, InterruptedException { - // https://github.com/vert-x3/vertx-web/issues/2296 - // WebClient: HTTP/2 request timeout does not throw TimeoutException - assumeTrue(protocol != Protocol.HTTP2_VPACK); - assumeTrue(protocol != Protocol.HTTP2_JSON); - ArangoDB arangoDB = dbBuilder() .timeout(1_000) .protocol(protocol) @@ -153,11 +148,6 @@ void connectionTimeout(Protocol protocol) throws IOException, InterruptedExcepti @ParameterizedTest @EnumSource(Protocol.class) void connectionTimeoutAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException { - // https://github.com/vert-x3/vertx-web/issues/2296 - // WebClient: HTTP/2 request timeout does not throw TimeoutException - assumeTrue(protocol != Protocol.HTTP2_VPACK); - assumeTrue(protocol != Protocol.HTTP2_JSON); - ArangoDBAsync arangoDB = dbBuilder() .timeout(1_000) .protocol(protocol) diff --git a/resilience-tests/src/test/java/resilience/timeout/TimeoutClusterTest.java b/resilience-tests/src/test/java/resilience/timeout/TimeoutClusterTest.java index f5480b607..fc7bf15f7 100644 --- a/resilience-tests/src/test/java/resilience/timeout/TimeoutClusterTest.java +++ b/resilience-tests/src/test/java/resilience/timeout/TimeoutClusterTest.java @@ -31,11 +31,6 @@ class TimeoutClusterTest extends ClusterTest { @ParameterizedTest @EnumSource(Protocol.class) void requestTimeout(Protocol protocol) throws InterruptedException { - // https://github.com/vert-x3/vertx-web/issues/2296 - // WebClient: HTTP/2 request timeout does not throw TimeoutException - assumeTrue(protocol != Protocol.HTTP2_VPACK); - assumeTrue(protocol != Protocol.HTTP2_JSON); - ArangoDB arangoDB = dbBuilder() .timeout(1_000) .protocol(protocol) @@ -77,11 +72,6 @@ void requestTimeout(Protocol protocol) throws InterruptedException { @ParameterizedTest @EnumSource(Protocol.class) void requestTimeoutAsync(Protocol protocol) throws InterruptedException, ExecutionException { - // https://github.com/vert-x3/vertx-web/issues/2296 - // WebClient: HTTP/2 request timeout does not throw TimeoutException - assumeTrue(protocol != Protocol.HTTP2_VPACK); - assumeTrue(protocol != Protocol.HTTP2_JSON); - ArangoDBAsync arangoDB = dbBuilder() .timeout(1_000) .protocol(protocol) diff --git a/resilience-tests/src/test/java/resilience/timeout/TimeoutTest.java b/resilience-tests/src/test/java/resilience/timeout/TimeoutTest.java index a6c562eee..306bf5b5e 100644 --- a/resilience-tests/src/test/java/resilience/timeout/TimeoutTest.java +++ b/resilience-tests/src/test/java/resilience/timeout/TimeoutTest.java @@ -30,11 +30,6 @@ class TimeoutTest extends SingleServerTest { @ParameterizedTest @EnumSource(Protocol.class) void requestTimeout(Protocol protocol) throws InterruptedException { - // https://github.com/vert-x3/vertx-web/issues/2296 - // WebClient: HTTP/2 request timeout does not throw TimeoutException - assumeTrue(protocol != Protocol.HTTP2_VPACK); - assumeTrue(protocol != Protocol.HTTP2_JSON); - ArangoDB arangoDB = dbBuilder() .timeout(1_000) .protocol(protocol) @@ -76,11 +71,6 @@ void requestTimeout(Protocol protocol) throws InterruptedException { @ParameterizedTest @EnumSource(Protocol.class) void requestTimeoutAsync(Protocol protocol) throws InterruptedException, ExecutionException { - // https://github.com/vert-x3/vertx-web/issues/2296 - // WebClient: HTTP/2 request timeout does not throw TimeoutException - assumeTrue(protocol != Protocol.HTTP2_VPACK); - assumeTrue(protocol != Protocol.HTTP2_JSON); - ArangoDBAsync arangoDB = dbBuilder() .timeout(1_000) .protocol(protocol) From ee2d3ddade719299e2fe2df527504be3a1906103 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Fri, 12 Jan 2024 14:19:24 +0100 Subject: [PATCH 4/8] test fix --- .github/workflows/test.yml | 2 +- .../src/test/java/com/arangodb/ArangoCollectionAsyncTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ee1d5d0f9..d1e8fe0fc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -132,7 +132,7 @@ jobs: db-ext-names: - false java-version: - - 11 + - 21 user-language: - en diff --git a/driver/src/test/java/com/arangodb/ArangoCollectionAsyncTest.java b/driver/src/test/java/com/arangodb/ArangoCollectionAsyncTest.java index 8e765e409..908578dce 100644 --- a/driver/src/test/java/com/arangodb/ArangoCollectionAsyncTest.java +++ b/driver/src/test/java/com/arangodb/ArangoCollectionAsyncTest.java @@ -2987,7 +2987,7 @@ void grantAccessRW(ArangoCollectionAsync collection) throws ExecutionException, ArangoDBAsync arangoDB = collection.db().arango(); try { arangoDB.createUser("user1", "1234", null).get(); - collection.grantAccess("user1", Permissions.RW); + collection.grantAccess("user1", Permissions.RW).get(); } finally { arangoDB.deleteUser("user1").get(); } From 3360128f9541dc22307a4ea67d14500dbe89d127 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Fri, 12 Jan 2024 17:36:05 +0100 Subject: [PATCH 5/8] fixed native tests on Liberica NIK --- driver/pom.xml | 4 ++-- pom.xml | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/driver/pom.xml b/driver/pom.xml index 5720d49bc..6a72445fb 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -186,8 +186,8 @@ org.graalvm.sdk graal-sdk - 23.1.1 - provided + ${graalvm.version} + test io.smallrye.config diff --git a/pom.xml b/pom.xml index 115e8fb8a..822711c99 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,7 @@ arangodb-1 https://sonarcloud.io 2.16.0 + 23.1.1 @@ -438,6 +439,12 @@ 1.3.2 test + + org.graalvm.truffle + truffle-runtime + ${graalvm.version} + test + From c71fe3bb5f57c3792d6bb1e2712a15f7a2573f03 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Fri, 12 Jan 2024 18:00:30 +0100 Subject: [PATCH 6/8] resilience tests: wait after enabling and disabling endpoints --- .../java/resilience/ActiveFailoverTest.java | 66 ------------------- .../src/test/java/resilience/ClusterTest.java | 6 +- .../LoadBalanceNoneClusterTest.java | 17 +++-- .../LoadBalanceRoundRobinClusterTest.java | 12 ++-- 4 files changed, 16 insertions(+), 85 deletions(-) delete mode 100644 resilience-tests/src/test/java/resilience/ActiveFailoverTest.java diff --git a/resilience-tests/src/test/java/resilience/ActiveFailoverTest.java b/resilience-tests/src/test/java/resilience/ActiveFailoverTest.java deleted file mode 100644 index bad70d4c1..000000000 --- a/resilience-tests/src/test/java/resilience/ActiveFailoverTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package resilience; - -import com.arangodb.ArangoDB; -import resilience.utils.MemoryAppender; -import eu.rekawek.toxiproxy.Proxy; -import eu.rekawek.toxiproxy.ToxiproxyClient; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Tag; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -@Tag("activeFailover") -public abstract class ActiveFailoverTest { - - protected static final String HOST = "127.0.0.1"; - protected static final String PASSWORD = "test"; - protected static final MemoryAppender logs = new MemoryAppender(); - private static final List endpoints = Arrays.asList( - new Endpoint("activeFailover1", HOST, 18529, "172.28.0.1:8529"), - new Endpoint("activeFailover2", HOST, 18539, "172.28.0.1:8539"), - new Endpoint("activeFailover3", HOST, 18549, "172.28.0.1:8549") - ); - - @BeforeAll - static void beforeAll() throws IOException { - ToxiproxyClient client = new ToxiproxyClient(HOST, 8474); - for (Endpoint ph : endpoints) { - Proxy p = client.getProxyOrNull(ph.getName()); - if (p != null) { - p.delete(); - } - ph.setProxy(client.createProxy(ph.getName(), ph.getHost() + ":" + ph.getPort(), ph.getUpstream())); - } - } - - @AfterAll - static void afterAll() throws IOException { - for (Endpoint ph : endpoints) { - ph.getProxy().delete(); - } - } - - @BeforeEach - void beforeEach() throws IOException { - for (Endpoint ph : endpoints) { - ph.getProxy().enable(); - } - } - - protected static List getEndpoints() { - return endpoints; - } - - protected static ArangoDB.Builder dbBuilder() { - ArangoDB.Builder builder = new ArangoDB.Builder().password(PASSWORD); - for (Endpoint ph : endpoints) { - builder.host(ph.getHost(), ph.getPort()); - } - return builder; - } - -} diff --git a/resilience-tests/src/test/java/resilience/ClusterTest.java b/resilience-tests/src/test/java/resilience/ClusterTest.java index bfe88d6e4..d16f4cbfa 100644 --- a/resilience-tests/src/test/java/resilience/ClusterTest.java +++ b/resilience-tests/src/test/java/resilience/ClusterTest.java @@ -50,10 +50,8 @@ static void afterAll() throws IOException { } @BeforeEach - void beforeEach() throws IOException { - for (Endpoint endpoint : endpoints) { - endpoint.getProxy().enable(); - } + void beforeEach() { + enableAllEndpoints(); } protected static List getEndpoints() { diff --git a/resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceNoneClusterTest.java b/resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceNoneClusterTest.java index f5a9eccee..5cbd94f06 100644 --- a/resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceNoneClusterTest.java +++ b/resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceNoneClusterTest.java @@ -7,7 +7,6 @@ import com.arangodb.entity.LoadBalancingStrategy; import eu.rekawek.toxiproxy.model.ToxicDirection; import eu.rekawek.toxiproxy.model.toxic.Latency; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import resilience.ClusterTest; @@ -55,20 +54,20 @@ void loadBalancingAsync(ArangoDBAsync arangoDB) { @ParameterizedTest(name = "{index}") @MethodSource("arangoProvider") - void failover(ArangoDB arangoDB) throws IOException { + void failover(ArangoDB arangoDB) { List endpoints = getEndpoints(); - endpoints.get(0).getProxy().disable(); + endpoints.get(0).disable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId()); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId()); enableAllEndpoints(); - endpoints.get(1).getProxy().disable(); + endpoints.get(1).disable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId()); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId()); enableAllEndpoints(); - endpoints.get(2).getProxy().disable(); + endpoints.get(2).disable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId()); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId()); enableAllEndpoints(); @@ -76,20 +75,20 @@ void failover(ArangoDB arangoDB) throws IOException { @ParameterizedTest(name = "{index}") @MethodSource("asyncArangoProvider") - void failoverAsync(ArangoDBAsync arangoDB) throws IOException { + void failoverAsync(ArangoDBAsync arangoDB) { List endpoints = getEndpoints(); - endpoints.get(0).getProxy().disable(); + endpoints.get(0).disable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId()); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId()); enableAllEndpoints(); - endpoints.get(1).getProxy().disable(); + endpoints.get(1).disable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId()); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId()); enableAllEndpoints(); - endpoints.get(2).getProxy().disable(); + endpoints.get(2).disable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId()); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId()); enableAllEndpoints(); diff --git a/resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceRoundRobinClusterTest.java b/resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceRoundRobinClusterTest.java index 195dfe90f..34d5c55b2 100644 --- a/resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceRoundRobinClusterTest.java +++ b/resilience-tests/src/test/java/resilience/loadbalance/LoadBalanceRoundRobinClusterTest.java @@ -59,22 +59,22 @@ void loadBalancingAsync(ArangoDBAsync arangoDB) { @ParameterizedTest(name = "{index}") @MethodSource("arangoProvider") - void failover(ArangoDB arangoDB) throws IOException { + void failover(ArangoDB arangoDB) { List endpoints = getEndpoints(); - endpoints.get(0).getProxy().disable(); + endpoints.get(0).disable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId()); - endpoints.get(0).getProxy().enable(); + endpoints.get(0).enable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId()); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId()); } @ParameterizedTest(name = "{index}") @MethodSource("asyncArangoProvider") - void failoverAsync(ArangoDBAsync arangoDB) throws IOException { + void failoverAsync(ArangoDBAsync arangoDB) { List endpoints = getEndpoints(); - endpoints.get(0).getProxy().disable(); + endpoints.get(0).disable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(1).getServerId()); - endpoints.get(0).getProxy().enable(); + endpoints.get(0).enable(); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(2).getServerId()); assertThat(serverIdGET(arangoDB)).isEqualTo(endpoints.get(0).getServerId()); } From fa7f76d42b4fc8df5d6657b88c856d073c6b66b0 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Fri, 12 Jan 2024 19:14:31 +0100 Subject: [PATCH 7/8] CI: fixed native tests --- pom.xml | 6 ------ .../src/test/java/resilience/retry/RetryClusterTest.java | 4 ---- .../src/test/java/resilience/retry/RetryTest.java | 6 ------ 3 files changed, 16 deletions(-) diff --git a/pom.xml b/pom.xml index 822711c99..f298ca802 100644 --- a/pom.xml +++ b/pom.xml @@ -439,12 +439,6 @@ 1.3.2 test - - org.graalvm.truffle - truffle-runtime - ${graalvm.version} - test - diff --git a/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java b/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java index 6cf0e1b75..fcb606313 100644 --- a/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java +++ b/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java @@ -160,7 +160,6 @@ void connectionTimeout(Protocol protocol) throws IOException, InterruptedExcepti // no failover for TimeoutException for (int i = 0; i < 2; i++) { Throwable thrown = catchThrowable(arangoDB::getVersion); - thrown.printStackTrace(); assertThat(thrown) .isInstanceOf(ArangoDBException.class) .extracting(Throwable::getCause) @@ -199,7 +198,6 @@ void connectionTimeoutAsync(Protocol protocol) throws IOException, InterruptedEx // no failover for TimeoutException for (int i = 0; i < 2; i++) { Throwable thrown = catchThrowable(() -> arangoDB.getVersion().get()).getCause(); - thrown.printStackTrace(); assertThat(thrown) .isInstanceOf(ArangoDBException.class) .extracting(Throwable::getCause) @@ -296,7 +294,6 @@ void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, Inter es.schedule(() -> getEndpoints().get(0).disable(), 300, TimeUnit.MILLISECONDS); Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class)); - thrown.printStackTrace(); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(IOException.class); if (protocol != Protocol.VST) { @@ -334,7 +331,6 @@ void notRetryPostOnClosedConnectionAsync(Protocol protocol) throws IOException, es.schedule(() -> getEndpoints().get(0).disable(), 300, TimeUnit.MILLISECONDS); Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class).get()).getCause(); - thrown.printStackTrace(); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(IOException.class); if (protocol != Protocol.VST) { diff --git a/resilience-tests/src/test/java/resilience/retry/RetryTest.java b/resilience-tests/src/test/java/resilience/retry/RetryTest.java index f45b7df22..84441e5d3 100644 --- a/resilience-tests/src/test/java/resilience/retry/RetryTest.java +++ b/resilience-tests/src/test/java/resilience/retry/RetryTest.java @@ -125,7 +125,6 @@ void connectionTimeout(Protocol protocol) throws IOException, InterruptedExcepti Thread.sleep(100); Throwable thrown = catchThrowable(arangoDB::getVersion); - thrown.printStackTrace(); assertThat(thrown) .isInstanceOf(ArangoDBException.class) .extracting(Throwable::getCause) @@ -161,7 +160,6 @@ void connectionTimeoutAsync(Protocol protocol) throws IOException, InterruptedEx Thread.sleep(100); Throwable thrown = catchThrowable(() -> arangoDB.getVersion().get()).getCause(); - thrown.printStackTrace(); assertThat(thrown) .isInstanceOf(ArangoDBException.class) .extracting(Throwable::getCause) @@ -203,7 +201,6 @@ void retryGetOnClosedConnection(Protocol protocol) throws IOException, Interrupt es.schedule(() -> getEndpoint().disable(), 300, TimeUnit.MILLISECONDS); Throwable thrown = catchThrowable(arangoDB::getVersion); - thrown.printStackTrace(); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(ArangoDBMultipleException.class); List exceptions = ((ArangoDBMultipleException) thrown.getCause()).getExceptions(); @@ -250,7 +247,6 @@ void retryGetOnClosedConnectionAsync(Protocol protocol) throws IOException, Inte es.schedule(() -> getEndpoint().disable(), 300, TimeUnit.MILLISECONDS); Throwable thrown = catchThrowable(() -> arangoDB.getVersion().get()).getCause(); - thrown.printStackTrace(); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(ArangoDBMultipleException.class); List exceptions = ((ArangoDBMultipleException) thrown.getCause()).getExceptions(); @@ -291,7 +287,6 @@ void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, Inter es.schedule(() -> getEndpoint().disable(), 300, TimeUnit.MILLISECONDS); Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class)); - thrown.printStackTrace(); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(IOException.class); if (protocol != Protocol.VST) { @@ -329,7 +324,6 @@ void notRetryPostOnClosedConnectionAsync(Protocol protocol) throws IOException, es.schedule(() -> getEndpoint().disable(), 300, TimeUnit.MILLISECONDS); Throwable thrown = catchThrowable(() -> arangoDB.db().query("return null", Void.class).get()).getCause(); - thrown.printStackTrace(); assertThat(thrown).isInstanceOf(ArangoDBException.class); assertThat(thrown.getCause()).isInstanceOf(IOException.class); if (protocol != Protocol.VST) { From 716a73b7b97ce020ba7e1ba7871ee17972498f90 Mon Sep 17 00:00:00 2001 From: Michele Rastelli Date: Mon, 15 Jan 2024 12:24:32 +0100 Subject: [PATCH 8/8] removed duplicated resilience tests --- .../resilience/retry/RetryClusterTest.java | 75 ------------------- 1 file changed, 75 deletions(-) diff --git a/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java b/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java index fcb606313..560c504f5 100644 --- a/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java +++ b/resilience-tests/src/test/java/resilience/retry/RetryClusterTest.java @@ -136,81 +136,6 @@ void unreachableHostFailoverAsync(ArangoDBAsync arangoDB) throws ExecutionExcept arangoDB.shutdown(); } - /** - * on delayed response: - * - ArangoDBException with cause TimeoutException - *

- * once the delay is removed: - * - the subsequent requests should be successful - */ - @ParameterizedTest - @EnumSource(Protocol.class) - void connectionTimeout(Protocol protocol) throws IOException, InterruptedException { - ArangoDB arangoDB = dbBuilder() - .timeout(1_000) - .protocol(protocol) - .build(); - - arangoDB.getVersion(); - - // slow down the driver connection - Latency toxic = getEndpoints().get(0).getProxy().toxics().latency("latency", ToxicDirection.DOWNSTREAM, 10_000); - Thread.sleep(100); - - // no failover for TimeoutException - for (int i = 0; i < 2; i++) { - Throwable thrown = catchThrowable(arangoDB::getVersion); - assertThat(thrown) - .isInstanceOf(ArangoDBException.class) - .extracting(Throwable::getCause) - .isInstanceOf(TimeoutException.class); - } - - toxic.remove(); - Thread.sleep(100); - - arangoDB.getVersion(); - arangoDB.shutdown(); - } - - /** - * on delayed response: - * - ArangoDBException with cause TimeoutException - *

- * once the delay is removed: - * - the subsequent requests should be successful - */ - @ParameterizedTest - @EnumSource(Protocol.class) - void connectionTimeoutAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException { - ArangoDBAsync arangoDB = dbBuilder() - .timeout(1_000) - .protocol(protocol) - .build() - .async(); - - arangoDB.getVersion().get(); - - // slow down the driver connection - Latency toxic = getEndpoints().get(0).getProxy().toxics().latency("latency", ToxicDirection.DOWNSTREAM, 10_000); - Thread.sleep(100); - - // no failover for TimeoutException - for (int i = 0; i < 2; i++) { - Throwable thrown = catchThrowable(() -> arangoDB.getVersion().get()).getCause(); - assertThat(thrown) - .isInstanceOf(ArangoDBException.class) - .extracting(Throwable::getCause) - .isInstanceOf(TimeoutException.class); - } - - toxic.remove(); - Thread.sleep(100); - - arangoDB.getVersion().get(); - arangoDB.shutdown(); - } - @ParameterizedTest @EnumSource(Protocol.class)