Skip to content

Commit

Permalink
fixing uts
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh97 committed Dec 30, 2023
1 parent bc50029 commit fb9791d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 36 deletions.
5 changes: 0 additions & 5 deletions ads/opctl/backend/marketplace/helm_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ class HelmPullStatus(Enum):
def run_helm_install(
name: str, chart: str, version: str, namespace: str, values_yaml_path: str, **kwargs
) -> subprocess.CompletedProcess:
cmd = (
HelmCommand.Install
if not _check_if_chart_already_exists_(name, namespace)
else HelmCommand.Upgrade
)
helm_cmd = [
_HELM_BINARY_,
HelmCommand.Upgrade,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,8 @@


@patch("ads.opctl.backend.marketplace.helm_helper.subprocess.run")
@patch("ads.opctl.backend.marketplace.helm_helper._check_if_chart_already_exists_")
def test_helm_install(mock_check_chart_exist: Mock, subprocess_mock: Mock):
mock_check_chart_exist.return_value = False
def test_helm_install(subprocess_mock: Mock):
run_helm_install(name, chart, version, namespace, values_yaml_path, **kwargs)
mock_check_chart_exist.assert_called_with(name, namespace)

helm_cmd = [
_HELM_BINARY_,
HelmCommand.Install,
name,
chart,
*_get_as_flags_(
namespace=namespace,
values=values_yaml_path,
version=version,
timeout="300s",
**kwargs,
),
"--wait",
]

subprocess_mock.assert_called_with(helm_cmd)


@patch("ads.opctl.backend.marketplace.helm_helper.subprocess.run")
@patch("ads.opctl.backend.marketplace.helm_helper._check_if_chart_already_exists_")
def test_helm_upgrade(mock_check_chart_exist: Mock, subprocess_mock: Mock):
mock_check_chart_exist.return_value = True
run_helm_install(name, chart, version, namespace, values_yaml_path, **kwargs)
mock_check_chart_exist.assert_called_with(name, namespace)
helm_cmd = [
_HELM_BINARY_,
HelmCommand.Upgrade,
Expand All @@ -68,7 +40,9 @@ def test_helm_upgrade(mock_check_chart_exist: Mock, subprocess_mock: Mock):
**kwargs,
),
"--wait",
"-i",
]

subprocess_mock.assert_called_with(helm_cmd)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_export_helm_chart_to_container_registry(list_api: Mock, export_api: Moc
pattern = "feature-store-dataplane-api"

mock_container_summary = Mock()
mock_container_summary.display_name = f"{pattern}-1"
mock_container_summary.display_name = f"{pattern}:1"

list_api.return_value.items.__iter__ = Mock(
return_value=iter([mock_container_summary])
Expand All @@ -65,4 +65,4 @@ def test_export_helm_chart_to_container_registry(list_api: Mock, export_api: Moc
listing_details.container_tag_pattern = [pattern]
result = _get_tags_map_(listing_details)
assert pattern in result
assert result[pattern] == f"{pattern}-1"
assert result[pattern] == f"1"

0 comments on commit fb9791d

Please sign in to comment.