mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-07 13:32:37 +00:00
Cleanup GitHub workflows (#655)
* Cleanup gha * test by removing matrix excludes * Rename sanity tests * trigger integration tests * Fix ansible-lint workflow * Fix concurrency * Add ansible-lint config * Add ansible-lint config * Fix integration and lint issues * integration wf * fix yamllint issues * fix yamllint issues * update readme and add ignore-2.16.txt * fix ansible-doc * Add version * Use /dev/random to generate random data The GHA environment has difficultly generating entropy. Trying to read from /dev/urandom just blocks forever. We don't care if the random data is cryptographically secure; it's just garbage data for the test. Read from /dev/random, instead. This is only used during the k8s_copy test target. This also removes the custom test module that was being used to generate the files. It's not worth maintaining this for two task that can be replaced with some simple command/shell tasks. * Fix saniry errors * test github_action fix * Address review comments * Remove default types * review comments * isort fixes * remove tags * Add setuptools to venv * Test gh changes * update changelog * update ignore-2.16 * Fix indentation in inventory plugin example * Update .github/workflows/integration-tests.yaml * Update integration-tests.yaml --------- Co-authored-by: Mike Graves <mgraves@redhat.com> Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
This commit is contained in:
@@ -7,18 +7,17 @@ from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
import os.path
|
||||
import yaml
|
||||
import random
|
||||
import string
|
||||
import tempfile
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
import yaml
|
||||
from ansible_collections.kubernetes.core.plugins.module_utils.helm import (
|
||||
AnsibleHelmModule,
|
||||
write_temp_kubeconfig,
|
||||
)
|
||||
from unittest.mock import MagicMock
|
||||
import random
|
||||
import string
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@@ -114,7 +113,6 @@ def test_write_temp_kubeconfig_with_kubeconfig():
|
||||
|
||||
|
||||
def test_module_get_helm_binary_from_params():
|
||||
|
||||
helm_binary_path = MagicMock()
|
||||
helm_sys_binary_path = MagicMock()
|
||||
|
||||
@@ -129,7 +127,6 @@ def test_module_get_helm_binary_from_params():
|
||||
|
||||
|
||||
def test_module_get_helm_binary_from_system():
|
||||
|
||||
helm_sys_binary_path = MagicMock()
|
||||
module = MagicMock()
|
||||
module.params = {}
|
||||
@@ -140,7 +137,6 @@ def test_module_get_helm_binary_from_system():
|
||||
|
||||
|
||||
def test_module_get_helm_plugin_list(_ansible_helm_module):
|
||||
|
||||
_ansible_helm_module.run_helm_command = MagicMock()
|
||||
_ansible_helm_module.run_helm_command.return_value = (0, "output", "error")
|
||||
|
||||
@@ -156,7 +152,6 @@ def test_module_get_helm_plugin_list(_ansible_helm_module):
|
||||
|
||||
|
||||
def test_module_get_helm_plugin_list_failure(_ansible_helm_module):
|
||||
|
||||
_ansible_helm_module.run_helm_command = MagicMock()
|
||||
_ansible_helm_module.run_helm_command.return_value = (-1, "output", "error")
|
||||
|
||||
@@ -175,7 +170,6 @@ def test_module_get_helm_plugin_list_failure(_ansible_helm_module):
|
||||
@pytest.mark.parametrize("no_values", [True, False])
|
||||
@pytest.mark.parametrize("get_all", [True, False])
|
||||
def test_module_get_values(_ansible_helm_module, no_values, get_all):
|
||||
|
||||
expected = {"test": "units"}
|
||||
output = "---\ntest: units\n"
|
||||
|
||||
@@ -211,7 +205,6 @@ def test_module_get_values(_ansible_helm_module, no_values, get_all):
|
||||
],
|
||||
)
|
||||
def test_module_get_helm_version(_ansible_helm_module, output, expected):
|
||||
|
||||
_ansible_helm_module.run_command = MagicMock()
|
||||
_ansible_helm_module.run_command.return_value = (0, output, "error")
|
||||
|
||||
@@ -224,7 +217,6 @@ def test_module_get_helm_version(_ansible_helm_module, output, expected):
|
||||
|
||||
|
||||
def test_module_run_helm_command(_ansible_helm_module):
|
||||
|
||||
error = "".join(
|
||||
random.choice(string.ascii_letters + string.digits) for x in range(10)
|
||||
)
|
||||
@@ -252,7 +244,6 @@ def test_module_run_helm_command(_ansible_helm_module):
|
||||
|
||||
@pytest.mark.parametrize("fails_on_error", [True, False])
|
||||
def test_module_run_helm_command_failure(_ansible_helm_module, fails_on_error):
|
||||
|
||||
error = "".join(
|
||||
random.choice(string.ascii_letters + string.digits) for x in range(10)
|
||||
)
|
||||
@@ -311,7 +302,6 @@ def test_module_run_helm_command_failure(_ansible_helm_module, fails_on_error):
|
||||
],
|
||||
)
|
||||
def test_module_prepare_helm_environment(params, env_update, kubeconfig):
|
||||
|
||||
module = MagicMock()
|
||||
module.params = params
|
||||
|
||||
@@ -355,7 +345,6 @@ def test_module_prepare_helm_environment(params, env_update, kubeconfig):
|
||||
def test_module_prepare_helm_environment_with_validate_certs(
|
||||
helm_version, is_env_var_set
|
||||
):
|
||||
|
||||
module = MagicMock()
|
||||
module.params = {"validate_certs": False}
|
||||
|
||||
@@ -387,7 +376,6 @@ def test_module_prepare_helm_environment_with_validate_certs(
|
||||
],
|
||||
)
|
||||
def test_module_prepare_helm_environment_with_ca_cert(helm_version, is_env_var_set):
|
||||
|
||||
ca_cert = "".join(
|
||||
random.choice(string.ascii_letters + string.digits) for i in range(50)
|
||||
)
|
||||
@@ -441,7 +429,6 @@ def test_module_prepare_helm_environment_with_ca_cert(helm_version, is_env_var_s
|
||||
],
|
||||
)
|
||||
def test_module_get_helm_set_values_args(set_values, expected):
|
||||
|
||||
module = MagicMock()
|
||||
module.params = {}
|
||||
module.fail_json.side_effect = SystemExit(1)
|
||||
|
||||
Reference in New Issue
Block a user