diff --git a/whitebox_tempest_plugin/services/clients.py b/whitebox_tempest_plugin/services/clients.py index 02fb9747..1c586762 100644 --- a/whitebox_tempest_plugin/services/clients.py +++ b/whitebox_tempest_plugin/services/clients.py @@ -88,7 +88,6 @@ class ServiceManager(SSHClient): self.config_path = getattr(conf, 'config_path', None) self.start_command = getattr(conf, 'start_command', None) self.stop_command = getattr(conf, 'stop_command', None) - self.restart_command = getattr(conf, 'restart_command', None) self.mask_command = getattr(conf, 'mask_command', None) self.unmask_command = getattr(conf, 'unmask_command', None) @@ -174,7 +173,8 @@ class ServiceManager(SSHClient): self.execute(self.mask_command, sudo=True) def restart(self): - self.execute(self.restart_command, sudo=True) + self.stop() + self.start() class NovaServiceManager(ServiceManager): @@ -206,10 +206,6 @@ class NovaServiceManager(ServiceManager): 'down') return result - def restart(self): - self.stop() - self.start() - class NUMAClient(SSHClient): """A client to get host NUMA information. `numactl` needs to be installed diff --git a/whitebox_tempest_plugin/tests/test_clients.py b/whitebox_tempest_plugin/tests/test_clients.py index 4406cbe8..f9cc06fd 100644 --- a/whitebox_tempest_plugin/tests/test_clients.py +++ b/whitebox_tempest_plugin/tests/test_clients.py @@ -147,21 +147,15 @@ class ServiceManagerTestCase(base.WhiteboxPluginTestCase): service.get_conf_opt, 'section', 'foo') def test_commands(self): - # NOTE(artom) There is currently no service that has all 3 start, stop - # and restart, so we set up a fake one for testing. CONF.register_group(cfg.OptGroup(name='whitebox-fake-service')) CONF.register_opt(cfg.StrOpt('start_command'), group='whitebox-fake-service') CONF.register_opt(cfg.StrOpt('stop_command'), group='whitebox-fake-service') - CONF.register_opt(cfg.StrOpt('restart_command'), - group='whitebox-fake-service') self.flags(start_command='fake start command', group='whitebox-fake-service') self.flags(stop_command='fake stop command', group='whitebox-fake-service') - self.flags(restart_command='fake restart command', - group='whitebox-fake-service') service = clients.ServiceManager('fake-host', 'fake-service') with mock.patch.object(service, 'execute') as mock_exec: # Start @@ -172,9 +166,6 @@ class ServiceManagerTestCase(base.WhiteboxPluginTestCase): service.stop() mock_exec.assert_called_with('fake stop command', sudo=True) mock_exec.reset_mock() - # Restart - service.restart() - mock_exec.assert_called_with('fake restart command', sudo=True) class NUMAClientTestCase(base.WhiteboxPluginTestCase):