You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ne...@apache.org on 2017/05/09 18:34:02 UTC

mesos git commit: Fixed flakiness in agent registration validation tests.

Repository: mesos
Updated Branches:
  refs/heads/master d2afca0b7 -> c0ff3f268


Fixed flakiness in agent registration validation tests.

RegisterSlaveValidationTest.DropInvalidReregistration and
RegisterSlaveValidationTest.DropInvalidRegistration.

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


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

Branch: refs/heads/master
Commit: c0ff3f2685e094154cacee91be485afe5a353410
Parents: d2afca0
Author: Neil Conway <ne...@gmail.com>
Authored: Tue May 9 07:59:01 2017 -0700
Committer: Neil Conway <ne...@gmail.com>
Committed: Tue May 9 11:33:42 2017 -0700

----------------------------------------------------------------------
 src/tests/master_validation_tests.cpp | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c0ff3f26/src/tests/master_validation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_validation_tests.cpp b/src/tests/master_validation_tests.cpp
index 3308803..4e7ce74 100644
--- a/src/tests/master_validation_tests.cpp
+++ b/src/tests/master_validation_tests.cpp
@@ -3732,6 +3732,8 @@ class RegisterSlaveValidationTest : public MesosTest {};
 
 TEST_F(RegisterSlaveValidationTest, DropInvalidReregistration)
 {
+  Clock::pause();
+
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
 
@@ -3739,10 +3741,13 @@ TEST_F(RegisterSlaveValidationTest, DropInvalidReregistration)
     FUTURE_PROTOBUF(SlaveRegisteredMessage(), master.get()->pid, _);
 
   StandaloneMasterDetector detector(master.get()->pid);
-
-  Try<Owned<cluster::Slave>> slave = StartSlave(&detector);
+  slave::Flags slaveFlags = CreateSlaveFlags();
+  Try<Owned<cluster::Slave>> slave = StartSlave(&detector, slaveFlags);
   ASSERT_SOME(slave);
 
+  Clock::advance(slaveFlags.authentication_backoff_factor);
+  Clock::advance(slaveFlags.registration_backoff_factor);
+
   // Wait until the master acknowledges the slave registration.
   AWAIT_READY(slaveRegisteredMessage);
 
@@ -3754,6 +3759,9 @@ TEST_F(RegisterSlaveValidationTest, DropInvalidReregistration)
   // so that the slave will do a re-registration.
   detector.appoint(master.get()->pid);
 
+  Clock::advance(slaveFlags.authentication_backoff_factor);
+  Clock::advance(slaveFlags.registration_backoff_factor);
+
   AWAIT_READY(reregisterSlaveMessage);
 
   // Now that we have a valid ReregisterSlaveMessage, tweak it to
@@ -3776,7 +3784,6 @@ TEST_F(RegisterSlaveValidationTest, DropInvalidReregistration)
   process::post(slave.get()->pid, master->get()->pid, message);
 
   // Settle the clock to retire in-flight messages.
-  Clock::pause();
   Clock::settle();
 }
 
@@ -3794,10 +3801,16 @@ TEST_F(RegisterSlaveValidationTest, DropInvalidRegistration)
   // will never send any SlaveRegisteredMessage responses.
   EXPECT_NO_FUTURE_PROTOBUFS(SlaveRegisteredMessage(), _, _);
 
+  Clock::pause();
+
   Owned<MasterDetector> detector = master.get()->createDetector();
-  Try<Owned<cluster::Slave>> slave = StartSlave(detector.get());
+  slave::Flags slaveFlags = CreateSlaveFlags();
+  Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), slaveFlags);
   ASSERT_SOME(slave);
 
+  Clock::advance(slaveFlags.authentication_backoff_factor);
+  Clock::advance(slaveFlags.registration_backoff_factor);
+
   AWAIT_READY(registerSlaveMessage);
 
   // Now that we have a valid RegisterSlaveMessage, tweak it to
@@ -3816,7 +3829,6 @@ TEST_F(RegisterSlaveValidationTest, DropInvalidRegistration)
   process::post(slave.get()->pid, master->get()->pid, message);
 
   // Settle the clock to retire in-flight messages.
-  Clock::pause();
   Clock::settle();
 }