You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/12/05 21:24:39 UTC
[2/3] mesos git commit: Use a common fixture for the PID namespace
test.
Use a common fixture for the PID namespace test.
Review: https://reviews.apache.org/r/53689/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a03ee9b3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a03ee9b3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a03ee9b3
Branch: refs/heads/master
Commit: a03ee9b3563d2191bf1d5575b7a2ddb1d3566898
Parents: 25ac581
Author: James Peach <jp...@apache.org>
Authored: Mon Dec 5 13:18:18 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Dec 5 13:18:18 2016 -0800
----------------------------------------------------------------------
src/tests/containerizer/isolator_tests.cpp | 29 +++++++------------------
1 file changed, 8 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/a03ee9b3/src/tests/containerizer/isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/isolator_tests.cpp b/src/tests/containerizer/isolator_tests.cpp
index 111e1ab..355e15f 100644
--- a/src/tests/containerizer/isolator_tests.cpp
+++ b/src/tests/containerizer/isolator_tests.cpp
@@ -99,32 +99,17 @@ public:
};
-class NamespacesPidIsolatorTest : public MesosTest {};
-
-
-TEST_F(NamespacesPidIsolatorTest, ROOT_PidNamespace)
+TEST_F(NamespacesIsolatorTest, ROOT_PidNamespace)
{
- slave::Flags flags = CreateSlaveFlags();
- flags.isolation = "filesystem/linux,namespaces/pid";
-
- string directory = os::getcwd(); // We're inside a temporary sandbox.
-
- Fetcher fetcher;
-
- Try<MesosContainerizer*> _containerizer =
- MesosContainerizer::create(flags, false, &fetcher);
-
- ASSERT_SOME(_containerizer);
- Owned<MesosContainerizer> containerizer(_containerizer.get());
-
- ContainerID containerId;
- containerId.set_value(UUID::random().toString());
+ Try<Owned<MesosContainerizer>> containerizer =
+ createContainerizer("filesystem/linux,namespaces/pid");
+ ASSERT_SOME(containerizer);
// Write the command's pid namespace inode and init name to files.
const string command =
"stat -c %i /proc/self/ns/pid > ns && (cat /proc/1/comm > init)";
- Future<bool> launch = containerizer->launch(
+ process::Future<bool> launch = containerizer.get()->launch(
containerId,
None(),
createExecutorInfo("executor", command),
@@ -138,7 +123,9 @@ TEST_F(NamespacesPidIsolatorTest, ROOT_PidNamespace)
ASSERT_TRUE(launch.get());
// Wait on the container.
- Future<Option<ContainerTermination>> wait = containerizer->wait(containerId);
+ Future<Option<ContainerTermination>> wait =
+ containerizer.get()->wait(containerId);
+
AWAIT_READY(wait);
ASSERT_SOME(wait.get());