Skip to content

Commit

Permalink
Fix curl test suite
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Jan 11, 2024
1 parent b7ef4bf commit cd5b8fd
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions container_ci_suite/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,19 +351,34 @@ def check_imagestreams(self, version: str, registry: str) -> bool:
def test_helm_curl_output(
self, route_name: str, expected_str: str, port: int = None, schema: str = "http://"
) -> bool:
# Let's get some time to start application
time.sleep(10)
host_name = self.get_route_name(route_name=route_name)
print(f"test_helm_curl_output: : Route name is: {host_name}")
if not host_name:
return False
url_address = f"{schema}{host_name}"
if port:
url_address = f"{url_address}:{port}"
resp = requests.get(url_address, verify=False)
resp.raise_for_status()
if resp.status_code != 200:
print(f"test_helm_curl_output: {resp.text}, {resp.status_code}")
return False
print(f"test_helm_curl_output: {resp.text}")
if expected_str not in resp.text:
print(f"test_helm_curl_output: to {url_address}")
valid_request: bool = False
for count in range(3):
try:
resp = requests.get(url_address, verify=False)
resp.raise_for_status()
valid_request = True
if resp.status_code != 200:
print(f"test_helm_curl_output: {resp.text}, {resp.status_code}")
return False
print(f"test_helm_curl_output: {resp.text}")
if expected_str not in resp.text:
return False
return True
except requests.exceptions.HTTPError:
print("test_helm_curl_output: Service is not yet available. Let's wait some time")
time.sleep(3)
pass
if not valid_request:
print("test_helm_curl_output: Service was not available")
return False
return True
return False

0 comments on commit cd5b8fd

Please sign in to comment.