From 5ecf9407aad48c48de12dcd4b1ea95247649dfdb Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Tue, 9 Nov 2021 14:14:07 +0100 Subject: [PATCH 1/3] updating OCL submodule to latest upstream master Signed-off-by: Adam Rutkowski --- tests/open-cas-linux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/open-cas-linux b/tests/open-cas-linux index 6dda643..259f9e3 160000 --- a/tests/open-cas-linux +++ b/tests/open-cas-linux @@ -1 +1 @@ -Subproject commit 6dda64332102b5cf2a62f076ef3ad5bfb9fbaf63 +Subproject commit 259f9e3c5872cb689179e7f9fff33b793ac190f2 From 66c17d27ade77f89436e010dbe5bb9dcd6767895 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Wed, 10 Nov 2021 13:13:07 +0100 Subject: [PATCH 2/3] tests: casadm mock to throw FileNotFoundError if casadm missing Signed-off-by: Adam Rutkowski --- tests/test_ansible_module_01.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_ansible_module_01.py b/tests/test_ansible_module_01.py index 80c4a42..ca9a1a1 100644 --- a/tests/test_ansible_module_01.py +++ b/tests/test_ansible_module_01.py @@ -6,6 +6,8 @@ import pytest from unittest.mock import patch, Mock import helpers as h +from os import strerror +from errno import ENOENT import cas import opencas @@ -50,7 +52,9 @@ def setup_module_with_params(**params): @patch("opencas.get_cas_version") @patch("cas.setup_module_object") def test_module_get_facts_not_installed(mock_setup_module, mock_get_version): - mock_get_version.side_effect = opencas.casadm.CasadmError("casadm error") + mock_get_version.side_effect = FileNotFoundError( + ENOENT, strerror(ENOENT), "/sbin/casadm" + ) mock_setup_module.return_value = setup_module_with_params(gather_facts=True) with pytest.raises(AnsibleExitJson) as e: From d5fce266b1274537a790969ea215cb2e5e22f7e5 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Wed, 10 Nov 2021 13:27:57 +0100 Subject: [PATCH 3/3] tests: remove style errors with black Signed-off-by: Adam Rutkowski --- tests/test_ansible_module_01.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_ansible_module_01.py b/tests/test_ansible_module_01.py index ca9a1a1..fe0306c 100644 --- a/tests/test_ansible_module_01.py +++ b/tests/test_ansible_module_01.py @@ -153,7 +153,9 @@ def test_module_stop_no_devices(mock_setup_module, mock_stop, mock_get_list): @patch("opencas.get_caches_list") @patch("opencas.stop") @patch("cas.setup_module_object") -def test_module_stop_list_exception(mock_setup_module, mock_stop, mock_get_list): +def test_module_stop_list_exception( + mock_setup_module, mock_stop, mock_get_list +): mock_setup_module.return_value = setup_module_with_params( stop={"flush": True} ) @@ -352,7 +354,9 @@ def test_modlue_configure_cache_no_config(mock_setup_module, mock_from_file): @patch("opencas.cas_config.from_file") @patch("cas.setup_module_object") -def test_modlue_configure_cache_insert_failed(mock_setup_module, mock_from_file): +def test_modlue_configure_cache_insert_failed( + mock_setup_module, mock_from_file +): mock_setup_module.return_value = setup_module_with_params( configure_cache_device={ "id": "1", @@ -546,7 +550,9 @@ def test_modlue_configure_cache_not_configured_not_started_start_failed( ], ) @patch("cas.setup_module_object") -def test_module_check_core_device_missing_params(mock_setup_module, core_params): +def test_module_check_core_device_missing_params( + mock_setup_module, core_params +): mock_setup_module.return_value = setup_module_with_params( check_core_config=core_params )