def test_connect_volume_hscli_missing(self): """Test connect_volume that can't call hscli""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_hscli_missing) fake_connection_properties = {'name': DEVICE_NAME} self.assertRaises(exception.BrickException, connector.connect_volume, fake_connection_properties)
def test_connect_volume_hscli_err(self): """Test connect_volume when hscli returns an error""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_hscli_err) fake_connection_properties = {'name': DEVICE_NAME} self.assertRaises(exception.BrickException, connector.connect_volume, fake_connection_properties)
def test_connect_volume_hscli_res_inval(self): """Test connect_volume if hscli returns an invalid result""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_hscli_res_inval) fake_connection_properties = {'name': DEVICE_NAME} self.assertRaises(exception.BrickException, connector.connect_volume, fake_connection_properties)
def test_connect_volume_arg_missing(self): """Test connect_volume with missing missing arguments""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_success) fake_connection_properties = {} self.assertRaises(exception.BrickException, connector.connect_volume, fake_connection_properties)
def test_connect_volume_arg_inval(self): """Test connect_volume with bad volume name argument""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_success) fake_connection_properties = {'name': 'x'} self.assertRaises(exception.BrickException, connector.connect_volume, fake_connection_properties)
def test_disconnect_volume_normal(self): """Test successful disconnect_volume call""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_success) fake_connection_properties = {'name': DEVICE_NAME} fake_device_info = {} connector.disconnect_volume(fake_connection_properties, fake_device_info)
def test_connect_volume_hscli_missing(self): """Test connect_volume that can't call hscli""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_hscli_missing) fake_connection_properties = { 'name': '{8ee71c33-dcd0-4267-8f2b-e0742ecabe9f}' } self.assertRaises(exception.BrickException, connector.connect_volume, fake_connection_properties)
def test_connect_volume_hscli_res_inval(self): """Test connect_volume if hscli returns an invalid result""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_hscli_res_inval) fake_connection_properties = { 'name': '{8ee71c33-dcd0-4267-8f2b-e0742ecabe9f}' } self.assertRaises(exception.BrickException, connector.connect_volume, fake_connection_properties)
def test_disconnect_volume_normal(self): """Test successful disconnect_volume call""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_success) fake_connection_properties = { 'name': '{8ee71c33-dcd0-4267-8f2b-e0742ecabe9f}' } fake_device_info = {} connector.disconnect_volume(fake_connection_properties, fake_device_info)
def test_connect_volume_normal(self): """Test results of successful connect_volume()""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_success) fake_connection_properties = {'name': DEVICE_NAME} device_info = connector.connect_volume(fake_connection_properties) self.assertEqual('192.0.2.2', device_info['vsa_ip']) self.assertEqual('2', device_info['refl_factor']) self.assertEqual('192.0.2.3,192.0.2.4', device_info['refl_targets']) self.assertEqual(DEVICE_PATH, device_info['path'])
def test_connect_volume_normal(self): """Test results of successful connect_volume()""" connector = vrtshyperscale.HyperScaleConnector( 'sudo', execute=self._fake_execute_success) fake_connection_properties = { 'name': '{8ee71c33-dcd0-4267-8f2b-e0742ecabe9f}' } device_info = connector.connect_volume(fake_connection_properties) self.assertEqual('192.0.2.2', device_info['vsa_ip']) self.assertEqual('2', device_info['refl_factor']) self.assertEqual('192.0.2.3,192.0.2.4', device_info['refl_targets']) self.assertEqual( 'oflame://192.0.2.2:9999/' '%7B8ee71c33-dcd0-4267-8f2b-e0742ecabe9f%7D', device_info['device_path'])