mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-07 05:22:39 +00:00
Ensure compatibility with Helm v4 for the collection (#1090)
SUMMARY Ensure compatibility with Helm v4 for modules helm_plugin and helm_plugin_info Partially addresses #1038 ISSUE TYPE Feature Pull Request COMPONENT NAME helm_plugin helm_plugin_info helm_info helm_pull helm_registry_auth helm helm_template Reviewed-by: Bianca Henderson <beeankha@gmail.com> Reviewed-by: Yuriy Novostavskiy <yuriy@novostavskiy.kyiv.ua> Reviewed-by: Alina Buzachis
This commit is contained in:
@@ -455,9 +455,9 @@ def test_module_get_helm_set_values_args(set_values, expected):
|
||||
("3.17.0", False),
|
||||
("2.9.0", True),
|
||||
("2.17.0", True),
|
||||
("4.0.0", True),
|
||||
("4.1.0", True),
|
||||
("5.0.0", True),
|
||||
("4.0.0", False),
|
||||
("4.1.0", False),
|
||||
("5.0.0", False),
|
||||
],
|
||||
)
|
||||
def test_module_validate_helm_version(_ansible_helm_module, helm_version, should_fail):
|
||||
@@ -469,8 +469,10 @@ def test_module_validate_helm_version(_ansible_helm_module, helm_version, should
|
||||
_ansible_helm_module.validate_helm_version()
|
||||
_ansible_helm_module.fail_json.assert_called_once()
|
||||
call_args = _ansible_helm_module.fail_json.call_args
|
||||
assert "Helm version must be >=3.0.0,<4.0.0" in call_args[1]["msg"]
|
||||
assert helm_version in call_args[1]["msg"]
|
||||
assert (
|
||||
f"Helm version must be >= 3.0.0, current version is {helm_version}"
|
||||
== call_args[1]["msg"]
|
||||
)
|
||||
else:
|
||||
_ansible_helm_module.validate_helm_version()
|
||||
_ansible_helm_module.fail_json.assert_not_called()
|
||||
55
tests/unit/module_utils/helm/test_helm_plugin_list.py
Normal file
55
tests/unit/module_utils/helm/test_helm_plugin_list.py
Normal file
@@ -0,0 +1,55 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright: (c) 2026, Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
|
||||
parse_helm_plugin_list,
|
||||
)
|
||||
|
||||
|
||||
def test_parse_helm_plugin_list_empty():
|
||||
assert parse_helm_plugin_list() == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"output,expected",
|
||||
[
|
||||
(
|
||||
"""
|
||||
NAME VERSION TYPE APIVERSION PROVENANCE SOURCE
|
||||
diff 3.4.1 cli/v1 legacy unknown unknown
|
||||
|
||||
""",
|
||||
[
|
||||
dict(
|
||||
name="diff",
|
||||
version="3.4.1",
|
||||
type="cli/v1",
|
||||
apiversion="legacy",
|
||||
provenance="unknown",
|
||||
source="unknown",
|
||||
)
|
||||
],
|
||||
),
|
||||
(
|
||||
"""
|
||||
NAME VERSION DESCRIPTION
|
||||
diff 3.4.1 Preview helm upgrade changes as a diff
|
||||
""",
|
||||
[
|
||||
dict(
|
||||
name="diff",
|
||||
version="3.4.1",
|
||||
description="Preview helm upgrade changes as a diff",
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_parse_helm_plugin_list_values(output, expected):
|
||||
assert parse_helm_plugin_list(output.split("\n")) == expected
|
||||
Reference in New Issue
Block a user