Added broker and notifier tests during start and fixed base64 response in notifier

This commit is contained in:
kexkey
2019-05-25 19:28:30 -04:00
committed by kexkey
parent acaf7c73a5
commit 7818b25256
3 changed files with 11 additions and 3 deletions

View File

@@ -106,7 +106,7 @@ esac
docker run --rm -it -v $current_path/testfeatures.sh:/testfeatures.sh \
-v <%= gatekeeper_datapath %>:/gatekeeper \
-v $current_path:/dist \
--network cyphernodenet alpine:3.8 /testfeatures.sh
--network cyphernodenet eclipse-mosquitto:1.6.2 /testfeatures.sh
if [ -f $current_path/exitStatus.sh ]; then
. $current_path/exitStatus.sh

View File

@@ -87,6 +87,8 @@ checkbroker() {
echo -en "\r\n\e[1;36mTesting Broker... " > /dev/console
local rc
rc=$(mosquitto_pub -h broker -t "testtopic" -m "testbroker")
[ "$?" -ne "0" ] && return 110
echo -e "\e[1;36mBroker rocks!" > /dev/console
@@ -95,8 +97,14 @@ checkbroker() {
checknotifier() {
echo -en "\r\n\e[1;36mTesting Notifier... " > /dev/console
local rc
local response
local returncode
response=$(mosquitto_rr -h broker -W 5 -t notifier -e "response/$$" -m "{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"http://proxy:8888/getbestblockhash\"}")
returncode=$?
[ "${returncode}" -ne "0" ] && return 115
http_code=$(echo "${response}" | jq ".http_code" | tr -d '"')
[ "${http_code}" -ge "400" ] && return 118
echo -e "\e[1;36mNotifier rocks!" > /dev/console

View File

@@ -59,7 +59,7 @@ curl_it() {
trace_rc ${returncode}
if [ "${returncode}" -eq "0" ]; then
response=$(cat webresponse-${rnd} | base64 | tr -d '"' ; rm webresponse-${rnd})
response=$(cat webresponse-${rnd} | base64 | tr -d '\n' ; rm webresponse-${rnd})
else
response=
fi