@@ -64,7 +64,7 @@ public void setUp() throws Exception {
6464
6565 @ Test
6666 public void runAbort () {
67- runTransaction (createRetryException ());
67+ runTransaction (createRetryException (Status . Code . ABORTED ));
6868 ArgumentCaptor <Long > backoffMillis = ArgumentCaptor .forClass (Long .class );
6969 verify (sleeper , times (1 )).backoffSleep (Mockito .<Context >any (), backoffMillis .capture ());
7070 assertThat (backoffMillis .getValue ()).isEqualTo (1001L );
@@ -81,7 +81,7 @@ public void runAbortNoRetryInfo() {
8181 @ Test
8282 public void commitAbort () {
8383 final SpannerException error =
84- SpannerExceptionFactory .newSpannerException (createRetryException ());
84+ SpannerExceptionFactory .newSpannerException (createRetryException (Status . Code . ABORTED ));
8585 when (rpc .commit (Mockito .<CommitRequest >any (), Mockito .<Map <Option , ?>>any ()))
8686 .thenThrow (error )
8787 .thenReturn (
@@ -106,9 +106,15 @@ public Void run(TransactionContext transaction) throws Exception {
106106 assertThat (backoffMillis .getValue ()).isEqualTo (1001L );
107107 }
108108
109- private StatusRuntimeException createRetryException () {
109+ @ Test (expected = SpannerException .class )
110+ public void runResourceExhaustedNoRetry () throws Exception {
111+ runTransaction (
112+ new StatusRuntimeException (Status .fromCodeValue (Status .Code .RESOURCE_EXHAUSTED .value ())));
113+ }
114+
115+ private StatusRuntimeException createRetryException (Status .Code code ) {
110116 Metadata .Key <RetryInfo > key = ProtoUtils .keyForProto (RetryInfo .getDefaultInstance ());
111- Status status = Status .fromCodeValue (Status . Code . ABORTED .value ());
117+ Status status = Status .fromCodeValue (code .value ());
112118 Metadata trailers = new Metadata ();
113119 RetryInfo retryInfo =
114120 RetryInfo .newBuilder ()
0 commit comments