Finish isolation and toxenv

This commit is contained in:
Adrien Ferrand 2019-08-28 17:16:58 +02:00
parent 23ec9afdb4
commit 4bc473a2db
3 changed files with 13 additions and 10 deletions

View file

@ -9,7 +9,7 @@ import getpass
def construct_apache_config_dir(apache_root, http_port, https_port, key_path=None,
cert_path=None, wtf_prefix='le'):
config_path = os.path.join(apache_root, 'config')
shutil.copytree('/etc/apache2', config_path, symlinks=True)
shutil.copytree('/etc/apache2-save', config_path, symlinks=True)
webroot_path = os.path.join(apache_root, 'www')
os.mkdir(webroot_path)
@ -163,7 +163,7 @@ export LANG=C
'''.format(https=https_port, le_host=le_host, webroot=webroot_path,
cert_path=cert_path, key_path=key_path))
return new_environ, pid_file
return new_environ, config_path, pid_file
def test():

View file

@ -16,25 +16,27 @@ class IntegrationTestsContext(certbot_context.IntegrationTestsContext):
self.apache_root = os.path.join(self.workspace, 'apache')
os.mkdir(self.apache_root)
self.apache_env, self.apache_pid_file = apache_config.construct_apache_config_dir(
self.env, self.config_dir, self.pid_file = apache_config.construct_apache_config_dir(
self.apache_root, self.http_01_port, self.tls_alpn_01_port,
wtf_prefix=self.worker_id)
def cleanup(self):
self._stop_apache()
#super(IntegrationTestsContext, self).cleanup()
super(IntegrationTestsContext, self).cleanup()
def certbot_test_apache(self, args):
command = ['--authenticator', 'apache', '--installer', 'apache']
command = ['--authenticator', 'apache', '--installer', 'apache',
'--apache-server-root', self.config_dir,
'--apache-challenge-location', self.apache_root]
command.extend(args)
return certbot_call.certbot_test(
command, self.directory_url, self.http_01_port, self.tls_alpn_01_port,
self.config_dir, self.workspace, env=self.apache_env, force_renew=True)
self.config_dir, self.workspace, env=self.env, force_renew=True)
def _stop_apache(self):
try:
with open(self.apache_pid_file) as file_h:
with open(self.pid_file) as file_h:
pid = int(file_h.read().strip())
except BaseException:
pid = None

View file

@ -223,13 +223,14 @@ passenv = DOCKER_*
[testenv:integration]
commands =
{[base]pip_install} acme . certbot-nginx certbot-ci
{[base]pip_install} acme . certbot-nginx certbot-apache certbot-ci
pytest certbot-ci/certbot_integration_tests \
--acme-server={env:ACME_SERVER:pebble} \
--cov=acme --cov=certbot --cov=certbot_nginx --cov-report= \
--cov-config=certbot-ci/certbot_integration_tests/.coveragerc
--cov=acme --cov=certbot --cov=certbot_nginx --cov=certbot_apache \
--cov-report= --cov-config=certbot-ci/certbot_integration_tests/.coveragerc
coverage report --include 'certbot/*' --show-missing --fail-under=66
coverage report --include 'certbot-nginx/*' --show-missing --fail-under=74
coverage report --include 'certbot-apache/*' --show-missing --fail-under=54
passenv = DOCKER_*
[testenv:integration-certbot]