From 096920b8b36e1d0cc5b33836f7c7a79808fcccf4 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sat, 27 Jun 2015 13:34:23 +0000 Subject: [PATCH] Refactor integration scripts, use --debug. --- tests/boulder-integration-nginx.sh | 50 --------------------------- tests/boulder-integration.sh | 20 +++-------- tests/integration/_common.sh | 25 ++++++++++++++ tests/{ => integration}/nginx.conf.sh | 0 tests/integration/nginx.sh | 28 +++++++++++++++ 5 files changed, 57 insertions(+), 66 deletions(-) delete mode 100755 tests/boulder-integration-nginx.sh create mode 100755 tests/integration/_common.sh rename tests/{ => integration}/nginx.conf.sh (100%) create mode 100755 tests/integration/nginx.sh diff --git a/tests/boulder-integration-nginx.sh b/tests/boulder-integration-nginx.sh deleted file mode 100755 index da0dab21e..000000000 --- a/tests/boulder-integration-nginx.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -xe - -# prerequisite: apt-get install --no-install-recommends nginx-light openssl - -if [ "xxx$root" = "xxx" ]; -then - root="$(mktemp -d)" -fi -export root - -export PATH="/usr/sbin:$PATH" # /usr/sbin/nginx - -echo "\nRoot integration tests directory: $root" -store_flags="--config-dir $root/conf --work-dir $root/work" -store_flags="$store_flags --logs-dir $root/logs" - -nginx_root="$root/nginx" -mkdir $nginx_root -root="$nginx_root" ./tests/nginx.conf.sh > $nginx_root/nginx.conf - -killall nginx || true -nginx -c $nginx_root/nginx.conf - -common() { - # first three flags required, rest is handy defaults - letsencrypt \ - --server "${SERVER:-http://localhost:4000/acme/new-reg}" \ - --no-verify-ssl \ - --dvsni-port 5001 \ - $store_flags \ - --text \ - --agree-eula \ - --email "" \ - -vvvvvvv "$@" -} - -test_nginx() { - common --configurator nginx \ - --nginx-server-root $nginx_root \ - "$@" -} - -test_nginx --domains nginx.wtf run -echo | openssl s_client -connect localhost:5001 \ - | openssl x509 -out $root/nginx.pem -diff -q $root/nginx.pem $root/conf/live/nginx.wtf/cert.pem - -# note: not reached if anything above fails, hence "killall" at the -# top -nginx -c $nginx_root/nginx.conf -s stop diff --git a/tests/boulder-integration.sh b/tests/boulder-integration.sh index ba2c160e0..06a1d8aa9 100755 --- a/tests/boulder-integration.sh +++ b/tests/boulder-integration.sh @@ -10,27 +10,15 @@ # # Note: this script is called by Boulder integration test suite! -root="$(mktemp -d)" -echo "\nRoot integration tests directory: $root" -store_flags="--config-dir $root/conf --work-dir $root/work" -store_flags="$store_flags --logs-dir $root/logs" - +. ./tests/integration/_common.sh export PATH="/usr/sbin:$PATH" # /usr/sbin/nginx common() { - # first three flags required, rest is handy defaults - letsencrypt \ - --server "${SERVER:-http://localhost:4000/acme/new-reg}" \ - --no-verify-ssl \ - --dvsni-port 5001 \ - $store_flags \ - --text \ - --agree-eula \ - --email "" \ + letsencrypt_test \ --authenticator standalone \ --installer null \ - -vvvvvvv "$@" + "$@" } common --domains le1.wtf auth @@ -67,5 +55,5 @@ done if type nginx; then - . ./tests/boulder-integration-nginx.sh + . ./tests/integration/nginx.sh fi diff --git a/tests/integration/_common.sh b/tests/integration/_common.sh new file mode 100755 index 000000000..0f26d3815 --- /dev/null +++ b/tests/integration/_common.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +if [ "xxx$root" = "xxx" ]; +then + root="$(mktemp -d)" + echo "Root integration tests directory: $root" +fi +store_flags="--config-dir $root/conf --work-dir $root/work" +store_flags="$store_flags --logs-dir $root/logs" +export root store_flags + +letsencrypt_test () { + # first three flags required, rest is handy defaults + letsencrypt \ + --server "${SERVER:-http://localhost:4000/acme/new-reg}" \ + --no-verify-ssl \ + --dvsni-port 5001 \ + $store_flags \ + --text \ + --agree-eula \ + --email "" \ + --debug \ + -vvvvvvv \ + "$@" +} diff --git a/tests/nginx.conf.sh b/tests/integration/nginx.conf.sh similarity index 100% rename from tests/nginx.conf.sh rename to tests/integration/nginx.conf.sh diff --git a/tests/integration/nginx.sh b/tests/integration/nginx.sh new file mode 100755 index 000000000..856615ad5 --- /dev/null +++ b/tests/integration/nginx.sh @@ -0,0 +1,28 @@ +#!/bin/sh -xe +# prerequisite: apt-get install --no-install-recommends nginx-light openssl + +. ./tests/integration/_common.sh + +export PATH="/usr/sbin:$PATH" # /usr/sbin/nginx +nginx_root="$root/nginx" +mkdir $nginx_root +root="$nginx_root" ./tests/integration/nginx.conf.sh > $nginx_root/nginx.conf + +killall nginx || true +nginx -c $nginx_root/nginx.conf + +letsencrypt_test_nginx () { + letsencrypt_test \ + --configurator nginx \ + --nginx-server-root $nginx_root \ + "$@" +} + +letsencrypt_test_nginx --domains nginx.wtf run +echo | openssl s_client -connect localhost:5001 \ + | openssl x509 -out $root/nginx.pem +diff -q $root/nginx.pem $root/conf/live/nginx.wtf/cert.pem + +# note: not reached if anything above fails, hence "killall" at the +# top +nginx -c $nginx_root/nginx.conf -s stop