mirror of
https://github.com/certbot/certbot.git
synced 2026-06-04 06:15:36 -04:00
Expanding tests for le-auto, adding CentOS test suite (#2671)
* Adding Dockerfile for CentOS 6 * Adding CentOS 7 to LEA tests * Enabling CentOS 6 LEA test * Removing CentOS 7 * Fixing nits * Using yum to install epel-release
This commit is contained in:
parent
c89bd421da
commit
1e27e43c14
4 changed files with 57 additions and 12 deletions
|
|
@ -71,6 +71,11 @@ matrix:
|
|||
services: docker
|
||||
before_install:
|
||||
addons:
|
||||
- sudo: required
|
||||
env: TOXENV=le_auto_centos6
|
||||
services: docker
|
||||
before_install:
|
||||
addons:
|
||||
- python: "2.7"
|
||||
env: TOXENV=apacheconftest
|
||||
sudo: required
|
||||
|
|
|
|||
32
letsencrypt-auto-source/Dockerfile.centos6
Normal file
32
letsencrypt-auto-source/Dockerfile.centos6
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# For running tests, build a docker image with a passwordless sudo and a trust
|
||||
# store we can manipulate.
|
||||
|
||||
FROM centos:6
|
||||
|
||||
RUN yum install -y epel-release
|
||||
|
||||
# Install pip, sudo and nose:
|
||||
RUN yum install -y python-pip sudo
|
||||
RUN pip install nose
|
||||
|
||||
# Add an unprivileged user:
|
||||
RUN useradd --create-home --home-dir /home/lea --shell /bin/bash --groups wheel --uid 1000 lea
|
||||
|
||||
# Let that user sudo:
|
||||
RUN sed -i.bkp -e \
|
||||
's/# %wheel\(NOPASSWD: ALL\)\?/%wheel/g' \
|
||||
/etc/sudoers
|
||||
|
||||
RUN mkdir -p /home/lea/certbot
|
||||
|
||||
# Install fake testing CA:
|
||||
COPY ./tests/certs/ca/my-root-ca.crt.pem /usr/local/share/ca-certificates/
|
||||
RUN update-ca-trust
|
||||
|
||||
# Copy code:
|
||||
COPY . /home/lea/certbot/letsencrypt-auto-source
|
||||
|
||||
USER lea
|
||||
WORKDIR /home/lea
|
||||
|
||||
CMD ["nosetests", "-v", "-s", "certbot/letsencrypt-auto-source/tests"]
|
||||
|
|
@ -279,8 +279,8 @@ class AutoTests(TestCase):
|
|||
ok_(re.match(r'letsencrypt \d+\.\d+\.\d+',
|
||||
err.strip().splitlines()[-1]))
|
||||
# Make a few assertions to test the validity of the next tests:
|
||||
self.assertIn('Upgrading certbot-auto ', out)
|
||||
self.assertIn('Creating virtual environment...', out)
|
||||
self.assertTrue('Upgrading certbot-auto ' in out)
|
||||
self.assertTrue('Creating virtual environment...' in out)
|
||||
|
||||
# Now we have le-auto 99.9.9 and LE 99.9.9 installed. This
|
||||
# conveniently sets us up to test the next 2 cases.
|
||||
|
|
@ -288,15 +288,15 @@ class AutoTests(TestCase):
|
|||
# Test when neither phase-1 upgrade nor phase-2 upgrade is
|
||||
# needed (probably a common case):
|
||||
out, err = run_letsencrypt_auto()
|
||||
self.assertNotIn('Upgrading certbot-auto ', out)
|
||||
self.assertNotIn('Creating virtual environment...', out)
|
||||
self.assertFalse('Upgrading certbot-auto ' in out)
|
||||
self.assertFalse('Creating virtual environment...' in out)
|
||||
|
||||
# Test when a phase-1 upgrade is not needed but a phase-2
|
||||
# upgrade is:
|
||||
set_le_script_version(venv_dir, '0.0.1')
|
||||
out, err = run_letsencrypt_auto()
|
||||
self.assertNotIn('Upgrading certbot-auto ', out)
|
||||
self.assertIn('Creating virtual environment...', out)
|
||||
self.assertFalse('Upgrading certbot-auto ' in out)
|
||||
self.assertTrue('Creating virtual environment...' in out)
|
||||
|
||||
def test_openssl_failure(self):
|
||||
"""Make sure we stop if the openssl signature check fails."""
|
||||
|
|
@ -313,9 +313,8 @@ class AutoTests(TestCase):
|
|||
out, err = run_le_auto(venv_dir, base_url)
|
||||
except CalledProcessError as exc:
|
||||
eq_(exc.returncode, 1)
|
||||
self.assertIn("Couldn't verify signature of downloaded "
|
||||
"certbot-auto.",
|
||||
exc.output)
|
||||
self.assertTrue("Couldn't verify signature of downloaded "
|
||||
"certbot-auto." in exc.output)
|
||||
else:
|
||||
self.fail('Signature check on certbot-auto erroneously passed.')
|
||||
|
||||
|
|
@ -335,9 +334,8 @@ class AutoTests(TestCase):
|
|||
out, err = run_le_auto(venv_dir, base_url)
|
||||
except CalledProcessError as exc:
|
||||
eq_(exc.returncode, 1)
|
||||
self.assertIn("THESE PACKAGES DO NOT MATCH THE HASHES "
|
||||
"FROM THE REQUIREMENTS FILE",
|
||||
exc.output)
|
||||
self.assertTrue("THESE PACKAGES DO NOT MATCH THE HASHES "
|
||||
"FROM THE REQUIREMENTS FILE" in exc.output)
|
||||
ok_(not exists(join(venv_dir, 'letsencrypt')),
|
||||
msg="The virtualenv was left around, even though "
|
||||
"installation didn't succeed. We shouldn't do "
|
||||
|
|
|
|||
10
tox.ini
10
tox.ini
|
|
@ -147,3 +147,13 @@ commands =
|
|||
whitelist_externals =
|
||||
docker
|
||||
passenv = DOCKER_*
|
||||
|
||||
[testenv:le_auto_centos6]
|
||||
# At the moment, this tests under Python 2.6 only, as only that version is
|
||||
# readily available on the CentOS 6 Docker image.
|
||||
commands =
|
||||
docker build -f letsencrypt-auto-source/Dockerfile.centos6 -t lea letsencrypt-auto-source
|
||||
docker run --rm -t -i lea
|
||||
whitelist_externals =
|
||||
docker
|
||||
passenv = DOCKER_*
|
||||
|
|
|
|||
Loading…
Reference in a new issue