Browse Source

Test using both Dynu.com and Duckdns.org

pull/618/head
Tim Kimber 5 years ago
parent
commit
5d6988f0ec
No known key found for this signature in database GPG Key ID: 3E1804964E76BD18
9 changed files with 104 additions and 29 deletions
  1. +1
    -1
      test/Dockerfile-centos7-duckdns
  2. +29
    -0
      test/Dockerfile-centos7-dynu
  3. +1
    -1
      test/Dockerfile-ubuntu-duckdns
  4. +30
    -0
      test/Dockerfile-ubuntu-dynu
  5. +13
    -5
      test/run-test.cmd
  6. +9
    -5
      test/run-test.sh
  7. +7
    -3
      test/test-config/getssl-staging-dns01.cfg
  8. +7
    -7
      test/u1-test-get_auth_dns-dig.bats
  9. +7
    -7
      test/u2-test-get_auth_dns-drill.bats

test/Dockerfile-centos7-staging → test/Dockerfile-centos7-duckdns View File


+ 29
- 0
test/Dockerfile-centos7-dynu View File

@ -0,0 +1,29 @@
FROM centos:centos7
# Note this image uses gawk
# Update and install required software
RUN yum -y update
RUN yum -y install epel-release
RUN yum -y install git curl bind-utils ldns wget which nginx
ENV staging "true"
ENV dynamic_dns "duckdns"
ENV DYNU_API_KEY 65cXefd35XbYf36546eg5dYcZT6X52Y2
WORKDIR /root
RUN mkdir /etc/nginx/pki
RUN mkdir /etc/nginx/pki/private
COPY ./test/test-config/nginx-ubuntu-no-ssl /etc/nginx/conf.d/default.conf
COPY ./test/test-config/nginx-centos7.conf /etc/nginx/nginx.conf
# BATS (Bash Automated Testings)
RUN git clone https://github.com/bats-core/bats-core.git /bats-core --branch v1.2.1
RUN git clone https://github.com/bats-core/bats-support /bats-support
RUN git clone https://github.com/bats-core/bats-assert /bats-assert
RUN /bats-core/install.sh /usr/local
EXPOSE 80 443
# Run eternal loop - for testing
CMD tail -f /dev/null

test/Dockerfile-ubuntu-staging → test/Dockerfile-ubuntu-duckdns View File


+ 30
- 0
test/Dockerfile-ubuntu-dynu View File

@ -0,0 +1,30 @@
FROM ubuntu:latest
# Note this image uses mawk1.3
# Set noninteractive otherwise tzdata hangs
ENV DEBIAN_FRONTEND noninteractive
# Ensure tests in this image use the staging server
ENV staging "true"
ENV dynamic_dns "dynu"
ENV DYNU_API_KEY 65cXefd35XbYf36546eg5dYcZT6X52Y2
# Update and install required software
RUN apt-get update --fix-missing
RUN apt-get install -y git curl dnsutils ldnsutils wget nginx-light
RUN apt-get install -y vim dos2unix # for debugging
WORKDIR /root
# Prevent "Can't load /root/.rnd into RNG" error from openssl
RUN touch /root/.rnd
# BATS (Bash Automated Testings)
RUN git clone https://github.com/bats-core/bats-core.git /bats-core --branch v1.2.1
RUN git clone https://github.com/bats-core/bats-support /bats-support
RUN git clone https://github.com/bats-core/bats-assert /bats-assert
RUN /bats-core/install.sh /usr/local
# Run eternal loop - for testing
CMD tail -f /dev/null

+ 13
- 5
test/run-test.cmd View File

@ -8,7 +8,8 @@ set COMMAND=%2 %3
:CheckAlias
REM check if OS *contains* staging
IF NOT x%OS:staging=%==x%OS% GOTO staging
IF NOT x%OS:duck=%==x%OS% GOTO duckdns
IF NOT x%OS:dynu=%==x%OS% GOTO dynu
set ALIAS=%OS%.getssl.test
set STAGING=
GOTO Run
@ -22,9 +23,16 @@ REM set COMMAND=/getssl/test/run-bats.sh
set COMMAND=bats /getssl/test
GOTO CheckAlias
:staging
set ALIAS=%OS:-staging=%-getssl.freeddns.org
set STAGING=--env STAGING=true
:duckdns
set ALIAS=%OS:-duckdns=%-getssl.duckdns.org
set STAGING=--env STAGING=true --env dynamic_dns=duckdns
set GETSSL_OS=%OS:-duckdns=%
GOTO Run
:dynu
set ALIAS=%OS:-dynu=%-getssl.freeddns.org
set STAGING=--env STAGING=true --env dynamic_dns=dynu
set GETSSL_OS=%OS:-dynu=%
:Run
for %%I in (.) do set CurrDirName=%%~nxI
@ -33,7 +41,7 @@ docker build --rm -f "test\Dockerfile-%OS%" -t getssl-%OS% .
@echo on
docker run -it ^
--env GETSSL_HOST=%ALIAS% %STAGING% ^
--env GETSSL_OS=%OS:-staging=% ^
--env GETSSL_OS=%GETSSL_OS% ^
-v %cd%:/getssl ^
--rm ^
--network %CurrDirName%_acmenet ^


