From 156e6564adebabd6d639fc02a8546c3a000aa024 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Wed, 22 Nov 2023 09:25:32 +0000 Subject: [PATCH] test-monitoring - fetching metrics - wait for not null value This change prevents the CI suite to fail due to an unexpected "null" value when fetching data from prometheus. This change now waits ~60s until we get a proper value. Change-Id: I6cc2429842fab79e7bfc3ed8bbf848ca9accb020 --- roles/health-check/test-monitoring/tasks/main.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/health-check/test-monitoring/tasks/main.yaml b/roles/health-check/test-monitoring/tasks/main.yaml index a3c3086f..ffe7539e 100644 --- a/roles/health-check/test-monitoring/tasks/main.yaml +++ b/roles/health-check/test-monitoring/tasks/main.yaml @@ -34,11 +34,17 @@ - name: Fetch a basic Zuul metric exporter by statsd ansible.builtin.shell: curl -k https://{{ prometheus_host }}/api/v1/query?query=zuul_executors_online | jq '.data.result[0].value[1]' register: zeo + until: zeo.stdout != "" and "null" not in zeo.stdout + retries: 60 + delay: 1 # config-update-nodepool-builder should at least trigger one tick for readiness. - name: Fetch a basic Nodepool metric exported by statsd ansible.builtin.shell: curl -k https://{{ prometheus_host }}/api/v1/query?query=nodepool_launch_ready | jq '.data.result[0].value[1]' register: nlr + until: nlr.stdout != "" and "null" not in nlr.stdout + retries: 60 + delay: 1 # Use a dictionary to trick Ansible into casting metrics to int/float - set_fact: