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

bmahler 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 f642368  Fixed flaky test `UpdateFrameworkV0Test.SuppressedRoles`.
f642368 is described below

commit f6423687f6fa99d54167da66cf3e72324c3a58a3
Author: Andrei Sekretenko <[email protected]>
AuthorDate: Thu Jul 4 18:01:26 2019 -0400

    Fixed flaky test `UpdateFrameworkV0Test.SuppressedRoles`.
    
    Previously, the test has been failing in cases when the first
    AGENT_ADDED message arrived after setting an expectation for the
    "second" one. After this patch, expectations for both messages are set,
    and this is performed before any of them can arrive.
    
    Review: https://reviews.apache.org/r/71013/
---
 src/tests/master/update_framework_tests.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/tests/master/update_framework_tests.cpp 
b/src/tests/master/update_framework_tests.cpp
index dda09fc..79aac41 100644
--- a/src/tests/master/update_framework_tests.cpp
+++ b/src/tests/master/update_framework_tests.cpp
@@ -1076,6 +1076,11 @@ TEST_F(UpdateFrameworkV0Test, SuppressedRoles)
   EXPECT_CALL(masterAPISubscriber, frameworkUpdated(_))
     .WillOnce(FutureArg<0>(&frameworkUpdated));
 
+  Future<Nothing> secondAgentAdded;
+  EXPECT_CALL(masterAPISubscriber, agentAdded(_))
+    .WillOnce(Return())
+    .WillOnce(FutureSatisfy(&secondAgentAdded));
+
   Owned<MasterDetector> detector = master->get()->createDetector();
 
   Try<Owned<cluster::Slave>> slave = StartSlave(detector.get());
@@ -1113,14 +1118,10 @@ TEST_F(UpdateFrameworkV0Test, SuppressedRoles)
 
   AWAIT_READY(frameworkUpdated);
 
-  Future<Nothing> newAgentAdded;
-  EXPECT_CALL(masterAPISubscriber, agentAdded(_))
-    .WillOnce(FutureSatisfy(&newAgentAdded));
-
   Try<Owned<cluster::Slave>> newSlave = StartSlave(detector.get());
   ASSERT_SOME(newSlave);
 
-  AWAIT_READY(newAgentAdded);
+  AWAIT_READY(secondAgentAdded);
 
   // After the agent has been added, no offers should be generated
   // within an allocation interval.

Reply via email to