+ 9
- 5
test/run-test.sh View File

@ -14,10 +14,14 @@ else
COMMAND="bats /getssl/test"
fi
if [[ "$OS" == *"staging"* ]]; then
#ALIAS="${OS%-staging}-getssl.duckdns.org"
ALIAS="${OS%-staging}-getssl.freeddns.org"
STAGING="--env STAGING=true"
if [[ "$OS" == *"duckdns"* ]]; then
ALIAS="${OS%-duckdns}-getssl.duckdns.org"
STAGING="--env STAGING=true --env dynamic_dns=duckdns"
GETSSL_OS="${OS%-duckdns}"
elif [[ "$OS" == *"dynu"* ]]; then
ALIAS="${OS%-dynu}-getssl.freeddns.org"
STAGING="--env STAGING=true --env dynamic_dns=dynu"
GETSSL_OS="${OS%-dynu}"
else
ALIAS="$OS.getssl.test"
STAGING=""
@ -27,7 +31,7 @@ docker build --rm -f "test/Dockerfile-$OS" -t "getssl-$OS" .
# shellcheck disable=SC2086
docker run \
--env GETSSL_HOST=$ALIAS $STAGING \
--env GETSSL_OS=${OS%-staging} \
--env GETSSL_OS=$GETSSL_OS \
-v "$(pwd)":/getssl \
--rm \
--network ${PWD##*/}_acmenet \


+ 7
- 3
test/test-config/getssl-staging-dns01.cfg View File

@ -3,10 +3,14 @@
CA="https://acme-staging-v02.api.letsencrypt.org/directory"
VALIDATE_VIA_DNS=true
DNS_ADD_COMMAND="/getssl/dns_scripts/dns_add_dynu"
DNS_DEL_COMMAND="/getssl/dns_scripts/dns_del_dynu"
DNS_ADD_COMMAND="/getssl/dns_scripts/dns_add_${dynamic_dns}"
DNS_DEL_COMMAND="/getssl/dns_scripts/dns_del_${dynamic_dns}"
PUBLIC_DNS_SERVER="8.8.8.8 resolver1.infoserve.de"
AUTH_DNS_SERVER=ns1.dynu.com
if [[ "${dynamic_dns}" == "dynu" ]]; then
AUTH_DNS_SERVER=ns1.dynu.com
else
AUTH_DNS_SERVER=ns1.duckdns.org
fi
CHECK_ALL_AUTH_DNS="true"
CHECK_PUBLIC_DNS_SERVER="true"
DNS_EXTRA_WAIT=120


+ 7
- 7
test/u1-test-get_auth_dns-dig.bats View File

@ -59,14 +59,14 @@ teardown() {
run get_auth_dns ubuntu-getssl.duckdns.org
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we had to use dig NS
assert_line --partial 'Using dig NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
run get_auth_dns ubuntu-getssl.duckdns.org
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org'
}
@ -86,7 +86,7 @@ teardown() {
run get_auth_dns ubuntu-getssl.duckdns.org
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we had to use dig NS
assert_line --partial 'Using dig SOA'
@ -95,12 +95,12 @@ teardown() {
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
run get_auth_dns ubuntu-getssl.duckdns.org
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org'
# Check that we also check the public DNS server if requested
CHECK_PUBLIC_DNS_SERVER=true
run get_auth_dns ubuntu-getssl.duckdns.org
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org 1\.0\.0\.1'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org 1\.0\.0\.1'
}
@ -165,7 +165,7 @@ teardown() {
run get_auth_dns www.duckdns.org
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we found a CNAME but didn't use dig NS
assert_line --partial 'Using dig CNAME'
@ -174,5 +174,5 @@ teardown() {
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
run get_auth_dns www.duckdns.org
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org'
}

+ 7
- 7
test/u2-test-get_auth_dns-drill.bats View File

@ -78,14 +78,14 @@ teardown() {
run get_auth_dns ubuntu-getssl.duckdns.org
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we had to use drill NS
assert_line --partial 'Using drill NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
run get_auth_dns ubuntu-getssl.duckdns.org
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org'
}
@ -110,7 +110,7 @@ teardown() {
run get_auth_dns ubuntu-getssl.duckdns.org
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we had to use drill NS
assert_line --partial 'Using drill SOA'
@ -119,12 +119,12 @@ teardown() {
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
run get_auth_dns ubuntu-getssl.duckdns.org
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org'
# Check that we also check the public DNS server if requested
CHECK_PUBLIC_DNS_SERVER=true
run get_auth_dns ubuntu-getssl.duckdns.org
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org 1\.0\.0\.1'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org 1\.0\.0\.1'
}
@ -202,7 +202,7 @@ teardown() {
run get_auth_dns www.duckdns.org
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we found a CNAME but didn't use drill NS
assert_line --partial 'Using drill CNAME'
@ -211,5 +211,5 @@ teardown() {
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
run get_auth_dns www.duckdns.org
assert_output --regexp 'set primary_ns = ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org ns[1-3]+\.duckdns\.org'
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org ns[1-4]+\.duckdns\.org'
}

Loading…
Cancel
Save