From a4ca942aa6caebeed685bf6bf6ab66f762bd5d25 Mon Sep 17 00:00:00 2001 From: Elliott Clark Date: Fri, 25 Mar 2016 15:44:06 -0700 Subject: [PATCH] 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(-) delete mode 100644 hbase-native-client/core/test_env.h 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 -#include 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 - -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"); -} -- 2.8.0-rc2