kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [kudu] branch branch-1.9.x updated: [fs_manager-test] fix tests for macOS
Date Thu, 07 Feb 2019 00:26:09 GMT
This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.9.x
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/branch-1.9.x by this push:
     new 892e584  [fs_manager-test] fix tests for macOS
892e584 is described below

commit 892e584e0e94942791bfb25ae1fa3e06aee64ee0
Author: Alexey Serbin <alexey@apache.org>
AuthorDate: Sun Feb 3 20:49:49 2019 -0800

    [fs_manager-test] fix tests for macOS
    
    As it turned out, it's been a while since the fs_manager-test started
    failing.  In changelist b2f690d5 some changes were introduced
    so one test started failing, and later on, with changelist 006937d3
    the total number of failing tests on macOS grew up to three in total.
    
    The reason behind the failures is simple: on macOS the only
    block manager is FileBlockManager and it doesn't support many of
    the operations exercised in the tests scenarios that started
    failing.  This patch short-circuits those scenarios so they now
    pass on macOS.
    
    Change-Id: I19a8c6f48435bf5424500c86283490c9fed408f4
    Reviewed-on: http://gerrit.cloudera.org:8080/12383
    Reviewed-by: Andrew Wong <awong@cloudera.com>
    Tested-by: Kudu Jenkins
    (cherry picked from commit a8367e862d5a71d920cbc94ea58d3bf5135418c6)
    Reviewed-on: http://gerrit.cloudera.org:8080/12390
---
 src/kudu/fs/fs_manager-test.cc | 46 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/kudu/fs/fs_manager-test.cc b/src/kudu/fs/fs_manager-test.cc
index df84259..7432ade 100644
--- a/src/kudu/fs/fs_manager-test.cc
+++ b/src/kudu/fs/fs_manager-test.cc
@@ -423,6 +423,7 @@ TEST_F(FsManagerTestBase, TestOpenWithNoBlockManagerInstances) {
   const string wal_path = GetTestPath("wals");
   FsManagerOpts opts;
   opts.wal_root = wal_path;
+  const auto block_manager_type = opts.block_manager_type;
   ReinitFsManagerWithOpts(std::move(opts));
   ASSERT_OK(fs_manager()->CreateInitialFileSystemLayout());
   ASSERT_OK(fs_manager()->Open());
@@ -444,7 +445,15 @@ TEST_F(FsManagerTestBase, TestOpenWithNoBlockManagerInstances) {
     // Once we supply the WAL directory as a data directory, we can open successfully.
     new_opts.data_roots.emplace_back(wal_path);
     ReinitFsManagerWithOpts(std::move(new_opts));
-    ASSERT_OK(fs_manager()->Open());
+    s = fs_manager()->Open();
+    if (block_manager_type == "file" &&
+        check_behavior == ConsistencyCheckBehavior::UPDATE_ON_DISK) {
+      ASSERT_TRUE(s.IsInvalidArgument()) << s.ToString();
+      ASSERT_STR_CONTAINS(s.ToString(),
+          "file block manager may not add or remove data directories");
+    } else {
+      ASSERT_OK(s);
+    }
   }
 }
 
@@ -459,9 +468,17 @@ TEST_F(FsManagerTestBase, TestOpenWithUnhealthyDataDir) {
   opts.data_roots = { fs_root_, new_root };
   opts.consistency_check = ConsistencyCheckBehavior::UPDATE_ON_DISK;
   ReinitFsManagerWithOpts(opts);
-  ASSERT_OK(fs_manager()->Open());
   string new_root_uuid;
-  ASSERT_TRUE(fs_manager()->dd_manager()->FindUuidByRoot(new_root, &new_root_uuid));
+  auto s = fs_manager()->Open();
+  if (opts.block_manager_type == "file") {
+    ASSERT_TRUE(s.IsInvalidArgument()) << s.ToString();
+    ASSERT_STR_CONTAINS(s.ToString(),
+        "file block manager may not add or remove data directories");
+  } else {
+    ASSERT_OK(s);
+    ASSERT_TRUE(fs_manager()->dd_manager()->FindUuidByRoot(new_root,
+                                                           &new_root_uuid));
+  }
 
   // Fail the new directory. Kudu should have no problem starting up with this
   // and should list one as failed.
@@ -469,7 +486,15 @@ TEST_F(FsManagerTestBase, TestOpenWithUnhealthyDataDir) {
   FLAGS_env_inject_eio = 1.0;
   opts.consistency_check = ConsistencyCheckBehavior::ENFORCE_CONSISTENCY;
   ReinitFsManagerWithOpts(opts);
-  ASSERT_OK(fs_manager()->Open());
+  s = fs_manager()->Open();
+  if (opts.block_manager_type == "file") {
+    ASSERT_TRUE(s.IsIOError()) << s.ToString();
+    ASSERT_STR_CONTAINS(s.ToString(), "could not verify integrity of files");
+    LOG(INFO) << "Skipping the rest of test, file block manager not supported";
+    return;
+  }
+
+  ASSERT_OK(s);
   ASSERT_EQ(1, fs_manager()->dd_manager()->GetFailedDataDirs().size());
 
   // Now remove the new directory on disk. Similarly, Kudu should have no
@@ -501,7 +526,7 @@ TEST_F(FsManagerTestBase, TestOpenWithUnhealthyDataDir) {
   FLAGS_env_inject_eio = 1.0;
   opts.consistency_check = ConsistencyCheckBehavior::ENFORCE_CONSISTENCY;
   ReinitFsManagerWithOpts(opts);
-  Status s = fs_manager()->Open();
+  s = fs_manager()->Open();
   ASSERT_TRUE(s.IsNotFound()) << s.ToString();
   ASSERT_STR_CONTAINS(s.ToString(), "could not find a healthy instance file");
 
@@ -564,7 +589,16 @@ TEST_F(FsManagerTestBase, TestOpenWithCanonicalizationFailure) {
   // one. Until that happens, we won't be able to update the data dirs.
   opts.consistency_check = ConsistencyCheckBehavior::UPDATE_ON_DISK;
   ReinitFsManagerWithOpts(opts);
-  Status s = fs_manager()->Open();
+
+  const auto s = fs_manager()->Open();
+  if (opts.block_manager_type == "file") {
+    ASSERT_TRUE(s.IsInvalidArgument()) << s.ToString();
+    ASSERT_STR_CONTAINS(s.ToString(),
+        "file block manager may not add or remove data directories");
+    LOG(INFO) << "Skipping the rest of test, file block manager not supported";
+    return;
+  }
+
   ASSERT_TRUE(s.IsNotFound()) << s.ToString();
   ASSERT_STR_CONTAINS(s.ToString(), "could not add new data directories");
 


Mime
View raw message