Skip to content

Commit

Permalink
Wait for instance ready in molecule test (#1901)
Browse files Browse the repository at this point in the history
Sometimes a job is launched through the web api
before the instance is in a ready state. This throws
a 500 internal server error, causing CI to fail.

Adds a task to query the instances endpoint
and check that at least one control node is
in a ready state.

Signed-off-by: Seth Foster <[email protected]>
  • Loading branch information
fosterseth committed Jun 19, 2024
1 parent 23a3266 commit e3c2720
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions molecule/default/tasks/awx_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@
name: example-awx-admin-password
register: admin_pw_secret

- name: Wait for instance to be ready
uri:
url: "http://localhost/awx/api/v2/instances/?node_type=control&node_state=ready"
user: admin
password: "{{ admin_pw_secret.resources[0].data.password | b64decode }}"
force_basic_auth: yes
register: instances
until: instances['json']['count'] | int > 0
retries: 20
delay: 2

- name: Validate demo job launch
block:
- name: Launch Demo Job Template
Expand Down

0 comments on commit e3c2720

Please sign in to comment.