3636public class RetryableInternalErrorTest extends AbstractMockServerTest {
3737 @ Test
3838 public void testTranslateInternalException () {
39+ mockSpanner .setBatchCreateSessionsExecutionTime (
40+ SimulatedExecutionTime .ofException (
41+ Status .INTERNAL
42+ .withDescription ("Authentication backend internal server error. Please retry." )
43+ .asRuntimeException ()));
44+ mockSpanner .setExecuteStreamingSqlExecutionTime (
45+ SimulatedExecutionTime .ofException (
46+ Status .INTERNAL
47+ .withDescription ("Authentication backend internal server error. Please retry." )
48+ .asRuntimeException ()));
49+
3950 try (Spanner spanner =
4051 SpannerOptions .newBuilder ()
4152 .setProjectId ("my-project" )
@@ -46,22 +57,12 @@ public void testTranslateInternalException() {
4657 SessionPoolOptions .newBuilder ()
4758 .setMinSessions (1 )
4859 .setMaxSessions (1 )
49- .setWaitForMinSessions (Duration .ofSeconds (1 ))
60+ .setWaitForMinSessions (Duration .ofSeconds (5 ))
5061 .build ())
5162 .build ()
5263 .getService ()) {
53- DatabaseClient client = spanner .getDatabaseClient (DatabaseId .of ("p" , "i" , "d" ));
54- mockSpanner .setBatchCreateSessionsExecutionTime (
55- SimulatedExecutionTime .ofException (
56- Status .INTERNAL
57- .withDescription ("Authentication backend internal server error. Please retry." )
58- .asRuntimeException ()));
59- mockSpanner .setExecuteStreamingSqlExecutionTime (
60- SimulatedExecutionTime .ofException (
61- Status .INTERNAL
62- .withDescription ("Authentication backend internal server error. Please retry." )
63- .asRuntimeException ()));
6464
65+ DatabaseClient client = spanner .getDatabaseClient (DatabaseId .of ("p" , "i" , "d" ));
6566 // Execute a query. This will block until a BatchCreateSessions call has finished and then
6667 // invoke ExecuteStreamingSql. Both of these RPCs should be retried.
6768 try (ResultSet resultSet = client .singleUse ().executeQuery (SELECT1_STATEMENT )) {
0 commit comments