Browse Source

Parallelisation changes

pull/740/head
Tim Kimber 6 years ago
parent
commit
ad1e8d3785
9 changed files with 81 additions and 58 deletions
  1. +5
    -4
      .github/workflows/run-all-tests.yml
  2. +6
    -11
      test/README-Testing.md
  3. +0
    -8
      test/run-all-tests.cmd
  4. +0
    -8
      test/run-all-tests.sh
  5. +0
    -9
      test/run-bats.sh
  6. +4
    -1
      test/run-test.cmd
  7. +43
    -0
      test/run-test.sh
  8. +14
    -14
      test/test-config/alpine-supervisord.conf
  9. +9
    -3
      test/test_helper.bash

+ 5
- 4
.github/workflows/run-all-tests.yml View File

@ -12,8 +12,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Build the docker-compose stack - name: Build the docker-compose stack
env:
DUCKDNS_TOKEN: ${{ secrets.DUCKDNS_TOKEN }}
run: docker-compose up -d --build run: docker-compose up -d --build
- name: Run test suite
run: test/run-all-tests.sh
test-alpine:
needs: build
steps:
- name: Run test suite on Alpine
run: test/run-test.sh alpine

+ 6
- 11
test/README-Testing.md View File

@ -10,28 +10,23 @@ For continuous integration testing we have the following:
2. Then runs the `bats` test scripts (all the files with a ".bats" extension) for each OS (alpine, centos6, debian, ubuntu) 2. Then runs the `bats` test scripts (all the files with a ".bats" extension) for each OS (alpine, centos6, debian, ubuntu)
3. Runs the `bats` test script against the staging server (using nn ubuntu docker image and duckdns.org) 3. Runs the `bats` test script against the staging server (using nn ubuntu docker image and duckdns.org)
## To run all the tests locally
1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build```
2. Run the test suite `run-all-tests.cmd`
## To run all the tests on a single OS ## To run all the tests on a single OS
1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build``` 1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build```
2. Run the test suite ```run-test.cmd [<os>]```
3. eg. `run-test.cmd ubuntu16`
2. Run the test suite ```run-test.sh [<os>]```
3. eg. `run-test.sh ubuntu16`
## To run a single bats test on a single OS ## To run a single bats test on a single OS
1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build``` 1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build```
2. ```run-test.cmd <os> bats <bats test script>```
3. e.g. `run-test.cmd ubuntu bats /getssl/test/1-simple-http01.bats`
2. ```run-test.sh <os> bats <bats test script>```
3. e.g. `run-test.sh ubuntu bats /getssl/test/1-simple-http01.bats`
## To debug a test ## To debug a test
1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build``` 1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build```
2. ```run-test.cmd <os> /getssl/test/debug-test.sh <getssl config file>```
3. e.g. `run-test.cmd ubuntu /getssl/test/debug-test.sh -d /getssl/test/test-config/getssl-http01-cfg`
2. ```run-test.sh <os> /getssl/test/debug-test.sh <getssl config file>```
3. e.g. `run-test.sh ubuntu /getssl/test/debug-test.sh -d /getssl/test/test-config/getssl-http01-cfg`
## TODO ## TODO


+ 0
- 8
test/run-all-tests.cmd View File

@ -1,8 +0,0 @@
echo %time%
run-test.cmd alpine /etc/nginx/conf.d/default.conf 10
run-test.cmd centos6 /etc/nginx/conf.d/default.conf 11
run-test.cmd debian /etc/nginx/sites-enabled/default 12
run-test.cmd ubuntu /etc/nginx/sites-enabled/default 13
run-test.cmd ubuntu16 /etc/nginx/sites-enabled/default 14
run-test.cmd ubuntu18 /etc/nginx/sites-enabled/default 15
run-test.cmd duckdns /etc/nginx/sites-enabled/default 16 getssl.duckdns.org

+ 0
- 8
test/run-all-tests.sh View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
docker exec getssl-alpine bats /getssl/test
docker exec getssl-centos6 bats /getssl/test
docker exec getssl-debian bats /getssl/test
docker exec getssl-ubuntu bats /getssl/test
docker exec getssl-ubuntu18 bats /getssl/test
docker exec getssl-duckdns bats /getssl/test

+ 0
- 9
test/run-bats.sh View File

@ -1,9 +0,0 @@
#! /usr/bin/env bash
if [ "$GETSSL_HOST" = "alpine.getssl.test" ]; then
# start nginx in background
/usr/bin/supervisord -c /etc/supervisord.conf &
sleep 5 # to allow for initialization
fi
bats /getssl/test

+ 4
- 1
test/run-test.cmd View File

@ -16,7 +16,8 @@ set OS=ubuntu
GOTO CheckCommand GOTO CheckCommand
:NoCmd :NoCmd
set COMMAND=/getssl/test/run-bats.sh
REM set COMMAND=/getssl/test/run-bats.sh
set COMMAND=bats /getssl/test
GOTO CheckAlias GOTO CheckAlias
:duckdns :duckdns
@ -29,6 +30,7 @@ docker build --rm -f "test\Dockerfile-%OS%" -t getssl-%OS% .
docker run -it ^ docker run -it ^
--env GETSSL_HOST=%OS%.getssl.test ^ --env GETSSL_HOST=%OS%.getssl.test ^
-v %cd%:/getssl ^ -v %cd%:/getssl ^
--rm ^
--network getssl-timkimber_acmenet ^ --network getssl-timkimber_acmenet ^
--network-alias %ALIAS% ^ --network-alias %ALIAS% ^
--network-alias a.%OS%.getssl.test ^ --network-alias a.%OS%.getssl.test ^
@ -42,5 +44,6 @@ docker run -it ^
--network-alias i.%OS%.getssl.test ^ --network-alias i.%OS%.getssl.test ^
--network-alias j.%OS%.getssl.test ^ --network-alias j.%OS%.getssl.test ^
--network-alias k.%OS%.getssl.test ^ --network-alias k.%OS%.getssl.test ^
--name getssl-%OS% ^
getssl-%OS% ^ getssl-%OS% ^
%COMMAND% %COMMAND%

+ 43
- 0
test/run-test.sh View File

@ -0,0 +1,43 @@
#! /usr/bin/env bash
if [ $# -eq 0 ]; then
echo "Usage: $(basename "$0") <os> [<command>]"
echo "e.g. $(basename "$0") alpine bats /getssl/test"
exit 1
fi
OS=$1
if [ $# -gt 1 ]; then
shift
COMMAND=$*
else
COMMAND="bats /getssl/test"
fi
if [ "$OS" == "duckdns" ]; then
ALIAS="$OS.duckdns.org"
else
ALIAS="$OS.getssl.test"
fi
docker build --rm -f "test\Dockerfile-$OS" -t "getssl-$OS" .
docker run -it \
--env GETSSL_HOST="$OS.getssl.test" \
-v .:/getssl \
--rm \
--network getssl-timkimber_acmenet \
--network-alias $ALIAS \
--network-alias "a.$OS.getssl.test" \
--network-alias "b.$OS.getssl.test" \
--network-alias "c.$OS.getssl.test" \
--network-alias "d.$OS.getssl.test" \
--network-alias "e.$OS.getssl.test" \
--network-alias "f.$OS.getssl.test" \
--network-alias "g.$OS.getssl.test" \
--network-alias "h.$OS.getssl.test" \
--network-alias "i.$OS.getssl.test" \
--network-alias "j.$OS.getssl.test" \
--network-alias "k.$OS.getssl.test" \
--name "getssl-$OS" \
"getssl-$OS" \
$COMMAND

+ 14
- 14
test/test-config/alpine-supervisord.conf View File

@ -1,14 +1,14 @@
[supervisord]
nodaemon=true
logfile=/tmp/supervisord.log
childlogdir=/tmp
pidfile = /tmp/supervisord.pid
[program:nginx]
command=nginx -g 'daemon off;'
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0
[supervisord]
nodaemon=false
logfile=/tmp/supervisord.log
childlogdir=/tmp
pidfile = /tmp/supervisord.pid
[program:nginx]
command=nginx
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0

+ 9
- 3
test/test_helper.bash View File

@ -34,10 +34,15 @@ create_certificate() {
run ${CODE_DIR}/getssl $1 "$GETSSL_HOST" run ${CODE_DIR}/getssl $1 "$GETSSL_HOST"
} }
# start nginx in background on alpine via supervisord
if [[ -f /usr/bin/supervisord && -f /etc/supervisord.conf ]]; then
if [[ ! $(pgrep supervisord) ]]; then
/usr/bin/supervisord -c /etc/supervisord.conf >&3-
fi
fi
# Find NGINX configuration directory for HTTP-01 testing (need to add SSL to config) # Find NGINX configuration directory for HTTP-01 testing (need to add SSL to config)
if [[ -d /etc/nginx/conf.d/default.conf ]]; then
if [[ -f /etc/nginx/conf.d/default.conf ]]; then
export NGINX_CONFIG=/etc/nginx/conf.d/default.conf export NGINX_CONFIG=/etc/nginx/conf.d/default.conf
elif [[ -f /etc/nginx/sites-enabled/default ]]; then elif [[ -f /etc/nginx/sites-enabled/default ]]; then
export NGINX_CONFIG=/etc/nginx/sites-enabled/default export NGINX_CONFIG=/etc/nginx/sites-enabled/default
@ -47,7 +52,8 @@ else
fi fi
# Find IP address # Find IP address
export GETSSL_IP=$(ip address | awk '/10.30.50/ { print $2 }' | awk -F/ '{ print $1 }')
GETSSL_IP=$(ip address | awk '/10.30.50/ { print $2 }' | awk -F/ '{ print $1 }')
export GETSSL_IP
if [ ! -f ${INSTALL_DIR}/pebble.minica.pem ]; then if [ ! -f ${INSTALL_DIR}/pebble.minica.pem ]; then
wget --quiet --no-clobber https://raw.githubusercontent.com/letsencrypt/pebble/master/test/certs/pebble.minica.pem 2>&1 wget --quiet --no-clobber https://raw.githubusercontent.com/letsencrypt/pebble/master/test/certs/pebble.minica.pem 2>&1


Loading…
Cancel
Save