def test_mprocess(self): port = self.pp.port(check=True) config_path = process.write_config(self.cfg) self.tmp_files.append(config_path) result = process.mprocess(self.bin_path, config_path, port=port, timeout=60) self.assertTrue(isinstance(result, tuple)) proc, host = result self.assertTrue(isinstance(proc, subprocess.Popen)) self.assertTrue(isinstance(host, str)) process.kill_mprocess(proc)
def test_mprocess(self): port = self.pp.port(check=True) config_path = process.write_config(self.cfg) self.tmp_files.append(config_path) result = process.mprocess(self.bin_path, config_path, port=port) self.assertTrue(isinstance(result, tuple)) proc, host = result self.assertTrue(isinstance(proc, subprocess.Popen)) self.assertTrue(isinstance(host, str)) process.kill_mprocess(proc)
def test_mprocess_timeout(self): port = self.pp.port() cfg = self.cfg.copy() cfg['journal'] = True config_path = process.write_config(cfg) self.tmp_files.append(config_path) proc, host = process.mprocess(self.bin_path, config_path, port, 0) self.assertTrue(isinstance(proc, subprocess.Popen)) self.assertTrue(isinstance(host, str)) process.kill_mprocess(proc) if platform.system() == 'Windows': raise SkipTest("Cannot test mongod startup timeout on Windows.") with self.assertRaises(TimeoutError): result = process.mprocess(self.bin_path, config_path, port, 0.1) print(result)
def stop(self): """stop server""" try: self.shutdown() except PyMongoError as exc: logger.info("Killing %s with signal, shutdown command failed: %r", self.name, exc) return process.kill_mprocess(self.proc)
def stop(self): """stop server""" try: self.shutdown() except (PyMongoError, ServersError) as exc: logger.info("Killing %s with signal, shutdown command failed: %r", self.name, exc) return process.kill_mprocess(self.proc)
def stop(self): """stop server""" return process.kill_mprocess(self.proc)
def test_kill_mprocess(self): p = subprocess.Popen([self.executable]) self.assertTrue(process.proc_alive(p)) process.kill_mprocess(p) self.assertFalse(process.proc_alive(p))