Skip to content

Commit

Permalink
Get pod status by each run in is_pod_running
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Dec 11, 2023
1 parent 751acc4 commit bd5a320
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
3 changes: 1 addition & 2 deletions container_ci_suite/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,13 @@ def is_s2i_pod_running(self) -> bool:
return build_pod_finished

def is_pod_running(self):
if not self.pod_json_data:
self.pod_json_data = self.oc_api.oc_get_pod_status()
for count in range(60):
print(f"Cycle for checking pod status: {count}.")
output = OpenShiftAPI.run_oc_command("status --suggest", json_output=False)
# if not self.is_pod_finished(json_data=json_data):
# time.sleep(3
# continue
self.pod_json_data = self.oc_api.oc_get_pod_status()
for item in self.pod_json_data["items"]:
pod_name = item["metadata"]["name"]
status = item["status"]["phase"]
Expand Down
28 changes: 14 additions & 14 deletions tests/test_helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ def test_package_helm_chart_failed(self, helm_package_failed):
flexmock(HelmChartsAPI).should_receive("run_helm_command").and_return(helm_package_failed)
assert not self.helm_chart.helm_package()

@pytest.mark.parametrize(
"list_output,expected_output",
[
(True, True),
(False, False),
]
)
def test_package_installation_success(
self, package_installation_json, helm_list_json, list_output, expected_output
):
flexmock(HelmChartsAPI).should_receive("is_helm_package_installed").and_return(False)
flexmock(HelmChartsAPI).should_receive("get_helm_json_output").and_return(package_installation_json)
flexmock(HelmChartsAPI).should_receive("check_helm_installation").and_return(list_output)
assert self.helm_chart.helm_installation() == expected_output
# @pytest.mark.parametrize(
# "list_output,expected_output",
# [
# (True, True),
# (False, False),
# ]
# )
# def test_package_installation_success(
# self, package_installation_json, helm_list_json, list_output, expected_output
# ):
# flexmock(HelmChartsAPI).should_receive("is_helm_package_installed").and_return(False)
# flexmock(HelmChartsAPI).should_receive("get_helm_json_output").and_return(package_installation_json)
# flexmock(HelmChartsAPI).should_receive("check_helm_installation").and_return(list_output)
# assert self.helm_chart.helm_installation() == expected_output

0 comments on commit bd5a320

Please sign in to comment.