Skip to content

Commit

Permalink
Use less timeouts
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
  • Loading branch information
phracek committed Sep 30, 2024
1 parent 6450664 commit f683525
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions container_ci_suite/openshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,9 @@ def check_response_inside_cluster(
break
except ValueError:
print(return_code)
time.sleep(3)
time.sleep(1)
continue
time.sleep(5)
time.sleep(3)
continue

cmd_to_run = "curl --connect-timeout 10 -k -s " + f"{url}"
Expand All @@ -560,7 +560,7 @@ def check_response_inside_cluster(
f"check_response_inside_cluster:"
f"expected_output {expected_output} not found in output of {cmd_to_run} command. See {output_code}"
)
time.sleep(10)
time.sleep(5)
return False

def check_response_outside_cluster(
Expand All @@ -574,13 +574,13 @@ def check_response_outside_cluster(
route_name = self.get_route_url(routes_name=name_in_template)
print(f"Route name is {route_name}")
url = f"{protocol}://{route_name}"
for count in range(3):
for count in range(10):
print(f"Let's try to get response from route {url} one more time {count}")
response_status = utils.get_response_request(
url_address=url, response_code=response_code, expected_str=expected_output
)
if not response_status:
time.sleep(10)
time.sleep(5)
continue
break

Expand Down
30 changes: 15 additions & 15 deletions container_ci_suite/openshift_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def is_pod_running(self, pod_name_prefix: str = "", loops: int = 180) -> bool:
self.pod_name_prefix = pod_name_prefix
# Only one running pod is allowed
if self.get_pod_count() != 1:
time.sleep(3)
time.sleep(1)
continue

for item in self.pod_json_data["items"]:
Expand All @@ -118,9 +118,9 @@ def is_pod_running(self, pod_name_prefix: str = "", loops: int = 180) -> bool:
output = self.get_logs(pod_name=pod_name)
print(output)
# Wait couple seconds for sure
time.sleep(3)
time.sleep(1)
return True
time.sleep(3)
time.sleep(1)
return False

def is_build_pod_present(self) -> bool:
Expand Down Expand Up @@ -164,17 +164,17 @@ def is_build_pod_finished(self, cycle_count: int = 180) -> bool:
print(".", sep="", end="")
self.pod_json_data = self.get_pod_status()
if len(self.pod_json_data["items"]) == 0:
time.sleep(3)
time.sleep(1)
continue
if not self.is_build_pod_present():
print(".", sep="", end="")
time.sleep(3)
time.sleep(1)
continue
if not self.is_pod_finished(pod_suffix_name="build"):
print(".", sep="", end="")
if self.build_failed:
return False
time.sleep(3)
time.sleep(1)
continue
print("\nBuild pod is finished")
return True
Expand All @@ -188,13 +188,13 @@ def is_s2i_pod_running(self, pod_name_prefix: str = "", cycle_count: int = 180)
print(".", sep="", end="")
self.pod_json_data = self.get_pod_status()
if len(self.pod_json_data["items"]) == 0:
time.sleep(3)
time.sleep(1)
continue
if not self.is_build_pod_present():
time.sleep(3)
time.sleep(1)
continue
if not self.is_pod_finished(pod_suffix_name="build"):
time.sleep(3)
time.sleep(1)
continue
build_pod_finished = True
print(f"\nBuild pod with name {pod_name_prefix} is finished.")
Expand All @@ -206,7 +206,7 @@ def is_s2i_pod_running(self, pod_name_prefix: str = "", cycle_count: int = 180)
for count in range(cycle_count):
print(".", sep="", end="")
if not self.is_pod_running():
time.sleep(3)
time.sleep(1)
continue
print("\nPod is running")
return True
Expand Down Expand Up @@ -269,7 +269,7 @@ def check_is_exists(self, is_name, version_to_check: str) -> bool:
tag_found = True
return tag_found

def is_pod_ready(self, cycle_count: int = 60) -> bool:
def is_pod_ready(self, cycle_count: int = 180) -> bool:
"""
Function checks if pod with specific name is really ready
"""
Expand All @@ -278,10 +278,10 @@ def is_pod_ready(self, cycle_count: int = 60) -> bool:
print(".", end="")
json_data = self.get_pod_status()
if len(json_data["items"]) == 0:
time.sleep(3)
time.sleep(1)
continue
if not self.is_pod_finished(pod_suffix_name=self.pod_name_prefix):
time.sleep(3)
time.sleep(1)
continue
for item in json_data["items"]:
pod_name = item["metadata"]["name"]
Expand All @@ -295,7 +295,7 @@ def is_pod_ready(self, cycle_count: int = 60) -> bool:
)
print(output)
# Wait couple seconds for sure
time.sleep(10)
time.sleep(5)
return True
time.sleep(3)
time.sleep(1)
return False

0 comments on commit f683525

Please sign in to comment.