Browse Source

Relax the assertion (#70308)

This relaxes the assertion to account for the case when the client
executes the request successfully before we cancel the underlying http
request.
Andrei Dan 4 years ago
parent
commit
4b02e84058

+ 2 - 3
client/rest/src/test/java/org/elasticsearch/client/RestClientSingleHostIntegTests.java

@@ -295,11 +295,10 @@ public class RestClientSingleHostIntegTests extends RestClientTestCase {
                 httpGet.abort();
                 assertTrue(httpGet.isAborted());
                 try {
-                    assertTrue(future.isCancelled());
+                    assertTrue(future.isDone());
                     future.get();
-                    throw new AssertionError("exception should have been thrown");
                 } catch(CancellationException e) {
-                    //expected
+                    //expected sometimes - if the future was cancelled before executing successfully
                 }
             }
             {