Skip to content

Commit 9b97844

Browse files
committed
Parallelize the gitactions tests
1 parent 1ab68d7 commit 9b97844

17 files changed

Lines changed: 261 additions & 277 deletions

.github/workflows/run-all-tests.yml

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,59 @@ on:
77
branches:
88
- master
99
jobs:
10-
build:
10+
test-alpine:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v1
1414
- name: Build the docker-compose stack
1515
run: docker-compose up -d --build
16-
- name: Run test suite
17-
run: test/run-all-tests.sh
16+
- name: Run test suite on Alpine
17+
run: test/run-test.sh alpine
18+
test-centos6:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v1
22+
- name: Build the docker-compose stack
23+
run: docker-compose up -d --build
24+
- name: Run test suite on centos6
25+
run: test/run-test.sh centos6
26+
test-debian:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v1
30+
- name: Build the docker-compose stack
31+
run: docker-compose up -d --build
32+
- name: Run test suite on Debian
33+
run: test/run-test.sh debian
34+
test-duckdns:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v1
38+
- name: Build the docker-compose stack
39+
run: docker-compose up -d --build
40+
- name: Run test suite on Ubuntu using DuckDNS
41+
run: test/run-test.sh duckdns
42+
test-ubuntu:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v1
46+
- name: Build the docker-compose stack
47+
run: docker-compose up -d --build
48+
- name: Run test suite on Ubuntu
49+
run: test/run-test.sh ubuntu
50+
test-ubuntu16:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v1
54+
- name: Build the docker-compose stack
55+
run: docker-compose up -d --build
56+
- name: Run test suite on Ubuntu16
57+
run: test/run-test.sh ubuntu16
58+
test-ubuntu18:
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v1
62+
- name: Build the docker-compose stack
63+
run: docker-compose up -d --build
64+
- name: Run test suite on Ubuntu18
65+
run: test/run-test.sh ubuntu18

docker-compose.yml

