Enable boulder tests on Python 3

This commit is contained in:
Yen Chi Hsuan 2017-03-16 17:52:58 +08:00
parent f54280d9b9
commit 29d25f0915
4 changed files with 40 additions and 7 deletions

View file

@ -78,13 +78,33 @@ matrix:
env: TOXENV=apacheconftest
sudo: required
- python: "3.3"
env: TOXENV=py33
env: TOXENV=py33 BOULDER_INTEGRATION=1
sudo: required
after_failure:
- sudo cat /var/log/mysql/error.log
- ps aux | grep mysql
services: docker
- python: "3.4"
env: TOXENV=py34
env: TOXENV=py34 BOULDER_INTEGRATION=1
sudo: required
after_failure:
- sudo cat /var/log/mysql/error.log
- ps aux | grep mysql
services: docker
- python: "3.5"
env: TOXENV=py35
env: TOXENV=py35 BOULDER_INTEGRATION=1
sudo: required
after_failure:
- sudo cat /var/log/mysql/error.log
- ps aux | grep mysql
services: docker
- python: "3.6"
env: TOXENV=py36
env: TOXENV=py36 BOULDER_INTEGRATION=1
sudo: required
after_failure:
- sudo cat /var/log/mysql/error.log
- ps aux | grep mysql
services: docker
- python: "2.7"
env: TOXENV=nginxroundtrip

View file

@ -82,7 +82,7 @@ CheckHooks() {
# We start a server listening on the port for the
# unrequested challenge to prevent regressions in #3601.
python -m SimpleHTTPServer $http_01_port &
python ./tests/run_http_server.py $http_01_port &
python_server_pid=$!
common --domains le1.wtf --preferred-challenges tls-sni-01 auth \
@ -90,7 +90,7 @@ common --domains le1.wtf --preferred-challenges tls-sni-01 auth \
--post-hook 'echo wtf.post >> "$HOOK_TEST"'\
--renew-hook 'echo renew >> "$HOOK_TEST"'
kill $python_server_pid
python -m SimpleHTTPServer $tls_sni_01_port &
python ./tests/run_http_server.py $tls_sni_01_port &
python_server_pid=$!
common --domains le2.wtf --preferred-challenges http-01 run \
--pre-hook 'echo wtf.pre >> "$HOOK_TEST"' \

View file

@ -1,10 +1,12 @@
#!/bin/sh
uri_path=".well-known/acme-challenge/$CERTBOT_TOKEN"
# This script should be run from the top level. e.g. ./tests/manual-http-auth.sh
source_dir="$(pwd)"
cd $(mktemp -d)
mkdir -p $(dirname $uri_path)
echo $CERTBOT_VALIDATION > $uri_path
python -m SimpleHTTPServer $http_01_port >/dev/null 2>&1 &
python "$source_dir/tests/run_http_server.py" $http_01_port >/dev/null 2>&1 &
server_pid=$!
while ! curl "http://localhost:$http_01_port/$uri_path" >/dev/null 2>&1; do
sleep 1s

11
tests/run_http_server.py Normal file
View file

@ -0,0 +1,11 @@
import runpy
import sys
# Run Python's built-in HTTP server
# Usage: python ./tests/run_http_server.py port_num
# NOTE: This script should be compatible with 2.6, 2.7, 3.3+
# sys.argv (port number) is passed as-is to the HTTP server module
runpy.run_module(
'http.server' if sys.version_info[0] == 3 else 'SimpleHTTPServer',
run_name='__main__')