Adjusted the revocable cpu isolator test.

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


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

Branch: refs/heads/master
Commit: 644bd30e3c836027ed54aef23a5916e5fbebdf01
Parents: b5dfddf
Author: Jie Yu <[email protected]>
Authored: Fri Jul 10 16:59:18 2015 -0700
Committer: Jie Yu <[email protected]>
Committed: Thu Jul 16 17:03:22 2015 -0700

----------------------------------------------------------------------
 src/tests/isolator_tests.cpp | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/644bd30e/src/tests/isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/isolator_tests.cpp b/src/tests/isolator_tests.cpp
index c251da3..9fc02c4 100644
--- a/src/tests/isolator_tests.cpp
+++ b/src/tests/isolator_tests.cpp
@@ -51,6 +51,7 @@
 #include "slave/slave.hpp"
 
 #ifdef __linux__
+#include "slave/containerizer/isolators/cgroups/constants.hpp"
 #include "slave/containerizer/isolators/cgroups/cpushare.hpp"
 #include "slave/containerizer/isolators/cgroups/mem.hpp"
 #include "slave/containerizer/isolators/cgroups/perf_event.hpp"
@@ -80,18 +81,17 @@ using mesos::internal::master::Master;
 using mesos::internal::slave::CgroupsCpushareIsolatorProcess;
 using mesos::internal::slave::CgroupsMemIsolatorProcess;
 using mesos::internal::slave::CgroupsPerfEventIsolatorProcess;
+using mesos::internal::slave::CPU_SHARES_PER_CPU_REVOCABLE;
 using mesos::internal::slave::Fetcher;
+using mesos::internal::slave::LinuxLauncher;
 using mesos::internal::slave::SharedFilesystemIsolatorProcess;
 #endif // __linux__
 using mesos::internal::slave::Launcher;
 using mesos::internal::slave::MesosContainerizer;
-using mesos::internal::slave::Slave;
-#ifdef __linux__
-using mesos::internal::slave::LinuxLauncher;
-#endif // __linux__
 using mesos::internal::slave::PosixLauncher;
 using mesos::internal::slave::PosixCpuIsolatorProcess;
 using mesos::internal::slave::PosixMemIsolatorProcess;
+using mesos::internal::slave::Slave;
 
 using mesos::slave::Isolator;
 using mesos::slave::IsolatorProcess;
@@ -417,6 +417,17 @@ TEST_F(RevocableCpuIsolatorTest, ROOT_CGROUPS_RevocableCpu)
   // Check the executor has its scheduling policy set to IDLE.
   EXPECT_SOME_EQ(sched::Policy::IDLE, sched::policy::get(pid.get()));
 
+  // Executor should have proper cpu.shares for revocable containers.
+  Result<string> cpuHierarchy = cgroups::hierarchy("cpu");
+  ASSERT_SOME(cpuHierarchy);
+
+  Result<string> cpuCgroup = cgroups::cpu::cgroup(pid.get());
+  ASSERT_SOME(cpuCgroup);
+
+  EXPECT_SOME_EQ(
+      CPU_SHARES_PER_CPU_REVOCABLE,
+      cgroups::cpu::shares(cpuHierarchy.get(), cpuCgroup.get()));
+
   // Kill the container and clean up.
   Future<Option<int>> status = process::reap(pid.get());
 

Reply via email to