@@ -79,7 +79,7 @@ void failoverAsync(ArangoDBAsync arangoDB) throws IOException {
79
79
assertThat (serverIdGET (arangoDB )).isEqualTo (endpoints .get (0 ).getServerId ());
80
80
}
81
81
82
- // FIXME: this only passes for HTTP, while fails for VST and HTTP2
82
+ // FIXME: this fails for VST
83
83
@ Disabled
84
84
@ ParameterizedTest (name = "{index}" )
85
85
@ MethodSource ("arangoProvider" )
@@ -105,13 +105,39 @@ void retryGET(ArangoDB arangoDB) throws IOException, InterruptedException {
105
105
es .shutdown ();
106
106
}
107
107
108
- // FIXME: this only passes for VST, while fails for HTTP and HTTP2:
109
- // for HTTP and HTTP2 it skips 2 hosts instead of skipping only the failing one
108
+ // FIXME: this fails for VST
110
109
@ Disabled
110
+ @ ParameterizedTest (name = "{index}" )
111
+ @ MethodSource ("asyncArangoProvider" )
112
+ void retryGETAsync (ArangoDBAsync arangoDB ) throws IOException , InterruptedException {
113
+ List <Endpoint > endpoints = getEndpoints ();
114
+
115
+ // slow down the driver connection
116
+ Latency toxic = getEndpoints ().get (0 ).getProxy ().toxics ().latency ("latency" , ToxicDirection .DOWNSTREAM , 10_000 );
117
+ Thread .sleep (100 );
118
+
119
+ ScheduledExecutorService es = Executors .newSingleThreadScheduledExecutor ();
120
+ es .schedule (() -> getEndpoints ().get (0 ).disable (), 300 , TimeUnit .MILLISECONDS );
121
+
122
+ assertThat (serverIdGET (arangoDB )).isEqualTo (endpoints .get (1 ).getServerId ());
123
+ assertThat (serverIdGET (arangoDB )).isEqualTo (endpoints .get (2 ).getServerId ());
124
+
125
+ toxic .remove ();
126
+ enableAllEndpoints ();
127
+ Thread .sleep (100 );
128
+
129
+ assertThat (serverIdGET (arangoDB )).isEqualTo (endpoints .get (0 ).getServerId ());
130
+
131
+ es .shutdown ();
132
+ }
133
+
111
134
@ ParameterizedTest (name = "{index}" )
112
135
@ MethodSource ("arangoProvider" )
113
136
void retryPOST (ArangoDB arangoDB ) throws IOException , InterruptedException {
114
137
List <Endpoint > endpoints = getEndpoints ();
138
+ for (Endpoint endpoint : endpoints ) {
139
+ System .out .println (endpoint .getServerId ());
140
+ }
115
141
116
142
// slow down the driver connection
117
143
Latency toxic = getEndpoints ().get (0 ).getProxy ().toxics ().latency ("latency" , ToxicDirection .DOWNSTREAM , 10_000 );
@@ -120,7 +146,7 @@ void retryPOST(ArangoDB arangoDB) throws IOException, InterruptedException {
120
146
ScheduledExecutorService es = Executors .newSingleThreadScheduledExecutor ();
121
147
es .schedule (() -> getEndpoints ().get (0 ).disable (), 300 , TimeUnit .MILLISECONDS );
122
148
123
- Throwable thrown = catchThrowable (()-> serverIdPOST (arangoDB ));
149
+ Throwable thrown = catchThrowable (() -> serverIdPOST (arangoDB ));
124
150
assertThat (thrown ).isInstanceOf (ArangoDBException .class );
125
151
assertThat (thrown .getCause ()).isInstanceOf (IOException .class );
126
152
@@ -129,8 +155,37 @@ void retryPOST(ArangoDB arangoDB) throws IOException, InterruptedException {
129
155
130
156
toxic .remove ();
131
157
enableAllEndpoints ();
158
+
159
+ assertThat (serverIdPOST (arangoDB )).isEqualTo (endpoints .get (0 ).getServerId ());
160
+
161
+ es .shutdown ();
162
+ }
163
+
164
+ @ ParameterizedTest (name = "{index}" )
165
+ @ MethodSource ("asyncArangoProvider" )
166
+ void retryPOSTAsync (ArangoDBAsync arangoDB ) throws IOException , InterruptedException {
167
+ List <Endpoint > endpoints = getEndpoints ();
168
+ for (Endpoint endpoint : endpoints ) {
169
+ System .out .println (endpoint .getServerId ());
170
+ }
171
+
172
+ // slow down the driver connection
173
+ Latency toxic = getEndpoints ().get (0 ).getProxy ().toxics ().latency ("latency" , ToxicDirection .DOWNSTREAM , 10_000 );
132
174
Thread .sleep (100 );
133
175
176
+ ScheduledExecutorService es = Executors .newSingleThreadScheduledExecutor ();
177
+ es .schedule (() -> getEndpoints ().get (0 ).disable (), 300 , TimeUnit .MILLISECONDS );
178
+
179
+ Throwable thrown = catchThrowable (() -> serverIdPOST (arangoDB ));
180
+ assertThat (thrown ).isInstanceOf (ArangoDBException .class );
181
+ assertThat (thrown .getCause ()).isInstanceOf (IOException .class );
182
+
183
+ assertThat (serverIdPOST (arangoDB )).isEqualTo (endpoints .get (1 ).getServerId ());
184
+ assertThat (serverIdPOST (arangoDB )).isEqualTo (endpoints .get (2 ).getServerId ());
185
+
186
+ toxic .remove ();
187
+ enableAllEndpoints ();
188
+
134
189
assertThat (serverIdPOST (arangoDB )).isEqualTo (endpoints .get (0 ).getServerId ());
135
190
136
191
es .shutdown ();
0 commit comments