Fix test_leauto_upgrades.sh on python3 systems.

This commit is contained in:
Brad Warren 2019-05-23 18:23:03 -07:00
parent 054b94ae9c
commit 728a34931b

View file

@ -21,7 +21,7 @@ if command -v python && [ $(python -V 2>&1 | cut -d" " -f 2 | cut -d. -f1,2 | se
# 0.20.0 is the latest version of letsencrypt-auto that doesn't install
# Python 3 on RHEL 6.
INITIAL_VERSION="0.20.0"
RUN_PYTHON3_TESTS=1
RUN_RHEL6_TESTS=1
else
# 0.33.x is the oldest version of letsencrypt-auto that works on Fedora 29+.
INITIAL_VERSION="0.33.1"
@ -32,14 +32,16 @@ if ! ./letsencrypt-auto -v --debug --version --no-self-upgrade 2>&1 | tail -n1 |
exit 1
fi
. tests/letstest/scripts/set_python_envvars.sh
# Now that python and openssl have been installed, we can set up a fake server
# to provide a new version of letsencrypt-auto. First, we start the server and
# directory to be served.
MY_TEMP_DIR=$(mktemp -d)
PORT_FILE="$MY_TEMP_DIR/port"
SERVER_PATH=$(tools/readlink.py tools/simple_http_server.py)
SERVER_PATH=$("$PYTHON_NAME" tools/readlink.py tools/simple_http_server.py)
cd "$MY_TEMP_DIR"
"$SERVER_PATH" 0 > $PORT_FILE &
"$PYTHON_NAME" "$SERVER_PATH" 0 > $PORT_FILE &
SERVER_PID=$!
trap 'kill "$SERVER_PID" && rm -rf "$MY_TEMP_DIR"' EXIT
cd ~-
@ -72,7 +74,7 @@ iQIDAQAB
-----END PUBLIC KEY-----
"
if [ "$RUN_PYTHON3_TESTS" = 1 ]; then
if [ "$RUN_RHEL6_TESTS" = 1 ]; then
if command -v python3; then
echo "Didn't expect Python 3 to be installed!"
exit 1
@ -110,7 +112,7 @@ if ! diff letsencrypt-auto letsencrypt-auto-source/letsencrypt-auto ; then
exit 1
fi
if [ "$RUN_PYTHON3_TESTS" = 1 ]; then
if [ "$RUN_RHEL6_TESTS" = 1 ]; then
if ! command -v python3; then
echo "Python3 wasn't properly installed"
exit 1
@ -120,7 +122,7 @@ if [ "$RUN_PYTHON3_TESTS" = 1 ]; then
exit 1
fi
if [ "$(tools/readlink.py $OLD_VENV_PATH)" != "/opt/eff.org/certbot/venv" ]; then
if [ "$("$PYTHON_NAME" tools/readlink.py $OLD_VENV_PATH)" != "/opt/eff.org/certbot/venv" ]; then
echo symlink from old venv path not properly created!
exit 1
fi