diff options
author | Brad Warren <bmw@eff.org> | 2017-06-30 18:06:51 +0300 |
---|---|---|
committer | Brad Warren <bmw@eff.org> | 2017-06-30 18:06:51 +0300 |
commit | 6dedfa62b63d7d20b60461eeea3d32513f49d0f6 (patch) | |
tree | 06e9c26dfe48f98bb3e458e860f7378880343230 /tests/boulder-integration.sh | |
parent | 8a664622eac4ca2fa23edf065228ed0ff967f6bd (diff) |
Test renew and deploy hooks are run properly
Diffstat (limited to 'tests/boulder-integration.sh')
-rwxr-xr-x | tests/boulder-integration.sh | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/tests/boulder-integration.sh b/tests/boulder-integration.sh index 913880c8b..a356da884 100755 --- a/tests/boulder-integration.sh +++ b/tests/boulder-integration.sh @@ -52,15 +52,19 @@ CheckHooks() { if [ $(head -n1 $HOOK_TEST) = "wtf.pre" ]; then echo "wtf.pre" > "$EXPECTED" echo "wtf2.pre" >> "$EXPECTED" - echo "renew" >> "$EXPECTED" - echo "renew" >> "$EXPECTED" + echo "deploy" >> "$EXPECTED" + echo "deploy" >> "$EXPECTED" + echo "deploy" >> "$EXPECTED" + echo "deploy" >> "$EXPECTED" echo "wtf.post" >> "$EXPECTED" echo "wtf2.post" >> "$EXPECTED" else echo "wtf2.pre" > "$EXPECTED" echo "wtf.pre" >> "$EXPECTED" - echo "renew" >> "$EXPECTED" - echo "renew" >> "$EXPECTED" + echo "deploy" >> "$EXPECTED" + echo "deploy" >> "$EXPECTED" + echo "deploy" >> "$EXPECTED" + echo "deploy" >> "$EXPECTED" echo "wtf2.post" >> "$EXPECTED" echo "wtf.post" >> "$EXPECTED" fi @@ -74,6 +78,27 @@ CheckHooks() { rm "$HOOK_TEST" } +# Checks if deploy was run and deletes the hook file +CheckDeployHook() { + CONTENTS=$(cat "$HOOK_TEST") + rm "$HOOK_TEST" + grep deploy <(echo "$CONTENTS") +} + +# Asserts the deploy hook was run and deletes the hook file +AssertDeployHook() { + if ! CheckDeployHook; then + echo "The deploy hook wasn't run" >&2 + fi +} + +# Asserts the deploy hook wasn't run and deletes the hook file +AssertNoDeployHook() { + if CheckDeployHook; then + echo "The deploy hook was incorrectly run" >&2 + fi +} + # Cleanup coverage data coverage erase @@ -104,24 +129,33 @@ python_server_pid=$! common --domains le1.wtf --preferred-challenges tls-sni-01 auth \ --pre-hook 'echo wtf.pre >> "$HOOK_TEST"' \ --post-hook 'echo wtf.post >> "$HOOK_TEST"'\ - --renew-hook 'echo renew >> "$HOOK_TEST"' + --deploy-hook 'echo deploy >> "$HOOK_TEST"' kill $python_server_pid +AssertDeployHook + python ./tests/run_http_server.py $tls_sni_01_port & python_server_pid=$! common --domains le2.wtf --preferred-challenges http-01 run \ --pre-hook 'echo wtf.pre >> "$HOOK_TEST"' \ --post-hook 'echo wtf.post >> "$HOOK_TEST"'\ - --renew-hook 'echo renew >> "$HOOK_TEST"' + --deploy-hook 'echo deploy >> "$HOOK_TEST"' kill $python_server_pid +AssertDeployHook common certonly -a manual -d le.wtf --rsa-key-size 4096 \ --manual-auth-hook ./tests/manual-http-auth.sh \ --manual-cleanup-hook ./tests/manual-http-cleanup.sh \ --pre-hook 'echo wtf2.pre >> "$HOOK_TEST"' \ - --post-hook 'echo wtf2.post >> "$HOOK_TEST"' + --post-hook 'echo wtf2.post >> "$HOOK_TEST"' \ + --renew-hook 'echo deploy >> "$HOOK_TEST"' +AssertNoDeployHook -common certonly -a manual -d dns.le.wtf --preferred-challenges dns,tls-sni \ - --manual-auth-hook ./tests/manual-dns-auth.sh +common -a manual -d dns.le.wtf --preferred-challenges dns,tls-sni run \ + --manual-auth-hook ./tests/manual-dns-auth.sh \ + --pre-hook 'echo wtf2.pre >> "$HOOK_TEST"' \ + --post-hook 'echo wtf2.post >> "$HOOK_TEST"' \ + --renew-hook 'echo deploy >> "$HOOK_TEST"' +AssertNoDeployHook common certonly --cert-name newname -d newname.le.wtf |