You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2015/05/12 01:39:00 UTC

[1/2] mesos git commit: Renamed shutdown_tests.cpp to teardown_tests.cpp.

Repository: mesos
Updated Branches:
  refs/heads/master 496aac347 -> 7bb58e27b


Renamed shutdown_tests.cpp to teardown_tests.cpp.

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


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

Branch: refs/heads/master
Commit: 7bb58e27b2a7c98548206785ce80bbaa5b43ff08
Parents: b2b03f2
Author: Vinod Kone <vi...@gmail.com>
Authored: Tue May 5 16:54:47 2015 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Mon May 11 16:32:35 2015 -0700

----------------------------------------------------------------------
 src/Makefile.am              |   2 +-
 src/tests/shutdown_tests.cpp | 317 --------------------------------------
 src/tests/teardown_tests.cpp | 317 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 318 insertions(+), 318 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7bb58e27/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 54271f7..14bc976 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1427,12 +1427,12 @@ mesos_tests_SOURCES =				\
   tests/resources_tests.cpp			\
   tests/scheduler_tests.cpp			\
   tests/script.cpp				\
-  tests/shutdown_tests.cpp			\
   tests/slave_recovery_tests.cpp		\
   tests/slave_tests.cpp				\
   tests/sorter_tests.cpp			\
   tests/state_tests.cpp				\
   tests/status_update_manager_tests.cpp		\
+  tests/teardown_tests.cpp			\
   tests/utils.cpp				\
   tests/values_tests.cpp			\
   tests/zookeeper_url_tests.cpp

