Browse Source

Add tests for #553

pull/554/head
Tim Kimber 6 years ago
parent
commit
61fe4647ad
No known key found for this signature in database GPG Key ID: 3E1804964E76BD18
5 changed files with 104 additions and 3 deletions
  1. +40
    -0
      test/1-simple-http01-dig.bats
  2. +40
    -0
      test/1-simple-http01-nslookup.bats
  3. +2
    -2
      test/1-simple-http01.bats
  4. +16
    -1
      test/2-simple-dns01-dig.bats
  5. +6
    -0
      test/2-simple-dns01-nslookup.bats

+ 40
- 0
test/1-simple-http01-dig.bats View File

@ -0,0 +1,40 @@
#! /usr/bin/env bats
load '/bats-support/load.bash'
load '/bats-assert/load.bash'
load '/getssl/test/test_helper.bash'
# This is run for every test
setup() {
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
if [ -f /usr/bin/host ]; then
mv /usr/bin/host /usr/bin/host.getssl.bak
fi
if [ -f /usr/bin/nslookup ]; then
mv /usr/bin/nslookup /usr/bin/nslookup.getssl.bak
fi
}
teardown() {
if [ -f /usr/bin/host.getssl.bak ]; then
mv /usr/bin/host.getssl.bak /usr/bin/host
fi
if [ -f /usr/bin/nslookup.getssl.bak ]; then
mv /usr/bin/nslookup.getssl.bak /usr/bin/nslookup
fi
}
@test "Create new certificate using HTTP-01 verification (dig)" {
if [ -n "$STAGING" ]; then
skip "Using staging server, skipping internal test"
fi
CONFIG_FILE="getssl-http01.cfg"
setup_environment
init_getssl
create_certificate
assert_success
check_output_for_errors
}

+ 40
- 0
test/1-simple-http01-nslookup.bats View File

@ -0,0 +1,40 @@
#! /usr/bin/env bats
load '/bats-support/load.bash'
load '/bats-assert/load.bash'
load '/getssl/test/test_helper.bash'
# This is run for every test
setup() {
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
if [ -f /usr/bin/dig ]; then
mv /usr/bin/dig /usr/bin/dig.getssl.bak
fi
if [ -f /usr/bin/host ]; then
mv /usr/bin/host /usr/bin/host.getssl.bak
fi
}
teardown() {
if [ -f /usr/bin/dig.getssl.bak ]; then
mv /usr/bin/dig.getssl.bak /usr/bin/dig
fi
if [ -f /usr/bin/host.getssl.bak ]; then
mv /usr/bin/host.getssl.bak /usr/bin/host
fi
}
@test "Create new certificate using HTTP-01 verification (nslookup)" {
if [ -n "$STAGING" ]; then
skip "Using staging server, skipping internal test"
fi
CONFIG_FILE="getssl-http01.cfg"
setup_environment
init_getssl
create_certificate
assert_success
check_output_for_errors
}

+ 2
- 2
test/1-simple-http01.bats View File

@ -11,7 +11,7 @@ setup() {
}
@test "Create new certificate using HTTP-01 verification" {
@test "Create new certificate using HTTP-01 verification (any dns tool)" {
if [ -n "$STAGING" ]; then
skip "Using staging server, skipping internal test"
fi
@ -24,7 +24,7 @@ setup() {
}
@test "Force renewal of certificate using HTTP-01" {
@test "Force renewal of certificate using HTTP-01 (any dns tool)" {
if [ -n "$STAGING" ]; then
skip "Using staging server, skipping internal test"
fi


+ 16
- 1
test/2-simple-dns01-dig.bats View File

@ -5,9 +5,24 @@ load '/bats-assert/load.bash'
load '/getssl/test/test_helper.bash'
# This is run for every test
setup() {
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
if [ -f /usr/bin/host ]; then
mv /usr/bin/host /usr/bin/host.getssl.bak
fi
if [ -f /usr/bin/nslookup ]; then
mv /usr/bin/nslookup /usr/bin/nslookup.getssl.bak
fi
}
teardown() {
if [ -f /usr/bin/host.getssl.bak ]; then
mv /usr/bin/host.getssl.bak /usr/bin/host
fi
if [ -f /usr/bin/nslookup.getssl.bak ]; then
mv /usr/bin/nslookup.getssl.bak /usr/bin/nslookup
fi
}


+ 6
- 0
test/2-simple-dns01-nslookup.bats View File

@ -11,6 +11,9 @@ setup() {
if [ -f /usr/bin/dig ]; then
mv /usr/bin/dig /usr/bin/dig.getssl.bak
fi
if [ -f /usr/bin/host ]; then
mv /usr/bin/host /usr/bin/host.getssl.bak
fi
}
@ -18,6 +21,9 @@ teardown() {
if [ -f /usr/bin/dig.getssl.bak ]; then
mv /usr/bin/dig.getssl.bak /usr/bin/dig
fi
if [ -f /usr/bin/host.getssl.bak ]; then
mv /usr/bin/host.getssl.bak /usr/bin/host
fi
}


Loading…
Cancel
Save