Makefile: Add test target

This commit is contained in:
Björn Busse 2021-03-03 19:00:03 +01:00
parent d7af6025fe
commit 3793cb0afb
2 changed files with 33 additions and 0 deletions

View File

@ -16,6 +16,10 @@ all:
cd $(hbase_tmp_path)/hbase-protocol-shaded/src/main/protobuf; \ cd $(hbase_tmp_path)/hbase-protocol-shaded/src/main/protobuf; \
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:
./hbase-setup.sh
./bash_unit
./bash_unit tests/test_hbase_up.sh
clean: clean:
rm -rf $(hbase_tmp_path) rm -rf $(hbase_tmp_path)

29
tests/test_hbase_up.sh Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
HBASE_HOST="127.0.0.1"
HBASE_PORT=16200
ZK_HOST=$HBASE_HOST
ZK_PORT=2181
HBASE_TIME_STARTUP=8
HBASE_VERSION="2.4.1"
run_hbase() {
cd "../hbase-${HBASE_VERSION}"
./bin/hbase-daemon.sh --config conf start $1
sleep ${HBASE_TIME_STARTUP}
}
test_hbase_running() {
nc -vnu -w1 $1 $2
}
test_hbase_zk_running() {
nc -vnu -w1 $1 $2 <<END
"ruok"
END
}
export JAVA_HOME=${JAVA_HOME:-"/usr/local"}
run_hbase "master"
test_hbase_running ${HBASE_HOST} ${HBASE_PORT}
test_hbase_zk_running ${ZK_HOST} ${ZK_PORT}