Lines changed: 0 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -21,186 +21,6 @@ services:
2121
networks:
2222
acmenet:
2323
ipv4_address: 10.30.50.3
24-
getssl-alpine:
25-
build:
26-
context: .
27-
dockerfile: test/Dockerfile-alpine
28-
container_name: getssl-alpine
29-
volumes:
30-
- .:/getssl
31-
environment:
32-
GETSSL_HOST: alpine.getssl.test
33-
GETSSL_IP: 10.30.50.10
34-
NGINX_CONFIG: /etc/nginx/conf.d/default.conf
35-
networks:
36-
acmenet:
37-
ipv4_address: 10.30.50.10
38-
aliases:
39-
- alpine.getssl.test
40-
- a.alpine.getssl.test
41-
- b.alpine.getssl.test
42-
- c.alpine.getssl.test
43-
- d.alpine.getssl.test
44-
- e.alpine.getssl.test
45-
- f.alpine.getssl.test
46-
- g.alpine.getssl.test
47-
- h.alpine.getssl.test
48-
- i.alpine.getssl.test
49-
- j.alpine.getssl.test
50-
- k.alpine.getssl.test
51-
getssl-centos6:
52-
build:
53-
context: .
54-
dockerfile: test/Dockerfile-centos6
55-
container_name: getssl-centos6
56-
volumes:
57-
- .:/getssl
58-
environment:
59-
GETSSL_HOST: centos6.getssl.test
60-
GETSSL_IP: 10.30.50.11
61-
NGINX_CONFIG: /etc/nginx/conf.d/default.conf
62-
networks:
63-
acmenet:
64-
ipv4_address: 10.30.50.11
65-
aliases:
66-
- centos6.getssl.test
67-
- a.centos6.getssl.test
68-
- b.centos6.getssl.test
69-
- c.centos6.getssl.test
70-
- d.centos6.getssl.test
71-
- e.centos6.getssl.test
72-
- f.centos6.getssl.test
73-
- g.centos6.getssl.test
74-
- h.centos6.getssl.test
75-
- i.centos6.getssl.test
76-
- j.centos6.getssl.test
77-
- k.centos6.getssl.test
78-
getssl-debian:
79-
build:
80-
context: .
81-
dockerfile: test/Dockerfile-debian
82-
container_name: getssl-debian
83-
volumes:
84-
- .:/getssl
85-
environment:
86-
GETSSL_HOST: debian.getssl.test
87-
GETSSL_IP: 10.30.50.12
88-
NGINX_CONFIG: /etc/nginx/sites-enabled/default
89-
networks:
90-
acmenet:
91-
ipv4_address: 10.30.50.12
92-
aliases:
93-
- debian.getssl.test
94-
- a.debian.getssl.test
95-
- b.debian.getssl.test
96-
- c.debian.getssl.test
97-
- d.debian.getssl.test
98-
- e.debian.getssl.test
99-
- f.debian.getssl.test
100-
- g.debian.getssl.test
101-
- h.debian.getssl.test
102-
- i.debian.getssl.test
103-
- j.debian.getssl.test
104-
- k.debian.getssl.test
105-
getssl-ubuntu:
106-
build:
107-
context: .
108-
dockerfile: test/Dockerfile-ubuntu
109-
container_name: getssl-ubuntu
110-
volumes:
111-
- .:/getssl
112-
environment:
113-
GETSSL_HOST: ubuntu.getssl.test
114-
GETSSL_IP: 10.30.50.13
115-
NGINX_CONFIG: /etc/nginx/sites-enabled/default
116-
networks:
117-
acmenet:
118-
ipv4_address: 10.30.50.13
119-
aliases:
120-
- ubuntu.getssl.test
121-
- a.ubuntu.getssl.test
122-
- b.ubuntu.getssl.test
123-
- c.ubuntu.getssl.test
124-
- d.ubuntu.getssl.test
125-
- e.ubuntu.getssl.test
126-
- f.ubuntu.getssl.test
127-
- g.ubuntu.getssl.test
128-
- h.ubuntu.getssl.test
129-
- i.ubuntu.getssl.test
130-
- j.ubuntu.getssl.test
131-
- k.ubuntu.getssl.test
132-
getssl-ubuntu16:
133-
build:
134-
context: .
135-
dockerfile: test/Dockerfile-ubuntu16
136-
container_name: getssl-ubuntu16
137-
volumes:
138-
- .:/getssl
139-
environment:
140-
GETSSL_HOST: ubuntu16.getssl.test
141-
GETSSL_IP: 10.30.50.14
142-
NGINX_CONFIG: /etc/nginx/sites-enabled/default
143-
networks:
144-
acmenet:
145-
ipv4_address: 10.30.50.14
146-
aliases:
147-
- ubuntu16.getssl.test
148-
- a.ubuntu16.getssl.test
149-
- b.ubuntu16.getssl.test
150-
- c.ubuntu16.getssl.test
151-
- d.ubuntu16.getssl.test
152-
- e.ubuntu16.getssl.test
153-
- f.ubuntu16.getssl.test
154-
- g.ubuntu16.getssl.test
155-
- h.ubuntu16.getssl.test
156-
- i.ubuntu16.getssl.test
157-
- j.ubuntu16.getssl.test
158-
- k.ubuntu16.getssl.test
159-
getssl-ubuntu18:
160-
build:
161-
context: .
162-
dockerfile: test/Dockerfile-ubuntu18
163-
container_name: getssl-ubuntu18
164-
volumes:
165-
- .:/getssl
166-
environment:
167-
GETSSL_HOST: ubuntu18.getssl.test
168-
GETSSL_IP: 10.30.50.15
169-
NGINX_CONFIG: /etc/nginx/sites-enabled/default
170-
networks:
171-
acmenet:
172-
ipv4_address: 10.30.50.15
173-
aliases:
174-
- ubuntu18.getssl.test
175-
- a.ubuntu18.getssl.test
176-
- b.ubuntu18.getssl.test
177-
- c.ubuntu18.getssl.test
178-
- d.ubuntu18.getssl.test
179-
- e.ubuntu18.getssl.test
180-
- f.ubuntu18.getssl.test
181-
- g.ubuntu18.getssl.test
182-
- h.ubuntu18.getssl.test
183-
- i.ubuntu18.getssl.test
184-
- j.ubuntu18.getssl.test
185-
- k.ubuntu18.getssl.test
186-
getssl-duckdns:
187-
build:
188-
context: .
189-
dockerfile: test/Dockerfile-ubuntu
190-
container_name: getssl-duckdns
191-
volumes:
192-
- .:/getssl
193-
environment:
194-
GETSSL_HOST: getssl.duckdns.org
195-
GETSSL_IP: 10.30.50.16
196-
NGINX_CONFIG: /etc/nginx/sites-enabled/default
197-
DUCKDNS_TOKEN: $DUCKDNS_TOKEN
198-
STAGING: "true"
199-
networks:
200-
acmenet:
201-
ipv4_address: 10.30.50.16
202-
aliases:
203-
- getssl.duckdns.org
20424

20525

20626
networks:

test/4-more-than-10-hosts.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ setup() {
4444
# Remove all the dns aliases
4545
cleanup_environment
4646
for prefix in a b c d e f g h i j k; do
47-
curl --silent -X POST -d '{"host":"'$prefix.$GETSSL_HOST'", "addresses":["'$GETSSL_IP'"]}' http://10.30.50.3:8055/del-a
47+
curl --silent -X POST -d '{"host":"'$prefix.$GETSSL_HOST'"}' http://10.30.50.3:8055/clear-a
4848
done
4949
}

