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/07/04 19:44:36 UTC
[3/3] mesos git commit: Added test for file volume from host sandbox
mountpoint.
Added test for file volume from host sandbox mountpoint.
Review: https://reviews.apache.org/r/49186/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/750ada63
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/750ada63
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/750ada63
Branch: refs/heads/master
Commit: 750ada63cacece03bba7d23bb498892c56fbd699
Parents: f6e2d1e
Author: Gilbert Song <so...@gmail.com>
Authored: Mon Jul 4 12:44:21 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Jul 4 12:44:21 2016 -0700
----------------------------------------------------------------------
.../containerizer/filesystem_isolator_tests.cpp | 52 ++++++++++++++++++++
1 file changed, 52 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/750ada63/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 82e5cae..4d852ad 100644
--- a/src/tests/containerizer/filesystem_isolator_tests.cpp
+++ b/src/tests/containerizer/filesystem_isolator_tests.cpp
@@ -1010,6 +1010,58 @@ TEST_F(LinuxFilesystemIsolatorTest, ROOT_VolumeFromHostSandboxMountPoint)
}
+// This test verifies that a file volume with an absolute host path
+// and a relative container path is properly mounted in the container's
+// mount namespace. The mount point will be created in the sandbox.
+TEST_F(LinuxFilesystemIsolatorTest, ROOT_FileVolumeFromHostSandboxMountPoint)
+{
+ slave::Flags flags = CreateSlaveFlags();
+
+ ContainerID containerId;
+ containerId.set_value(UUID::random().toString());
+
+ Try<Owned<MesosContainerizer>> containerizer = createContainerizer(
+ flags,
+ {{"test_image", path::join(os::getcwd(), "test_image")}});
+
+ ASSERT_SOME(containerizer);
+
+ ExecutorInfo executor = CREATE_EXECUTOR_INFO(
+ "test_executor",
+ "test -f mountpoint/file.txt");
+
+ const string file = path::join(os::getcwd(), "file");
+ ASSERT_SOME(os::touch(file));
+
+ executor.mutable_container()->CopyFrom(createContainerInfo(
+ "test_image",
+ {createVolumeFromHostPath("mountpoint/file.txt", file, Volume::RW)}));
+
+ const string directory = path::join(os::getcwd(), "sandbox");
+ ASSERT_SOME(os::mkdir(directory));
+
+ Future<bool> launch = containerizer.get()->launch(
+ containerId,
+ executor,
+ directory,
+ None(),
+ SlaveID(),
+ PID<Slave>(),
+ false);
+
+ AWAIT_READY_FOR(launch, Seconds(60));
+
+ Future<containerizer::Termination> wait =
+ containerizer.get()->wait(containerId);
+
+ AWAIT_READY(wait);
+
+ // Check the executor exited correctly.
+ EXPECT_TRUE(wait.get().has_status());
+ EXPECT_EQ(0, wait.get().status());
+}
+
+
// This test verifies that persistent volumes are properly mounted in
// the container's root filesystem.
TEST_F(LinuxFilesystemIsolatorTest, ROOT_PersistentVolumeWithRootFilesystem)