def test_run_no_drivers(self): self.pm = power_management.PowerManager() exc = self.assertRaises(error.PowerManagementError, self.pm.reset, self.hosts) self.assertEqual("No supported driver found for host " "Host(ip='10.0.0.2', mac='09:7b:74:90:63:c1', " "fqdn='node1.com', libvirt_name=None)", str(exc))
def setUp(self): super(PowerManagerTestCase, self).setUp() self.dummy_driver1 = mock.Mock(spec=power_management.PowerDriver) self.dummy_driver1.supports.side_effect = lambda host: 'c1' in host.mac self.dummy_driver2 = mock.Mock(spec=power_management.PowerDriver) self.dummy_driver2.supports.side_effect = lambda host: 'c2' in host.mac self.dummy_drivers = [self.dummy_driver1, self.dummy_driver2] self.hosts = [ node_collection.Host(ip='10.0.0.2', mac='09:7b:74:90:63:c1', fqdn='node1.com'), node_collection.Host(ip='10.0.0.3', mac='09:7b:74:90:63:c2', fqdn='node2.com'), ] self.pm = power_management.PowerManager() self.pm.add_driver(self.dummy_driver1) self.pm.add_driver(self.dummy_driver2)
def __init__(self): self.power_manager = power_management.PowerManager() self.node_discover = None self.services = copy.deepcopy(self.SERVICES) self.containers = copy.deepcopy(self.CONTAINERS)