def test_mount_volume(self, p_ex_cmd): instance = r.InstanceResource({'instance_id': '123454321'}) p_ex_cmd.return_value = (0, None) self.assertIsNone(volumes._mount_volume(instance, '123', '456')) self.assertEqual(p_ex_cmd.call_count, 3) p_ex_cmd.reset_mock() p_ex_cmd.side_effect = ex.RemoteCommandException('cmd') self.assertRaises(ex.RemoteCommandException, volumes._mount_volume, instance, '123', '456')
def test_mount_volume(self, p_get_username): p_get_username.return_value = 'root' instance = self._get_instance() execute_com = instance.remote().execute_command self.assertIsNone(volumes._mount_volume(instance, '123', '456')) self.assertEqual(execute_com.call_count, 3) execute_com.side_effect = ex.RemoteCommandException('cmd') self.assertRaises(ex.RemoteCommandException, volumes._mount_volume, instance, '123', '456')
def test_mount_volume(self, p_ex_cmd): instance = r.InstanceResource({'instance_id': '123454321'}) p_ex_cmd.return_value = (0, None) self.assertIsNone(volumes._mount_volume(instance, '123', '456')) self.assertEqual(p_ex_cmd.call_count, 3) p_ex_cmd.reset_mock() p_ex_cmd.return_value = (1, None) self.assertRaises(RuntimeError, volumes._mount_volume, instance, '123', '456') self.assertEqual(p_ex_cmd.call_count, 3)
def test_mount_volume(self, p_ex_cmd, p_get_username, run_in_sub, start_sub, get_conn_params, p_close): p_get_username.return_value = 'root' instance = r.InstanceResource({'instance_id': '123454321', 'node_group': {}}) p_ex_cmd.return_value = (0, None) self.assertIsNone(volumes._mount_volume(instance, '123', '456')) self.assertEqual(p_ex_cmd.call_count, 3) p_ex_cmd.reset_mock() p_ex_cmd.side_effect = ex.RemoteCommandException('cmd') self.assertRaises(ex.RemoteCommandException, volumes._mount_volume, instance, '123', '456')
def test_mount_volume(self, p_ex_cmd, p_get_username, _acq, _rel, run_in_sub, start_sub, get_conn_params, p_close): p_get_username.return_value = 'root' instance = r.InstanceResource({ 'instance_id': '123454321', 'node_group': {} }) p_ex_cmd.return_value = (0, None) self.assertIsNone(volumes._mount_volume(instance, '123', '456')) self.assertEqual(p_ex_cmd.call_count, 3) p_ex_cmd.reset_mock() p_ex_cmd.side_effect = ex.RemoteCommandException('cmd') self.assertRaises(ex.RemoteCommandException, volumes._mount_volume, instance, '123', '456')