Skip to content

Commit cbc2baf

Browse files
committed
faster resilience tests
1 parent 6c0820f commit cbc2baf

File tree

7 files changed

+28
-19
lines changed

7 files changed

+28
-19
lines changed

Diff for: resilience-tests/src/test/java/resilience/connection/ConnectionClusterTest.java

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import ch.qos.logback.classic.Level;
44
import com.arangodb.*;
5+
import org.junit.jupiter.api.Disabled;
56
import org.junit.jupiter.params.ParameterizedTest;
67
import org.junit.jupiter.params.provider.MethodSource;
78
import resilience.ClusterTest;
@@ -20,7 +21,9 @@ class ConnectionClusterTest extends ClusterTest {
2021

2122
@ParameterizedTest
2223
@MethodSource("protocolProvider")
24+
@Disabled
2325
void nameResolutionFail(Protocol protocol) {
26+
// FIXME: make this test faster and re-enable
2427
ArangoDB arangoDB = new ArangoDB.Builder()
2528
.host("wrongHost", 8529)
2629
.protocol(protocol)
@@ -40,7 +43,9 @@ void nameResolutionFail(Protocol protocol) {
4043

4144
@ParameterizedTest
4245
@MethodSource("protocolProvider")
46+
@Disabled
4347
void nameResolutionFailAsync(Protocol protocol) {
48+
// FIXME: make this test faster and re-enable
4449
ArangoDBAsync arangoDB = new ArangoDB.Builder()
4550
.host("wrongHost", 8529)
4651
.protocol(protocol)
@@ -61,7 +66,9 @@ void nameResolutionFailAsync(Protocol protocol) {
6166

6267
@ParameterizedTest
6368
@MethodSource("protocolProvider")
69+
@Disabled
6470
void nameResolutionFailover(Protocol protocol) {
71+
// FIXME: make this test faster and re-enable
6572
ArangoDB arangoDB = new ArangoDB.Builder()
6673
.password("test")
6774
.host("wrongHost", 8529)
@@ -80,7 +87,9 @@ void nameResolutionFailover(Protocol protocol) {
8087

8188
@ParameterizedTest
8289
@MethodSource("protocolProvider")
90+
@Disabled
8391
void nameResolutionFailoverAsync(Protocol protocol) throws ExecutionException, InterruptedException {
92+
// FIXME: make this test faster and re-enable
8493
ArangoDBAsync arangoDB = new ArangoDB.Builder()
8594
.password("test")
8695
.host("wrongHost", 8529)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class RetriableCursorTest extends SingleServerTest {
2323

2424
static Stream<ArangoDB> arangoProvider() {
25-
return builderProvider().map(it -> it.timeout(1_000).build());
25+
return builderProvider().map(it -> it.timeout(500).build());
2626
}
2727

2828
static Stream<ArangoDBAsync> asyncArangoProvider() {

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void unreachableHostAsync(ArangoDBAsync arangoDB) throws ExecutionException, Int
100100
@MethodSource("protocolProvider")
101101
void connectionTimeout(Protocol protocol) throws IOException, InterruptedException {
102102
ArangoDB arangoDB = dbBuilder()
103-
.timeout(1_000)
103+
.timeout(500)
104104
.protocol(protocol)
105105
.build();
106106

@@ -134,7 +134,7 @@ void connectionTimeout(Protocol protocol) throws IOException, InterruptedExcepti
134134
@MethodSource("protocolProvider")
135135
void connectionTimeoutAsync(Protocol protocol) throws IOException, InterruptedException, ExecutionException {
136136
ArangoDBAsync arangoDB = dbBuilder()
137-
.timeout(1_000)
137+
.timeout(500)
138138
.protocol(protocol)
139139
.build()
140140
.async();

Diff for: resilience-tests/src/test/java/resilience/shutdown/ShutdownClusterTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void shutdown(Protocol protocol) throws InterruptedException {
3333

3434
arangoDB.getVersion();
3535
arangoDB.shutdown();
36-
Thread.sleep(1_000);
36+
Thread.sleep(500);
3737
Throwable thrown = catchThrowable(arangoDB::getVersion);
3838
assertThat(thrown).isInstanceOf(ArangoDBException.class);
3939
assertThat(thrown.getMessage()).contains("closed");
@@ -49,7 +49,7 @@ void shutdownAsync(Protocol protocol) throws InterruptedException, ExecutionExce
4949

5050
arangoDB.getVersion().get();
5151
arangoDB.shutdown();
52-
Thread.sleep(1_000);
52+
Thread.sleep(500);
5353
Throwable thrown = catchThrowable(() -> arangoDB.getVersion().get()).getCause();
5454
assertThat(thrown).isInstanceOf(ArangoDBException.class);
5555
assertThat(thrown.getMessage()).contains("closed");

Diff for: resilience-tests/src/test/java/resilience/shutdown/ShutdownTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void shutdown(Protocol protocol) throws InterruptedException {
3333

3434
arangoDB.getVersion();
3535
arangoDB.shutdown();
36-
Thread.sleep(1_000);
36+
Thread.sleep(500);
3737
Throwable thrown = catchThrowable(arangoDB::getVersion);
3838
assertThat(thrown).isInstanceOf(ArangoDBException.class);
3939
assertThat(thrown.getMessage()).contains("closed");
@@ -49,7 +49,7 @@ void shutdownAsync(Protocol protocol) throws InterruptedException, ExecutionExce
4949

5050
arangoDB.getVersion().get();
5151
arangoDB.shutdown();
52-
Thread.sleep(1_000);
52+
Thread.sleep(500);
5353
Throwable thrown = catchThrowable(() -> arangoDB.getVersion().get()).getCause();
5454
assertThat(thrown).isInstanceOf(ArangoDBException.class);
5555
assertThat(thrown.getMessage()).contains("closed");

Diff for: resilience-tests/src/test/java/resilience/timeout/TimeoutClusterTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TimeoutClusterTest extends ClusterTest {
3030
@MethodSource("protocolProvider")
3131
void requestTimeout(Protocol protocol) throws InterruptedException {
3232
ArangoDB arangoDB = dbBuilder()
33-
.timeout(1_000)
33+
.timeout(500)
3434
.protocol(protocol)
3535
.build();
3636

@@ -41,7 +41,7 @@ void requestTimeout(Protocol protocol) throws InterruptedException {
4141
col.truncate();
4242

4343
Throwable thrown = catchThrowable(() -> arangoDB.db()
44-
.query("INSERT {value:sleep(2)} INTO @@col RETURN NEW",
44+
.query("INSERT {value:sleep(1)} INTO @@col RETURN NEW",
4545
Map.class,
4646
Collections.singletonMap("@col", colName))
4747
);
@@ -53,7 +53,7 @@ void requestTimeout(Protocol protocol) throws InterruptedException {
5353

5454
arangoDB.getVersion();
5555

56-
Thread.sleep(2_000);
56+
Thread.sleep(1_000);
5757
assertThat(col.count().getCount()).isEqualTo(1);
5858

5959
arangoDB.shutdown();
@@ -71,7 +71,7 @@ void requestTimeout(Protocol protocol) throws InterruptedException {
7171
@MethodSource("protocolProvider")
7272
void requestTimeoutAsync(Protocol protocol) throws InterruptedException, ExecutionException {
7373
ArangoDBAsync arangoDB = dbBuilder()
74-
.timeout(1_000)
74+
.timeout(500)
7575
.protocol(protocol)
7676
.build()
7777
.async();
@@ -83,7 +83,7 @@ void requestTimeoutAsync(Protocol protocol) throws InterruptedException, Executi
8383
col.truncate().get();
8484

8585
Throwable thrown = catchThrowable(() -> arangoDB.db()
86-
.query("INSERT {value:sleep(2)} INTO @@col RETURN NEW",
86+
.query("INSERT {value:sleep(1)} INTO @@col RETURN NEW",
8787
Map.class,
8888
Collections.singletonMap("@col", colName)).get()
8989
).getCause();
@@ -95,7 +95,7 @@ void requestTimeoutAsync(Protocol protocol) throws InterruptedException, Executi
9595

9696
arangoDB.getVersion().get();
9797

98-
Thread.sleep(2_000);
98+
Thread.sleep(1_000);
9999
assertThat(col.count().get().getCount()).isEqualTo(1);
100100

101101
arangoDB.shutdown();

Diff for: resilience-tests/src/test/java/resilience/timeout/TimeoutTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TimeoutTest extends SingleServerTest {
3131
@MethodSource("protocolProvider")
3232
void requestTimeout(Protocol protocol) throws InterruptedException {
3333
ArangoDB arangoDB = dbBuilder()
34-
.timeout(1_000)
34+
.timeout(500)
3535
.protocol(protocol)
3636
.build();
3737

@@ -42,7 +42,7 @@ void requestTimeout(Protocol protocol) throws InterruptedException {
4242
col.truncate();
4343

4444
Throwable thrown = catchThrowable(() -> arangoDB.db()
45-
.query("INSERT {value:sleep(2)} INTO @@col RETURN NEW",
45+
.query("INSERT {value:sleep(1)} INTO @@col RETURN NEW",
4646
Map.class,
4747
Collections.singletonMap("@col", colName))
4848
);
@@ -54,7 +54,7 @@ void requestTimeout(Protocol protocol) throws InterruptedException {
5454

5555
arangoDB.getVersion();
5656

57-
Thread.sleep(2_000);
57+
Thread.sleep(1_000);
5858
assertThat(col.count().getCount()).isEqualTo(1);
5959

6060
arangoDB.shutdown();
@@ -72,7 +72,7 @@ void requestTimeout(Protocol protocol) throws InterruptedException {
7272
@MethodSource("protocolProvider")
7373
void requestTimeoutAsync(Protocol protocol) throws InterruptedException, ExecutionException {
7474
ArangoDBAsync arangoDB = dbBuilder()
75-
.timeout(1_000)
75+
.timeout(500)
7676
.protocol(protocol)
7777
.build()
7878
.async();
@@ -84,7 +84,7 @@ void requestTimeoutAsync(Protocol protocol) throws InterruptedException, Executi
8484
col.truncate().get();
8585

8686
Throwable thrown = catchThrowable(() -> arangoDB.db()
87-
.query("INSERT {value:sleep(2)} INTO @@col RETURN NEW",
87+
.query("INSERT {value:sleep(1)} INTO @@col RETURN NEW",
8888
Map.class,
8989
Collections.singletonMap("@col", colName)).get()
9090
).getCause();
@@ -96,7 +96,7 @@ void requestTimeoutAsync(Protocol protocol) throws InterruptedException, Executi
9696

9797
arangoDB.getVersion().get();
9898

99-
Thread.sleep(2_000);
99+
Thread.sleep(1_000);
100100
assertThat(col.count().get().getCount()).isEqualTo(1);
101101

102102
arangoDB.shutdown();

0 commit comments

Comments
 (0)