Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'letstest/scripts/test_apache2.sh')
-rwxr-xr-xletstest/scripts/test_apache2.sh42
1 files changed, 19 insertions, 23 deletions
diff --git a/letstest/scripts/test_apache2.sh b/letstest/scripts/test_apache2.sh
index f7338b3b3..5a8f97042 100755
--- a/letstest/scripts/test_apache2.sh
+++ b/letstest/scripts/test_apache2.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -ex
# $OS_TYPE $PUBLIC_IP $PRIVATE_IP $PUBLIC_HOSTNAME $BOULDER_URL
# are dynamically set at execution
@@ -8,7 +8,6 @@ then
CONFFILE=/etc/apache2/sites-available/000-default.conf
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --no-upgrade install apache2 curl
- sudo DEBIAN_FRONTEND=noninteractive apt-get -y install realpath # needed for test-apache-conf
# For apache 2.4, set up ServerName
sudo sed -i '/ServerName/ s/#ServerName/ServerName/' $CONFFILE
sudo sed -i '/ServerName/ s/www.example.com/'$PUBLIC_HOSTNAME'/' $CONFFILE
@@ -41,9 +40,19 @@ cd letsencrypt
echo "Bootstrapping dependencies..."
sudo letstest/scripts/bootstrap_os_packages.sh
-if [ $? -ne 0 ] ; then
- exit 1
-fi
+
+# Install pyenv
+curl https://pyenv.run | bash
+export PYENV_ROOT="$HOME/.pyenv"
+export PATH="$PYENV_ROOT/bin:$PATH"
+eval "$(pyenv init --path)"
+eval "$(pyenv init -)"
+
+# Install and configure Python
+# Python<=3.9 must be used because Python 3.10 requires too new of a version of
+# OpenSSL.
+pyenv install 3.9.10
+pyenv shell 3.9.10
tools/venv.py -e acme -e certbot -e certbot-apache -e certbot-ci tox
PEBBLE_LOGS="acme_server.log"
@@ -56,12 +65,15 @@ PEBBLE_URL="https://localhost:14000/dir"
# existing virtual host for the port used for http-01 validation.
venv/bin/run_acme_server --http-01-port 80 > "${PEBBLE_LOGS}" 2>&1 &
-DumpPebbleLogs() {
- if [ -f "${PEBBLE_LOGS}" ] ; then
+DumpPebbleLogsOnFailure() {
+ exit_status="$?"
+ if [ "$exit_status" != 0 ] && [ -f "${PEBBLE_LOGS}" ] ; then
echo "Pebble's logs were:"
cat "${PEBBLE_LOGS}"
fi
+ exit "$exit_status"
}
+trap DumpPebbleLogsOnFailure EXIT
for n in $(seq 1 150) ; do
if curl --insecure "${PEBBLE_URL}" 2>/dev/null; then
@@ -80,9 +92,6 @@ fi
sudo "venv/bin/certbot" -v --debug --text --agree-tos --no-verify-ssl \
--renew-by-default --redirect --register-unsafely-without-email \
--domain "${PUBLIC_HOSTNAME}" --server "${PEBBLE_URL}"
-if [ $? -ne 0 ] ; then
- FAIL=1
-fi
# Check that ssl_module detection is working on various systems
if [ "$OS_TYPE" = "ubuntu" ] ; then
@@ -95,9 +104,6 @@ fi
OPENSSL_VERSION=$(strings "$MOD_SSL_LOCATION" | egrep -o -m1 '^OpenSSL ([0-9]\.[^ ]+) ' | tail -c +9)
APACHE_VERSION=$(sudo $APACHE_NAME -v | egrep -o 'Apache/([0-9]\.[^ ]+)' | tail -c +8)
"venv/bin/python" letstest/scripts/test_openssl_version.py "$OPENSSL_VERSION" "$APACHE_VERSION"
-if [ $? -ne 0 ] ; then
- FAIL=1
-fi
if [ "$OS_TYPE" = "ubuntu" ] ; then
@@ -106,13 +112,3 @@ if [ "$OS_TYPE" = "ubuntu" ] ; then
else
echo Not running hackish apache tests on $OS_TYPE
fi
-
-if [ $? -ne 0 ] ; then
- FAIL=1
-fi
-
-# return error if any of the subtests failed
-if [ "$FAIL" = 1 ] ; then
- DumpPebbleLogs
- exit 1
-fi