diff options
-rwxr-xr-x | buildbot/checks.sh | 73 |
1 files changed, 51 insertions, 22 deletions
diff --git a/buildbot/checks.sh b/buildbot/checks.sh index 39f52b6..779d845 100755 --- a/buildbot/checks.sh +++ b/buildbot/checks.sh @@ -8,50 +8,79 @@ if test $active = "test-blue"; then nonactive="green" fi -if ! test 200 = $(curl \ +error_stringify () +{ + case $1 in + 28) echo "connection timed out" ;; + 7) echo "failed to connect to host" ;; + *) echo "unknown, see curl man page" ;; + esac +} + +error_fmt="%s (http status code: %s)/(curl exit code: %s - %s)\n" + +http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ -s https://exchange.test.taler.net/ -o /dev/null \ - -w "%{http_code}"); then - echo Exchange did not restart correctly + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf "%s (http status code: %s)/(curl exit code: %s - %s)\n" \ + "Exchange did not restart correctly" \ + $http_status_code $? $(error_stringify $?) exit 1 fi -if ! test 200 = $(curl \ +http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ -s http://backend.test.taler.net/ -o /dev/null \ - -w "%{http_code}"); then - echo Merchant backend did not restart correctly + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf $error_fmt \ + "Merchant backend did not restart correctly" \ + $http_status_code $? $(error_stringify $?) exit 1 fi -if ! test 200 = $(curl \ +http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s https://shop.test.taler.net/ -o /dev/null \ - -w "%{http_code}"); then - echo Blog did not restart correctly + -s http://shop.test.taler.net/ -o /dev/null \ + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf $error_fmt \ + "Blog did not restart correctly" \ + $http_status_code $? $(error_stringify $?) exit 1 fi -if ! test 200 = $(curl \ +http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s https://donations.test.taler.net/ -o /dev/null \ - -w "%{http_code}"); then - echo Donations shop did not restart correctly + -s http://donations.test.taler.net/ -o /dev/null \ + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf $error_fmt \ + "Donations shop did not restart correctly" \ + $http_status_code $? $(error_stringify $?) exit 1 fi -if ! test 302 = $(curl \ +http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s https://bank.test.taler.net/ -o /dev/null \ - -w "%{http_code}"); then - echo Bank did not restart correctly + -s http://bank.test.taler.net/ -o /dev/null \ + -w "%{http_code}") +if ! test 302 = $http_status_code; then + printf $error_fmt \ + "Bank did not restart correctly" \ + $http_status_code $? $(error_stringify $?) exit 1 fi -if ! test 200 = $(curl \ +http_status_code=$(curl \ -H "X-Taler-Deployment-Color: $nonactive" \ - -s https://test.taler.net/en/index.html -o /dev/null \ - -w "%{http_code}"); then - echo Landing page did not restart correctly + -s http://test.taler.net/ -o /dev/null \ + -w "%{http_code}") +if ! test 200 = $http_status_code; then + printf $error_fmt \ + "Landing page not restart correctly" \ + $http_status_code $? $(error_stringify $?) exit 1 fi |