2020-03-03 00:07:47 +01:00
|
|
|
if [ ${BRANCH} == 'master' ]; then
|
|
|
|
TEST_URL='http://beer.k3s.kleph.eu'
|
|
|
|
else
|
|
|
|
TEST_URL='http://staging.beer.k3s.kleph.eu'
|
|
|
|
fi
|
|
|
|
echo "testing URL: ${TEST_URL}"
|
2020-03-03 00:07:47 +01:00
|
|
|
|
2020-04-08 20:54:38 +02:00
|
|
|
while :
|
|
|
|
do
|
|
|
|
status_code=$(curl -o /dev/null -s -w '%{http_code}' ${TEST_URL})
|
|
|
|
echo "status code: ${status_code}"
|
|
|
|
[[ ${status_code} -eq 200 ]] && break
|
|
|
|
[[ ${i} -gt 5 ]] && exit 1
|
|
|
|
echo "service not ready or in error"
|
|
|
|
sleep 5
|
|
|
|
i=$(( i+1 ))
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2020-03-03 00:07:47 +01:00
|
|
|
CURL_OPTS='-s'
|
|
|
|
# default
|
2020-04-08 03:21:08 +02:00
|
|
|
curl ${CURL_OPTS} ${TEST_URL} | grep -q 'setHours( 17, 30);'
|
2020-04-08 03:18:34 +02:00
|
|
|
[ $? -ne 0 ] && echo "Failed with default" && exit 1
|
2020-03-03 00:07:47 +01:00
|
|
|
|
|
|
|
# set 1 parameter
|
|
|
|
hours=18
|
|
|
|
curl ${CURL_OPTS} ${TEST_URL}/${hours} | grep -q "setHours( ${hours}, 0);"
|
2020-04-08 03:18:34 +02:00
|
|
|
[ $? -ne 0 ] && echo "Failed with 1 parameter set" && exit 1
|
2020-03-03 00:07:47 +01:00
|
|
|
|
|
|
|
# set 2 parameters
|
|
|
|
minutes=30
|
|
|
|
curl ${CURL_OPTS} ${TEST_URL}/${hours}/${minutes} | grep -q "setHours( ${hours}, ${minutes});"
|
2020-04-08 03:18:34 +02:00
|
|
|
[ $? -ne 0 ] && echo "Failed with 2 parameters set" && exit 1
|
2020-03-03 00:07:47 +01:00
|
|
|
|
|
|
|
echo "OK"
|
|
|
|
exit 0
|