Repository: mesos
Updated Branches:
  refs/heads/master 00ad42728 -> ca559f67f


Increased the timeout for the flaky SlaveTest.CommandExecutorGracefulShutdown 
test.

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


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

Branch: refs/heads/master
Commit: ca559f67f0ee27272a3fa3e0c0f9e03f861a92fc
Parents: 00ad427
Author: Benjamin Mahler <[email protected]>
Authored: Wed Jan 28 20:19:16 2015 -0800
Committer: Benjamin Mahler <[email protected]>
Committed: Thu Jan 29 11:06:26 2015 -0800

----------------------------------------------------------------------
 src/launcher/executor.cpp |  8 ++++----
 src/tests/slave_tests.cpp | 31 +++++++++++++++++++------------
 2 files changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ca559f67/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index f00b6fc..1cf28f1 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -610,10 +610,10 @@ public:
   {
     add(&override,
         "override",
-        "Whether or not to override the command the executor should run\n"
-        "when the task is launched. Only this flag is expected to be on\n"
-        "the command line and all arguments after the flag will be used as\n"
-        "the subsequent 'argv' to be used with 'execvp'",
+        "Whether to override the command the executor should run when the\n"
+        "task is launched. Only this flag is expected to be on the command\n"
+        "line and all arguments after the flag will be used as the\n"
+        "subsequent 'argv' to be used with 'execvp'",
         false);
 
     // TODO(nnielsen): Add 'prefix' option to enable replacing

http://git-wip-us.apache.org/repos/asf/mesos/blob/ca559f67/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index aff9e25..e7e2af6 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -20,6 +20,7 @@
 
 #include <gmock/gmock.h>
 
+#include <algorithm>
 #include <map>
 #include <string>
 #include <vector>
@@ -267,9 +268,9 @@ TEST_F(SlaveTest, RemoveUnregisteredTerminatedExecutor)
 }
 
 
-// Test that we can run the mesos-executor and specify an "override"
+// Test that we can run the command executor and specify an "override"
 // command to use via the --override argument.
-TEST_F(SlaveTest, MesosExecutorWithOverride)
+TEST_F(SlaveTest, CommandExecutorWithOverride)
 {
   Try<PID<Master> > master = StartMaster();
   ASSERT_SOME(master);
@@ -404,7 +405,7 @@ TEST_F(SlaveTest, MesosExecutorWithOverride)
 // mesos-executor args. For more details of this see MESOS-1873.
 //
 // This assumes the ability to execute '/bin/echo --author'.
-TEST_F(SlaveTest, MesosExecutorCommandTaskWithArgsList)
+TEST_F(SlaveTest, ComamndTaskWithArguments)
 {
   Try<PID<Master> > master = StartMaster();
   ASSERT_SOME(master);
@@ -1665,21 +1666,26 @@ TEST_F(SlaveTest, ShutdownGracePeriod)
 }
 
 
-// This test runs a long-living task responsive to SIGTERM and
-// attempts to kill it gracefully.
-TEST_F(SlaveTest, MesosExecutorGracefulShutdown)
+// This test ensures that the graceful shutdown in the command
+// uses SIGTERM to gracefully shutdown a task.
+TEST_F(SlaveTest, CommandExecutorGracefulShutdown)
 {
   Try<PID<Master>> master = StartMaster();
   ASSERT_SOME(master);
 
-  // Explicitly set the grace period for slave default.
+  // Explicitly set the grace period for the executor.
+  // NOTE: We ensure that the graceful shutdown is at least
+  // 10 seconds because we've observed the sleep command to take
+  // several seconds to terminate from SIGTERM on some slow CI VMs.
   slave::Flags flags = CreateSlaveFlags();
-  flags.executor_shutdown_grace_period = slave::EXECUTOR_SHUTDOWN_GRACE_PERIOD;
+  flags.executor_shutdown_grace_period = std::max(
+      slave::EXECUTOR_SHUTDOWN_GRACE_PERIOD,
+      Duration(Seconds(10)));
 
-  // Ensure escalation timeout is more than the maximal reap interval.
+  // Ensure that a reap will occur within the grace period.
   Duration timeout = slave::getExecutorGracePeriod(
-      slave::EXECUTOR_SHUTDOWN_GRACE_PERIOD);
-  EXPECT_LT(process::MAX_REAP_INTERVAL(), timeout);
+      flags.executor_shutdown_grace_period);
+  EXPECT_GT(timeout, process::MAX_REAP_INTERVAL());
 
   Fetcher fetcher;
   Try<MesosContainerizer*> containerizer = MesosContainerizer::create(
@@ -1733,7 +1739,8 @@ TEST_F(SlaveTest, MesosExecutorGracefulShutdown)
   // TODO(alex): By now we have no better way to extract the kill
   // reason. Change this once we have level 2 enums for task states.
   EXPECT_TRUE(statusKilled.get().has_message());
-  EXPECT_NE(std::string::npos, 
statusKilled.get().message().find("Terminated"));
+  EXPECT_TRUE(strings::contains(statusKilled.get().message(), "Terminated"))
+    << statusKilled.get().message();
 
   // Stop the driver while the task is running.
   driver.stop();

Reply via email to