Skip to content

Commit

Permalink
Merge pull request #707 from srvrco/temp-revert-upgrade-with-make
Browse files Browse the repository at this point in the history
Temporarily revert changes to upgrade using `make`
  • Loading branch information
timkimber authored Sep 27, 2021
2 parents d807ad0 + d013dc5 commit 03e1a33
Show file tree
Hide file tree
Showing 59 changed files with 383 additions and 417 deletions.
178 changes: 54 additions & 124 deletions getssl

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/1-simple-http01-dig.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
if [ -f /usr/bin/host ]; then
mv /usr/bin/host /usr/bin/host.getssl.bak
Expand All @@ -19,7 +19,7 @@ setup() {


teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
if [ -f /usr/bin/host.getssl.bak ]; then
mv /usr/bin/host.getssl.bak /usr/bin/host
fi
Expand Down
4 changes: 2 additions & 2 deletions test/1-simple-http01-nslookup.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
if [ -f /usr/bin/dig ]; then
mv /usr/bin/dig /usr/bin/dig.getssl.bak
Expand All @@ -19,7 +19,7 @@ setup() {


teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
if [ -f /usr/bin/dig.getssl.bak ]; then
mv /usr/bin/dig.getssl.bak /usr/bin/dig
fi
Expand Down
8 changes: 4 additions & 4 deletions test/1-simple-http01-two-acl.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
}

Expand All @@ -23,9 +23,9 @@ setup() {
CONFIG_FILE="getssl-http01-two-acl.cfg"
setup_environment
init_getssl
create_certificate -d
create_certificate
assert_success
assert_output --partial "to /var/www/html/.well-known/acme-challenge"
assert_output --partial "to /var/webroot/html/.well-known/acme-challenge"
check_output_for_errors "debug"
check_output_for_errors
}
4 changes: 2 additions & 2 deletions test/1-simple-http01.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
}

Expand Down
4 changes: 2 additions & 2 deletions test/10-mixed-case.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
if [ -z "$STAGING" ]; then
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
fi
Expand Down
12 changes: 6 additions & 6 deletions test/11-test--install.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
}

Expand All @@ -38,8 +38,8 @@ setup() {

assert_success
check_output_for_errors
assert_line 'Verification completed, obtaining certificate.'
assert_line 'Requesting certificate'
assert_line --partial 'Verification completed, obtaining certificate.'
assert_line --partial 'Requesting certificate'
refute [ -d '$HOME/.getssl' ]
}

Expand All @@ -57,8 +57,8 @@ setup() {

assert_success
check_output_for_errors
refute_line 'Verification completed, obtaining certificate.'
refute_line 'Requesting certificate'
refute_line --partial 'Verification completed, obtaining certificate.'
refute_line --partial 'Requesting certificate'
assert_line --partial 'copying domain certificate to'
assert_line --partial 'copying private key to'
assert_line --partial 'copying CA certificate to'
Expand Down
6 changes: 3 additions & 3 deletions test/11-test-no-domain-storage.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ load '/getssl/test/test_helper.bash'


setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
}
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

@test "Check that if domain storage isn't set getssl doesn't try to delete /tmp" {
Expand All @@ -23,5 +23,5 @@ teardown() {
run ${CODE_DIR}/getssl -U -d -a
assert_success
check_output_for_errors
assert_line 'Not going to delete TEMP_DIR ///tmp as it appears to be /tmp'
assert_line --partial 'Not going to delete TEMP_DIR ///tmp as it appears to be /tmp'
}
45 changes: 10 additions & 35 deletions test/12-auto-upgrade-v1.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ load '/getssl/test/test_helper.bash'


setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
}


teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}


@test "Check that auto upgrade to v2 doesn't change pebble url" {
if [ -n "$STAGING" ]; then
skip "Using staging server, skipping internal test"
Expand All @@ -22,17 +25,10 @@ teardown() {
cp "${CODE_DIR}/test/test-config/${CONFIG_FILE}" "${INSTALL_DIR}/.getssl/getssl.cfg"
run ${CODE_DIR}/getssl -U -d --check-config "$GETSSL_CMD_HOST"
assert_success
assert_line 'Using certificate issuer: https://pebble:14000/dir'
assert_line --partial 'Using certificate issuer: https://pebble:14000/dir'
}


setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
}
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
}

@test "Check that auto upgrade to v2 doesn't change v2 staging url" {
if [ -n "$STAGING" ]; then
skip "Using staging server, skipping internal test"
Expand All @@ -43,17 +39,10 @@ teardown() {
cp "${CODE_DIR}/test/test-config/${CONFIG_FILE}" "${INSTALL_DIR}/.getssl/getssl.cfg"
run ${CODE_DIR}/getssl -U -d --check-config "$GETSSL_CMD_HOST"
assert_success
assert_line 'Using certificate issuer: https://acme-staging-v02.api.letsencrypt.org/directory'
assert_line --partial 'Using certificate issuer: https://acme-staging-v02.api.letsencrypt.org/directory'
}


setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
}
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
}

