Allow retry in query tests

This commit is contained in:
2025-06-18 03:23:43 -04:00
parent b7f731c6ac
commit ecb616f6d9
2 changed files with 5 additions and 15 deletions

View File

@@ -656,9 +656,12 @@ def test_queries():
# If the metric has arguments to use while testing, grab those
args = metric.get("test_args", {})
print("Testing {} [{}]".format(name, ", ".join(["{}={}".format(key, value) for key, value in args.items()])))
# Run the query without the ability to retry.
# Run the query with the ability to retry, mostly because the PostgreSQL
# docker image restarts during its initialization phase. If the health
# check passes during the first phase, the agent will start testing too
# early and will break when PostgreSQL restarts.
try:
res = sample_metric(dbname, name, args, retry=False)
res = sample_metric(dbname, name, args, retry=True)
except MetricVersionError:
print("{} -> Unsupported for this version".format(name))
continue