You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2018/11/16 18:28:20 UTC

kudu git commit: Fix some issues in HMS and Sentry test fixtures

Repository: kudu
Updated Branches:
  refs/heads/master b22f9d7e8 -> 3efc113be


Fix some issues in HMS and Sentry test fixtures

1. The HMS or Sentry client object may be null in TearDown. If we don't
   check, we'll deref a null pointer if there's an error during SetUp()
   (e.g. if the HMS or Sentry server failed to start).
2. The HMSCatalogTest fixture should properly chain to its superclass.

Change-Id: Ib0376b972fe6add6d9312aea6944c9ab1a03f25f
Reviewed-on: http://gerrit.cloudera.org:8080/11943
Reviewed-by: Hao Hao <ha...@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/3efc113b
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/3efc113b
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/3efc113b

Branch: refs/heads/master
Commit: 3efc113bed03e72408e2d7d792d8267d86575f81
Parents: b22f9d7
Author: Adar Dembo <ad...@cloudera.com>
Authored: Fri Nov 16 10:04:47 2018 -0800
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Fri Nov 16 18:28:07 2018 +0000

----------------------------------------------------------------------
 src/kudu/hms/hms_catalog-test.cc   | 6 +++++-
 src/kudu/sentry/sentry-test-base.h | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/3efc113b/src/kudu/hms/hms_catalog-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/hms/hms_catalog-test.cc b/src/kudu/hms/hms_catalog-test.cc
index 20f975f..9c57b9e 100644
--- a/src/kudu/hms/hms_catalog-test.cc
+++ b/src/kudu/hms/hms_catalog-test.cc
@@ -126,6 +126,7 @@ class HmsCatalogTest : public KuduTest {
   }
 
   void SetUp() override {
+    KuduTest::SetUp();
     bool enable_kerberos = EnableKerberos();
 
     thrift::ClientOptions hms_client_opts;
@@ -167,8 +168,11 @@ class HmsCatalogTest : public KuduTest {
   }
 
   void TearDown() override {
-    ASSERT_OK(hms_client_->Stop());
+    if (hms_client_) {
+      ASSERT_OK(hms_client_->Stop());
+    }
     ASSERT_OK(hms_->Stop());
+    KuduTest::TearDown();
   }
 
   Status StopHms() {

http://git-wip-us.apache.org/repos/asf/kudu/blob/3efc113b/src/kudu/sentry/sentry-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/sentry/sentry-test-base.h b/src/kudu/sentry/sentry-test-base.h
index c18bc79..a67f74f 100644
--- a/src/kudu/sentry/sentry-test-base.h
+++ b/src/kudu/sentry/sentry-test-base.h
@@ -67,7 +67,9 @@ class SentryTestBase : public KuduTest,
   }
 
   void TearDown() override {
-    ASSERT_OK(sentry_client_->Stop());
+    if (sentry_client_) {
+      ASSERT_OK(sentry_client_->Stop());
+    }
     ASSERT_OK(sentry_->Stop());
     KuduTest::TearDown();
   }