mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-06-09 18:16:09 +00:00
Fix unit test failures in CI (#1133)
This commit is contained in:
@@ -57,6 +57,11 @@ def _create_temp_file(content=""):
|
|||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
|
def _assert_configuration(actual, expected):
|
||||||
|
for key, value in expected.items():
|
||||||
|
assert getattr(actual, key) == value
|
||||||
|
|
||||||
|
|
||||||
def test_create_auth_spec_ssl_no_options():
|
def test_create_auth_spec_ssl_no_options():
|
||||||
module = MagicMock()
|
module = MagicMock()
|
||||||
module.params = {}
|
module.params = {}
|
||||||
@@ -138,13 +143,14 @@ def test_load_kube_config_from_file_path():
|
|||||||
auth = {"kubeconfig": config_file, "context": "simple_token"}
|
auth = {"kubeconfig": config_file, "context": "simple_token"}
|
||||||
actual_configuration = _create_configuration(auth)
|
actual_configuration = _create_configuration(auth)
|
||||||
|
|
||||||
expected_configuration = {
|
_assert_configuration(
|
||||||
"host": TEST_HOST,
|
actual_configuration,
|
||||||
"kubeconfig": config_file,
|
{
|
||||||
"context": "simple_token",
|
"host": TEST_HOST,
|
||||||
}
|
"kubeconfig": config_file,
|
||||||
|
"context": "simple_token",
|
||||||
assert expected_configuration.items() <= actual_configuration.__dict__.items()
|
},
|
||||||
|
)
|
||||||
_remove_temp_file()
|
_remove_temp_file()
|
||||||
|
|
||||||
|
|
||||||
@@ -152,13 +158,14 @@ def test_load_kube_config_from_dict():
|
|||||||
auth_spec = {"kubeconfig": TEST_KUBE_CONFIG, "context": "simple_token"}
|
auth_spec = {"kubeconfig": TEST_KUBE_CONFIG, "context": "simple_token"}
|
||||||
actual_configuration = _create_configuration(auth_spec)
|
actual_configuration = _create_configuration(auth_spec)
|
||||||
|
|
||||||
expected_configuration = {
|
_assert_configuration(
|
||||||
"host": TEST_HOST,
|
actual_configuration,
|
||||||
"kubeconfig": TEST_KUBE_CONFIG,
|
{
|
||||||
"context": "simple_token",
|
"host": TEST_HOST,
|
||||||
}
|
"kubeconfig": TEST_KUBE_CONFIG,
|
||||||
|
"context": "simple_token",
|
||||||
assert expected_configuration.items() <= actual_configuration.__dict__.items()
|
},
|
||||||
|
)
|
||||||
_remove_temp_file()
|
_remove_temp_file()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user