Esempio n. 1
0
    def tets_is_pid_healthy_raises(self):
        m_fopen = mock_open(side_effect=IOError)
        with patch('salt.utils.files.fopen', m_fopen):
            assert master.is_pid_healthy(12345) is False

        m_fopen = mock_open(side_effect=OSError)
        with patch('salt.utils.files.fopen', m_fopen):
            assert master.is_pid_healthy(12345) is False
Esempio n. 2
0
 def test_is_pid_healthy_not_running_salt(self):
     m_fopen = mock_open(read_data=b'tacos')
     with patch('salt.utils.process.os_is_running', return_value=True):
         with patch('salt.utils.files.fopen', m_fopen):
             assert master.is_pid_healthy(12345) is False
Esempio n. 3
0
 def test_pid_not_running(self):
     assert master.is_pid_healthy(99999999) is False
Esempio n. 4
0
    def test_is_pid_healthy_unsupported_platform(self):
        with patch("salt.utils.platform.is_aix", return_value=True):
            assert master.is_pid_healthy(11) is True

        with patch("salt.utils.platform.is_windows", return_value=True):
            assert master.is_pid_healthy(1) is True
Esempio n. 5
0
 def tets_is_pid_healthy_raises(self):
     with patch("psutil.Process", side_effect=psutil.NoSuchProcess):
         assert master.is_pid_healthy(1) is False
Esempio n. 6
0
 def test_is_pid_healthy_not_running_salt(self):
     with patch('psutil.Process.cmdline', return_value=['tacos']):
         assert master.is_pid_healthy(1) is False