You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2014/10/27 21:09:13 UTC

git commit: Added --isolation flag for tests.

Repository: mesos
Updated Branches:
  refs/heads/master 360e432e1 -> 1ff259e96


Added --isolation flag for tests.

This is useful to test custom isolation modules with the test suite.
The user can specify the available modules with --modules and then he
can specify the isolator module with the --isolation flag.
With these flags, the test suite will run all tests with the specified
isolator modules.

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


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

Branch: refs/heads/master
Commit: 1ff259e96396273b36624cf94a7989dee150baa6
Parents: 360e432
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Mon Oct 27 21:07:26 2014 +0100
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Oct 27 21:07:27 2014 +0100

----------------------------------------------------------------------
 src/tests/flags.hpp | 12 +++++++++++-
 src/tests/mesos.cpp | 11 +++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1ff259e9/src/tests/flags.hpp
----------------------------------------------------------------------
diff --git a/src/tests/flags.hpp b/src/tests/flags.hpp
index 80f0cee..bf3569f 100644
--- a/src/tests/flags.hpp
+++ b/src/tests/flags.hpp
@@ -75,7 +75,7 @@ public:
         "Where to find docker executable",
         "docker");
 
-    add(&modules,
+    add(&Flags::modules,
         "modules",
         "List of modules to be loaded and be available to the internal\n"
         "subsystems.\n"
@@ -104,6 +104,15 @@ public:
         "    }\n"
         "  ]\n"
         "}");
+
+    // This help message is duplicated from slave/flags.hpp and
+    // should always be kept in sync with that.
+    add(&Flags::isolation,
+        "isolation",
+        "Isolation mechanisms to use, e.g., 'posix/cpu,posix/mem', or\n"
+        "'cgroups/cpu,cgroups/mem', or network/port_mapping\n"
+        "(configure with flag: --with-network-isolator to enable),\n"
+        "or 'external'.");
   }
 
   bool verbose;
@@ -112,6 +121,7 @@ public:
   std::string build_dir;
   std::string docker;
   Option<Modules> modules;
+  Option<std::string> isolation;
 };
 
 // Global flags for running the tests.

http://git-wip-us.apache.org/repos/asf/mesos/blob/1ff259e9/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index bff10d2..2e8e39a 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -170,6 +170,10 @@ slave::Flags MesosTest::CreateSlaveFlags()
   // Make sure that the slave uses the same 'docker' as the tests.
   flags.docker = tests::flags.docker;
 
+  if (tests::flags.isolation.isSome()) {
+    flags.isolation = tests::flags.isolation.get();
+  }
+
   return flags;
 }
 
@@ -410,6 +414,13 @@ slave::Flags ContainerizerTest<slave::MesosContainerizer>::CreateSlaveFlags()
 {
   slave::Flags flags = MesosTest::CreateSlaveFlags();
 
+  // If the user has specified isolation on command-line, we better
+  // use it.
+  if (tests::flags.isolation.isSome()) {
+    flags.isolation = tests::flags.isolation.get();
+    return flags;
+  }
+
 #ifdef __linux__
   Result<string> user = os::user();
   EXPECT_SOME(user);