Skip to content

Commit

Permalink
add debug message to flaky molecule test (#426)
Browse files Browse the repository at this point in the history
Sometimes, the nginx service gets stuck in a non-started state
and i have no idea why.
Since the failure is only sporadic, add a debug function to gather more info
  • Loading branch information
maxhoesel authored Jun 27, 2024
1 parent 9beb387 commit c3b8d3f
Showing 1 changed file with 42 additions and 32 deletions.
74 changes: 42 additions & 32 deletions roles/step_acme_cert/molecule/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,49 @@
- name: Get service facts
service_facts:

- name: Verify that nginx and renew services are running
assert:
that:
- ansible_facts.services["nginx.service"]["state"] == "running"
- ansible_facts.services["step-renew-standalone.service"]["state"] == "running"
- ansible_facts.services["step-renew-webroot.service"]["state"] == "running"
register: _res
retries: 10
delay: 5
until: _res is not failed
- block:
- name: Verify that nginx and renew services are running
assert:
that:
- ansible_facts.services["nginx.service"]["state"] == "running"
- ansible_facts.services["step-renew-standalone.service"]["state"] == "running"
- ansible_facts.services["step-renew-webroot.service"]["state"] == "running"
register: _res
retries: 10
delay: 5
until: _res is not failed

- name: Wait for renewal to occur
ansible.builtin.pause:
minutes: 1
- name: Wait for renewal to occur
ansible.builtin.pause:
minutes: 1

- name: Get service facts
service_facts:
- name: Get service facts
service_facts:

- name: Verify that nginx and renew services are running
assert:
that:
- ansible_facts.services["nginx.service"]["state"] == "running"
- ansible_facts.services["step-renew-standalone.service"]["state"] == "running"
- ansible_facts.services["step-renew-webroot.service"]["state"] == "running"
register: _res
retries: 10
delay: 5
until: _res is not failed

- name: Verify that nginx and renew services are running
assert:
that:
- ansible_facts.services["nginx.service"]["state"] == "running"
- ansible_facts.services["step-renew-standalone.service"]["state"] == "running"
- ansible_facts.services["step-renew-webroot.service"]["state"] == "running"
register: _res
retries: 10
delay: 5
until: _res is not failed
- name: Try to access the locally hosted site over HTTPS
uri:
url: "https://{{ ansible_fqdn }}"
register: _res
retries: 5
delay: 5
until: _res is not failed
rescue:
- name: Show nginx status
ansible.builtin.command: journalctl -eu nginx.service
changed_when: false
check_mode: false

- name: Try to access the locally hosted site over HTTPS
uri:
url: "https://{{ ansible_fqdn }}"
register: _res
retries: 5
delay: 5
until: _res is not failed
- name: Fail Test
ansible.builtin.fail:
msg: Nginx service is in error state

0 comments on commit c3b8d3f

Please sign in to comment.