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 2017/12/02 06:36:08 UTC

mesos git commit: Add a temporary filter for overlay backend related tests.

Repository: mesos
Updated Branches:
  refs/heads/master 18b488ff9 -> 11f2f7ef3


Add a temporary filter for overlay backend related tests.

This is a temporary filter to disable tests that use
overlay as backend on filesystems where `d_type` support is
missing. In particular, many XFS nodes are known to have this
issue.

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


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

Branch: refs/heads/master
Commit: 11f2f7ef30946093b9d584ea17232bc6e9fa0e97
Parents: 18b488f
Author: Meng Zhu <mz...@mesosphere.io>
Authored: Fri Dec 1 22:35:27 2017 -0800
Committer: Gilbert Song <so...@gmail.com>
Committed: Fri Dec 1 22:35:27 2017 -0800

----------------------------------------------------------------------
 .../containerizer/provisioner_docker_tests.cpp  |  4 +-
 src/tests/environment.cpp                       | 74 ++++++++++++++++++++
 2 files changed, 76 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/11f2f7ef/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 832c81f..13f5350 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -672,7 +672,7 @@ INSTANTIATE_TEST_CASE_P(
 
 // This test verifies that a docker image containing whiteout files
 // will be processed correctly by copy, aufs and overlay backends.
-TEST_P(ProvisionerDockerBackendTest, ROOT_INTERNET_CURL_Whiteout)
+TEST_P(ProvisionerDockerBackendTest, ROOT_INTERNET_CURL_DTYPE_Whiteout)
 {
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
@@ -760,7 +760,7 @@ TEST_P(ProvisionerDockerBackendTest, ROOT_INTERNET_CURL_Whiteout)
 // This test verifies that the provisioner correctly overwrites a
 // directory in underlying layers with a with a regular file or symbolic
 // link of the same name in an upper layer, and vice versa.
-TEST_P(ProvisionerDockerBackendTest, ROOT_INTERNET_CURL_Overwrite)
+TEST_P(ProvisionerDockerBackendTest, ROOT_INTERNET_CURL_DTYPE_Overwrite)
 {
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);

http://git-wip-us.apache.org/repos/asf/mesos/blob/11f2f7ef/src/tests/environment.cpp
----------------------------------------------------------------------
diff --git a/src/tests/environment.cpp b/src/tests/environment.cpp
index 607ac6c..72bd621 100644
--- a/src/tests/environment.cpp
+++ b/src/tests/environment.cpp
@@ -317,6 +317,79 @@ private:
 };
 
 
+// Note: This is a temporary filter to disable tests that use
+// overlay as backend on filesystems where `d_type` support is
+// missing. In particular, many XFS nodes are known to have this
+// issue due to mkfs option with `f_type = 0`. Please see
+// MESOS-8121 for more info.
+//
+// This filter assumes that the affected tests will use
+// `/tmp` as root directory of the agent's work dir.
+class DtypeFilter : public TestFilter
+{
+public:
+  DtypeFilter()
+  {
+#ifdef __linux__
+    auto checkDirDtype = [this](const string& directory) {
+      string probeDir = path::join(directory, ".probe");
+
+      Try<Nothing> mkdir = os::mkdir(probeDir);
+      if (mkdir.isError()) {
+        dtypeError = Error(
+            "Cannot verify filesystem d_type attribute: "
+            "Failed to create temporary directory '" +
+            probeDir + "': " + mkdir.error());
+      }
+
+      Try<bool> supportDType = fs::dtypeSupported(directory);
+
+      // Clean up the temporary directory that is used
+      // for d_type detection.
+      Try<Nothing> rmdir = os::rmdir(probeDir);
+      if (rmdir.isError()) {
+        LOG(WARNING) << "Failed to remove temporary directory"
+                     << "' " << probeDir << "': " << rmdir.error();
+      }
+
+      if (supportDType.isError()) {
+        dtypeError = Error(
+          "Cannot verify filesystem d_type attribute: " +
+          supportDType.error());
+      }
+
+      if (!supportDType.get()) {
+        dtypeError = Error(
+            "The underlying filesystem of " + directory +
+            " misses d_type support.");
+      }
+    };
+
+    // TODO(mzhu): Avoid hard coding a specific directory for
+    // filtering. This is a temporary solution.
+    checkDirDtype(os::temp());
+
+    if (dtypeError.isSome()) {
+      std::cerr
+        << "-------------------------------------------------------------\n"
+        << "We cannot run any overlay backend tests because:\n"
+        << dtypeError.get().message << "\n"
+        << "-------------------------------------------------------------\n";
+      return;
+    }
+#endif
+  }
+
+  bool disable(const ::testing::TestInfo* test) const
+  {
+    return dtypeError.isSome() && matches(test, "DTYPE_");
+  }
+
+private:
+  Option<Error> dtypeError;
+};
+
+
 class InternetFilter : public TestFilter
 {
 public:
@@ -692,6 +765,7 @@ Environment::Environment(const Flags& _flags)
             std::make_shared<CgroupsFilter>(),
             std::make_shared<CurlFilter>(),
             std::make_shared<DockerFilter>(),
+            std::make_shared<DtypeFilter>(),
             std::make_shared<InternetFilter>(),
             std::make_shared<LogrotateFilter>(),
             std::make_shared<NetcatFilter>(),