diff --git a/hbase-exporter b/hbase-exporter index ec5e0d7..05478f1 100755 --- a/hbase-exporter +++ b/hbase-exporter @@ -78,7 +78,6 @@ hdfs_config_file = "/etc/hadoop/conf/hdfs-site.xml" cmd_hbase_active_master = ['/usr/hdp/current/hbase-client/bin/hbase-jruby', '/usr/hdp/current/hbase-client/bin/get-active-master.rb'] cmd_hbase = 'hbase' cmd_hbase_test = 'tests/hbase/bin/hbase' -cmd_hbase_write = ['hbase-write'] cmd_hdfs_namenodes = ['hdfs', 'getconf', '-namenodes'] # Use command line arguments to set the following vars @@ -527,7 +526,7 @@ class hbase_exporter(): self.num_inconsistencies = None hbck_status = None - logging.info("hbase: Running hbck consistency check") + logging.info("hbase: Running hbck consistency check with cmd: " + cmd_hbase) p = Popen([cmd_hbase, 'hbck'], stdout=PIPE, stderr=PIPE, close_fds=False) output, error = p.communicate() output = output.splitlines() @@ -745,7 +744,11 @@ if __name__ == '__main__': # Try the hbase from test suite if no hbase on PATH if not which('hbase'): - if os.access(cmd_hbase_test, os.X_OK): + logging.error("hbase: Could not find HBase executable in PATH") + if not os.access(cmd_hbase_test, os.X_OK): + logging.error("hbase: Could not find HBase executable from test suite (" + cmd_hbase_test + ")") + else: + logging.info("hbase: Using HBase executable from test suite") cmd_hbase = cmd_hbase_test # Start the Prometheus server diff --git a/tests/hbase-setup.sh b/tests/hbase-setup.sh index 7b0373e..ef3a8cf 100755 --- a/tests/hbase-setup.sh +++ b/tests/hbase-setup.sh @@ -34,7 +34,7 @@ download() { printf "Extracting HBase archive\n" tar xfz ${HBASE_FILE} - mv hbase-${HBASE_VERSION} hbase/ + mv -f hbase-${HBASE_VERSION} hbase/ } create_config() { diff --git a/tests/test_hbase_exporter.sh b/tests/test_hbase_exporter.sh index a098f63..0893b58 100644 --- a/tests/test_hbase_exporter.sh +++ b/tests/test_hbase_exporter.sh @@ -5,7 +5,7 @@ HBASE_PORT=16020 ZK_HOST="$HBASE_HOST" ZK_PORT=2181 HBASE_TIME_STARTUP=15 -HBASE_EXPORTER_TIME_STARTUP=15 +HBASE_EXPORTER_TIME_STARTUP=60 HBASE_VERSION="2.4.1" setup_suite() { @@ -21,14 +21,13 @@ setup_suite() { sleep ${HBASE_TIME_STARTUP} # Run exporter - cd ../ + cd ../../ printf "Starting hbase-exporter\n" #./hbase-exporter --zookeeper-server ${ZK_SERVER:-"127.0.0.1"} 2>&1 > /dev/null & - ../hbase-exporter --zookeeper-server=${ZK_SERVER:-"127.0.0.1"} \ + ./hbase-exporter --zookeeper-server=${ZK_SERVER:-"127.0.0.1"} \ --hbase-pseudo-distributed=True \ --hbase-table="foo" & PID=$! - sleep $HBASE_EXPORTER_TIME_STARTUP } test_hbase_running() { @@ -49,6 +48,7 @@ test_hbase_exporter_up() { } test_hbase_exporter_export_zk_live() { + sleep $HBASE_EXPORTER_TIME_STARTUP r=$(curl -s http://127.0.0.1:9010 | grep '^zookeeper_num_live' | cut -d " " -f2) assert_not_equals "0.0" "$r" "Zookeeper not live" }