Enabled executor authentication in the tests.

This patch sets the `--authenticate_http_executors` and
`--executor_secret_key` flags by default in the tests,
and it updates the test cluster code to load a secret
generator when those flags are set.

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


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

Branch: refs/heads/master
Commit: 95dcb6faf19f4af7850a4cdbe9acdbb8b2aff4a3
Parents: 873497f
Author: Greg Mann <[email protected]>
Authored: Sat Mar 25 12:05:15 2017 -0700
Committer: Anand Mazumdar <[email protected]>
Committed: Sat Mar 25 12:05:15 2017 -0700

----------------------------------------------------------------------
 src/tests/cluster.cpp | 2 ++
 src/tests/mesos.cpp   | 7 +++++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/95dcb6fa/src/tests/cluster.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cluster.cpp b/src/tests/cluster.cpp
index 15eaf42..7f09a0c 100644
--- a/src/tests/cluster.cpp
+++ b/src/tests/cluster.cpp
@@ -536,6 +536,8 @@ Slave::~Slave()
       slave::READONLY_HTTP_AUTHENTICATION_REALM);
   process::http::authentication::unsetAuthenticator(
       slave::READWRITE_HTTP_AUTHENTICATION_REALM);
+  process::http::authentication::unsetAuthenticator(
+      slave::EXECUTOR_HTTP_AUTHENTICATION_REALM);
 
   // If either `shutdown()` or `terminate()` were called already,
   // skip the below container cleanup logic.  Additionally, we can skip

http://git-wip-us.apache.org/repos/asf/mesos/blob/95dcb6fa/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 3333c50..099ec37 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -208,6 +208,13 @@ slave::Flags MesosTest::CreateSlaveFlags()
   flags.authenticate_http_readonly = true;
   flags.authenticate_http_readwrite = true;
 
+#ifdef USE_SSL_SOCKET
+  // Executor authentication currently has SSL as a dependency, so we
+  // cannot enable it if Mesos was not built with SSL support.
+  flags.authenticate_http_executors = true;
+  flags.executor_secret_key = "secret_key";
+#endif // USE_SSL_SOCKET
+
   {
     // Create a default HTTP credentials file.
     const string& path = path::join(directory.get(), "http_credentials");

Reply via email to