Repository: mesos
Updated Branches:
  refs/heads/master 5e850a362 -> bf00061b5


Avoided using SIGUSR1 in two test cases.

We want to cause the agent to shutdown gracefully (i.e., to send an
"unregister" message to the master). This can be accomplished by sending
the whole process a SIGUSR1 but that seems fragile; using the agent's
`shutdown()` method seems more robust.

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


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

Branch: refs/heads/master
Commit: 2c15661e58ef34d1496ac11745cd434fe7b8d8b0
Parents: 5e850a3
Author: Neil Conway <neil.con...@gmail.com>
Authored: Wed Oct 19 16:31:32 2016 -0700
Committer: Vinod Kone <vinodk...@gmail.com>
Committed: Wed Oct 19 16:31:32 2016 -0700

----------------------------------------------------------------------
 src/tests/slave_tests.cpp | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2c15661e/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 93b81d3..ab46293 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -2854,16 +2854,16 @@ TEST_F(SlaveTest, HealthCheckUnregisterRace)
   EXPECT_CALL(sched, slaveLost(&driver, _))
     .WillOnce(FutureSatisfy(&slaveLost));
 
-  // Cause the slave to shutdown gracefully by sending it SIGUSR1.
-  // This should result in the slave sending `UnregisterSlaveMessage`
-  // to the master.
+  // Cause the slave to shutdown gracefully. This should result in
+  // the slave sending `UnregisterSlaveMessage` to the master.
   Future<UnregisterSlaveMessage> unregisterSlaveMessage =
     FUTURE_PROTOBUF(
         UnregisterSlaveMessage(),
         slave.get()->pid,
         master.get()->pid);
 
-  kill(getpid(), SIGUSR1);
+  slave.get()->shutdown();
+  slave->reset();
 
   AWAIT_READY(unregisterSlaveMessage);
   AWAIT_READY(slaveLost);
@@ -2966,10 +2966,10 @@ TEST_F(SlaveTest, UnreachableThenUnregisterRace)
       dynamic_cast<master::MarkSlaveUnreachable*>(
           markUnreachable.get().get()));
 
-  // Cause the slave to shutdown gracefully by sending it SIGUSR1.
-  // This should result in the slave sending `UnregisterSlaveMessage`
-  // to the master. Normally, the master would then remove the slave
-  // from the registry, but since the slave is already being marked
+  // Cause the slave to shutdown gracefully.  This should result in
+  // the slave sending `UnregisterSlaveMessage` to the master.
+  // Normally, the master would then remove the slave from the
+  // registry, but since the slave is already being marked
   // unreachable, the master should ignore the unregister message.
   Future<UnregisterSlaveMessage> unregisterSlaveMessage =
     FUTURE_PROTOBUF(
@@ -2980,7 +2980,8 @@ TEST_F(SlaveTest, UnreachableThenUnregisterRace)
   EXPECT_CALL(*master.get()->registrar.get(), apply(_))
     .Times(0);
 
-  kill(getpid(), SIGUSR1);
+  slave.get()->shutdown();
+  slave->reset();
 
   AWAIT_READY(unregisterSlaveMessage);
 

Reply via email to