File tree 2 files changed +4
-7
lines changed
main/java/io/trino/client/auth/external
test/java/io/trino/client/auth/external
2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change 37
37
import static io .trino .client .JsonCodec .jsonCodec ;
38
38
import static io .trino .client .JsonResponse .execute ;
39
39
import static java .lang .String .format ;
40
+ import static java .net .HttpURLConnection .HTTP_INTERNAL_ERROR ;
40
41
import static java .net .HttpURLConnection .HTTP_OK ;
41
42
import static java .net .HttpURLConnection .HTTP_UNAVAILABLE ;
42
43
import static java .time .temporal .ChronoUnit .MILLIS ;
@@ -96,7 +97,7 @@ public void tokenReceived(URI tokenUri)
96
97
.withMaxAttempts (-1 )
97
98
.withMaxDuration (Duration .ofSeconds (4 ))
98
99
.withBackoff (100 , 500 , MILLIS )
99
- .handleResultIf (code -> code != HTTP_OK ))
100
+ .handleResultIf (code -> code >= HTTP_INTERNAL_ERROR ))
100
101
.get (() -> {
101
102
Request request = prepareRequestBuilder (tokenUri )
102
103
.delete ()
Original file line number Diff line number Diff line change @@ -176,20 +176,16 @@ public void testTokenReceived()
176
176
}
177
177
178
178
@ Test
179
- public void testTokenReceivedRetriesUntilHTTP_OK ()
179
+ public void testTokenReceivedRetriesUntilNotErrorReturned ()
180
180
{
181
181
server .enqueue (status (HTTP_UNAVAILABLE ));
182
182
server .enqueue (status (HTTP_UNAVAILABLE ));
183
183
server .enqueue (status (HTTP_UNAVAILABLE ));
184
184
server .enqueue (status (202 ));
185
- server .enqueue (status (303 ));
186
- server .enqueue (status (HTTP_OK ));
187
- server .enqueue (status (HTTP_OK ));
188
- server .enqueue (status (HTTP_OK ));
189
185
190
186
tokenPoller .tokenReceived (tokenUri ());
191
187
192
- assertThat (server .getRequestCount ()).isEqualTo (6 );
188
+ assertThat (server .getRequestCount ()).isEqualTo (4 );
193
189
}
194
190
195
191
@ Test
You can’t perform that action at this time.
0 commit comments