Refactor integration scripts, use --debug.

This commit is contained in:
Jakub Warmuz 2015-06-27 13:34:23 +00:00
parent 98844a196c
commit 096920b8b3
No known key found for this signature in database
GPG key ID: 2A7BAD3A489B52EA
5 changed files with 57 additions and 66 deletions

View file

@ -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

View file

@ -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

25
tests/integration/_common.sh Executable file
View file

@ -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 \
"$@"
}

28
tests/integration/nginx.sh Executable file
View file

@ -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