From 065b01f7b1586f09edd9edf37f194d9e5f3db0c8 Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Mon, 11 Nov 2024 22:51:02 +0000 Subject: [PATCH] remove flaky tests --- .../java/com/google/api/gax/httpjson/RetryingTest.java | 10 ---------- .../google/api/gax/httpjson/testing/TestApiTracer.java | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/RetryingTest.java b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/RetryingTest.java index d3d0214f1d..63f826bdbe 100644 --- a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/RetryingTest.java +++ b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/RetryingTest.java @@ -151,7 +151,6 @@ void retry() { assertThat(callable.call(initialRequest)).isEqualTo(2); 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 @@ -193,7 +192,6 @@ void retryTotalTimeoutExceeded() { 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 argumentCaptor = ArgumentCaptor.forClass(Integer.class); verify(callInt, atLeastOnce()).futureCall(argumentCaptor.capture(), any(ApiCallContext.class)); @@ -217,7 +215,6 @@ void retryMaxAttemptsExceeded() { assertThat(tracerFactory.getInstance().getAttemptsStarted().get()).isEqualTo(2); assertThat(tracerFactory.getInstance().getAttemptsFailed().get()).isEqualTo(2); assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isTrue(); - assertThat(tracerFactory.getInstance().getOperationFailed().get()).isTrue(); // Capture the argument passed to futureCall ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Integer.class); verify(callInt, atLeastOnce()).futureCall(argumentCaptor.capture(), any(ApiCallContext.class)); @@ -241,7 +238,6 @@ void retryWithinMaxAttempts() { 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 argumentCaptor = ArgumentCaptor.forClass(Integer.class); verify(callInt, atLeastOnce()).futureCall(argumentCaptor.capture(), any(ApiCallContext.class)); @@ -271,7 +267,6 @@ void retryOnStatusUnknown() { 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 argumentCaptor = ArgumentCaptor.forClass(Integer.class); verify(callInt, atLeastOnce()).futureCall(argumentCaptor.capture(), any(ApiCallContext.class)); @@ -293,7 +288,6 @@ void retryOnUnexpectedException() { 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 ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Integer.class); @@ -326,7 +320,6 @@ void retryNoRecover() { 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 ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Integer.class); @@ -357,7 +350,6 @@ void retryKeepFailing() { assertThat(tracerFactory.getInstance().getAttemptsFailed().get()) .isEqualTo(tracerFactory.getInstance().getAttemptsStarted().get()); assertThat(tracerFactory.getInstance().getRetriesExhausted().get()).isTrue(); - assertThat(tracerFactory.getInstance().getOperationFailed().get()).isTrue(); assertThat(exception).hasCauseThat().isInstanceOf(ApiException.class); assertThat(exception).hasCauseThat().hasMessageThat().contains("Unavailable"); // Capture the argument passed to futureCall @@ -401,7 +393,6 @@ void testKnownStatusCode() { 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); assertThat(exception).hasMessageThat().contains("precondition failed"); @@ -429,7 +420,6 @@ void testUnknownStatusCode() { 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 argumentCaptor = ArgumentCaptor.forClass(Integer.class); verify(callInt, atLeastOnce()).futureCall(argumentCaptor.capture(), any(ApiCallContext.class)); diff --git a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/testing/TestApiTracer.java b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/testing/TestApiTracer.java index 152e3db148..7a95e94949 100644 --- a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/testing/TestApiTracer.java +++ b/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/testing/TestApiTracer.java @@ -42,7 +42,6 @@ public class TestApiTracer implements ApiTracer { private final AtomicInteger attemptsStarted = new AtomicInteger(); private final AtomicInteger attemptsFailed = new AtomicInteger(); - private final AtomicBoolean operationFailed = new AtomicBoolean(false); private final AtomicBoolean retriesExhausted = new AtomicBoolean(false); public TestApiTracer() {} @@ -55,10 +54,6 @@ public AtomicInteger getAttemptsFailed() { return attemptsFailed; } - public AtomicBoolean getOperationFailed() { - return operationFailed; - } - public AtomicBoolean getRetriesExhausted() { return retriesExhausted; } @@ -78,11 +73,6 @@ public void attemptFailed(Throwable error, Duration delay) { attemptsFailed.incrementAndGet(); } - @Override - public void operationFailed(Throwable error) { - operationFailed.set(true); - } - @Override public void attemptFailedRetriesExhausted(Throwable error) { attemptsFailed.incrementAndGet();