def test_get_config(self): hs = vrtshyperscale.LibvirtHyperScaleVolumeDriver(self.fake_host) # expect valid conf is returned if called with proper arguments conn = {'data': {'device_path': DEVICE_PATH}} conf = hs.get_config(conn, self.disk_info) self.assertEqual("block", conf.source_type) self.assertEqual(DEVICE_PATH, conf.source_path)
def test_disconnect_volume(self, mock_brick_disconnect_volume): mock_brick_disconnect_volume.return_value = None hs = vrtshyperscale.LibvirtHyperScaleVolumeDriver(self.fake_host) # dummy arguments are just passed through to mock connector conn_data = {'name': DEVICE_NAME} connection_info = {'data': conn_data} hs.disconnect_volume(connection_info, mock.sentinel.instance) hs.connector.disconnect_volume.assert_called_once_with(conn_data, None)
def test_connect_volume(self, mock_brick_connect_volume): mock_brick_connect_volume.return_value = {'path': DEVICE_PATH} hs = vrtshyperscale.LibvirtHyperScaleVolumeDriver(self.fake_host) # dummy arguments are just passed through to mock connector disk_info = {'name': DEVICE_NAME} connection_info = {'data': disk_info} hs.connect_volume(connection_info, mock.sentinel.instance) # expect connect_volume to add device_path to connection_info: self.assertEqual(connection_info['data']['device_path'], DEVICE_PATH)
def test_driver_init(self): hs = vrtshyperscale.LibvirtHyperScaleVolumeDriver(self.fake_host) self.assertIsInstance(hs.connector, connector.HyperScaleConnector)