mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [1/4] mesos git commit: Update tests that use the MesosContainerizer to use ContainerLogger.
Date Tue, 29 Dec 2015 23:13:32 GMT
Repository: mesos
Updated Branches:
  refs/heads/master 0d66b6915 -> d5bc8de98


Update tests that use the MesosContainerizer to use ContainerLogger.

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


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

Branch: refs/heads/master
Commit: d5bc8de98b206843495674a6210bd76f8b24c038
Parents: d041363
Author: Joseph Wu <joseph@mesosphere.io>
Authored: Tue Dec 29 15:01:09 2015 -0800
Committer: Benjamin Hindman <benjamin.hindman@gmail.com>
Committed: Tue Dec 29 15:13:23 2015 -0800

----------------------------------------------------------------------
 .../containerizer/filesystem_isolator_tests.cpp | 30 ++++++++++++-------
 .../containerizer/mesos_containerizer_tests.cpp | 31 ++++++++++++++++++++
 2 files changed, 50 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d5bc8de9/src/tests/containerizer/filesystem_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/filesystem_isolator_tests.cpp b/src/tests/containerizer/filesystem_isolator_tests.cpp
index f1dd81b..5bb8503 100644
--- a/src/tests/containerizer/filesystem_isolator_tests.cpp
+++ b/src/tests/containerizer/filesystem_isolator_tests.cpp
@@ -18,6 +18,8 @@
 
 #include <mesos/mesos.hpp>
 
+#include <mesos/slave/container_logger.hpp>
+
 #include <process/owned.hpp>
 #include <process/gtest.hpp>
 
@@ -76,6 +78,7 @@ using mesos::internal::slave::ProvisionerProcess;
 using mesos::internal::slave::Slave;
 using mesos::internal::slave::Store;
 
+using mesos::slave::ContainerLogger;
 using mesos::slave::Isolator;
 
 namespace mesos {
@@ -151,32 +154,37 @@ protected:
 
     Owned<Provisioner> provisioner(new Provisioner(provisionerProcess));
 
-    Try<Isolator*> _isolator =
+    Try<Isolator*> isolator =
       LinuxFilesystemIsolatorProcess::create(flags, provisioner);
 
-    if (_isolator.isError()) {
+    if (isolator.isError()) {
       return Error(
           "Failed to create LinuxFilesystemIsolatorProcess: " +
-          _isolator.error());
+          isolator.error());
     }
 
-    Owned<Isolator> isolator(_isolator.get());
-
-    Try<Launcher*> _launcher = LinuxLauncher::create(flags);
+    Try<Launcher*> launcher = LinuxLauncher::create(flags);
 
-    if (_launcher.isError()) {
-      return Error("Failed to create LinuxLauncher: " + _launcher.error());
+    if (launcher.isError()) {
+      return Error("Failed to create LinuxLauncher: " + launcher.error());
     }
 
-    Owned<Launcher> launcher(_launcher.get());
+    // Create and initialize a new container logger.
+    Try<ContainerLogger*> logger =
+      ContainerLogger::create(flags.container_logger);
+
+    if (logger.isError()) {
+      return Error("Failed to create container logger: " + logger.error());
+    }
 
     return Owned<MesosContainerizer>(
         new MesosContainerizer(
             flags,
             true,
             &fetcher,
-            launcher,
-            {isolator}));
+            Owned<ContainerLogger>(logger.get()),
+            Owned<Launcher>(launcher.get()),
+            {Owned<Isolator>(isolator.get())}));
   }
 
   ContainerInfo createContainerInfo(

http://git-wip-us.apache.org/repos/asf/mesos/blob/d5bc8de9/src/tests/containerizer/mesos_containerizer_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/mesos_containerizer_tests.cpp b/src/tests/containerizer/mesos_containerizer_tests.cpp
index fe67935..95b493c 100644
--- a/src/tests/containerizer/mesos_containerizer_tests.cpp
+++ b/src/tests/containerizer/mesos_containerizer_tests.cpp
@@ -23,6 +23,7 @@
 
 #include <mesos/mesos.hpp>
 
+#include <mesos/slave/container_logger.hpp>
 #include <mesos/slave/isolator.hpp>
 
 #include <process/future.hpp>
@@ -62,6 +63,7 @@ using mesos::internal::slave::state::RunState;
 using mesos::internal::slave::state::SlaveState;
 
 using mesos::slave::ContainerLimitation;
+using mesos::slave::ContainerLogger;
 using mesos::slave::ContainerPrepareInfo;
 using mesos::slave::ContainerState;
 using mesos::slave::Isolator;
@@ -109,10 +111,19 @@ public:
       return Error(launcher.error());
     }
 
+    // Create and initialize a new container logger.
+    Try<ContainerLogger*> logger =
+      ContainerLogger::create(flags.container_logger);
+
+    if (logger.isError()) {
+      return Error("Failed to create container logger: " + logger.error());
+    }
+
     return new MesosContainerizer(
         flags,
         false,
         fetcher,
+        Owned<ContainerLogger>(logger.get()),
         Owned<Launcher>(launcher.get()),
         isolators);
   }
@@ -443,12 +454,14 @@ public:
       const slave::Flags& flags,
       bool local,
       Fetcher* fetcher,
+      const Owned<ContainerLogger>& logger,
       const Owned<Launcher>& launcher,
       const vector<Owned<Isolator>>& isolators)
     : MesosContainerizerProcess(
           flags,
           local,
           fetcher,
+          logger,
           launcher,
           isolators)
   {
@@ -552,10 +565,16 @@ TEST_F(MesosContainerizerDestroyTest, DestroyWhileFetching)
 
   Fetcher fetcher;
 
+  Try<ContainerLogger*> logger =
+    ContainerLogger::create(flags.container_logger);
+
+  ASSERT_SOME(logger);
+
   MockMesosContainerizerProcess* process = new MockMesosContainerizerProcess(
       flags,
       true,
       &fetcher,
+      Owned<ContainerLogger>(logger.get()),
       Owned<Launcher>(launcher.get()),
       vector<Owned<Isolator>>());
 
@@ -618,10 +637,16 @@ TEST_F(MesosContainerizerDestroyTest, DestroyWhilePreparing)
 
   Fetcher fetcher;
 
+  Try<ContainerLogger*> logger =
+    ContainerLogger::create(flags.container_logger);
+
+  ASSERT_SOME(logger);
+
   MockMesosContainerizerProcess* process = new MockMesosContainerizerProcess(
       flags,
       true,
       &fetcher,
+      Owned<ContainerLogger>(logger.get()),
       Owned<Launcher>(launcher.get()),
       {Owned<Isolator>(isolator)});
 
@@ -694,10 +719,16 @@ TEST_F(MesosContainerizerDestroyTest, LauncherDestroyFailure)
 
   Fetcher fetcher;
 
+  Try<ContainerLogger*> logger =
+    ContainerLogger::create(flags.container_logger);
+
+  ASSERT_SOME(logger);
+
   MesosContainerizerProcess* process = new MesosContainerizerProcess(
       flags,
       true,
       &fetcher,
+      Owned<ContainerLogger>(logger.get()),
       Owned<Launcher>(launcher),
       vector<Owned<Isolator>>());
 


Mime
View raw message