tests: Add tests
This commit is contained in:
parent
3105c8ac3f
commit
cd217535d0
@ -18,7 +18,7 @@ setup_suite() {
|
|||||||
cd hbase
|
cd hbase
|
||||||
printf "Starting HBase in pseudo-distributed mode\n"
|
printf "Starting HBase in pseudo-distributed mode\n"
|
||||||
./bin/hbase-daemon.sh --config conf start master
|
./bin/hbase-daemon.sh --config conf start master
|
||||||
sleep ${HBASE_TIME_STARTUP}
|
sleep $HBASE_TIME_STARTUP
|
||||||
|
|
||||||
# Run exporter
|
# Run exporter
|
||||||
cd ../../
|
cd ../../
|
||||||
@ -27,10 +27,12 @@ setup_suite() {
|
|||||||
--hbase-pseudo-distributed=True \
|
--hbase-pseudo-distributed=True \
|
||||||
--hbase-table="foo" 2>&1 > /dev/null &
|
--hbase-table="foo" 2>&1 > /dev/null &
|
||||||
PID=$!
|
PID=$!
|
||||||
|
printf "Waiting ${HBASE_EXPORTER_TIME_STARTUP}s to gather exporter values\n"
|
||||||
|
sleep $HBASE_EXPORTER_TIME_STARTUP
|
||||||
}
|
}
|
||||||
|
|
||||||
test_hbase_running() {
|
test_hbase_running() {
|
||||||
nc -n -w1 ${1:-"127.0.0.1"} ${2:-"16200"}
|
nc -n -w1 ${1:-"127.0.0.1"} ${2:-"16010"}
|
||||||
}
|
}
|
||||||
|
|
||||||
test_hbase_zk_running() {
|
test_hbase_zk_running() {
|
||||||
@ -47,7 +49,6 @@ test_hbase_exporter_up() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_hbase_exporter_export_zk_live() {
|
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)
|
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"
|
assert_not_equals "0.0" "$r" "Zookeeper not live"
|
||||||
}
|
}
|
||||||
@ -62,6 +63,21 @@ test_hbase_exporter_export_zk_connection_count() {
|
|||||||
assert_not_equals "0.0" "$r" "Zookeeper has no connections"
|
assert_not_equals "0.0" "$r" "Zookeeper has no connections"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_hbase_exporter_export_zk_has_leader() {
|
||||||
|
r=$(curl -s http://127.0.0.1:9010 | grep '^zookeeper_has_leader' | cut -d " " -f2)
|
||||||
|
assert_not_equals "0.0" "$r" "Zookeeper has no leader"
|
||||||
|
}
|
||||||
|
|
||||||
|
test_hbase_exporter_export_regionserver_live() {
|
||||||
|
r=$(curl -s http://127.0.0.1:9010 | grep '^hbase_regionservers_live' | cut -d " " -f2)
|
||||||
|
assert_not_equals "0.0" "$r" "HBase: No regionservers"
|
||||||
|
}
|
||||||
|
|
||||||
|
test_hbase_exporter_export_regionserver_dead() {
|
||||||
|
r=$(curl -s http://127.0.0.1:9010 | grep '^hbase_regionservers_dead' | cut -d " " -f2)
|
||||||
|
assert_equals "0.0" "$r" "HBase: Dead regionservers"
|
||||||
|
}
|
||||||
|
|
||||||
teardown_suite() {
|
teardown_suite() {
|
||||||
kill $PID
|
kill $PID
|
||||||
./tests/hbase/bin/hbase-daemon.sh stop master
|
./tests/hbase/bin/hbase-daemon.sh stop master
|
||||||
|
Loading…
Reference in New Issue
Block a user