From 16fbe072e96c5fdf480872541f0e182f05886e85 Mon Sep 17 00:00:00 2001 From: Jeff-SearchPilot <138439698+Jeff-SearchPilot@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:33:41 +0000 Subject: [PATCH] Support tests with no performance data --- status_cake_exporter/_status_cake.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/status_cake_exporter/_status_cake.py b/status_cake_exporter/_status_cake.py index 593bf79..d943d08 100644 --- a/status_cake_exporter/_status_cake.py +++ b/status_cake_exporter/_status_cake.py @@ -182,7 +182,10 @@ def list_tests(self, tags: str = "") -> list[dict]: # Fetch the performance of each test and add it to the response for test in response: history = self.get_test_history(test["id"]) - test["performance"] = history["data"][0]["performance"] + if history["data"]: + test["performance"] = history["data"][0]["performance"] + else: + logger.warning(f"No performance data found for test ID {test['id']}") print(response) return response