test/6-dual-rsa-ecdsa-copy-2-locations.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ setup() {
1616

1717
teardown() {
1818
if [ -z "$STAGING" ]; then
19-
curl --silent -X POST -d '{"host":"'a.$GETSSL_HOST'", "addresses":["'$GETSSL_IP'"]}' http://10.30.50.3:8055/del-a
19+
curl --silent -X POST -d '{"host":"'a.$GETSSL_HOST'"}' http://10.30.50.3:8055/clear-a
2020
fi
2121
}
2222

test/7-duckdns-dns01.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ setup() {
3838
refute_output --regexp '[Ee][Rr][Rr][Oo][Rr]'
3939
refute_output --regexp '[Ww][Aa][Rr][Nn][Ii][Nn][Gg]'
4040
cleanup_environment
41-
curl --silent -X POST -d '{"host":"getssl.duckdns.org", "addresses":["'$GETSSL_IP'"]}' http://10.30.50.3:8055/del-a
41+
curl --silent -X POST -d '{"host":"getssl.duckdns.org"}' http://10.30.50.3:8055/clear-a
4242
}

test/Dockerfile-alpine

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ RUN git clone https://github.com/jasonkarns/bats-assert-1 /bats-assert
1818
RUN /bats-core/install.sh /usr/local
1919

2020
# Use supervisord to run nginx in the background
21-
COPY ./test/alpine-supervisord.conf /etc/supervisord.conf
22-
ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf
21+
COPY ./test/test-config/alpine-supervisord.conf /etc/supervisord.conf
22+
CMD tail -f /dev/null

test/Dockerfile-duckdns

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:latest
2+
3+
# Note this image uses mawk1.3
4+
5+
ENV staging "true"
6+
ENV DUCKDNS_TOKEN 1d616aa9-b8e4-4bb4-b312-3289de82badb
7+
# Update and install required software
8+
RUN apt-get update --fix-missing
9+
RUN apt-get install -y git curl dnsutils wget nginx-light
10+
RUN apt-get install -y vim dos2unix # for debugging
11+
# TODO test with drill, dig, host
12+
13+
WORKDIR /root
14+
15+
# Prevent "Can't load /root/.rnd into RNG" error from openssl
16+
RUN touch /root/.rnd
17+
18+
# BATS (Bash Automated Testings)
19+
RUN git clone https://github.com/bats-core/bats-core.git /bats-core
20+
RUN git clone https://github.com/jasonkarns/bats-support /bats-support
21+
RUN git clone https://github.com/jasonkarns/bats-assert-1 /bats-assert
22+
RUN /bats-core/install.sh /usr/local
23+
24+
# Run eternal loop - for testing
25+
CMD tail -f /dev/null

test/README-Testing.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Testing
2+
3+
## Continuous Integration
4+
5+
For continuous integration testing we have the following:
6+
7+
`gitactions` script which runs whenever a PR is pushed:
8+
9+
1. Uses `docker-compose` to start `pebble` (letsencrypt test server) and `challtestsrv` (minimal dns client for pebble)
10+
2. Then runs the `bats` test scripts (all the files with a ".bats" extension) for each OS (alpine, centos6, debian, ubuntu)
11+
3. Runs the `bats` test script against the staging server (using nn ubuntu docker image and duckdns.org)
12+
13+
## To run all the tests on a single OS
14+
15+
1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build```
16+
2. Run the test suite ```run-test.sh [<os>]```
17+
3. eg. `run-test.sh ubuntu16`
18+
19+
## To run a single bats test on a single OS
20+
21+
1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build```
22+
2. ```run-test.sh <os> bats <bats test script>```
23+
3. e.g. `run-test.sh ubuntu bats /getssl/test/1-simple-http01.bats`
24+
25+
## To debug a test
26+
27+
1. Start `pebble` and `challtestsrv` using ```docker-compose up -d --build```
28+
2. ```run-test.sh <os> /getssl/test/debug-test.sh <getssl config file>```
29+
3. e.g. `run-test.sh ubuntu /getssl/test/debug-test.sh -d /getssl/test/test-config/getssl-http01-cfg`
30+
31+
## TODO
32+
33+
1. Test wildcards
34+
2. Test SSH, SFTP, SCP
35+
3. Test change of key algorithm (should automatically delete and re-create account.key)

test/README.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

test/restart-nginx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ if [ "$GETSSL_HOST" = "alpine.getssl.test" ]; then
44
killall -HUP nginx >&3-
55
sleep 5
66
else
7-
service nginx restart >&3-
7+
service nginx restart >/dev/null >&3-
88
fi

0 commit comments

Comments
 (0)