http://git-wip-us.apache.org/repos/asf/mesos/blob/7bb58e27/src/tests/shutdown_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/shutdown_tests.cpp b/src/tests/shutdown_tests.cpp
deleted file mode 100644
index b3e999e..0000000
--- a/src/tests/shutdown_tests.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gmock/gmock.h>
-
-#include <string>
-
-#include <mesos/executor.hpp>
-#include <mesos/scheduler.hpp>
-
-#include <process/future.hpp>
-#include <process/gmock.hpp>
-#include <process/http.hpp>
-#include <process/pid.hpp>
-
-#include <stout/base64.hpp>
-#include <stout/hashmap.hpp>
-#include <stout/option.hpp>
-
-#include "master/flags.hpp"
-#include "master/master.hpp"
-
-#include "tests/mesos.hpp"
-#include "tests/utils.hpp"
-
-using std::string;
-
-using mesos::internal::master::Master;
-using mesos::internal::slave::Slave;
-
-using process::Future;
-using process::PID;
-
-using process::http::BadRequest;
-using process::http::OK;
-using process::http::Response;
-using process::http::Unauthorized;
-
-using testing::_;
-using testing::Eq;
-using testing::SaveArg;
-using testing::Return;
-
-namespace mesos {
-namespace internal {
-namespace tests {
-
-
-class ShutdownTest : public MesosTest {};
-
-
-// Testing /master/shutdown so this endopoint  shuts down
-// designated framework or return adequate error.
-
-// Testing route with authorization header and good credentials.
-TEST_F(ShutdownTest, ShutdownEndpoint)
-{
-  Try<PID<Master> > master = StartMaster();
-  ASSERT_SOME(master);
-
-  MockScheduler sched;
-  MesosSchedulerDriver driver(
-      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
-
-  Future<FrameworkID> frameworkId;
-  EXPECT_CALL(sched, registered(&driver, _, _))
-    .WillOnce(FutureArg<1>(&frameworkId));
-
-  ASSERT_EQ(DRIVER_RUNNING, driver.start());
-
-  AWAIT_READY(frameworkId);
-
-  hashmap<string, string> headers;
-  headers["Authorization"] = "Basic " +
-    base64::encode(DEFAULT_CREDENTIAL.principal() +
-                   ":" + DEFAULT_CREDENTIAL.secret());
-
-  Future<Response> response = process::http::post(
-      master.get(),
-      "shutdown",
-      headers,
-      "frameworkId=" + frameworkId.get().value());
-
-  AWAIT_READY(response);
-  AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
-
-  driver.stop();
-  driver.join();
-
-  Shutdown();
-}
-
-
-// Testing route with bad credentials.
-TEST_F(ShutdownTest, ShutdownEndpointBadCredentials)
-{
-  Try<PID<Master> > master = StartMaster();
-  ASSERT_SOME(master);
-
-  MockScheduler sched;
-  MesosSchedulerDriver driver(
-      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
-
-  Future<FrameworkID> frameworkId;
-  EXPECT_CALL(sched, registered(&driver, _, _))
-    .WillOnce(FutureArg<1>(&frameworkId));
-
-  ASSERT_EQ(DRIVER_RUNNING, driver.start());
-
-  AWAIT_READY(frameworkId);
-
-  hashmap<string, string> headers;
-  headers["Authorization"] = "Basic " +
-    base64::encode("badPrincipal:badSecret");
-
-  Future<Response> response = process::http::post(
-      master.get(),
-      "shutdown",
-      headers,
-      "frameworkId=" + frameworkId.get().value());
-
-  AWAIT_READY(response);
-  AWAIT_EXPECT_RESPONSE_STATUS_EQ(
-      Unauthorized("Mesos master").status,
-      response);
-
-  driver.stop();
-  driver.join();
-
-  Shutdown();
-}
-
-
-// Testing route with good ACLs.
-TEST_F(ShutdownTest, ShutdownEndpointGoodACLs)
-{
-  // Setup ACLs so that the default principal can shutdown the
-  // framework.
-  ACLs acls;
-  mesos::ACL::ShutdownFramework* acl = acls.add_shutdown_frameworks();
-  acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
-  acl->mutable_framework_principals()->add_values(
-      DEFAULT_CREDENTIAL.principal());
-
-  master::Flags flags = CreateMasterFlags();
-  flags.acls = acls;
-  Try<PID<Master> > master = StartMaster(flags);
-  ASSERT_SOME(master);
-
-  MockScheduler sched;
-  MesosSchedulerDriver driver(
-      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
-
-  Future<FrameworkID> frameworkId;
-  EXPECT_CALL(sched, registered(&driver, _, _))
-    .WillOnce(FutureArg<1>(&frameworkId));
-
-  ASSERT_EQ(DRIVER_RUNNING, driver.start());
-
-  AWAIT_READY(frameworkId);
-
-  hashmap<string, string> headers;
-  headers["Authorization"] = "Basic " +
-    base64::encode(DEFAULT_CREDENTIAL.principal() +
-                   ":" + DEFAULT_CREDENTIAL.secret());
-
-  Future<Response> response = process::http::post(
-      master.get(),
-      "shutdown",
-      headers,
-      "frameworkId=" + frameworkId.get().value());
-
-  AWAIT_READY(response);
-  AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
-
-  driver.stop();
-  driver.join();
-
-  Shutdown();
-}
-
-
-// Testing route with bad ACLs.
-TEST_F(ShutdownTest, ShutdownEndpointBadACLs)
-{
-  // Setup ACLs so that no principal can do shutdown the framework.
-  ACLs acls;
-  mesos::ACL::ShutdownFramework* acl = acls.add_shutdown_frameworks();
-  acl->mutable_principals()->set_type(mesos::ACL::Entity::NONE);
-  acl->mutable_framework_principals()->add_values(
-      DEFAULT_CREDENTIAL.principal());
-
-  master::Flags flags = CreateMasterFlags();
-  flags.acls = acls;
-  Try<PID<Master> > master = StartMaster(flags);
-  ASSERT_SOME(master);
-
-  MockScheduler sched;
-  MesosSchedulerDriver driver(
-      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
-
-  Future<FrameworkID> frameworkId;
-  EXPECT_CALL(sched, registered(&driver, _, _))
-    .WillOnce(FutureArg<1>(&frameworkId));
-
-  ASSERT_EQ(DRIVER_RUNNING, driver.start());
-
-  AWAIT_READY(frameworkId);
-
-  hashmap<string, string> headers;
-  headers["Authorization"] = "Basic " +
-    base64::encode(DEFAULT_CREDENTIAL.principal() +
-                   ":" + DEFAULT_CREDENTIAL.secret());
-
-  Future<Response> response = process::http::post(
-      master.get(),
-      "shutdown",
-      headers,
-      "frameworkId=" + frameworkId.get().value());
-
-  AWAIT_READY(response);
-  AWAIT_EXPECT_RESPONSE_STATUS_EQ(
-      Unauthorized("Mesos master").status,
-      response);
-
-  driver.stop();
-  driver.join();
-
-  Shutdown();
-}
-
-
-// Testing route without frameworkId value.
-TEST_F(ShutdownTest, ShutdownEndpointNoFrameworkId)
-{
-  Try<PID<Master> > master = StartMaster();
-  ASSERT_SOME(master);
-
-  MockScheduler sched;
-  MesosSchedulerDriver driver(
-      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
-
-  Future<FrameworkID> frameworkId;
-  EXPECT_CALL(sched, registered(&driver, _, _))
-    .WillOnce(FutureArg<1>(&frameworkId));
-
-  ASSERT_EQ(DRIVER_RUNNING, driver.start());
-
-  AWAIT_READY(frameworkId);
-  hashmap<string, string> headers;
-  headers["Authorization"] = "Basic " +
-    base64::encode("badPrincipal:badSecret");
-  Future<Response> response =
-    process::http::post(master.get(), "shutdown", headers, "");
-  AWAIT_READY(response);
-  AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
-
-  driver.stop();
-  driver.join();
-
-  Shutdown();
-}
-
-
-// Testing route without authorization header.
-TEST_F(ShutdownTest, ShutdownEndpointNoHeader)
-{
-  Try<PID<Master> > master = StartMaster();
-  ASSERT_SOME(master);
-
-  MockScheduler sched;
-  MesosSchedulerDriver driver(
-      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
-
-  Future<FrameworkID> frameworkId;
-  EXPECT_CALL(sched, registered(&driver, _, _))
-    .WillOnce(FutureArg<1>(&frameworkId));
-
-  ASSERT_EQ(DRIVER_RUNNING, driver.start());
-
-  AWAIT_READY(frameworkId);
-
-  Future<Response> response = process::http::post(
-      master.get(),
-      "shutdown",
-      None(),
-      "frameworkId=" + frameworkId.get().value());
-
-  AWAIT_READY(response);
-  AWAIT_EXPECT_RESPONSE_STATUS_EQ(
-      Unauthorized("Mesos master").status,
-      response);
-
-  driver.stop();
-  driver.join();
-
-  Shutdown();
-}
-
-} // namespace tests {
-} // namespace internal {
-} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/7bb58e27/src/tests/teardown_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/teardown_tests.cpp b/src/tests/teardown_tests.cpp
new file mode 100644
index 0000000..daf748c
--- /dev/null
+++ b/src/tests/teardown_tests.cpp
@@ -0,0 +1,317 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gmock/gmock.h>
+
+#include <string>
+
+#include <mesos/executor.hpp>
+#include <mesos/scheduler.hpp>
+
+#include <process/future.hpp>
+#include <process/gmock.hpp>
+#include <process/http.hpp>
+#include <process/pid.hpp>
+
+#include <stout/base64.hpp>
+#include <stout/hashmap.hpp>
+#include <stout/option.hpp>
+
+#include "master/flags.hpp"
+#include "master/master.hpp"
+
+#include "tests/mesos.hpp"
+#include "tests/utils.hpp"
+
+using std::string;
+
+using mesos::internal::master::Master;
+using mesos::internal::slave::Slave;
+
+using process::Future;
+using process::PID;
+
+using process::http::BadRequest;
+using process::http::OK;
+using process::http::Response;
+using process::http::Unauthorized;
+
+using testing::_;
+using testing::Eq;
+using testing::SaveArg;
+using testing::Return;
+
+namespace mesos {
+namespace internal {
+namespace tests {
+
+
+class TeardownTest : public MesosTest {};
+
+
+// Testing /master/teardown so this endopoint  shuts down
+// designated framework or return adequate error.
+
+// Testing route with authorization header and good credentials.
+TEST_F(TeardownTest, TeardownEndpoint)
+{
+  Try<PID<Master> > master = StartMaster();
+  ASSERT_SOME(master);
+
+  MockScheduler sched;
+  MesosSchedulerDriver driver(
+      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
+
+  Future<FrameworkID> frameworkId;
+  EXPECT_CALL(sched, registered(&driver, _, _))
+    .WillOnce(FutureArg<1>(&frameworkId));
+
+  ASSERT_EQ(DRIVER_RUNNING, driver.start());
+
+  AWAIT_READY(frameworkId);
+
+  hashmap<string, string> headers;
+  headers["Authorization"] = "Basic " +
+    base64::encode(DEFAULT_CREDENTIAL.principal() +
+                   ":" + DEFAULT_CREDENTIAL.secret());
+
+  Future<Response> response = process::http::post(
+      master.get(),
+      "teardown",
+      headers,
+      "frameworkId=" + frameworkId.get().value());
+
+  AWAIT_READY(response);
+  AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
+
+  driver.stop();
+  driver.join();
+
+  Shutdown();
+}
+
+
+// Testing route with bad credentials.
+TEST_F(TeardownTest, TeardownEndpointBadCredentials)
+{
+  Try<PID<Master> > master = StartMaster();
+  ASSERT_SOME(master);
+
+  MockScheduler sched;
+  MesosSchedulerDriver driver(
+      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
+
+  Future<FrameworkID> frameworkId;
+  EXPECT_CALL(sched, registered(&driver, _, _))
+    .WillOnce(FutureArg<1>(&frameworkId));
+
+  ASSERT_EQ(DRIVER_RUNNING, driver.start());
+
+  AWAIT_READY(frameworkId);
+
+  hashmap<string, string> headers;
+  headers["Authorization"] = "Basic " +
+    base64::encode("badPrincipal:badSecret");
+
+  Future<Response> response = process::http::post(
+      master.get(),
+      "teardown",
+      headers,
+      "frameworkId=" + frameworkId.get().value());
+
+  AWAIT_READY(response);
+  AWAIT_EXPECT_RESPONSE_STATUS_EQ(
+      Unauthorized("Mesos master").status,
+      response);
+
+  driver.stop();
+  driver.join();
+
+  Shutdown();
+}
+
+
+// Testing route with good ACLs.
+TEST_F(TeardownTest, TeardownEndpointGoodACLs)
+{
+  // Setup ACLs so that the default principal can teardown the
+  // framework.
+  ACLs acls;
+  mesos::ACL::ShutdownFramework* acl = acls.add_shutdown_frameworks();
+  acl->mutable_principals()->add_values(DEFAULT_CREDENTIAL.principal());
+  acl->mutable_framework_principals()->add_values(
+      DEFAULT_CREDENTIAL.principal());
+
+  master::Flags flags = CreateMasterFlags();
+  flags.acls = acls;
+  Try<PID<Master> > master = StartMaster(flags);
+  ASSERT_SOME(master);
+
+  MockScheduler sched;
+  MesosSchedulerDriver driver(
+      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
+
+  Future<FrameworkID> frameworkId;
+  EXPECT_CALL(sched, registered(&driver, _, _))
+    .WillOnce(FutureArg<1>(&frameworkId));
+
+  ASSERT_EQ(DRIVER_RUNNING, driver.start());
+
+  AWAIT_READY(frameworkId);
+
+  hashmap<string, string> headers;
+  headers["Authorization"] = "Basic " +
+    base64::encode(DEFAULT_CREDENTIAL.principal() +
+                   ":" + DEFAULT_CREDENTIAL.secret());
+
+  Future<Response> response = process::http::post(
+      master.get(),
+      "teardown",
+      headers,
+      "frameworkId=" + frameworkId.get().value());
+
+  AWAIT_READY(response);
+  AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
+
+  driver.stop();
+  driver.join();
+
+  Shutdown();
+}
+
+
+// Testing route with bad ACLs.
+TEST_F(TeardownTest, TeardownEndpointBadACLs)
+{
+  // Setup ACLs so that no principal can do teardown the framework.
+  ACLs acls;
+  mesos::ACL::ShutdownFramework* acl = acls.add_shutdown_frameworks();
+  acl->mutable_principals()->set_type(mesos::ACL::Entity::NONE);
+  acl->mutable_framework_principals()->add_values(
+      DEFAULT_CREDENTIAL.principal());
+
+  master::Flags flags = CreateMasterFlags();
+  flags.acls = acls;
+  Try<PID<Master> > master = StartMaster(flags);
+  ASSERT_SOME(master);
+
+  MockScheduler sched;
+  MesosSchedulerDriver driver(
+      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
+
+  Future<FrameworkID> frameworkId;
+  EXPECT_CALL(sched, registered(&driver, _, _))
+    .WillOnce(FutureArg<1>(&frameworkId));
+
+  ASSERT_EQ(DRIVER_RUNNING, driver.start());
+
+  AWAIT_READY(frameworkId);
+
+  hashmap<string, string> headers;
+  headers["Authorization"] = "Basic " +
+    base64::encode(DEFAULT_CREDENTIAL.principal() +
+                   ":" + DEFAULT_CREDENTIAL.secret());
+
+  Future<Response> response = process::http::post(
+      master.get(),
+      "teardown",
+      headers,
+      "frameworkId=" + frameworkId.get().value());
+
+  AWAIT_READY(response);
+  AWAIT_EXPECT_RESPONSE_STATUS_EQ(
+      Unauthorized("Mesos master").status,
+      response);
+
+  driver.stop();
+  driver.join();
+
+  Shutdown();
+}
+
+
+// Testing route without frameworkId value.
+TEST_F(TeardownTest, TeardownEndpointNoFrameworkId)
+{
+  Try<PID<Master> > master = StartMaster();
+  ASSERT_SOME(master);
+
+  MockScheduler sched;
+  MesosSchedulerDriver driver(
+      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
+
+  Future<FrameworkID> frameworkId;
+  EXPECT_CALL(sched, registered(&driver, _, _))
+    .WillOnce(FutureArg<1>(&frameworkId));
+
+  ASSERT_EQ(DRIVER_RUNNING, driver.start());
+
+  AWAIT_READY(frameworkId);
+  hashmap<string, string> headers;
+  headers["Authorization"] = "Basic " +
+    base64::encode("badPrincipal:badSecret");
+  Future<Response> response =
+    process::http::post(master.get(), "teardown", headers, "");
+  AWAIT_READY(response);
+  AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
+
+  driver.stop();
+  driver.join();
+
+  Shutdown();
+}
+
+
+// Testing route without authorization header.
+TEST_F(TeardownTest, TeardownEndpointNoHeader)
+{
+  Try<PID<Master> > master = StartMaster();
+  ASSERT_SOME(master);
+
+  MockScheduler sched;
+  MesosSchedulerDriver driver(
+      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);
+
+  Future<FrameworkID> frameworkId;
+  EXPECT_CALL(sched, registered(&driver, _, _))
+    .WillOnce(FutureArg<1>(&frameworkId));
+
+  ASSERT_EQ(DRIVER_RUNNING, driver.start());
+
+  AWAIT_READY(frameworkId);
+
+  Future<Response> response = process::http::post(
+      master.get(),
+      "teardown",
+      None(),
+      "frameworkId=" + frameworkId.get().value());
+
+  AWAIT_READY(response);
+  AWAIT_EXPECT_RESPONSE_STATUS_EQ(
+      Unauthorized("Mesos master").status,
+      response);
+
+  driver.stop();
+  driver.join();
+
+  Shutdown();
+}
+
+} // namespace tests {
+} // namespace internal {
+} // namespace mesos {


[2/2] mesos git commit: Added /master/teardown endpoint that is going to replace /master/shutdown endpoint.

Posted by vi...@apache.org.
Added /master/teardown endpoint that is going to replace
/master/shutdown endpoint.

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


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

Branch: refs/heads/master
Commit: b2b03f220df8960ecfa0242c5efb304b1c07b8b9
Parents: 496aac3
Author: Vinod Kone <vi...@gmail.com>
Authored: Tue May 5 16:45:25 2015 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Mon May 11 16:32:35 2015 -0700

----------------------------------------------------------------------
 src/master/http.cpp   | 32 +++++++++++++++++++++++---------
 src/master/master.cpp | 12 +++++++++++-
 src/master/master.hpp |  9 +++++----
 3 files changed, 39 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b2b03f22/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index acc85b6..7fa47a9 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -862,16 +862,30 @@ Future<Response> Master::Http::roles(const Request& request) const
 
 const string Master::Http::SHUTDOWN_HELP = HELP(
     TLDR(
-        "Shuts down a running framework."),
+        "Shuts down a running framework by shutting down all tasks/executors "
+        "and removing the framework."),
     USAGE(
         "/master/shutdown"),
     DESCRIPTION(
-        "Please provide a \"frameworkId\" value designating the ",
-        "running framework to shut down.",
+        "NOTE: This endpoint is deprecated in favor of /master/teardown.",
+        "Please provide a \"frameworkId\" value designating the running "
+        "framework to shut down.",
         "Returns 200 OK if the framework was correctly shutdown."));
 
 
-Future<Response> Master::Http::shutdown(const Request& request) const
+const string Master::Http::TEARDOWN_HELP = HELP(
+    TLDR(
+        "Tears down a running framework by shutting down all tasks/executors "
+        "and removing the framework."),
+    USAGE(
+        "/master/teardown"),
+    DESCRIPTION(
+        "Please provide a \"frameworkId\" value designating the running "
+        "framework to tear down.",
+        "Returns 200 OK if the framework was correctly teared down."));
+
+
+Future<Response> Master::Http::teardown(const Request& request) const
 {
   if (request.method != "POST") {
     return BadRequest("Expecting POST");
@@ -909,7 +923,7 @@ Future<Response> Master::Http::shutdown(const Request& request) const
 
   // Skip authorization if no ACLs were provided to the master.
   if (master->authorizer.isNone()) {
-    return _shutdown(id);
+    return _teardown(id);
   }
 
   mesos::ACL::ShutdownFramework shutdown;
@@ -927,15 +941,15 @@ Future<Response> Master::Http::shutdown(const Request& request) const
     shutdown.mutable_framework_principals()->set_type(ACL::Entity::ANY);
   }
 
-  lambda::function<Future<Response>(bool)> _shutdown =
-    lambda::bind(&Master::Http::_shutdown, this, id, lambda::_1);
+  lambda::function<Future<Response>(bool)> _teardown =
+    lambda::bind(&Master::Http::_teardown, this, id, lambda::_1);
 
   return master->authorizer.get()->authorize(shutdown)
-    .then(defer(master->self(), _shutdown));
+    .then(defer(master->self(), _teardown));
 }
 
 
-Future<Response> Master::Http::_shutdown(
+Future<Response> Master::Http::_teardown(
     const FrameworkID& id,
     bool authorized) const
 {

http://git-wip-us.apache.org/repos/asf/mesos/blob/b2b03f22/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 4ad683e..ec32cd6 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -747,12 +747,22 @@ void Master::initialize()
           Http::log(request);
           return http.roles(request);
         });
+
+  // TODO(vinod): "/shutdown" endpoint is deprecated in favor of
+  // "/teardown". Remove this endpoint in 0.24.0.
   route("/shutdown",
         Http::SHUTDOWN_HELP,
         [http](const http::Request& request) {
           Http::log(request);
-          return http.shutdown(request);
+          return http.teardown(request);
         });
+  route("/teardown",
+        Http::TEARDOWN_HELP,
+        [http](const http::Request& request) {
+          Http::log(request);
+          return http.teardown(request);
+        });
+
   route("/slaves",
         Http::SLAVES_HELP,
         [http](const http::Request& request) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/b2b03f22/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index ee53dfb..af41216 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -497,8 +497,8 @@ private:
     process::Future<process::http::Response> roles(
         const process::http::Request& request) const;
 
-    // /master/shutdown
-    process::Future<process::http::Response> shutdown(
+    // /master/teardown and /master/shutdown (deprecated).
+    process::Future<process::http::Response> teardown(
         const process::http::Request& request) const;
 
     // /master/slaves
@@ -520,7 +520,8 @@ private:
     const static std::string HEALTH_HELP;
     const static std::string OBSERVE_HELP;
     const static std::string REDIRECT_HELP;
-    const static std::string SHUTDOWN_HELP;
+    const static std::string SHUTDOWN_HELP;  // Deprecated.
+    const static std::string TEARDOWN_HELP;
     const static std::string SLAVES_HELP;
     const static std::string TASKS_HELP;
 
@@ -532,7 +533,7 @@ private:
         const process::http::Request& request) const;
 
     // Continuations.
-    process::Future<process::http::Response> _shutdown(
+    process::Future<process::http::Response> _teardown(
         const FrameworkID& id,
         bool authorized = true) const;