You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zg...@apache.org on 2019/03/12 12:44:54 UTC

[hbase] 06/133: HBASE-15418 Clean up un-used warning in test util

This is an automated email from the ASF dual-hosted git repository.

zghao pushed a commit to branch HBASE-14850
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit bbf613f0f06fc6ad9c1e4bb41ba0ab8117b5ee7c
Author: Elliott Clark <ec...@apache.org>
AuthorDate: Fri Mar 25 15:44:06 2016 -0700

    HBASE-15418 Clean up un-used warning in test util
---
 .../bin/start_local_hbase_and_wait.sh              |  9 +++++-
 .../bin/stop_local_hbase_and_wait.sh               |  2 +-
 hbase-native-client/core/BUCK                      |  6 ----
 hbase-native-client/core/native-client-test-env.cc |  9 ++++--
 hbase-native-client/core/test_env.h                | 32 ----------------------
 5 files changed, 15 insertions(+), 43 deletions(-)

diff --git a/hbase-native-client/bin/start_local_hbase_and_wait.sh b/hbase-native-client/bin/start_local_hbase_and_wait.sh
index 64d0b68..cfc71f9 100755
--- a/hbase-native-client/bin/start_local_hbase_and_wait.sh
+++ b/hbase-native-client/bin/start_local_hbase_and_wait.sh
@@ -17,10 +17,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# Clean up from any other tests.
+rm -rf /tmp/hbase-*
+
+# Start the master/regionservers.
 $PWD/../bin/start-hbase.sh
 
-until [ $(curl -s -o /dev/null -I -w "%{http_code}" http://localhost:16010) == "200" ]
+until [ $(curl -s -o /dev/null -I -w "%{http_code}" http://localhost:16010/jmx) == "200" ]
 do
      printf "Waiting for local HBase cluster to start\n"
      sleep 1
 done
+
+# This sucks, but master can easily be up and meta not be assigned yet.
+sleep 30
diff --git a/hbase-native-client/bin/stop_local_hbase_and_wait.sh b/hbase-native-client/bin/stop_local_hbase_and_wait.sh
index 4e89334..761412a 100755
--- a/hbase-native-client/bin/stop_local_hbase_and_wait.sh
+++ b/hbase-native-client/bin/stop_local_hbase_and_wait.sh
@@ -17,7 +17,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-$PWD/../bin/stop-hbase.sh
+ps aux | grep proc_master | awk '{print $2}' | xargs kill -9
 
 while [ $(curl -s -o /dev/null -I -w "%{http_code}" http://localhost:16010) == "200" ]
 do
diff --git a/hbase-native-client/core/BUCK b/hbase-native-client/core/BUCK
index 817b5a0..d1e89d1 100644
--- a/hbase-native-client/core/BUCK
+++ b/hbase-native-client/core/BUCK
@@ -51,9 +51,6 @@ cxx_library(name="core",
             ], )
 
 cxx_test(name="simple-test",
-         headers=[
-             "test_env.h",
-         ],
          srcs=[
              "native-client-test-env.cc",
              "simple-native-client-test.cc",
@@ -63,9 +60,6 @@ cxx_test(name="simple-test",
          ],
          run_test_separately=True, )
 cxx_test(name="location-cache-test",
-         headers=[
-             "test_env.h",
-         ],
          srcs=[
              "native-client-test-env.cc",
              "location-cache-test.cc",
diff --git a/hbase-native-client/core/native-client-test-env.cc b/hbase-native-client/core/native-client-test-env.cc
index a86961f..07f30a6 100644
--- a/hbase-native-client/core/native-client-test-env.cc
+++ b/hbase-native-client/core/native-client-test-env.cc
@@ -18,18 +18,21 @@
  */
 
 #include <gtest/gtest.h>
-#include <core/test_env.h>
 
 namespace {
 
 class NativeClientTestEnv : public ::testing::Environment {
  public:
   void SetUp() override {
-    init_test_env();
+    // start local HBase cluster to be reused by all tests
+    auto result = system("bin/start_local_hbase_and_wait.sh");
+    ASSERT_EQ(0, result);
   }
 
   void TearDown() override {
-    clean_test_env();
+    // shutdown local HBase cluster
+    auto result = system("bin/stop_local_hbase_and_wait.sh");
+    ASSERT_EQ(0, result);
   }
 };
 
diff --git a/hbase-native-client/core/test_env.h b/hbase-native-client/core/test_env.h
deleted file mode 100644
index 79bdbec..0000000
--- a/hbase-native-client/core/test_env.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#pragma once
-
-#include <cstdlib>
-
-inline void init_test_env() {
-  // start local HBase cluster to be reused by all tests
-  system("scripts/start_local_hbase_and_wait.sh");
-}
-
-inline void clean_test_env() {
-  // shutdown local HBase cluster
-  system("scripts/stop_local_hbase_and_wait.sh");
-}