Skip to content

Commit

Permalink
Fix count of tests
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 Jun 28, 2024
1 parent 0eb86f7 commit cd1655a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 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}'.")
return_code = output_code[-3]
int_ret_code = 0
try:
int_ret_code = int(return_code)
except ValueError:
time.sleep(3)
continue
if int_ret_code != response_code:
time.sleep(5)
continue
if int_ret_code == response_code:
print(f"HTTP_CODE is VALID {int_ret_code}")
break
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 cd1655a

Please sign in to comment.