diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-11-28 10:43:01 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-11-28 10:43:01 +0100 |
commit | 11f1874a227ca99e0c26fbdd1f854b4701e722f0 (patch) | |
tree | e0d46d2fd848a220b20c10e96dfc759a1473bc1e /buildbot | |
parent | 2b12fd371c4950eb99cda97ccadce7768ae1b78d (diff) | |
download | deployment-11f1874a227ca99e0c26fbdd1f854b4701e722f0.tar.gz deployment-11f1874a227ca99e0c26fbdd1f854b4701e722f0.tar.bz2 deployment-11f1874a227ca99e0c26fbdd1f854b4701e722f0.zip |
Make 'Web-services-check' script work against "demo".
Diffstat (limited to 'buildbot')
-rwxr-xr-x | buildbot/checks.sh | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/buildbot/checks.sh b/buildbot/checks.sh index 076cfce..85d031f 100755 --- a/buildbot/checks.sh +++ b/buildbot/checks.sh @@ -1,17 +1,21 @@ #!/bin/bash -active=$(sudo -u test cat /home/test/active) -nonactive="blue" if test -z ${DEPLOYMENT}; then echo "Please export env variable DEPLOYMENT=(test|demo) before running this script" exit 1 fi -echo "Active party: ${active}" +nonactive="dummy" +if test $DEPLOYMENT = "test"; then + active=$(sudo -u $DEPLOYMENT cat /home/$DEPLOYMENT/active) + nonactive="blue" -if test $active = "test-blue"; then - nonactive="green" + echo "Active party: ${active}" + + if test $active = "test-blue"; then + nonactive="green" + fi fi error_stringify () @@ -26,70 +30,88 @@ error_stringify () error_fmt="%s (http status code: %s)/(curl exit code: %s - %s)\n" +URL="https://exchange.${DEPLOYMENT}.taler.net/" http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s https://exchange.${DEPLOYMENT}.taler.net/ -o /dev/null \ + -s "$URL" -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then + printf "'%s' failed\n" $URL printf "$error_fmt" \ "Exchange did not restart correctly" \ $http_status_code $? "$(error_stringify $?)" exit 1 fi +URL="http://backend.${DEPLOYMENT}.taler.net/" http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s http://backend.${DEPLOYMENT}.taler.net/ \ + -s $URL \ --header "Authorization: ApiKey sandbox" \ -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then + printf "'%s' failed\n" $URL printf "$error_fmt" \ "Merchant backend did not restart correctly" \ $http_status_code $? "$(error_stringify $?)" exit 1 fi + +URL="https://shop.${DEPLOYMENT}.taler.net/" http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s https://shop.${DEPLOYMENT}.taler.net/ -o /dev/null \ + -s $URL -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then + printf "%s failed" $URL printf "$error_fmt" \ "Blog did not restart correctly" \ $http_status_code $? "$(error_stringify $?)" exit 1 fi + +URL="https://donations.${DEPLOYMENT}.taler.net/" http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s https://donations.${DEPLOYMENT}.taler.net/ -o /dev/null \ + -s $URL -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then + printf "%s failed" $URL printf "$error_fmt" \ "Donations shop did not restart correctly" \ $http_status_code $? "$(error_stringify $?)" exit 1 fi + + +URL="https://bank.${DEPLOYMENT}.taler.net/" http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s https://bank.${DEPLOYMENT}.taler.net/ -o /dev/null \ + -s $URL -o /dev/null \ -w "%{http_code}") if ! test 302 = $http_status_code; then + printf "%s failed" $URL printf "$error_fmt" \ "Bank did not restart correctly" \ $http_status_code $? "$(error_stringify $?)" exit 1 fi +URL="https://${DEPLOYMENT}.taler.net/en/index.html" http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s https://${DEPLOYMENT}.taler.net/en/index.html -o /dev/null \ + -s $URL -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then + printf "%s failed" $URL printf "$error_fmt" \ "Landing page not restart correctly" \ $http_status_code $? "$(error_stringify $?)" exit 1 fi + +printf "All services correctly restarted!\n" |