@test "Check that auto upgrade to v2 doesn't change v2 prod url" {
if [ -n "$STAGING" ]; then
skip "Using staging server, skipping internal test"
Expand All @@ -64,17 +53,10 @@ teardown() {
cp "${CODE_DIR}/test/test-config/${CONFIG_FILE}" "${INSTALL_DIR}/.getssl/getssl.cfg"
run ${CODE_DIR}/getssl -U -d --check-config "$GETSSL_CMD_HOST"
assert_success
assert_line 'Using certificate issuer: https://acme-v02.api.letsencrypt.org/directory'
assert_line --partial 'Using certificate issuer: https://acme-v02.api.letsencrypt.org/directory'
}


setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
}
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
}

@test "Check that auto upgrade to v2 changes v1 staging to v2 staging url" {
if [ -n "$STAGING" ]; then
skip "Using staging server, skipping internal test"
Expand All @@ -85,17 +67,10 @@ teardown() {
cp "${CODE_DIR}/test/test-config/${CONFIG_FILE}" "${INSTALL_DIR}/.getssl/getssl.cfg"
run ${CODE_DIR}/getssl -U -d --check-config "$GETSSL_CMD_HOST"
assert_success
assert_line 'Using certificate issuer: https://acme-staging-v02.api.letsencrypt.org/directory'
assert_line --partial 'Using certificate issuer: https://acme-staging-v02.api.letsencrypt.org/directory'
}


setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
}
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
}

@test "Check that auto upgrade to v2 changes v1 prod to v2 prod url" {
if [ -n "$STAGING" ]; then
skip "Using staging server, skipping internal test"
Expand All @@ -106,5 +81,5 @@ teardown() {
cp "${CODE_DIR}/test/test-config/${CONFIG_FILE}" "${INSTALL_DIR}/.getssl/getssl.cfg"
run ${CODE_DIR}/getssl -U -d --check-config "$GETSSL_CMD_HOST"
assert_success
assert_line 'Using certificate issuer: https://acme-v02.api.letsencrypt.org/directory'
assert_line --partial 'Using certificate issuer: https://acme-v02.api.letsencrypt.org/directory'
}
4 changes: 2 additions & 2 deletions test/13-notify-valid.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
}

Expand Down
6 changes: 3 additions & 3 deletions test/14-test-revoke.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
if [ -z "$STAGING" ]; then
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
fi
Expand Down Expand Up @@ -45,5 +45,5 @@ setup() {

run ${CODE_DIR}/getssl -U -d --revoke $CERT $KEY $CA
assert_success
check_output_for_errors "debug"
check_output_for_errors
}
6 changes: 3 additions & 3 deletions test/15-test-revoke-no-suffix.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
if [ -z "$STAGING" ]; then
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
fi
Expand Down Expand Up @@ -51,5 +51,5 @@ setup() {

run ${CODE_DIR}/getssl -U -d --revoke $CERT $KEY $CA
assert_success
check_output_for_errors "debug"
check_output_for_errors
}
4 changes: 2 additions & 2 deletions test/16-test-bad-acl.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ load '/getssl/test/test_helper.bash'

# This is run for every test
teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
}

Expand Down
33 changes: 21 additions & 12 deletions test/17-test-spaces-in-sans-dns01.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,32 @@ load '/getssl/test/test_helper.bash'


# This is run for every test
setup() {
[ ! -f $BATS_RUN_TMPDIR/failed.skip ] || skip "skipping tests after first failure"
}


teardown() {
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_TMPDIR/failed.skip
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
}

setup() {
[ ! -f $BATS_TMPDIR/failed.skip ] || skip "skipping tests after first failure"

setup_file() {
# Add hosts to DNS (also need to be added as aliases in docker-compose.yml)
if [ -z "$STAGING" ]; then
export CURL_CA_BUNDLE=/root/pebble-ca-bundle.crt
for prefix in a b c; do
curl --silent -X POST -d '{"host":"'$prefix.$GETSSL_HOST'", "addresses":["'$GETSSL_IP'"]}' http://10.30.50.3:8055/add-a
done
fi
}


teardown_file() {
if [ -z "$STAGING" ]; then
for prefix in a b c; do
curl --silent -X POST -d '{"host":"'$prefix.$GETSSL_HOST'"}' http://10.30.50.3:8055/clear-a
done
fi
}

Expand All @@ -25,11 +43,6 @@ setup() {
CONFIG_FILE="getssl-dns01-spaces-sans.cfg"
setup_environment

# Add hosts to DNS (also need to be added as aliases in docker-compose.yml)
for prefix in a b c; do
curl --silent -X POST -d '{"host":"'$prefix.$GETSSL_HOST'", "addresses":["'$GETSSL_IP'"]}' http://10.30.50.3:8055/add-a
done

init_getssl
create_certificate
assert_success
Expand Down Expand Up @@ -85,8 +98,4 @@ setup() {
assert_success
check_output_for_errors
cleanup_environment

for prefix in a b c; do
curl --silent -X POST -d '{"host":"'$prefix.$GETSSL_HOST'"}' http://10.30.50.3:8055/clear-a
done
}
Loading

0 comments on commit 03e1a33

Please sign in to comment.