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

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


The following commit(s) were added to refs/heads/master by this push:
     new f0460e5  Fixed flaky test 'FrameworkPrincipalChangeFails'.
f0460e5 is described below

commit f0460e5d2aed4a6d3a3e775cd95375610cc15d1e
Author: Andrei Sekretenko <asekrete...@mesosphere.io>
AuthorDate: Fri May 3 10:24:48 2019 -0700

    Fixed flaky test 'FrameworkPrincipalChangeFails'.
    
    The test is currently flaky due to the race between `EXPECT_CALL` and
    the scheduler API.
    
    This patch moves the EXPECT_CALLs before `v1::scheduler::TestMesos` is
    instantiated.
    
    Review: https://reviews.apache.org/r/70593/
---
 src/tests/http_fault_tolerance_tests.cpp | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/tests/http_fault_tolerance_tests.cpp 
b/src/tests/http_fault_tolerance_tests.cpp
index a9e8d0c..a269352 100644
--- a/src/tests/http_fault_tolerance_tests.cpp
+++ b/src/tests/http_fault_tolerance_tests.cpp
@@ -103,11 +103,6 @@ TEST_F(HttpFaultToleranceTest, 
FrameworkPrincipalChangeFails)
     EXPECT_CALL(*scheduler, connected(_))
       .WillOnce(v1::scheduler::SendSubscribe(frameworkInfo));
 
-    v1::scheduler::TestMesos mesos(
-      master.get()->pid,
-      ContentType::JSON,
-      scheduler);
-
     EXPECT_CALL(*scheduler, heartbeat(_))
       .WillRepeatedly(Return()); // Ignore heartbeats.
 
@@ -115,6 +110,11 @@ TEST_F(HttpFaultToleranceTest, 
FrameworkPrincipalChangeFails)
     EXPECT_CALL(*scheduler, subscribed(_, _))
       .WillOnce(FutureArg<1>(&subscribed));
 
+    v1::scheduler::TestMesos mesos(
+      master.get()->pid,
+      ContentType::JSON,
+      scheduler);
+
     AWAIT_READY(subscribed);
 
     frameworkId = subscribed->framework_id();
@@ -139,13 +139,6 @@ TEST_F(HttpFaultToleranceTest, 
FrameworkPrincipalChangeFails)
       .WillOnce(v1::scheduler::SendSubscribe(frameworkInfo, frameworkId))
       .WillRepeatedly(Return());
 
-    v1::scheduler::TestMesos mesos(
-      master.get()->pid,
-      ContentType::JSON,
-      scheduler,
-      None(),
-      v1::DEFAULT_CREDENTIAL_2);
-
     EXPECT_CALL(*scheduler, heartbeat(_))
       .WillRepeatedly(Return()); // Ignore heartbeats.
 
@@ -162,6 +155,13 @@ TEST_F(HttpFaultToleranceTest, 
FrameworkPrincipalChangeFails)
     EXPECT_CALL(*scheduler, error(_, _))
       .WillOnce(FutureArg<1>(&error));
 
+    v1::scheduler::TestMesos mesos(
+      master.get()->pid,
+      ContentType::JSON,
+      scheduler,
+      None(),
+      v1::DEFAULT_CREDENTIAL_2);
+
     AWAIT_READY(error);
     EXPECT_EQ(error->message(),
               "Changing framework's principal is not allowed.");

Reply via email to