def test_ps_not_running(self): with patch('salt.utils.psutil_compat.process_iter', **PATCH_OPTS) as mock_process_iter: mock_process_iter.return_value = [FakeProcess(_name='salt-master', pid=3), FakeProcess(_name='salt-minion', pid=4)] config = [{'processes': {'mysql': 'stopped'}}] ret = ps.validate(config) self.assertEqual(ret, (True, 'Valid beacon configuration')) ret = ps.beacon(config) self.assertEqual(ret, [{'mysql': 'Stopped'}])
def test_ps_not_running(self): with patch("salt.utils.psutil_compat.process_iter", **PATCH_OPTS) as mock_process_iter: mock_process_iter.return_value = [ FakeProcess(_name="salt-master", pid=3), FakeProcess(_name="salt-minion", pid=4), ] config = [{"processes": {"mysql": "stopped"}}] ret = ps.validate(config) self.assertEqual(ret, (True, "Valid beacon configuration")) ret = ps.beacon(config) self.assertEqual(ret, [{"mysql": "Stopped"}])
def test_ps_not_running(): with patch("salt.utils.psutil_compat.process_iter", autospec=True, spec_set=True) as mock_process_iter: mock_process_iter.return_value = [ FakeProcess(_name="salt-master", pid=3), FakeProcess(_name="salt-minion", pid=4), ] config = [{"processes": {"mysql": "stopped"}}] ret = ps.validate(config) assert ret == (True, "Valid beacon configuration") ret = ps.beacon(config) assert ret == [{"mysql": "Stopped"}]