Skip to content

Commit

Permalink
Fix count of tests (#71)
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
  • Loading branch information
phracek authored Jun 28, 2024
1 parent 0eb86f7 commit ca8c17d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions container_ci_suite/openshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def check_response_inside_cluster(
port: int = 8080,
protocol: str = "http",
response_code: int = 200,
max_tests: int = 3
max_tests: int = 20
) -> bool:
ip_address = self.get_service_ip(service_name=name_in_template)
url = f"{protocol}://{ip_address}:{port}/"
Expand All @@ -647,17 +647,19 @@ def check_response_inside_cluster(
print("Check if HTTP_CODE is valid.")
for count in range(max_tests):
output_code = self.command_app_run(cmd=f"{cmd_to_run}", return_output=True)
return_code = output_code.split('\n')[-1]
print(f"HTTP_CODE from command {cmd_to_run} is '{return_code}'.")
int_ret_code = 0
return_code = output_code[-3:]
try:
int_ret_code = int(return_code)
if int_ret_code == response_code:
print(f"HTTP_CODE is VALID {int_ret_code}")
break
except ValueError:
print(return_code)
time.sleep(3)
continue
if int_ret_code != response_code:
time.sleep(5)
continue
time.sleep(5)
continue

cmd_to_run = "curl --connect-timeout 10 -k -s " + f"{url}"
# Check if application returns proper output
for count in range(max_tests):
Expand Down

0 comments on commit ca8c17d

Please sign in to comment.