You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by me...@apache.org on 2016/03/24 07:50:12 UTC

mesos git commit: Fixed flaky `MasterTest.SlavesEndpointTwoSlaves`.

Repository: mesos
Updated Branches:
  refs/heads/master 73790d3c1 -> 40a1626f1


Fixed flaky `MasterTest.SlavesEndpointTwoSlaves`.

We were not correctly waiting for the master to register the first
slave before making a call to the `/slaves` endpoint. There was this
possible race:

- Slave1 is started.
- Slave2 is started.
- Slave2 sends register message to master.
- Slave2 re-tries the register message.
- Master registers slave2.
- Master resends register acknowledgment to slave2.
- The test thinks both expectations (`FUTURE_PROTOBUF`) have completed.
- Test calls `/slaves` and sees only 1 slave has registered. Test fails.
- Master registers slave1.

Reordering the `AWAIT_READY` calls to explicitly wait for `slave1` to
register first should fix the flakiness.

Review: https://reviews.apache.org/r/45166/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/40a1626f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/40a1626f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/40a1626f

Branch: refs/heads/master
Commit: 40a1626f12fcf6d22fb222793ec64ff022b989b6
Parents: 73790d3
Author: Anand Mazumdar <ma...@gmail.com>
Authored: Wed Mar 23 23:46:31 2016 -0700
Committer: Adam B <ad...@mesosphere.io>
Committed: Wed Mar 23 23:46:31 2016 -0700

----------------------------------------------------------------------
 src/tests/master_tests.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/40a1626f/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 0f7a2ca..bb599c9 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -1681,6 +1681,8 @@ TEST_F(MasterTest, SlavesEndpointTwoSlaves)
   Try<Owned<cluster::Slave>> slave1 = StartSlave(detector.get());
   ASSERT_SOME(slave1);
 
+  AWAIT_READY(slave1RegisteredMessage);
+
   Future<SlaveRegisteredMessage> slave2RegisteredMessage =
     FUTURE_PROTOBUF(
         SlaveRegisteredMessage(), master.get()->pid, Not(slave1.get()->pid));
@@ -1688,8 +1690,6 @@ TEST_F(MasterTest, SlavesEndpointTwoSlaves)
   Try<Owned<cluster::Slave>> slave2 = StartSlave(detector.get());
   ASSERT_SOME(slave2);
 
-  // Wait for the slaves to be registered.
-  AWAIT_READY(slave1RegisteredMessage);
   AWAIT_READY(slave2RegisteredMessage);
 
   // Query the master.
@@ -1707,7 +1707,7 @@ TEST_F(MasterTest, SlavesEndpointTwoSlaves)
 
   ASSERT_SOME(parse);
 
-  // Check that there are at least two elements in the array.
+  // Check that there are two elements in the array.
   Result<JSON::Array> array = parse.get().find<JSON::Array>("slaves");
   ASSERT_SOME(array);
   EXPECT_EQ(2u, array.get().values.size());