This is an automated email from the ASF dual-hosted git repository.

adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit e97e8947f7edced314a9e22084a2738e8474451b
Author: Thomas Tauber-Marshall <[email protected]>
AuthorDate: Thu Feb 6 11:08:20 2020 -0800

    [rpc-test] fix flaky TestCancellation
    
    KUDU-3042 added a test case for the interaction between rpc
    cancellation and rpc timeouts. This test was flaky as it assumed that
    rpcs that are cancelled will return with an aborted status, which is
    not always the case due to cancellation being best effort.
    
    The fix is to make the test more permissive by allowing the rpcs to
    fail with either an aborted or a timed out status.
    
    Change-Id: If140a9215c94d781c2c61ec30b18d2d67d80310a
    Reviewed-on: http://gerrit.cloudera.org:8080/15174
    Tested-by: Kudu Jenkins
    Reviewed-by: Adar Dembo <[email protected]>
---
 src/kudu/rpc/rpc-test-base.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/kudu/rpc/rpc-test-base.h b/src/kudu/rpc/rpc-test-base.h
index fcc7452..56e4c3d 100644
--- a/src/kudu/rpc/rpc-test-base.h
+++ b/src/kudu/rpc/rpc-test-base.h
@@ -565,9 +565,11 @@ class RpcTestBase : public KuduTest {
     // And we also shouldn't take the full time that we asked for
     EXPECT_LT(elapsed_millis * 1000, sleep_micros);
     if (will_be_cancelled) {
-      EXPECT_TRUE(s.IsAborted());
+      // Cancellation is best effort, so even if we cancel the rpc it may 
still end up
+      // with a timed out status.
+      EXPECT_TRUE(s.IsAborted() || s.IsTimedOut()) << s.ToString();
     } else {
-      EXPECT_TRUE(s.IsTimedOut());
+      EXPECT_TRUE(s.IsTimedOut()) << s.ToString();
     }
     LOG(INFO) << "status: " << s.ToString() << ", seconds elapsed: " << 
sw.elapsed().wall_seconds();
   }

Reply via email to