From 11f1874a227ca99e0c26fbdd1f854b4701e722f0 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Wed, 28 Nov 2018 10:43:01 +0100 Subject: Make 'Web-services-check' script work against "demo". --- buildbot/checks.sh | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'buildbot') 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" -- cgit v1.2.3