def test_workers_defaults(self, get_worker_count, mock_wait, mock_serve, service_create): scheduler.main() get_worker_count.assert_called_once_with() mock_serve.assert_called_once_with(service_create.return_value, workers=2) mock_wait.assert_called_once_with()
def test_workers_defaults(self, get_worker_count, mock_wait, mock_serve, service_create): scheduler.main() get_worker_count.assert_called_once_with() mock_serve.assert_called_once_with( service_create.return_value, workers=2) mock_wait.assert_called_once_with()
def test_workers_caching_scheduler(self, get_worker_count, mock_wait, mock_serve, service_create): self.flags(driver='caching_scheduler', group='scheduler') scheduler.main() get_worker_count.assert_not_called() mock_serve.assert_called_once_with(service_create.return_value, workers=1) mock_wait.assert_called_once_with()
def test_workers_override(self, get_worker_count, mock_wait, mock_serve, service_create): self.flags(workers=4, group='scheduler') scheduler.main() get_worker_count.assert_not_called() mock_serve.assert_called_once_with(service_create.return_value, workers=4) mock_wait.assert_called_once_with()
def test_workers_caching_scheduler(self, get_worker_count, mock_wait, mock_serve, service_create): self.flags(driver='caching_scheduler', group='scheduler') scheduler.main() get_worker_count.assert_not_called() mock_serve.assert_called_once_with( service_create.return_value, workers=1) mock_wait.assert_called_once_with()
def test_workers_override(self, get_worker_count, mock_wait, mock_serve, service_create): self.flags(workers=4, group='scheduler') scheduler.main() get_worker_count.assert_not_called() mock_serve.assert_called_once_with( service_create.return_value, workers=4) mock_wait.assert_called_once_with()
def run_service(self): sys.argv = [""] sys.argv.append("--config-file") sys.argv.append("/etc/nova/nova.conf") service = self.service_name if service == "compute": sys.argv[0] = "nova-compute" compute.main() elif service == "conductor": sys.argv[0] = "nova-conductor" conductor.main() elif service == "scheduler": sys.argv[0] = "nova-scheduler" scheduler.main() elif service == "api": sys.argv[0] = "nova-api" api.main() else: raise RuntimeError("Unsupported service %s" % service)