mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-01-31 10:14:35 +01:00
Added broker and notifier tests during start and fixed base64 response in notifier
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user