mirror of
https://github.com/diafygi/acme-tiny
synced 2026-10-07 10:01:56 +03:00
updated tests for newer versions of python and ubuntu
This commit is contained in:
@@ -8,12 +8,16 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
|
||||
- test-name: ubuntu-18.04-python-3.4
|
||||
os: ubuntu-18.04
|
||||
python-version: 3.4
|
||||
|
||||
- test-name: ubuntu-20.04-python-2.7
|
||||
os: ubuntu-20.04
|
||||
python-version: 2.7
|
||||
|
||||
- test-name: ubuntu-18.04-python-3.4
|
||||
os: ubuntu-18.04
|
||||
- test-name: ubuntu-20.04-python-3.4
|
||||
os: ubuntu-20.04
|
||||
python-version: 3.4
|
||||
|
||||
- test-name: ubuntu-20.04-python-3.5
|
||||
@@ -32,39 +36,45 @@ jobs:
|
||||
os: ubuntu-20.04
|
||||
python-version: 3.8
|
||||
|
||||
- test-name: ubuntu-22.04-python-3.10
|
||||
os: ubuntu-22.04
|
||||
python-version: 3.10
|
||||
|
||||
- test-name: ubuntu-24.04-python-3.12
|
||||
os: ubuntu-24.04
|
||||
python-version: 3.12
|
||||
|
||||
- test-name: ubuntu-24.04-python-3.12
|
||||
os: ubuntu-24.04
|
||||
python-version: 3.13
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.13
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pebble
|
||||
run: |
|
||||
export PATH=$PATH:$(go env GOPATH)/bin
|
||||
go get -u github.com/letsencrypt/pebble/...
|
||||
cd $GOPATH/src/github.com/letsencrypt/pebble && go install ./...
|
||||
pebble -h || true
|
||||
wget https://github.com/letsencrypt/pebble/releases/latest/download/pebble-linux-amd64.tar.gz
|
||||
tar -xvzf pebble-linux-amd64.tar.gz -C /tmp
|
||||
chmod 744 /tmp/pebble-linux-amd64/linux/amd64/pebble
|
||||
/tmp/pebble-linux-amd64/linux/amd64/pebble -h || true
|
||||
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install virtualenv
|
||||
pip install -U -r tests/requirements.txt
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: |
|
||||
export PEBBLE_BIN=$(go env GOPATH)/bin/pebble
|
||||
export ACME_TINY_PEBBLE_BIN="/tmp/pebble-linux-amd64/linux/amd64/pebble"
|
||||
coverage run --source . --omit ./setup.py -m unittest tests
|
||||
|
||||
- name: Print coverage report
|
||||
|
||||
@@ -8,12 +8,16 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
|
||||
- test-name: ubuntu-18.04-python-3.4
|
||||
os: ubuntu-18.04
|
||||
python-version: 3.4
|
||||
|
||||
- test-name: ubuntu-20.04-python-2.7
|
||||
os: ubuntu-20.04
|
||||
python-version: 2.7
|
||||
|
||||
- test-name: ubuntu-18.04-python-3.4
|
||||
os: ubuntu-18.04
|
||||
- test-name: ubuntu-20.04-python-3.4
|
||||
os: ubuntu-20.04
|
||||
python-version: 3.4
|
||||
|
||||
- test-name: ubuntu-20.04-python-3.5
|
||||
@@ -32,39 +36,45 @@ jobs:
|
||||
os: ubuntu-20.04
|
||||
python-version: 3.8
|
||||
|
||||
- test-name: ubuntu-22.04-python-3.10
|
||||
os: ubuntu-22.04
|
||||
python-version: 3.10
|
||||
|
||||
- test-name: ubuntu-24.04-python-3.12
|
||||
os: ubuntu-24.04
|
||||
python-version: 3.12
|
||||
|
||||
- test-name: ubuntu-24.04-python-3.12
|
||||
os: ubuntu-24.04
|
||||
python-version: 3.13
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.13
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pebble
|
||||
run: |
|
||||
export PATH=$PATH:$(go env GOPATH)/bin
|
||||
go get -u github.com/letsencrypt/pebble/...
|
||||
cd $GOPATH/src/github.com/letsencrypt/pebble && go install ./...
|
||||
pebble -h || true
|
||||
wget https://github.com/letsencrypt/pebble/releases/latest/download/pebble-linux-amd64.tar.gz
|
||||
tar -xvzf pebble-linux-amd64.tar.gz -C /tmp
|
||||
chmod 744 /tmp/pebble-linux-amd64/linux/amd64/pebble
|
||||
/tmp/pebble-linux-amd64/linux/amd64/pebble -h || true
|
||||
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install virtualenv
|
||||
pip install -U -r tests/requirements.txt
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: |
|
||||
export PEBBLE_BIN=$(go env GOPATH)/bin/pebble
|
||||
export ACME_TINY_PEBBLE_BIN="/tmp/pebble-linux-amd64/linux/amd64/pebble"
|
||||
coverage run --source . --omit ./setup.py -m unittest tests
|
||||
|
||||
- name: Print coverage report
|
||||
|
||||
@@ -8,12 +8,16 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
|
||||
- test-name: ubuntu-18.04-python-3.4
|
||||
os: ubuntu-18.04
|
||||
python-version: 3.4
|
||||
|
||||
- test-name: ubuntu-20.04-python-2.7
|
||||
os: ubuntu-20.04
|
||||
python-version: 2.7
|
||||
|
||||
- test-name: ubuntu-18.04-python-3.4
|
||||
os: ubuntu-18.04
|
||||
- test-name: ubuntu-20.04-python-3.4
|
||||
os: ubuntu-20.04
|
||||
python-version: 3.4
|
||||
|
||||
- test-name: ubuntu-20.04-python-3.5
|
||||
@@ -32,22 +36,33 @@ jobs:
|
||||
os: ubuntu-20.04
|
||||
python-version: 3.8
|
||||
|
||||
- test-name: ubuntu-22.04-python-3.10
|
||||
os: ubuntu-22.04
|
||||
python-version: 3.10
|
||||
|
||||
- test-name: ubuntu-24.04-python-3.12
|
||||
os: ubuntu-24.04
|
||||
python-version: 3.12
|
||||
|
||||
- test-name: ubuntu-24.04-python-3.12
|
||||
os: ubuntu-24.04
|
||||
python-version: 3.13
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install virtualenv
|
||||
pip install -U -r tests/requirements.txt
|
||||
|
||||
- name: Mount staging.gethttpsforfree.com on local for serving challenge files
|
||||
|
||||
+10
-9
@@ -6,13 +6,14 @@ Testing acme-tiny requires a bit of setup since it needs to interact with a loca
|
||||
|
||||
In the default test setup, we use [pebble](https://github.com/letsencrypt/pebble) as the mock Let's Encrypt CA server on your local computer. So you need to install that before running the test suite.
|
||||
|
||||
1. Install the Let's Encrypt test server: `pebble` (instructions below are for Ubuntu 20.04, adjust as needed)
|
||||
* `sudo apt install golang`
|
||||
* `go get -u github.com/letsencrypt/pebble/...`
|
||||
* `cd ~/go/src/github.com/letsencrypt/pebble && go install ./...`
|
||||
* `~/go/bin/pebble -h` (should print out pebble usage help)
|
||||
1. Install the Let's Encrypt test server: `pebble` (instructions below are for Ubuntu 24.04 AMD64, adjust as needed)
|
||||
* `wget https://github.com/letsencrypt/pebble/releases/latest/download/pebble-linux-amd64.tar.gz`
|
||||
* `tar -xvzf pebble-linux-amd64.tar.gz -C /tmp`
|
||||
* `chmod 744 /tmp/pebble-linux-amd64/linux/amd64/pebble`
|
||||
* `/tmp/pebble-linux-amd64/linux/amd64/pebble -h` (should print out pebble usage help)
|
||||
* `export ACME_TINY_PEBBLE_BIN="/tmp/pebble-linux-amd64/linux/amd64/pebble"`
|
||||
2. Setup a virtual environment for python:
|
||||
* `virtualenv -p python3 /tmp/venv` (creates the virtualenv)
|
||||
* `python3 -m venv /tmp/venv` (creates the virtualenv)
|
||||
* `source /tmp/venv/bin/activate` (starts using the virtualenv)
|
||||
3. Install `acme-tiny` test dependencies:
|
||||
* `cd /path/to/acme-tiny`
|
||||
@@ -21,7 +22,7 @@ In the default test setup, we use [pebble](https://github.com/letsencrypt/pebble
|
||||
* `cd /path/to/acme-tiny`
|
||||
* `unset ACME_TINY_USE_STAGING` (optional, if set previously to use staging)
|
||||
* `unset ACME_TINY_DOMAIN` (optional, if set previously to use staging)
|
||||
* `export ACME_TINY_PEBBLE_BIN="..."` (optional, if different from `"$HOME/go/bin/pebble"`)
|
||||
* `export ACME_TINY_PEBBLE_BIN="/tmp/pebble-linux-amd64/linux/amd64/pebble"` (optional, if not set previously)
|
||||
* `coverage erase` (removes any previous coverage data files)
|
||||
* `coverage run --source . --omit ./setup.py -m unittest tests` (runs the test suite)
|
||||
* `coverage report -m` (optional, prints out coverage summary in console)
|
||||
@@ -31,13 +32,13 @@ In the default test setup, we use [pebble](https://github.com/letsencrypt/pebble
|
||||
|
||||
We also allow running the test suite against the official Let's Encrypt [staging](https://letsencrypt.org/docs/staging-environment/) server. Since the staging server is run by Let's Encrypt, you need to actually host a real domain an serve real challenge files. The simplest way to do this is to mount your remote server's static challenge file directory (see example instructions below).
|
||||
|
||||
1. Run a static server with a real domain (e.g. `test.mydomain.com`) with a challenge directory (instructions below are for Ubuntu 20.04, adjust as needed).
|
||||
1. Run a static server with a real domain (e.g. `test.mydomain.com`) with a challenge directory (instructions below are for Ubuntu 24.04, adjust as needed).
|
||||
* `ssh ubuntu@test.mydomain.com` (log into your server)
|
||||
* `mkdir -p /tmp/testfiles/.well-known/acme-challenge` (make the ACME challenge file directory)
|
||||
* `cd /tmp/testfiles` (go to the test file base directory)
|
||||
* `sudo python3 -m http.server 80 --bind 0.0.0.0` (start listening on port 80, NOTE: needs to run as root)
|
||||
* Alternatively, if you are already have a web server running on port 80, adjust that server's config to serve files statically from your test directory.
|
||||
2. Mount your server's challenge directory on your local system (instructions below are for Ubuntu 20.04, adjust as needed).
|
||||
2. Mount your server's challenge directory on your local system (instructions below are for Ubuntu 24.04, adjust as needed).
|
||||
* `sudo apt install sshfs` (if not already done, install sshfs)
|
||||
* `sshfs ubuntu@test.mydomain.com:/tmp/testfiles/.well-known/acme-challenge /tmp/challenge-files`
|
||||
3. Setup a virtual environment for python:
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
coverage
|
||||
virtualenv ; python_version <= "2"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import unittest
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import shutil
|
||||
import subprocess
|
||||
@@ -8,7 +9,8 @@ import subprocess
|
||||
class TestInstall(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.tempdir = tempfile.mkdtemp()
|
||||
subprocess.check_call(["virtualenv", self.tempdir])
|
||||
venv_cmd = ["virtualenv"] if sys.version_info[0] == 2 else ["python", "-m", "venv"]
|
||||
subprocess.check_call(venv_cmd + [self.tempdir])
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.tempdir)
|
||||
|
||||
@@ -162,7 +162,8 @@ class TestModule(unittest.TestCase):
|
||||
except Exception as e:
|
||||
result = e
|
||||
self.assertIsInstance(result, IOError)
|
||||
self.assertIn("unable to load Private Key", result.args[0])
|
||||
err_msgs = ["unable to load Private Key", "Could not open file or uri for loading private key"]
|
||||
self.assertTrue(any(msg in result.args[0] for msg in err_msgs))
|
||||
|
||||
def test_missing_csr(self):
|
||||
""" OpenSSL throws an error when the CSR is missing """
|
||||
@@ -457,5 +458,6 @@ class TestModule(unittest.TestCase):
|
||||
except Exception as e:
|
||||
result = e
|
||||
self.assertIsInstance(result, ValueError)
|
||||
self.assertIn("key too small", result.args[0])
|
||||
err_msgs = ["key too small", "key size not supported"]
|
||||
self.assertTrue(any(msg in result.args[0] for msg in err_msgs))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user