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 2016/04/25 23:35:47 UTC

[06/48] mesos git commit: Fixed the NetClsIsolatorTest to correctly learn the net_cls hierarchy.

Fixed the NetClsIsolatorTest to correctly learn the net_cls hierarchy.

The test relied on the flags.cgroups_hierarchy to learn the net_cls
hierarchy, instead it should be making a call to cgroups::hierarchy to
learn the hierarchy.

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


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

Branch: refs/heads/0.27.x
Commit: 1a35d59e9933e43328a92ba72160f9e0f28e5ee0
Parents: 502c2d3
Author: Avinash sridharan <av...@mesosphere.io>
Authored: Wed Jan 27 17:31:14 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Wed Jan 27 20:04:51 2016 -0800

----------------------------------------------------------------------
 src/tests/containerizer/isolator_tests.cpp | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1a35d59e/src/tests/containerizer/isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/isolator_tests.cpp b/src/tests/containerizer/isolator_tests.cpp
index 7033ac1..8d101df 100644
--- a/src/tests/containerizer/isolator_tests.cpp
+++ b/src/tests/containerizer/isolator_tests.cpp
@@ -867,6 +867,7 @@ TEST_F(NetClsIsolatorTest, ROOT_CGROUPS_NetClsIsolate)
 
   Try<MesosContainerizer*> containerizer =
     MesosContainerizer::create(flags, true, &fetcher);
+
   ASSERT_SOME(containerizer);
 
   Try<PID<Slave>> slave = StartSlave(containerizer.get(), flags);
@@ -914,15 +915,16 @@ TEST_F(NetClsIsolatorTest, ROOT_CGROUPS_NetClsIsolate)
 
   const ContainerID& containerID = *(containers.get().begin());
 
-  // Check if the net_cls cgroup for this container exists, by checking for the
-  // processes associated with this cgroup.
-  string container_cgroup = path::join(
+  Result<string> hierarchy = cgroups::hierarchy("net_cls");
+  ASSERT_SOME(hierarchy);
+
+  // Check if the net_cls cgroup for this container exists, by
+  // checking for the processes associated with this cgroup.
+  string cgroup = path::join(
       flags.cgroups_root,
       containerID.value());
 
-  Try<set<pid_t>> pids = cgroups::processes(
-        path::join(flags.cgroups_hierarchy, "net_cls"),
-        container_cgroup);
+  Try<set<pid_t>> pids = cgroups::processes(hierarchy.get(), cgroup);
   ASSERT_SOME(pids);
 
   // There should be at least one TGID associated with this cgroup.
@@ -945,7 +947,7 @@ TEST_F(NetClsIsolatorTest, ROOT_CGROUPS_NetClsIsolate)
 
   // If the cleanup is successful the net_cls cgroup for this container should
   // not exist.
-  ASSERT_FALSE(os::exists(container_cgroup));
+  ASSERT_FALSE(os::exists(cgroup));
 
   driver.stop();
   driver.join();