You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/11/04 07:00:54 UTC

[3/6] mesos git commit: Added mesos test helper 'createCommandInfo()'.

Added mesos test helper 'createCommandInfo()'.

Added a new parameter 'arguments' for non-shell command.

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


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

Branch: refs/heads/master
Commit: e2658a1b3cfe673467f50307eb3368954458ff22
Parents: 0bef43c
Author: Gilbert Song <so...@gmail.com>
Authored: Thu Nov 3 21:51:57 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Nov 4 00:00:46 2016 -0700

----------------------------------------------------------------------
 src/tests/mesos.hpp | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e2658a1b/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 45dba23..756e873 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -498,10 +498,18 @@ inline TExecutorInfo createExecutorInfo(
 
 
 template <typename TCommandInfo>
-inline TCommandInfo createCommandInfo(const std::string& command)
+inline TCommandInfo createCommandInfo(
+    const std::string& value,
+    const std::vector<std::string>& arguments = {})
 {
   TCommandInfo commandInfo;
-  commandInfo.set_value(command);
+  commandInfo.set_value(value);
+  if (!arguments.empty()) {
+    commandInfo.set_shell(false);
+    foreach (const std::string& arg, arguments) {
+      commandInfo.add_arguments(arg);
+    }
+  }
   return commandInfo;
 }
 
@@ -1017,10 +1025,12 @@ inline ExecutorInfo createExecutorInfo(Args&&... args)
 }
 
 
-template <typename... Args>
-inline CommandInfo createCommandInfo(Args&&... args)
+// We specify the argument to allow brace initialized construction.
+inline CommandInfo createCommandInfo(
+    const std::string& value,
+    const std::vector<std::string>& arguments = {})
 {
-  return common::createCommandInfo<CommandInfo>(std::forward<Args>(args)...);
+  return common::createCommandInfo<CommandInfo>(value, arguments);
 }
 
 
@@ -1201,11 +1211,12 @@ inline mesos::v1::ExecutorInfo createExecutorInfo(Args&&... args)
 }
 
 
-template <typename... Args>
-inline mesos::v1::CommandInfo createCommandInfo(Args&&... args)
+// We specify the argument to allow brace initialized construction.
+inline mesos::v1::CommandInfo createCommandInfo(
+    const std::string& value,
+    const std::vector<std::string>& arguments = {})
 {
-  return common::createCommandInfo<mesos::v1::CommandInfo>(
-      std::forward<Args>(args)...);
+  return common::createCommandInfo<mesos::v1::CommandInfo>(value, arguments);
 }