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:
GomathiselviS
2023-11-10 10:33:40 -05:00
committed by GitHub
parent 9e9962bc6c
commit b066a2dda3
80 changed files with 496 additions and 680 deletions

View File

@@ -7,6 +7,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from datetime import datetime
from ansible_collections.kubernetes.core.plugins.action.k8s_info import RemoveOmit

View File

@@ -6,12 +6,11 @@ import json
import sys
from io import BytesIO
import pytest
import ansible.module_utils.basic
from ansible.module_utils.six import string_types
import pytest
from ansible.module_utils._text import to_bytes
from ansible.module_utils.common._collections_compat import MutableMapping
from ansible.module_utils.six import string_types
@pytest.fixture

View File

@@ -18,8 +18,8 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible_collections.kubernetes.core.plugins.module_utils.apply import (
merge,
apply_patch,
merge,
)
tests = [

View File

@@ -1,14 +1,14 @@
import os
import base64
import os
import tempfile
import yaml
import mock
from mock import MagicMock
import mock
import yaml
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import (
_create_auth_spec,
_create_configuration,
)
from mock import MagicMock
TEST_HOST = "test-host"
TEST_SSL_HOST = "https://test-host"

View File

@@ -6,7 +6,6 @@ import json
import kubernetes
import pytest
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import (
AnsibleK8SModule,
)

View File

@@ -14,19 +14,17 @@
import pytest
from kubernetes.client import ApiClient
from kubernetes.dynamic import Resource
from ansible_collections.kubernetes.core.plugins.module_utils.k8sdynamicclient import (
K8SDynamicClient,
)
from ansible_collections.kubernetes.core.plugins.module_utils.client.discovery import (
LazyDiscoverer,
)
from ansible_collections.kubernetes.core.plugins.module_utils.client.resource import (
ResourceList,
)
from ansible_collections.kubernetes.core.plugins.module_utils.k8sdynamicclient import (
K8SDynamicClient,
)
from kubernetes.client import ApiClient
from kubernetes.dynamic import Resource
@pytest.fixture(scope="module")

View File

@@ -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)

View File

@@ -1,12 +1,11 @@
import pytest
from copy import deepcopy
from unittest.mock import Mock
from kubernetes.dynamic.resource import ResourceInstance
import pytest
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.runner import (
perform_action,
)
from kubernetes.dynamic.resource import ResourceInstance
definition = {
"apiVersion": "v1",

View File

@@ -1,14 +1,12 @@
from unittest.mock import Mock
import pytest
from kubernetes.dynamic.resource import ResourceInstance, Resource
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import (
K8sService,
diff_objects,
)
from kubernetes.dynamic.exceptions import NotFoundError
from kubernetes.dynamic.resource import Resource, ResourceInstance
pod_definition = {
"apiVersion": "v1",

View File

@@ -5,20 +5,19 @@ from unittest.mock import Mock
import pytest
import yaml
from kubernetes.dynamic.resource import ResourceInstance
from kubernetes.dynamic.exceptions import NotFoundError
from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import (
DummyWaiter,
Waiter,
clock,
custom_condition,
deployment_ready,
DummyWaiter,
exists,
get_waiter,
pod_ready,
resource_absent,
Waiter,
)
from kubernetes.dynamic.exceptions import NotFoundError
from kubernetes.dynamic.resource import ResourceInstance
def resources(filepath):

View File

@@ -7,14 +7,13 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
import unittest
from unittest.mock import patch
from ansible.module_utils import basic
from ansible_collections.kubernetes.core.plugins.modules import helm_template
from ansible_collections.kubernetes.core.tests.unit.utils.ansible_module_mock import (
AnsibleFailJson,
AnsibleExitJson,
AnsibleFailJson,
exit_json,
fail_json,
get_bin_path,

View File

@@ -7,14 +7,13 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
import unittest
from unittest.mock import MagicMock, patch, call
from unittest.mock import MagicMock, call, patch
from ansible.module_utils import basic
from ansible_collections.kubernetes.core.plugins.modules import helm
from ansible_collections.kubernetes.core.tests.unit.utils.ansible_module_mock import (
AnsibleFailJson,
AnsibleExitJson,
AnsibleFailJson,
exit_json,
fail_json,
get_bin_path,