Merge branch 'certbot-ci-part5' into test-certbot-ci

This commit is contained in:
Adrien Ferrand 2019-05-11 00:11:30 +02:00
commit 7125b93632
6 changed files with 31 additions and 33 deletions

View file

@ -6,7 +6,7 @@ cache:
before_script:
- 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ulimit -n 1024 ; fi'
# On Travis, the fastest parallelization for integration tests is proved to be 4.
# On Travis, the fastest parallelization for integration tests has proved to be 4.
- 'if [[ "$TOXENV" == *"integration"* ]]; then export PYTEST_ADDOPTS="--numprocesses 4"; fi'
- export TOX_TESTENV_PASSENV=TRAVIS
@ -110,13 +110,9 @@ matrix:
<<: *extended-test-suite
- python: "2.7"
env: TOXENV=py27-certbot-oldest
sudo: required
services: docker
<<: *extended-test-suite
- python: "2.7"
env: TOXENV=py27-nginx-oldest
sudo: required
services: docker
<<: *extended-test-suite
- python: "2.7"
env: ACME_SERVER=boulder-v1 TOXENV=integration-certbot-oldest
@ -139,44 +135,57 @@ matrix:
services: docker
<<: *extended-test-suite
- python: "3.4"
env: ACME_SERVER=boulder-v1 TOXENV=py34,integration
env: TOXENV=py34
<<: *extended-test-suite
- python: "3.5"
env: TOXENV=py35
<<: *extended-test-suite
- python: "3.6"
env: TOXENV=py36
<<: *extended-test-suite
- python: "3.7"
dist: xenial
env: TOXENV=py37
<<: *extended-test-suite
- python: "3.4"
env: ACME_SERVER=boulder-v1 TOXENV=integration
sudo: required
services: docker
<<: *extended-test-suite
- python: "3.4"
env: ACME_SERVER=boulder-v2 TOXENV=py34,integration
env: ACME_SERVER=boulder-v2 TOXENV=integration
sudo: required
services: docker
<<: *extended-test-suite
- python: "3.5"
env: ACME_SERVER=boulder-v1 TOXENV=py35,integration
env: ACME_SERVER=boulder-v1 TOXENV=integration
sudo: required
services: docker
<<: *extended-test-suite
- python: "3.5"
env: ACME_SERVER=boulder-v2 TOXENV=py35,integration
env: ACME_SERVER=boulder-v2 TOXENV=integration
sudo: required
services: docker
<<: *extended-test-suite
- python: "3.6"
env: ACME_SERVER=boulder-v1 TOXENV=py36,integration
env: ACME_SERVER=boulder-v1 TOXENV=integration
sudo: required
services: docker
<<: *extended-test-suite
- python: "3.6"
env: ACME_SERVER=boulder-v2 TOXENV=py36,integration
env: ACME_SERVER=boulder-v2 TOXENV=integration
sudo: required
services: docker
<<: *extended-test-suite
- python: "3.7"
dist: xenial
env: ACME_SERVER=boulder-v1 TOXENV=py37,integration
env: ACME_SERVER=boulder-v1 TOXENV=integration
sudo: required
services: docker
<<: *extended-test-suite
- python: "3.7"
dist: xenial
env: ACME_SERVER=boulder-v2 TOXENV=py37,integration
env: ACME_SERVER=boulder-v2 TOXENV=integration
sudo: required
services: docker
<<: *extended-test-suite

View file

@ -18,9 +18,10 @@ def pytest_addoption(parser):
Standard pytest hook to add options to the pytest parser.
:param parser: current pytest parser that will be used on the CLI
"""
parser.addoption('--acme-server',
parser.addoption('--acme-server', default='pebble',
choices=['boulder-v1', 'boulder-v2', 'pebble'],
help='select the ACME server to use (boulder-v1, boulder-v2, pebble)')
help='select the ACME server to use (boulder-v1, boulder-v2, '
'pebble), defaulting to pebble')
def pytest_configure(config):
@ -28,8 +29,7 @@ def pytest_configure(config):
Standard pytest hook used to add a configuration logic for each node of a pytest run.
:param config: the current pytest configuration
"""
acme_server = config.option.acme_server if hasattr(config.option, 'acme_server') else None
if not hasattr(config, 'slaveinput') and acme_server: # If true, this is the primary node
if not hasattr(config, 'slaveinput'): # If true, this is the primary node
with _print_on_err():
config.acme_xdist = _setup_primary_node(config)
@ -39,8 +39,7 @@ def pytest_configure_node(node):
Standard pytest-xdist hook used to configure a worker node.
:param node: current worker node
"""
if hasattr(node.config, 'acme_xdist'):
node.slaveinput['acme_xdist'] = node.config.acme_xdist
node.slaveinput['acme_xdist'] = node.config.acme_xdist
@contextlib.contextmanager

View file

@ -1,4 +0,0 @@
# Even if only pyparsing 1.5.6 is available on CentOS 6, version 2.0.2 is required
# to make pytest plugins auto-discovery working. No breaking change is done from 1.5.6
# besides removal of support to Python < 2.6, that is irrelevant for oldest tests.
pyparsing==2.0.2

0
certbot-ci/pytest.ini Normal file
View file

View file

@ -46,9 +46,4 @@ setup(
packages=find_packages(),
include_package_data=True,
install_requires=install_requires,
entry_points={
'pytest11': [
'acme-xdist = certbot_integration_tests.utils.pytest_plugin'
]
}
)

View file

@ -249,20 +249,19 @@ passenv = DOCKER_*
[testenv:integration]
commands =
{[base]pip_install} acme . certbot-nginx certbot-ci
pytest --pyargs certbot_integration_tests \
pytest certbot-ci/certbot_integration_tests \
--acme-server={env:ACME_SERVER:pebble} \
--cov=acme --cov=certbot --cov=certbot_nginx --cov-report= \
--cov-config={toxinidir}/certbot-ci/certbot_integration_tests/.coveragerc
--cov-config=certbot-ci/certbot_integration_tests/.coveragerc
coverage report --include 'certbot/*' --show-missing --fail-under=67
coverage report --include 'certbot-nginx/*' --show-missing --fail-under=74
passenv = DOCKER_*
setenv = {[testenv]setenv}
[testenv:integration-certbot-oldest]
commands =
{[base]pip_install} .
{[base]pip_install} certbot-ci
pytest --pyargs certbot_integration_tests.certbot_tests \
pytest certbot-ci/certbot_integration_tests/certbot_tests \
--acme-server={env:ACME_SERVER:pebble}
passenv = DOCKER_*
setenv = {[testenv:py27-oldest]setenv}
@ -271,7 +270,7 @@ setenv = {[testenv:py27-oldest]setenv}
commands =
{[base]pip_install} certbot-nginx
{[base]pip_install} certbot-ci
pytest --pyargs certbot_integration_tests.nginx_tests \
pytest certbot-ci/certbot_integration_tests/nginx_tests \
--acme-server={env:ACME_SERVER:pebble}
passenv = DOCKER_*
setenv = {[testenv:py27-oldest]setenv}