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 2017/04/13 22:53:47 UTC

[5/5] mesos git commit: Updated check tests to authenticate with agent operator API.

Updated check tests to authenticate with agent operator API.

This patch updates the check tests to enable authentication
on the agent operator API when Mesos has been built with SSL.

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


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

Branch: refs/heads/master
Commit: 6cf2536c2710ca8f5545709688a481c93bd62f31
Parents: 04be349
Author: Greg Mann <gr...@mesosphere.io>
Authored: Thu Apr 13 15:49:57 2017 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Thu Apr 13 15:49:57 2017 -0700

----------------------------------------------------------------------
 src/tests/check_tests.cpp | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6cf2536c/src/tests/check_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/check_tests.cpp b/src/tests/check_tests.cpp
index d7fcbf9..79ba5eb 100644
--- a/src/tests/check_tests.cpp
+++ b/src/tests/check_tests.cpp
@@ -878,7 +878,24 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(CommandExecutorCheckTest, HTTPCheckDelivered)
 
 
 // These are check tests with the default executor.
-class DefaultExecutorCheckTest : public CheckTest {};
+class DefaultExecutorCheckTest : public CheckTest
+{
+protected:
+  slave::Flags CreateSlaveFlags()
+  {
+    slave::Flags flags = CheckTest::CreateSlaveFlags();
+
+#ifndef USE_SSL_SOCKET
+    // Disable operator API authentication for the default executor. Executor
+    // authentication currently has SSL as a dependency, so we cannot require
+    // executors to authenticate with the agent operator API if Mesos was not
+    // built with SSL support.
+    flags.authenticate_http_readwrite = false;
+#endif // USE_SSL_SOCKET
+
+    return flags;
+  }
+};
 
 
 // Verifies that a command check is supported by the default executor,
@@ -895,9 +912,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
 
-  // Disable AuthN on the agent.
   slave::Flags flags = CreateSlaveFlags();
-  flags.authenticate_http_readwrite = false;
 
   Fetcher fetcher;
 
@@ -1091,9 +1106,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
 
-  // Disable AuthN on the agent.
   slave::Flags flags = CreateSlaveFlags();
-  flags.authenticate_http_readwrite = false;
 
   Fetcher fetcher;
 
@@ -1254,9 +1267,7 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(DefaultExecutorCheckTest, CommandCheckTimeout)
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
 
-  // Disable AuthN on the agent.
   slave::Flags flags = CreateSlaveFlags();
-  flags.authenticate_http_readwrite = false;
 
   Fetcher fetcher;
 
@@ -1404,9 +1415,7 @@ TEST_F(DefaultExecutorCheckTest, CommandCheckAndHealthCheckNoShadowing)
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
 
-  // Disable AuthN on the agent.
   slave::Flags flags = CreateSlaveFlags();
-  flags.authenticate_http_readwrite = false;
 
   Fetcher fetcher;
 
@@ -1593,12 +1602,9 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(DefaultExecutorCheckTest, HTTPCheckDelivered)
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
 
-  // Disable AuthN on the agent.
-  slave::Flags flags = CreateSlaveFlags();
-  flags.authenticate_http_readwrite = false;
-
   Owned<MasterDetector> detector = master.get()->createDetector();
-  Try<Owned<cluster::Slave>> agent = StartSlave(detector.get(), flags);
+  Try<Owned<cluster::Slave>> agent =
+    StartSlave(detector.get(), CreateSlaveFlags());
   ASSERT_SOME(agent);
 
   v1::FrameworkInfo frameworkInfo = v1::DEFAULT_FRAMEWORK_INFO;