Repository: mesos
Updated Branches:
  refs/heads/master 044b72e8e -> 73c962831


Updated the Overwrite docker provisioner test for MESOS-7280.

Created a non-empty file 'abc' under the agent's work directory, which
is linked by the symlink '/xyz' in the 2nd layer of the testing image.
This file should not be overwritten by the empty file '/xyz' in the 3rd
layer. Please see the following link for more details:
  https://hub.docker.com/r/chhsiao/overwrite/

The testing image is updated in a way that it is compatible to the
previous Overwrite test.

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


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

Branch: refs/heads/master
Commit: 73c962831c5ce8ee47742d9951fec7c38e691c2f
Parents: 044b72e
Author: Chun-Hung Hsiao <[email protected]>
Authored: Wed Apr 26 12:06:33 2017 -0700
Committer: Jie Yu <[email protected]>
Committed: Wed Apr 26 12:08:50 2017 -0700

----------------------------------------------------------------------
 .../containerizer/provisioner_docker_tests.cpp      | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/73c96283/src/tests/containerizer/provisioner_docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/provisioner_docker_tests.cpp 
b/src/tests/containerizer/provisioner_docker_tests.cpp
index c26e1f9..52e57ce 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -769,7 +769,7 @@ TEST_P(ProvisionerDockerBackendTest, 
ROOT_INTERNET_CURL_Overwrite)
   // We are using the docker image 'chhsiao/overwrite' to verify that:
   //   1. The '/merged' directory is merged.
   //   2. All '/replaced*' files/directories are correctly overwritten.
-  //   3. The '/bar' symlink and '/baz' file are correctly overwritten.
+  //   3. The '/foo', '/bar' and '/baz' files are correctly overwritten.
   // See more details in the following link:
   //   https://hub.docker.com/r/chhsiao/overwrite/
   CommandInfo command = createCommandInfo(
@@ -802,6 +802,16 @@ TEST_P(ProvisionerDockerBackendTest, 
ROOT_INTERNET_CURL_Overwrite)
     .WillOnce(FutureArg<1>(&statusRunning))
     .WillOnce(FutureArg<1>(&statusFinished));
 
+  // Create a non-empty file 'abc' in the agent's work directory on the
+  // host filesystem. This file is symbolically linked by
+  //   '/xyz -> ../../../../../../../abc'
+  // in the 2nd layer of the testing image during provisioning.
+  // For more details about the provisioner directory please see:
+  //   
https://github.com/apache/mesos/blob/master/src/slave/containerizer/mesos/provisioner/paths.hpp#L34-L48
 // NOLINT
+  const string hostFile = flags.work_dir + "/abc";
+  os::shell("echo abc > " + hostFile);
+  ASSERT_SOME(os::shell("test -s " + hostFile));
+
   driver.launchTasks(offer.id(), {task});
 
   AWAIT_READY_FOR(statusRunning, Seconds(60));
@@ -812,6 +822,10 @@ TEST_P(ProvisionerDockerBackendTest, 
ROOT_INTERNET_CURL_Overwrite)
   EXPECT_EQ(task.task_id(), statusFinished->task_id());
   EXPECT_EQ(TASK_FINISHED, statusFinished->state());
 
+  // The non-empty file should not be overwritten by the empty file
+  // '/xyz' in the 3rd layer of the testing image during provisioning.
+  EXPECT_SOME(os::shell("test -s " + hostFile));
+
   driver.stop();
   driver.join();
 }

Reply via email to