certbot/tests/letstest
ohemorange acb6d34c5f
Update test farm tests to stop using certbot-auto (#8207)
* Create bootstrap script

* Delete a whole bunch of the bootstrap script

* modify test_tests to use new script

* put python version checking in back in

* add x

* call the venv creation from inside the bootstrap

* add targets back

* modify test_apache2 to use new format

* shouldn't need virtualenv on rhel

* readd targets

* Update test_sdists to use new script

* move setting up venv back out of script so it's not run with sudo

* take venv3.py call out of bootstrap in all scripts

* add additional python3-devel pkg name

* fix test_sdists

* enable additional rhel7 repos

* clean up code and comments

* Update tests and instructions to use auto_targets.yaml with test_leauto_upgrades.sh and test_letsencrypt_auto_certonly_standalone.sh

* only install python3-devel.x86_64 for rhel7

* Upgrade python version for debian in test_apache2.sh

* don't run test_tests or test_sdists on debian 9 or ubuntu 16.04

* Add 20.04 and 20.04 arm images to targets.yaml

* use pyenv to upgrade to python3.5

* remove arm64 instance because it's having auth trouble

* correct pyenv usage on ubuntu

* add arm64 target to targets.yaml

* replace debian 9 arm64 with ubuntu 20

* don't try to upgrade a perfectly good python version

* let's just add ubuntu20 to apache2_targets while we're here

* uncomment test_apache2

* move adding python3-devel.x86_64 to bootstrap_os_packages to avoid potential race condition

* no need to specify the arch once extra rhel7 repos enabled

* explicitly specify python3

* don't fail if we can't enable rhel7 extras

* capture python36-devel as well
2020-08-18 10:07:27 -07:00
..
scripts Update test farm tests to stop using certbot-auto (#8207) 2020-08-18 10:07:27 -07:00
apache2_targets.yaml Update test farm tests to stop using certbot-auto (#8207) 2020-08-18 10:07:27 -07:00
auto_targets.yaml Update test farm tests to stop using certbot-auto (#8207) 2020-08-18 10:07:27 -07:00
multitester.py Migrate the CI pipeline from Travis to Azure Pipeline (#8098) 2020-07-02 15:01:21 -07:00
README.md mention python3-venv in docs (#8006) 2020-05-19 14:28:41 -07:00
requirements.txt Add awscli to requirements.txt (#8113) 2020-06-25 16:52:56 -07:00
targets.yaml Update test farm tests to stop using certbot-auto (#8207) 2020-08-18 10:07:27 -07:00

letstest

Simple AWS testfarm scripts for certbot client testing

  • Configures (canned) boulder server
  • Launches EC2 instances with a given list of AMIs for different distros
  • Copies certbot repo and puts it on the instances
  • Runs certbot tests (bash scripts) on all of these
  • Logs execution and success/fail for debugging

Notes

  • Some AWS images, e.g. official CentOS and FreeBSD images require acceptance of user terms on the AWS marketplace website. This can't be automated.
  • AWS EC2 has a default limit of 20 t2/t1 instances, if more are needed, they need to be requested via online webform.

Installation and configuration

These tests require Python 3, awscli, boto3, PyYAML, and fabric 2.0+. If you're on a Debian based system, make sure you also have the python3-venv package installed. If you have Python 3 installed, you can use requirements.txt to create a virtual environment with a known set of dependencies by running:

python3 -m venv venv3
. ./venv3/bin/activate
pip install --requirement requirements.txt

You can then configure AWS credentials and create a key by running:

>aws configure --profile <profile name>
[interactive: enter secrets for IAM role]
>aws ec2 create-key-pair --profile <profile name> --key-name <key name> --query 'KeyMaterial' --output text > whatever/path/you/want.pem

Note: whatever you pick for <key name> will be shown to other users with AWS access.

When prompted for a default region name, enter: us-east-1.

Usage

To run tests, activate the virtual environment you created above and run:

>python multitester.py targets.yaml /path/to/your/key.pem <profile name> scripts/<test to run>

You can only run up to two tests at once. The following error is often indicative of there being too many AWS instances running on our account:

NameError: name 'instances' is not defined

If you see this, you can run the following command to shut down all running instances:

aws ec2 terminate-instances --profile <profile name> --instance-ids $(aws ec2 describe-instances --profile <profile name> | grep <key name> | cut -f8)

It will take a minute for these instances to shut down and become available again. Running this will invalidate any in progress tests.

A folder named letest-<timestamp> is also created with a log file from each instance of the test and a file named "results" containing the output above. The tests take quite a while to run.

Also, the way all of the tests work is to check if there is already a boulder server running and if not start one. The boulder server is left running between tests, and there are known issues if two instances of boulder attempt to be started. After starting your first test, wait until you see "Found existing boulder server:" or if you see output about creating a boulder server, wait a minute before starting the 2nd test. You only have to do this after starting your first session of tests or after running the aws ec2 terminate-instances command above.

Scripts

Example scripts are in the 'scripts' directory, these are just bash scripts that have a few parameters passed to them at runtime via environment variables. test_apache2.sh is a useful reference.

Note that the

test_letsencrypt_auto_*
scripts pull code from PyPI using the letsencrypt-auto script, not the local python code. test_apache2 runs the dev venv and does local tests.

See:

Main repos: