Example #1
0
    def test_stop_process(self):
        self.nc.test_connectivity()
        server_pid = self.nc.server_process.child_pid
        client_pid = self.nc.client_process.child_pid
        self.assertTrue(utils.process_is_running(server_pid))
        self.assertTrue(utils.process_is_running(client_pid))

        self.nc.stop_processes()
        self.assertFalse(utils.process_is_running(server_pid))
        self.assertFalse(utils.process_is_running(client_pid))
Example #2
0
 def test_stop_process_no_process(self):
     self.nc.test_connectivity()
     client_pid = self.nc.client_process.child_pid
     utils.execute(['kill', '-%d' % signal.SIGKILL, client_pid],
                   run_as_root=True)
     n_utils.wait_until_true(
         lambda: not utils.process_is_running(client_pid), timeout=5)
     with mock.patch.object(net_helpers.RootHelperProcess,
                            'poll',
                            return_value=None):
         self.assertRaises(n_exc.ProcessExecutionError,
                           self.nc.stop_processes,
                           skip_errors=[])