mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-21 16:01:20 +02:00
additional tests and show log output if script execution fails
This commit is contained in:
15
test.sh
15
test.sh
@@ -98,7 +98,7 @@ touch domains.txt
|
|||||||
|
|
||||||
# Check if help command is working
|
# Check if help command is working
|
||||||
_TEST "Checking if help command is working..."
|
_TEST "Checking if help command is working..."
|
||||||
./letsencrypt.sh --help > tmplog 2> errorlog
|
./letsencrypt.sh --help > tmplog 2> errorlog || _FAIL "Script execution failed"
|
||||||
_CHECK_LOG "Default command: help"
|
_CHECK_LOG "Default command: help"
|
||||||
_CHECK_LOG "--help (-h)"
|
_CHECK_LOG "--help (-h)"
|
||||||
_CHECK_LOG "--domain (-d) domain.tld"
|
_CHECK_LOG "--domain (-d) domain.tld"
|
||||||
@@ -106,7 +106,7 @@ _CHECK_ERRORLOG
|
|||||||
|
|
||||||
# Run in cron mode with empty domains.txt (should only generate private key and exit)
|
# Run in cron mode with empty domains.txt (should only generate private key and exit)
|
||||||
_TEST "First run in cron mode, checking if private key is generated and registered"
|
_TEST "First run in cron mode, checking if private key is generated and registered"
|
||||||
./letsencrypt.sh --cron > tmplog 2> errorlog
|
./letsencrypt.sh --cron > tmplog 2> errorlog || _FAIL "Script execution failed"
|
||||||
_CHECK_LOG "Registering account key"
|
_CHECK_LOG "Registering account key"
|
||||||
_CHECK_FILE "private_key.pem"
|
_CHECK_FILE "private_key.pem"
|
||||||
_CHECK_ERRORLOG
|
_CHECK_ERRORLOG
|
||||||
@@ -114,7 +114,8 @@ _CHECK_ERRORLOG
|
|||||||
# Temporarily move config out of the way and try signing certificate by using temporary config location
|
# Temporarily move config out of the way and try signing certificate by using temporary config location
|
||||||
_TEST "Try signing using temporary config location and with domain as command line parameter"
|
_TEST "Try signing using temporary config location and with domain as command line parameter"
|
||||||
mv config.sh tmp_config.sh
|
mv config.sh tmp_config.sh
|
||||||
./letsencrypt.sh --cron --domain "${TMP_URL}" -f tmp_config.sh > tmplog 2> errorlog
|
./letsencrypt.sh --domain "${TMP_URL}" -f tmp_config.sh > tmplog 2> errorlog || _FAIL "Script execution failed"
|
||||||
|
_CHECK_NOT_LOG "Checking domain name(s) of existing cert"
|
||||||
_CHECK_LOG "Generating private key"
|
_CHECK_LOG "Generating private key"
|
||||||
_CHECK_LOG "Requesting challenge for ${TMP_URL}"
|
_CHECK_LOG "Requesting challenge for ${TMP_URL}"
|
||||||
_CHECK_LOG "Challenge is valid!"
|
_CHECK_LOG "Challenge is valid!"
|
||||||
@@ -130,14 +131,16 @@ echo 'PRIVATE_KEY="./account_key.pem"' >> config.sh
|
|||||||
# Add domain to domains.txt and run in cron mode again (should find a non-expiring certificate and do nothing)
|
# Add domain to domains.txt and run in cron mode again (should find a non-expiring certificate and do nothing)
|
||||||
_TEST "Run in cron mode again, this time with domain in domains.txt, should find non-expiring certificate"
|
_TEST "Run in cron mode again, this time with domain in domains.txt, should find non-expiring certificate"
|
||||||
echo "${TMP_URL}" >> domains.txt
|
echo "${TMP_URL}" >> domains.txt
|
||||||
./letsencrypt.sh --cron > tmplog 2> errorlog
|
./letsencrypt.sh --cron > tmplog 2> errorlog || _FAIL "Script execution failed"
|
||||||
|
_CHECK_LOG "Checking domain name(s) of existing cert... unchanged."
|
||||||
_CHECK_LOG "Skipping!"
|
_CHECK_LOG "Skipping!"
|
||||||
_CHECK_ERRORLOG
|
_CHECK_ERRORLOG
|
||||||
|
|
||||||
# Run in cron mode one last time, with domain in domains.txt and force-resign (should find certificate, resign anyway, and not generate private key)
|
# Run in cron mode one last time, with domain in domains.txt and force-resign (should find certificate, resign anyway, and not generate private key)
|
||||||
_TEST "Run in cron mode one last time, with domain in domains.txt and force-resign"
|
_TEST "Run in cron mode one last time, with domain in domains.txt and force-resign"
|
||||||
echo "${TMP_URL}" >> domains.txt
|
echo "${TMP_URL}" >> domains.txt
|
||||||
./letsencrypt.sh --cron --force > tmplog 2> errorlog
|
./letsencrypt.sh --cron --force > tmplog 2> errorlog || _FAIL "Script execution failed"
|
||||||
|
_CHECK_LOG "Checking domain name(s) of existing cert... unchanged."
|
||||||
_CHECK_LOG "Ignoring because renew was forced!"
|
_CHECK_LOG "Ignoring because renew was forced!"
|
||||||
_CHECK_NOT_LOG "Generating private key"
|
_CHECK_NOT_LOG "Generating private key"
|
||||||
_CHECK_LOG "Requesting challenge for ${TMP_URL}"
|
_CHECK_LOG "Requesting challenge for ${TMP_URL}"
|
||||||
@@ -162,7 +165,7 @@ _CHECK_ERRORLOG
|
|||||||
|
|
||||||
# Revoke certificate using certificate key
|
# Revoke certificate using certificate key
|
||||||
_TEST "Revoking certificate..."
|
_TEST "Revoking certificate..."
|
||||||
./letsencrypt.sh --revoke "certs/${TMP_URL}/cert.pem" --privkey "certs/${TMP_URL}/privkey.pem" > tmplog 2> errorlog
|
./letsencrypt.sh --revoke "certs/${TMP_URL}/cert.pem" --privkey "certs/${TMP_URL}/privkey.pem" > tmplog 2> errorlog || _FAIL "Script execution failed"
|
||||||
_CHECK_LOG "Revoking certs/${TMP_URL}/cert.pem"
|
_CHECK_LOG "Revoking certs/${TMP_URL}/cert.pem"
|
||||||
_CHECK_LOG "SUCCESS"
|
_CHECK_LOG "SUCCESS"
|
||||||
_CHECK_FILE "certs/${TMP_URL}/cert.pem-revoked"
|
_CHECK_FILE "certs/${TMP_URL}/cert.pem-revoked"
|
||||||
|
|||||||
Reference in New Issue
Block a user