tests: Improve tests
This commit is contained in:
parent
f052f01ebf
commit
0c033f45b8
3
Makefile
3
Makefile
@ -17,9 +17,10 @@ all:
|
|||||||
protoc -I=/usr/local/include/ --proto_path=. --python_out=$(bindings_path) server/zookeeper/*.proto
|
protoc -I=/usr/local/include/ --proto_path=. --python_out=$(bindings_path) server/zookeeper/*.proto
|
||||||
|
|
||||||
test:
|
test:
|
||||||
./hbase-setup.sh
|
./tests/install_bash_unit.sh
|
||||||
./bash_unit
|
./bash_unit
|
||||||
./bash_unit tests/test_hbase_up.sh
|
./bash_unit tests/test_hbase_up.sh
|
||||||
|
./bash_unit tests/test_hbase_exporter_up.sh
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(hbase_tmp_path)
|
rm -rf $(hbase_tmp_path)
|
||||||
|
0
tests/install_bash_unit.sh
Normal file → Executable file
0
tests/install_bash_unit.sh
Normal file → Executable file
22
tests/test_hbase_exporter_up.sh
Normal file
22
tests/test_hbase_exporter_up.sh
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
cd ../
|
||||||
|
./hbase-exporter --zookeeper-server ${ZK_SERVER:-"127.0.0.1:2181"} 2>&1 > /dev/null &
|
||||||
|
PID=$!
|
||||||
|
sleep 5
|
||||||
|
}
|
||||||
|
|
||||||
|
test_hbase_exporter_up() {
|
||||||
|
nc -znu -w1 ${1:-"127.0.0.1"} ${2:-"9010"}
|
||||||
|
curl -s http://127.0.0.1:9010
|
||||||
|
}
|
||||||
|
|
||||||
|
test_hbase_exporter_zk_connection() {
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
teardown() {
|
||||||
|
kill "$PID"
|
||||||
|
}
|
@ -7,8 +7,17 @@ ZK_PORT=2181
|
|||||||
HBASE_TIME_STARTUP=8
|
HBASE_TIME_STARTUP=8
|
||||||
HBASE_VERSION="2.4.1"
|
HBASE_VERSION="2.4.1"
|
||||||
|
|
||||||
|
|
||||||
|
setup_suite() {
|
||||||
|
export JAVA_HOME=${JAVA_HOME:-"/usr/local"}
|
||||||
|
PWD=$(pwd)
|
||||||
|
cd ../
|
||||||
|
./hbase-setup.sh
|
||||||
|
cd $PWD
|
||||||
|
}
|
||||||
|
|
||||||
test_run_hbase() {
|
test_run_hbase() {
|
||||||
cd "../hbase-${HBASE_VERSION}"
|
cd "hbase-${HBASE_VERSION}"
|
||||||
./bin/hbase-daemon.sh --config conf start $1
|
./bin/hbase-daemon.sh --config conf start $1
|
||||||
sleep ${HBASE_TIME_STARTUP}
|
sleep ${HBASE_TIME_STARTUP}
|
||||||
}
|
}
|
||||||
@ -22,5 +31,3 @@ test_hbase_zk_running() {
|
|||||||
"ruok"
|
"ruok"
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
|
|
||||||
export JAVA_HOME=${JAVA_HOME:-"/usr/local"}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user