You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2019/07/19 22:06:22 UTC
[mesos] 03/03: Added a test `ROOT_DebugContainerWithPrivateIPCMode`.
This is an automated email from the ASF dual-hosted git repository.
gilbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 02b6467f9e8035166f400e0112015ac56c9281b6
Author: Qian Zhang <zh...@gmail.com>
AuthorDate: Fri Jul 19 15:06:08 2019 -0700
Added a test `ROOT_DebugContainerWithPrivateIPCMode`.
Review: https://reviews.apache.org/r/71122/
---
src/tests/containerizer/isolator_tests.cpp | 53 ++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/src/tests/containerizer/isolator_tests.cpp b/src/tests/containerizer/isolator_tests.cpp
index 0cbe0fe..e442cdf 100644
--- a/src/tests/containerizer/isolator_tests.cpp
+++ b/src/tests/containerizer/isolator_tests.cpp
@@ -1121,6 +1121,59 @@ TEST_F(NamespacesIsolatorTest, ROOT_NonePrivateIPCModeWithShmSize)
AWAIT_FAILED(launch);
}
+
+
+// This test verifies that we do not support launching debug container
+// with private IPC mode.
+TEST_F(NamespacesIsolatorTest, ROOT_DebugContainerWithPrivateIPCMode)
+{
+ Try<Owned<MesosContainerizer>> containerizer =
+ createContainerizer("filesystem/linux,namespaces/ipc");
+
+ ASSERT_SOME(containerizer);
+
+ // Launch a top-level container.
+ process::Future<Containerizer::LaunchResult> launch =
+ containerizer.get()->launch(
+ containerId,
+ createContainerConfig(
+ None(),
+ createExecutorInfo("executor", "sleep 1000"),
+ directory),
+ std::map<string, string>(),
+ None());
+
+ AWAIT_ASSERT_EQ(Containerizer::LaunchResult::SUCCESS, launch);
+
+ // Launch a debug container with private IPC mode under the
+ // top-level container.
+ ContainerID debugContainerId;
+ debugContainerId.mutable_parent()->CopyFrom(containerId);
+ debugContainerId.set_value(id::UUID::random().toString());
+
+ ContainerInfo containerInfo;
+ containerInfo.set_type(ContainerInfo::MESOS);
+ containerInfo.mutable_linux_info()->set_ipc_mode(LinuxInfo::PRIVATE);
+
+ launch = containerizer.get()->launch(
+ debugContainerId,
+ createContainerConfig(
+ createCommandInfo("sleep 1000"),
+ containerInfo,
+ ContainerClass::DEBUG),
+ std::map<string, string>(),
+ None());
+
+ AWAIT_FAILED(launch);
+
+ Future<Option<ContainerTermination>> termination =
+ containerizer.get()->destroy(containerId);
+
+ AWAIT_READY(termination);
+ ASSERT_SOME(termination.get());
+ ASSERT_TRUE(termination.get()->has_status());
+ EXPECT_WTERMSIG_EQ(SIGKILL, termination.get()->status());
+}
#endif // __linux__
} // namespace tests {