Skip to content

Commit

Permalink
remove retries exhausted
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomarquezp committed Nov 4, 2024
1 parent 87f807a commit e57b4db
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ void retry() {
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(3);
assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(4);
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isFalse();
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isFalse();

// Capture the argument passed to futureCall
ArgumentCaptor<Integer> argumentCaptor = ArgumentCaptor.forClass(Integer.class);
Expand Down Expand Up @@ -192,7 +191,6 @@ void retryTotalTimeoutExceeded() {
assertThrows(ApiException.class, () -> callable.call(initialRequest));
assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(1);
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(0);
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isFalse();
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isTrue();
// Capture the argument passed to futureCall
ArgumentCaptor<Integer> argumentCaptor = ArgumentCaptor.forClass(Integer.class);
Expand All @@ -216,7 +214,6 @@ void retryMaxAttemptsExceeded() {
assertThrows(ApiException.class, () -> callable.call(initialRequest));
assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(2);
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(1);
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isTrue();
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isTrue();
// Capture the argument passed to futureCall
ArgumentCaptor<Integer> argumentCaptor = ArgumentCaptor.forClass(Integer.class);
Expand All @@ -240,7 +237,6 @@ void retryWithinMaxAttempts() {
assertThat(callable.call(initialRequest)).isEqualTo(2);
assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(3);
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(2);
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isFalse();
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isFalse();
// Capture the argument passed to futureCall
ArgumentCaptor<Integer> argumentCaptor = ArgumentCaptor.forClass(Integer.class);
Expand Down Expand Up @@ -270,7 +266,6 @@ void retryOnStatusUnknown() {
assertThat(callable.call(initialRequest)).isEqualTo(2);
assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(4);
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(3);
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isFalse();
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isFalse();
// Capture the argument passed to futureCall
ArgumentCaptor<Integer> argumentCaptor = ArgumentCaptor.forClass(Integer.class);
Expand All @@ -292,7 +287,6 @@ void retryOnUnexpectedException() {
ApiException exception = assertThrows(ApiException.class, () -> callable.call(initialRequest));
assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(1);
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(0);
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isFalse();
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isTrue();
assertThat(exception).hasCauseThat().isSameInstanceAs(throwable);
// Capture the argument passed to futureCall
Expand Down Expand Up @@ -325,7 +319,6 @@ void retryNoRecover() {
ApiException exception = assertThrows(ApiException.class, () -> callable.call(initialRequest));
assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(1);
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(0);
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isFalse();
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isTrue();
assertThat(exception).isSameInstanceAs(apiException);
// Capture the argument passed to futureCall
Expand Down Expand Up @@ -359,7 +352,6 @@ void retryKeepFailing() {
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isGreaterThan(0);
assertThat(tracerFactory.getInstance().getAttemptsFailed().get())
.isEqualTo(tracerFactory.getInstance().getAttemptsStarted().get() - 1);
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isTrue();
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isTrue();
assertThat(exception).hasCauseThat().isInstanceOf(ApiException.class);
assertThat(exception).hasCauseThat().hasMessageThat().contains("Unavailable");
Expand Down Expand Up @@ -403,7 +395,6 @@ void testKnownStatusCode() {
assertThrows(FailedPreconditionException.class, () -> callable.call(initialRequest));
assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(1);
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(0);
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isFalse();
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isTrue();
assertThat(exception.getStatusCode().getTransportCode())
.isEqualTo(HTTP_CODE_PRECONDITION_FAILED);
Expand Down Expand Up @@ -431,7 +422,6 @@ void testUnknownStatusCode() {
assertThat(exception).hasMessageThat().isEqualTo("java.lang.RuntimeException: unknown");
assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(1);
assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(0);
assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isFalse();
assertThat(tracerFactory.getInstance().getOperationFailed().get()).isTrue();
// Capture the argument passed to futureCall
ArgumentCaptor<Integer> argumentCaptor = ArgumentCaptor.forClass(Integer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ public AtomicBoolean getOperationFailed() {
return operationFailed;
}

public AtomicBoolean getRetriesExhausted() {
return retriesExhausted;
}

@Override
public void attemptStarted(int attemptNumber) {
attemptsStarted.incrementAndGet();
Expand All @@ -82,9 +78,4 @@ public void attemptFailed(Throwable error, Duration delay) {
public void operationFailed(Throwable error) {
operationFailed.set(true);
}

@Override
public void attemptFailedRetriesExhausted(Throwable error) {
retriesExhausted.set(true);
}
};

0 comments on commit e57b4db

Please sign in to comment.