updating tuple type for health checks
Some checks failed
Functional & Unit Tests / Functional & Unit Tests (push) Failing after 8m58s
Functional & Unit Tests / Generate Coverage Badge (push) Has been skipped

Signed-off-by: Paige Patton <prubenda@redhat.com>
This commit is contained in:
Paige Patton
2025-04-15 15:18:47 -04:00
committed by Naga Ravi Chaitanya Elluri
parent 126f4ebb35
commit 7f0110972b

View File

@@ -11,9 +11,9 @@ class HealthChecker:
def __init__(self, iterations):
self.iterations = iterations
def make_request(self, url, auth=None, headers=None):
def make_request(self, url, auth=None, headers=None, verify=True):
response_data = {}
response = requests.get(url, auth=auth, headers=headers)
response = requests.get(url, auth=auth, headers=headers, verify=verify)
response_data["url"] = url
response_data["status"] = response.status_code == 200
response_data["status_code"] = response.status_code
@@ -26,18 +26,20 @@ class HealthChecker:
health_check_telemetry = []
health_check_tracker = {}
interval = health_check_config["interval"] if health_check_config["interval"] else 2
response_tracker = {config["url"]:True for config in health_check_config["config"]}
while self.current_iterations < self.iterations:
for config in health_check_config.get("config"):
auth, headers = None, None
verify_url = config["verify_url"] if "verify_url" in config else True
if config["url"]: url = config["url"]
if config["bearer_token"]:
bearer_token = "Bearer " + config["bearer_token"]
headers = {"Authorization": bearer_token}
if config["auth"]: auth = config["auth"]
response = self.make_request(url, auth, headers)
if config["auth"]: auth = tuple(config["auth"].split(','))
response = self.make_request(url, auth, headers, verify_url)
if response["status_code"] != 200:
if config["url"] not in health_check_tracker: