summaryrefslogtreecommitdiffstats
path: root/test/units/module_utils/facts/test_collectors.py
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2021-06-04 21:28:41 +0200
committerGitHub <noreply@github.com>2021-06-04 21:28:41 +0200
commit5dd8dc8fd089e609d2a14c7ddaf1b11c4f396a0f (patch)
tree21fe24a38659a0bfc8bf671a973379fd28ea6328 /test/units/module_utils/facts/test_collectors.py
parentbring back async_status module for direct callers (diff)
downloadansible-5dd8dc8fd089e609d2a14c7ddaf1b11c4f396a0f.tar.xz
ansible-5dd8dc8fd089e609d2a14c7ddaf1b11c4f396a0f.zip
minor service_mgr facts fixes (#74894)
* minor service_mgr facts fixes handle case in which ps command fails or returns empty updated tests since it now does keep trying to detect after ps fails
Diffstat (limited to 'test/units/module_utils/facts/test_collectors.py')
-rw-r--r--test/units/module_utils/facts/test_collectors.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/units/module_utils/facts/test_collectors.py b/test/units/module_utils/facts/test_collectors.py
index ae25636bad..5492582bf5 100644
--- a/test/units/module_utils/facts/test_collectors.py
+++ b/test/units/module_utils/facts/test_collectors.py
@@ -366,7 +366,10 @@ class TestServiceMgrFacts(BaseFactsTest):
# TODO: dedupe some of this test code
@patch('ansible.module_utils.facts.system.service_mgr.get_file_content', return_value=None)
- def test_no_proc1(self, mock_gfc):
+ @patch('ansible.module_utils.facts.system.service_mgr.ServiceMgrFactCollector.is_systemd_managed', return_value=False)
+ @patch('ansible.module_utils.facts.system.service_mgr.ServiceMgrFactCollector.is_systemd_managed_offline', return_value=False)
+ @patch('ansible.module_utils.facts.system.service_mgr.os.path.exists', return_value=False)
+ def test_service_mgr_runit(self, mock_gfc, mock_ism, mock_ismo, mock_ope):
# no /proc/1/comm, ps returns non-0
# should fallback to 'service'
module = self._mock_module()
@@ -388,7 +391,10 @@ class TestServiceMgrFacts(BaseFactsTest):
self.assertEqual(facts_dict['service_mgr'], 'sys11')
@patch('ansible.module_utils.facts.system.service_mgr.get_file_content', return_value=None)
- def test_clowncar(self, mock_gfc):
+ @patch('ansible.module_utils.facts.system.service_mgr.ServiceMgrFactCollector.is_systemd_managed', return_value=False)
+ @patch('ansible.module_utils.facts.system.service_mgr.ServiceMgrFactCollector.is_systemd_managed_offline', return_value=False)
+ @patch('ansible.module_utils.facts.system.service_mgr.os.path.exists', return_value=False)
+ def test_service_mgr_runit(self, mock_gfc, mock_ism, mock_ismo, mock_ope):
# no /proc/1/comm, ps fails, distro and system are clowncar
# should end up return 'sys11'
module = self._mock_module()