From e3c27206815f68b2c5ba75b019bc2bc1a940b311 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Tue, 18 Jun 2024 23:11:04 -0400 Subject: [PATCH] Wait for instance ready in molecule test (#1901) 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 --- molecule/default/tasks/awx_test.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/molecule/default/tasks/awx_test.yml b/molecule/default/tasks/awx_test.yml index a08751620..3075e5b99 100644 --- a/molecule/default/tasks/awx_test.yml +++ b/molecule/default/tasks/awx_test.yml @@ -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