Repository: mesos Updated Branches: refs/heads/master dcae184eb -> e0c540173
Modified a test to also check if the data was written to the volume. Previously, it was possbile that the directory exists but does not link to the persistent volume. Review: https://reviews.apache.org/r/57700 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e0c54017 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e0c54017 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e0c54017 Branch: refs/heads/master Commit: e0c54017313843502cd808cfa568d43417476b03 Parents: 28876a4 Author: Anand Mazumdar <[email protected]> Authored: Thu Mar 16 11:35:51 2017 -0700 Committer: Anand Mazumdar <[email protected]> Committed: Mon Mar 20 15:39:55 2017 -0700 ---------------------------------------------------------------------- src/tests/default_executor_tests.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/e0c54017/src/tests/default_executor_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/default_executor_tests.cpp b/src/tests/default_executor_tests.cpp index cbce486..b7440d3 100644 --- a/src/tests/default_executor_tests.cpp +++ b/src/tests/default_executor_tests.cpp @@ -1421,6 +1421,7 @@ TEST_P(PersistentVolumeDefaultExecutor, ROOT_PersistentResources) flags.authenticate_http_readwrite = false; flags.launcher = param.launcher; flags.isolation = param.isolation; + Owned<MasterDetector> detector = master.get()->createDetector(); Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), flags); ASSERT_SOME(slave); @@ -1464,7 +1465,7 @@ TEST_P(PersistentVolumeDefaultExecutor, ROOT_PersistentResources) frameworkInfo.role(), v1::createReservationInfo(frameworkInfo.principal())).get(); - v1::Resources volume = v1::createPersistentVolume( + v1::Resource volume = v1::createPersistentVolume( Megabytes(1), frameworkInfo.role(), "id1", @@ -1493,7 +1494,7 @@ TEST_P(PersistentVolumeDefaultExecutor, ROOT_PersistentResources) v1::TaskInfo taskInfo = v1::createTask( offer.agent_id(), unreserved, - "test -d task_volume_path"); + "echo abc > task_volume_path/file"); // TODO(gilbert): Refactor the following code once the helper // to create a 'sandbox_path' volume is suppported. @@ -1540,6 +1541,15 @@ TEST_P(PersistentVolumeDefaultExecutor, ROOT_PersistentResources) AWAIT_READY(updateFinished); ASSERT_EQ(TASK_FINISHED, updateFinished->status().state()); ASSERT_EQ(taskInfo.task_id(), updateFinished->status().task_id()); + + string volumePath = slave::paths::getPersistentVolumePath( + flags.work_dir, + devolve(volume)); + + string filePath = path::join(volumePath, "file"); + + // Ensure that the task was able to write to the persistent volume. + EXPECT_SOME_EQ("abc\n", os::read(filePath)); }
