You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/02/08 01:40:50 UTC

[4/6] mesos git commit: Changed test DockerArchive to include environment variables.

Changed test DockerArchive to include environment variables.

This subtly modifies all tests using the `docker/runtime` isolator
to fail if environment variables from inside the DockerArchive
are passed into the Mesos executor's environment.  This applies
for all executors (default, command, and docker), but mainly
affects the command executor.

The environment variables are `LD_LIBRARY_PATH`, `LIBPROCESS_IP`,
and `LIBPROCESS_PORT`; all of which are set to `invalid`.  This
either causes linking problems or will force libprocess to exit.

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


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

Branch: refs/heads/master
Commit: f7a77bf5306b5e4ef20c9bb1121e60ed22adf19e
Parents: 7319e01
Author: Joseph Wu <jo...@apache.org>
Authored: Wed Feb 1 14:00:19 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Tue Feb 7 17:35:22 2017 -0800

----------------------------------------------------------------------
 src/tests/containerizer/docker_archive.hpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f7a77bf5/src/tests/containerizer/docker_archive.hpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/docker_archive.hpp b/src/tests/containerizer/docker_archive.hpp
index 9e4895b..56211f7 100644
--- a/src/tests/containerizer/docker_archive.hpp
+++ b/src/tests/containerizer/docker_archive.hpp
@@ -23,6 +23,7 @@
 
 #include <stout/error.hpp>
 #include <stout/json.hpp>
+#include <stout/jsonify.hpp>
 #include <stout/nothing.hpp>
 #include <stout/os.hpp>
 #include <stout/path.hpp>
@@ -48,11 +49,21 @@ public:
   // Create a docker test image tarball in docker registry directory.
   // Users can define own entrypoint/cmd as JSON array of JSON string
   // (e.g., `[\"sh\", \"-c\"]`).
+  //
+  // NOTE: The default value for `environment` includes some environment
+  // variables which will cause problems if they are fed into one of Mesos'
+  // built-in executors. This is on purpose, as the environment variables
+  // of the image should not be passed into built-in executors. Tests that
+  // use a custom executor should consider overriding this default.
   static Future<Nothing> create(
       const std::string& directory,
       const std::string& name,
       const std::string& entrypoint = "null",
-      const std::string& cmd = "null")
+      const std::string& cmd = "null",
+      const std::vector<std::string>& environment = {
+        {"LD_LIBRARY_PATH=invalid"},
+        {"LIBPROCESS_IP=invalid"},
+        {"LIBPROCESS_PORT=invalid"}})
   {
     Try<Nothing> mkdir = os::mkdir(directory, true);
     if (mkdir.isError()) {
@@ -138,7 +149,7 @@ public:
                 "Tty": false,
                 "OpenStdin": false,
                 "StdinOnce": false,
-                "Env": null,
+                "Env": %s,
                 "Cmd": %s,
                 "Image": "",
                 "Volumes": null,
@@ -150,6 +161,7 @@ public:
             "architecture": "amd64",
             "os": "linux"
         })~",
+        std::string(jsonify(environment)),
         cmd,
         entrypoint).get()).get();