Repository: mesos Updated Branches: refs/heads/master 2db51b134 -> a9574b461
Updated SlaveTest.PingTimeoutNoPings test to use custom timeout values. Review: https://reviews.apache.org/r/35958 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a9574b46 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a9574b46 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a9574b46 Branch: refs/heads/master Commit: a9574b461c94615f8dd42b4db7ed9a01c56a9306 Parents: 2db51b1 Author: Adam B <[email protected]> Authored: Mon Jun 29 20:10:11 2015 -0700 Committer: Adam B <[email protected]> Committed: Mon Jun 29 20:11:21 2015 -0700 ---------------------------------------------------------------------- src/tests/slave_tests.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/a9574b46/src/tests/slave_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp index 90bbc81..4ddc608 100644 --- a/src/tests/slave_tests.cpp +++ b/src/tests/slave_tests.cpp @@ -1517,8 +1517,15 @@ TEST_F(SlaveTest, TaskLaunchContainerizerUpdateFails) // if it does not receive any pings after registering. TEST_F(SlaveTest, PingTimeoutNoPings) { + // Set shorter ping timeout values. + master::Flags masterFlags = CreateMasterFlags(); + masterFlags.slave_ping_timeout = Seconds(5); + masterFlags.max_slave_ping_timeouts = 2u; + Duration totalTimeout = + masterFlags.slave_ping_timeout * masterFlags.max_slave_ping_timeouts; + // Start a master. - Try<PID<Master>> master = StartMaster(); + Try<PID<Master>> master = StartMaster(masterFlags); ASSERT_SOME(master); // Block all pings to the slave. @@ -1532,6 +1539,9 @@ TEST_F(SlaveTest, PingTimeoutNoPings) ASSERT_SOME(slave); AWAIT_READY(slaveRegisteredMessage); + ASSERT_TRUE(slaveRegisteredMessage.get().has_connection()); + MasterSlaveConnection connection = slaveRegisteredMessage.get().connection(); + EXPECT_EQ(totalTimeout, Seconds(connection.total_ping_timeout_seconds())); // Ensure the slave processes the registration message and schedules // the ping timeout, before we advance the clock. @@ -1545,7 +1555,7 @@ TEST_F(SlaveTest, PingTimeoutNoPings) Future<SlaveReregisteredMessage> slaveReregisteredMessage = FUTURE_PROTOBUF(SlaveReregisteredMessage(), _, _); - Clock::advance(slave::DEFAULT_MASTER_PING_TIMEOUT()); + Clock::advance(totalTimeout); AWAIT_READY(detected); AWAIT_READY(slaveReregisteredMessage);
