Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/xpk/core/kueue_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def install_or_upgrade(
Args:
tolerations: An optional list of tolerations to apply to the kueue-controller-manager.
"""
return_code, installed_version = self.__get_installed_kueue_version()
return_code, installed_version = self.get_installed_kueue_version()

if return_code == 0:
if installed_version and installed_version > self.kueue_version:
Expand All @@ -121,7 +121,7 @@ def install_or_upgrade(

return self.__configure(kueue_config)

def __get_installed_kueue_version(self) -> tuple[int, str | None]:
def get_installed_kueue_version(self) -> tuple[int, str | None]:
command = (
"kubectl get deployment kueue-controller-manager -n kueue-system -o"
" jsonpath='{.spec.template.spec.containers[0].image}'"
Expand Down
26 changes: 9 additions & 17 deletions src/xpk/core/kueue_manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ def test_version_check_when_kueue_not_installed(self, mock_run_for_value):
mock_install.assert_called_once()
mock_configure.assert_called_once()

@patch(
"xpk.core.kueue_manager.KueueManager._KueueManager__get_installed_kueue_version"
)
@patch("xpk.core.kueue_manager.KueueManager.get_installed_kueue_version")
@patch("xpk.core.kueue_manager.KueueManager._KueueManager__install")
@patch("xpk.core.kueue_manager.KueueManager._KueueManager__configure")
def test_install_or_upgrade_when_newer_version_already_installed(
Expand All @@ -95,9 +93,7 @@ def test_install_or_upgrade_when_newer_version_already_installed(
mock_install.assert_not_called()
mock_configure.assert_not_called()

@patch(
"xpk.core.kueue_manager.KueueManager._KueueManager__get_installed_kueue_version"
)
@patch("xpk.core.kueue_manager.KueueManager.get_installed_kueue_version")
def test_install_or_upgrade_when_outdated(
self,
mock_get_version,
Expand All @@ -121,9 +117,7 @@ def test_install_or_upgrade_when_outdated(
mock_install.assert_called_once()
mock_configure.assert_called_once()

@patch(
"xpk.core.kueue_manager.KueueManager._KueueManager__get_installed_kueue_version"
)
@patch("xpk.core.kueue_manager.KueueManager.get_installed_kueue_version")
def test_install_or_upgrade_when_not_installed(
self,
mock_get_version,
Expand Down Expand Up @@ -155,7 +149,7 @@ def test_installation_with_tolerations(self):
return_value=0,
) as mock_run_retry,
patch(
"xpk.core.kueue_manager.KueueManager._KueueManager__get_installed_kueue_version",
"xpk.core.kueue_manager.KueueManager.get_installed_kueue_version",
return_value=(1, None),
),
patch(
Expand Down Expand Up @@ -199,7 +193,7 @@ def test_installation_without_tolerations(self):
return_value=0,
) as mock_run_retry,
patch(
"xpk.core.kueue_manager.KueueManager._KueueManager__get_installed_kueue_version",
"xpk.core.kueue_manager.KueueManager.get_installed_kueue_version",
return_value=(1, None),
),
patch(
Expand All @@ -224,9 +218,7 @@ def test_installation_without_tolerations(self):
self.assertEqual(result, 0)
self.assertEqual(mock_run_retry.call_count, 0)

@patch(
"xpk.core.kueue_manager.KueueManager._KueueManager__get_installed_kueue_version"
)
@patch("xpk.core.kueue_manager.KueueManager.get_installed_kueue_version")
@patch("xpk.core.kueue_manager.KueueManager._KueueManager__apply_manifest")
def test_configuration_updates_resources(
self, mock_apply_manifest, mock_get_version
Expand Down Expand Up @@ -276,7 +268,7 @@ def test_resource_update_for_small_cluster(self, mock_run_retry):
),
patch.object(
self.kueue_manager,
"_KueueManager__get_installed_kueue_version",
"get_installed_kueue_version",
return_value=(1, None),
),
patch.object(
Expand Down Expand Up @@ -319,7 +311,7 @@ def test_resource_update_for_large_cluster(self, mock_run_retry):
),
patch.object(
self.kueue_manager,
"_KueueManager__get_installed_kueue_version",
"get_installed_kueue_version",
return_value=(1, None),
),
patch.object(
Expand Down Expand Up @@ -553,7 +545,7 @@ def _trigger_installation(self, kueue_config: KueueConfig) -> str:
"""Calls Kueue installation and returns the rendered manifest."""
with (
patch.object(
self.kueue_manager, "_KueueManager__get_installed_kueue_version"
self.kueue_manager, "get_installed_kueue_version"
) as mock_get_version,
patch.object(
self.kueue_manager, "_KueueManager__apply_manifest"
Expand Down
Loading