Merge "Adding the ability to use pre-created ports in Network scenarios"
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index 9d1ea9e..7ccec8e 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -124,12 +124,12 @@
device = '/dev/%s' % CONF.compute.volume_device_name
resp, server = self.create_test_server(wait_until='ACTIVE')
- resp, volume = volumes_client.create_volume(1)
+ volume = volumes_client.create_volume(1)
self.addCleanup(volumes_client.delete_volume, volume['id'])
volumes_client.wait_for_volume_status(volume['id'], 'available')
- resp, body = self.client.attach_volume(server['id'],
- volume['id'],
- device=device)
+ self.client.attach_volume(server['id'],
+ volume['id'],
+ device=device)
volumes_client.wait_for_volume_status(volume['id'], 'in-use')
resp, _ = self.client.delete_server(server['id'])
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index f1e2f7f..c01a95c 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -49,7 +49,7 @@
cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
def _create_volume(self):
- resp, volume = self.volumes_extensions_client.create_volume(
+ volume = self.volumes_extensions_client.create_volume(
1, display_name=data_utils.rand_name(
self.__class__.__name__ + '_volume'))
self.addCleanup(self.delete_volume, volume['id'])
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 7fef52f..40b93a8 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -68,7 +68,7 @@
'available')
# Attach the volume to the server
- _, self.attachment = self.servers_client.attach_volume(
+ self.attachment = self.servers_client.attach_volume(
self.server['id'],
self.volume['id'],
device='/dev/%s' % self.device)
@@ -116,13 +116,13 @@
# Create Server, Volume and attach that Volume to Server
self._create_and_attach()
# List Volume attachment of the server
- _, body = self.servers_client.list_volume_attachments(
+ body = self.servers_client.list_volume_attachments(
self.server['id'])
self.assertEqual(1, len(body))
self.assertIn(self.attachment, body)
# Get Volume attachment of the server
- _, body = self.servers_client.get_volume_attachment(
+ body = self.servers_client.get_volume_attachment(
self.server['id'],
self.attachment['id'])
self.assertEqual(self.server['id'], body['serverId'])
diff --git a/tempest/api/compute/volumes/test_volumes_get.py b/tempest/api/compute/volumes/test_volumes_get.py
index d441427..53f5ac0 100644
--- a/tempest/api/compute/volumes/test_volumes_get.py
+++ b/tempest/api/compute/volumes/test_volumes_get.py
@@ -41,11 +41,10 @@
v_name = data_utils.rand_name('Volume-%s-') % self._interface
metadata = {'Type': 'work'}
# Create volume
- resp, volume = self.client.create_volume(size=1,
- display_name=v_name,
- metadata=metadata)
+ volume = self.client.create_volume(size=1,
+ display_name=v_name,
+ metadata=metadata)
self.addCleanup(self.delete_volume, volume['id'])
- self.assertEqual(200, resp.status)
self.assertIn('id', volume)
self.assertIn('displayName', volume)
self.assertEqual(volume['displayName'], v_name,
@@ -56,8 +55,7 @@
# Wait for Volume status to become ACTIVE
self.client.wait_for_volume_status(volume['id'], 'available')
# GET Volume
- resp, fetched_volume = self.client.get_volume(volume['id'])
- self.assertEqual(200, resp.status)
+ fetched_volume = self.client.get_volume(volume['id'])
# Verification of details of fetched Volume
self.assertEqual(v_name,
fetched_volume['displayName'],
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index 6bf9519..c0ac99b 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -45,11 +45,11 @@
v_name = data_utils.rand_name('volume-%s' % cls._interface)
metadata = {'Type': 'work'}
try:
- resp, volume = cls.client.create_volume(size=1,
- display_name=v_name,
- metadata=metadata)
+ volume = cls.client.create_volume(size=1,
+ display_name=v_name,
+ metadata=metadata)
cls.client.wait_for_volume_status(volume['id'], 'available')
- resp, volume = cls.client.get_volume(volume['id'])
+ volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
except Exception:
@@ -79,8 +79,7 @@
def test_volume_list(self):
# Should return the list of Volumes
# Fetch all Volumes
- resp, fetched_list = self.client.list_volumes()
- self.assertEqual(200, resp.status)
+ fetched_list = self.client.list_volumes()
# Now check if all the Volumes created in setup are in fetched list
missing_volumes = [
v for v in self.volume_list if v not in fetched_list
@@ -95,8 +94,7 @@
def test_volume_list_with_details(self):
# Should return the list of Volumes with details
# Fetch all Volumes
- resp, fetched_list = self.client.list_volumes_with_detail()
- self.assertEqual(200, resp.status)
+ fetched_list = self.client.list_volumes_with_detail()
# Now check if all the Volumes created in setup are in fetched list
missing_volumes = [
v for v in self.volume_list if v not in fetched_list
@@ -111,8 +109,7 @@
def test_volume_list_param_limit(self):
# Return the list of volumes based on limit set
params = {'limit': 2}
- resp, fetched_vol_list = self.client.list_volumes(params=params)
- self.assertEqual(200, resp.status)
+ fetched_vol_list = self.client.list_volumes(params=params)
self.assertEqual(len(fetched_vol_list), params['limit'],
"Failed to list volumes by limit set")
@@ -121,9 +118,7 @@
def test_volume_list_with_detail_param_limit(self):
# Return the list of volumes with details based on limit set.
params = {'limit': 2}
- resp, fetched_vol_list = \
- self.client.list_volumes_with_detail(params=params)
- self.assertEqual(200, resp.status)
+ fetched_vol_list = self.client.list_volumes_with_detail(params=params)
self.assertEqual(len(fetched_vol_list), params['limit'],
"Failed to list volume details by limit set")
@@ -132,10 +127,9 @@
def test_volume_list_param_offset_and_limit(self):
# Return the list of volumes based on offset and limit set.
# get all volumes list
- response, all_vol_list = self.client.list_volumes()
+ all_vol_list = self.client.list_volumes()
params = {'offset': 1, 'limit': 1}
- resp, fetched_vol_list = self.client.list_volumes(params=params)
- self.assertEqual(200, resp.status)
+ fetched_vol_list = self.client.list_volumes(params=params)
# Validating length of the fetched volumes
self.assertEqual(len(fetched_vol_list), params['limit'],
@@ -150,11 +144,9 @@
def test_volume_list_with_detail_param_offset_and_limit(self):
# Return the list of volumes details based on offset and limit set.
# get all volumes list
- response, all_vol_list = self.client.list_volumes_with_detail()
+ all_vol_list = self.client.list_volumes_with_detail()
params = {'offset': 1, 'limit': 1}
- resp, fetched_vol_list = \
- self.client.list_volumes_with_detail(params=params)
- self.assertEqual(200, resp.status)
+ fetched_vol_list = self.client.list_volumes_with_detail(params=params)
# Validating length of the fetched volumes
self.assertEqual(len(fetched_vol_list), params['limit'],
diff --git a/tempest/api/data_processing/base.py b/tempest/api/data_processing/base.py
index 2ec1017..45c8488 100644
--- a/tempest/api/data_processing/base.py
+++ b/tempest/api/data_processing/base.py
@@ -77,12 +77,12 @@
object. All resources created in this method will be automatically
removed in tearDownClass method.
"""
- _, resp_body = cls.client.create_node_group_template(name, plugin_name,
- hadoop_version,
- node_processes,
- flavor_id,
- node_configs,
- **kwargs)
+ resp_body = cls.client.create_node_group_template(name, plugin_name,
+ hadoop_version,
+ node_processes,
+ flavor_id,
+ node_configs,
+ **kwargs)
# store id of created node group template
cls._node_group_templates.append(resp_body['id'])
@@ -97,11 +97,11 @@
object. All resources created in this method will be automatically
removed in tearDownClass method.
"""
- _, resp_body = cls.client.create_cluster_template(name, plugin_name,
- hadoop_version,
- node_groups,
- cluster_configs,
- **kwargs)
+ resp_body = cls.client.create_cluster_template(name, plugin_name,
+ hadoop_version,
+ node_groups,
+ cluster_configs,
+ **kwargs)
# store id of created cluster template
cls._cluster_templates.append(resp_body['id'])
@@ -115,7 +115,7 @@
object. All resources created in this method will be automatically
removed in tearDownClass method.
"""
- _, resp_body = cls.client.create_data_source(name, type, url, **kwargs)
+ resp_body = cls.client.create_data_source(name, type, url, **kwargs)
# store id of created data source
cls._data_sources.append(resp_body['id'])
@@ -128,7 +128,7 @@
It returns created object. All resources created in this method will
be automatically removed in tearDownClass method.
"""
- _, resp_body = cls.client.create_job_binary_internal(name, data)
+ resp_body = cls.client.create_job_binary_internal(name, data)
# store id of created job binary internal
cls._job_binary_internals.append(resp_body['id'])
@@ -142,7 +142,7 @@
object. All resources created in this method will be automatically
removed in tearDownClass method.
"""
- _, resp_body = cls.client.create_job_binary(name, url, extra, **kwargs)
+ resp_body = cls.client.create_job_binary(name, url, extra, **kwargs)
# store id of created job binary
cls._job_binaries.append(resp_body['id'])
@@ -156,8 +156,8 @@
object. All resources created in this method will be automatically
removed in tearDownClass method.
"""
- _, resp_body = cls.client.create_job(name,
- job_type, mains, libs, **kwargs)
+ resp_body = cls.client.create_job(name,
+ job_type, mains, libs, **kwargs)
# store id of created job
cls._jobs.append(resp_body['id'])
diff --git a/tempest/api/data_processing/test_cluster_templates.py b/tempest/api/data_processing/test_cluster_templates.py
index 537f90c..422ea5b 100644
--- a/tempest/api/data_processing/test_cluster_templates.py
+++ b/tempest/api/data_processing/test_cluster_templates.py
@@ -120,7 +120,7 @@
template_info = self._create_cluster_template()
# check for cluster template in list
- _, templates = self.client.list_cluster_templates()
+ templates = self.client.list_cluster_templates()
templates_info = [(template['id'], template['name'])
for template in templates]
self.assertIn(template_info, templates_info)
@@ -130,7 +130,7 @@
template_id, template_name = self._create_cluster_template()
# check cluster template fetch by id
- _, template = self.client.get_cluster_template(template_id)
+ template = self.client.get_cluster_template(template_id)
self.assertEqual(template_name, template['name'])
self.assertDictContainsSubset(self.cluster_template, template)
diff --git a/tempest/api/data_processing/test_data_sources.py b/tempest/api/data_processing/test_data_sources.py
index 3650751..a50f44b 100644
--- a/tempest/api/data_processing/test_data_sources.py
+++ b/tempest/api/data_processing/test_data_sources.py
@@ -68,13 +68,13 @@
def _list_data_sources(self, source_info):
# check for data source in list
- _, sources = self.client.list_data_sources()
+ sources = self.client.list_data_sources()
sources_info = [(source['id'], source['name']) for source in sources]
self.assertIn(source_info, sources_info)
def _get_data_source(self, source_id, source_name, source_body):
# check data source fetch by id
- _, source = self.client.get_data_source(source_id)
+ source = self.client.get_data_source(source_id)
self.assertEqual(source_name, source['name'])
self.assertDictContainsSubset(source_body, source)
diff --git a/tempest/api/data_processing/test_job_binaries.py b/tempest/api/data_processing/test_job_binaries.py
index d006991..2f6d998 100644
--- a/tempest/api/data_processing/test_job_binaries.py
+++ b/tempest/api/data_processing/test_job_binaries.py
@@ -78,7 +78,7 @@
binary_info = self._create_job_binary(self.swift_job_binary_with_extra)
# check for job binary in list
- _, binaries = self.client.list_job_binaries()
+ binaries = self.client.list_job_binaries()
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@@ -88,7 +88,7 @@
self._create_job_binary(self.swift_job_binary_with_extra))
# check job binary fetch by id
- _, binary = self.client.get_job_binary(binary_id)
+ binary = self.client.get_job_binary(binary_id)
self.assertEqual(binary_name, binary['name'])
self.assertDictContainsSubset(self.swift_job_binary, binary)
@@ -109,7 +109,7 @@
binary_info = self._create_job_binary(self.internal_db_job_binary)
# check for job binary in list
- _, binaries = self.client.list_job_binaries()
+ binaries = self.client.list_job_binaries()
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@@ -119,7 +119,7 @@
self._create_job_binary(self.internal_db_job_binary))
# check job binary fetch by id
- _, binary = self.client.get_job_binary(binary_id)
+ binary = self.client.get_job_binary(binary_id)
self.assertEqual(binary_name, binary['name'])
self.assertDictContainsSubset(self.internal_db_job_binary, binary)
diff --git a/tempest/api/data_processing/test_job_binary_internals.py b/tempest/api/data_processing/test_job_binary_internals.py
index 7e99867..b8121a0 100644
--- a/tempest/api/data_processing/test_job_binary_internals.py
+++ b/tempest/api/data_processing/test_job_binary_internals.py
@@ -55,7 +55,7 @@
binary_info = self._create_job_binary_internal()
# check for job binary internal in list
- _, binaries = self.client.list_job_binary_internals()
+ binaries = self.client.list_job_binary_internals()
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@@ -64,7 +64,7 @@
binary_id, binary_name = self._create_job_binary_internal()
# check job binary internal fetch by id
- _, binary = self.client.get_job_binary_internal(binary_id)
+ binary = self.client.get_job_binary_internal(binary_id)
self.assertEqual(binary_name, binary['name'])
@test.attr(type='smoke')
diff --git a/tempest/api/data_processing/test_jobs.py b/tempest/api/data_processing/test_jobs.py
index 5af2eef..a7beb0e 100644
--- a/tempest/api/data_processing/test_jobs.py
+++ b/tempest/api/data_processing/test_jobs.py
@@ -69,7 +69,7 @@
job_info = self._create_job()
# check for job in list
- _, jobs = self.client.list_jobs()
+ jobs = self.client.list_jobs()
jobs_info = [(job['id'], job['name']) for job in jobs]
self.assertIn(job_info, jobs_info)
@@ -78,7 +78,7 @@
job_id, job_name = self._create_job()
# check job fetch by id
- _, job = self.client.get_job(job_id)
+ job = self.client.get_job(job_id)
self.assertEqual(job_name, job['name'])
@test.attr(type='smoke')
diff --git a/tempest/api/data_processing/test_node_group_templates.py b/tempest/api/data_processing/test_node_group_templates.py
index f3f59fc..d37e910 100644
--- a/tempest/api/data_processing/test_node_group_templates.py
+++ b/tempest/api/data_processing/test_node_group_templates.py
@@ -69,7 +69,7 @@
template_info = self._create_node_group_template()
# check for node group template in list
- _, templates = self.client.list_node_group_templates()
+ templates = self.client.list_node_group_templates()
templates_info = [(template['id'], template['name'])
for template in templates]
self.assertIn(template_info, templates_info)
@@ -79,7 +79,7 @@
template_id, template_name = self._create_node_group_template()
# check node group template fetch by id
- _, template = self.client.get_node_group_template(template_id)
+ template = self.client.get_node_group_template(template_id)
self.assertEqual(template_name, template['name'])
self.assertDictContainsSubset(self.node_group_template, template)
diff --git a/tempest/api/data_processing/test_plugins.py b/tempest/api/data_processing/test_plugins.py
index 4b4ec48..8c9b720 100644
--- a/tempest/api/data_processing/test_plugins.py
+++ b/tempest/api/data_processing/test_plugins.py
@@ -25,7 +25,7 @@
It ensures main plugins availability.
"""
- _, plugins = self.client.list_plugins()
+ plugins = self.client.list_plugins()
plugins_names = [plugin['name'] for plugin in plugins]
for enabled_plugin in CONF.data_processing_feature_enabled.plugins:
self.assertIn(enabled_plugin, plugins_names)
@@ -39,12 +39,12 @@
@test.attr(type='smoke')
def test_plugin_get(self):
for plugin_name in self._list_all_plugin_names():
- _, plugin = self.client.get_plugin(plugin_name)
+ plugin = self.client.get_plugin(plugin_name)
self.assertEqual(plugin_name, plugin['name'])
for plugin_version in plugin['versions']:
- _, detailed_plugin = self.client.get_plugin(plugin_name,
- plugin_version)
+ detailed_plugin = self.client.get_plugin(plugin_name,
+ plugin_version)
self.assertEqual(plugin_name, detailed_plugin['name'])
# check that required image tags contains name and version
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 179eb09..d667dfd 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -70,7 +70,7 @@
self.addCleanup(self.servers_client.delete_server, server['id'])
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
mountpoint = '/dev/%s' % CONF.compute.volume_device_name
- _, body = self.servers_client.attach_volume(
+ self.servers_client.attach_volume(
server['id'], self.volume_origin['id'], mountpoint)
self.volumes_client.wait_for_volume_status(self.volume_origin['id'],
'in-use')
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 2acee96..b6eff3a 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -417,7 +417,7 @@
def nova_volume_attach(self):
# TODO(andreaf) Device should be here CONF.compute.volume_device_name
volume = self.servers_client.attach_volume(
- self.server['id'], self.volume['id'], '/dev/vdb')[1]
+ self.server['id'], self.volume['id'], '/dev/vdb')
self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
# Refresh the volume after the attachment
diff --git a/tempest/scenario/test_dashboard_basic_ops.py b/tempest/scenario/test_dashboard_basic_ops.py
index 35f6689..1313050 100644
--- a/tempest/scenario/test_dashboard_basic_ops.py
+++ b/tempest/scenario/test_dashboard_basic_ops.py
@@ -65,7 +65,7 @@
def check_login_page(self):
response = urllib2.urlopen(CONF.dashboard.dashboard_url)
- self.assertIn("Log In", response.read())
+ self.assertIn("id_username", response.read())
def user_login(self, username, password):
self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 5ea48e0..4624038 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -78,7 +78,7 @@
def nova_volume_attach(self):
volume_device_path = '/dev/' + CONF.compute.volume_device_name
volume = self.servers_client.attach_volume(
- self.server['id'], self.volume['id'], volume_device_path)[1]
+ self.server['id'], self.volume['id'], volume_device_path)
self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
# Refresh the volume after the attachment
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 16f5283..9efd55b 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -102,7 +102,7 @@
def _attach_volume(self, server, volume):
# TODO(andreaf) we should use device from config instead if vdb
- _, attached_volume = self.servers_client.attach_volume(
+ attached_volume = self.servers_client.attach_volume(
server['id'], volume['id'], device='/dev/vdb')
self.assertEqual(volume['id'], attached_volume['id'])
self._wait_for_volume_status(attached_volume, 'in-use')
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index cbe1ca8..be23b78 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -364,14 +364,14 @@
post_body)
body = json.loads(body)
self.validate_response(schema.attach_volume, resp, body)
- return resp, body['volumeAttachment']
+ return service_client.ResponseBody(resp, body['volumeAttachment'])
def detach_volume(self, server_id, volume_id):
"""Detaches a volume from a server instance."""
resp, body = self.delete('servers/%s/os-volume_attachments/%s' %
(server_id, volume_id))
self.validate_response(schema.detach_volume, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_volume_attachment(self, server_id, attach_id):
"""Return details about the given volume attachment."""
@@ -379,7 +379,7 @@
str(server_id), attach_id))
body = json.loads(body)
self.validate_response(schema.get_volume_attachment, resp, body)
- return resp, body['volumeAttachment']
+ return service_client.ResponseBody(resp, body['volumeAttachment'])
def list_volume_attachments(self, server_id):
"""Returns the list of volume attachments for a given instance."""
@@ -387,7 +387,7 @@
str(server_id)))
body = json.loads(body)
self.validate_response(schema.list_volume_attachments, resp, body)
- return resp, body['volumeAttachments']
+ return service_client.ResponseBodyList(resp, body['volumeAttachments'])
def add_security_group(self, server_id, name):
"""Adds a security group to the server."""
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py
index 61d0b23..2e3e49c 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_extensions_client.py
@@ -33,7 +33,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_volumes, resp, body)
- return resp, body['volumes']
+ return service_client.ResponseBodyList(resp, body['volumes'])
def list_volumes_with_detail(self, params=None):
"""List all the details of volumes."""
@@ -44,7 +44,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_volumes, resp, body)
- return resp, body['volumes']
+ return service_client.ResponseBodyList(resp, body['volumes'])
def get_volume(self, volume_id):
"""Returns the details of a single volume."""
@@ -52,7 +52,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.create_get_volume, resp, body)
- return resp, body['volume']
+ return service_client.ResponseBody(resp, body['volume'])
def create_volume(self, size, **kwargs):
"""
@@ -71,23 +71,23 @@
resp, body = self.post('os-volumes', post_body)
body = json.loads(body)
self.validate_response(schema.create_get_volume, resp, body)
- return resp, body['volume']
+ return service_client.ResponseBody(resp, body['volume'])
def delete_volume(self, volume_id):
"""Deletes the Specified Volume."""
resp, body = self.delete("os-volumes/%s" % str(volume_id))
self.validate_response(schema.delete_volume, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def wait_for_volume_status(self, volume_id, status):
"""Waits for a Volume to reach a given status."""
- resp, body = self.get_volume(volume_id)
+ body = self.get_volume(volume_id)
volume_status = body['status']
start = int(time.time())
while volume_status != status:
time.sleep(self.build_interval)
- resp, body = self.get_volume(volume_id)
+ body = self.get_volume(volume_id)
volume_status = body['status']
if volume_status == 'error':
raise exceptions.VolumeBuildErrorException(volume_id=volume_id)
diff --git a/tempest/services/data_processing/v1_1/client.py b/tempest/services/data_processing/v1_1/client.py
index 55b6be6..8879373 100644
--- a/tempest/services/data_processing/v1_1/client.py
+++ b/tempest/services/data_processing/v1_1/client.py
@@ -33,7 +33,17 @@
"""Make a request using specified request_func and check response
status code.
- It returns pair: resp and response body.
+ It returns a ResponseBody.
+ """
+ resp, body = request_func(uri)
+ self.expected_success(resp_status, resp.status)
+ return service_client.ResponseBody(resp, body)
+
+ def _request_and_check_resp_data(self, request_func, uri, resp_status):
+ """Make a request using specified request_func and check response
+ status code.
+
+ It returns pair: resp and response data.
"""
resp, body = request_func(uri)
self.expected_success(resp_status, resp.status)
@@ -44,20 +54,35 @@
"""Make a request using specified request_func, check response status
code and parse response body.
- It returns pair: resp and parsed resource(s) body.
+ It returns a ResponseBody.
"""
headers = {'Content-Type': 'application/json'}
resp, body = request_func(uri, headers=headers, *args, **kwargs)
self.expected_success(resp_status, resp.status)
body = json.loads(body)
- return resp, body[resource_name]
+ return service_client.ResponseBody(resp, body[resource_name])
+
+ def _request_check_and_parse_resp_list(self, request_func, uri,
+ resp_status, resource_name,
+ *args, **kwargs):
+ """Make a request using specified request_func, check response status
+ code and parse response body.
+
+ It returns a ResponseBodyList.
+ """
+ headers = {'Content-Type': 'application/json'}
+ resp, body = request_func(uri, headers=headers, *args, **kwargs)
+ self.expected_success(resp_status, resp.status)
+ body = json.loads(body)
+ return service_client.ResponseBodyList(resp, body[resource_name])
def list_node_group_templates(self):
"""List all node group templates for a user."""
uri = 'node-group-templates'
- return self._request_check_and_parse_resp(self.get, uri,
- 200, 'node_group_templates')
+ return self._request_check_and_parse_resp_list(self.get, uri,
+ 200,
+ 'node_group_templates')
def get_node_group_template(self, tmpl_id):
"""Returns the details of a single node group template."""
@@ -98,8 +123,8 @@
"""List all enabled plugins."""
uri = 'plugins'
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'plugins')
+ return self._request_check_and_parse_resp_list(self.get,
+ uri, 200, 'plugins')
def get_plugin(self, plugin_name, plugin_version=None):
"""Returns the details of a single plugin."""
@@ -113,8 +138,9 @@
"""List all cluster templates for a user."""
uri = 'cluster-templates'
- return self._request_check_and_parse_resp(self.get, uri,
- 200, 'cluster_templates')
+ return self._request_check_and_parse_resp_list(self.get, uri,
+ 200,
+ 'cluster_templates')
def get_cluster_template(self, tmpl_id):
"""Returns the details of a single cluster template."""
@@ -154,8 +180,9 @@
"""List all data sources for a user."""
uri = 'data-sources'
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'data_sources')
+ return self._request_check_and_parse_resp_list(self.get,
+ uri, 200,
+ 'data_sources')
def get_data_source(self, source_id):
"""Returns the details of a single data source."""
@@ -191,8 +218,8 @@
"""List all job binary internals for a user."""
uri = 'job-binary-internals'
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'binaries')
+ return self._request_check_and_parse_resp_list(self.get,
+ uri, 200, 'binaries')
def get_job_binary_internal(self, job_binary_id):
"""Returns the details of a single job binary internal."""
@@ -218,14 +245,14 @@
"""Returns data of a single job binary internal."""
uri = 'job-binary-internals/%s/data' % job_binary_id
- return self._request_and_check_resp(self.get, uri, 200)
+ return self._request_and_check_resp_data(self.get, uri, 200)
def list_job_binaries(self):
"""List all job binaries for a user."""
uri = 'job-binaries'
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'binaries')
+ return self._request_check_and_parse_resp_list(self.get,
+ uri, 200, 'binaries')
def get_job_binary(self, job_binary_id):
"""Returns the details of a single job binary."""
@@ -261,13 +288,14 @@
"""Returns data of a single job binary."""
uri = 'job-binaries/%s/data' % job_binary_id
- return self._request_and_check_resp(self.get, uri, 200)
+ return self._request_and_check_resp_data(self.get, uri, 200)
def list_jobs(self):
"""List all jobs for a user."""
uri = 'jobs'
- return self._request_check_and_parse_resp(self.get, uri, 200, 'jobs')
+ return self._request_check_and_parse_resp_list(self.get,
+ uri, 200, 'jobs')
def get_job(self, job_id):
"""Returns the details of a single job."""
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index b52eca9..9bc55fa 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -95,7 +95,7 @@
except Exception:
pass
- _, vols = admin_manager.volumes_client.list_volumes({"all_tenants": True})
+ vols = admin_manager.volumes_client.list_volumes({"all_tenants": True})
LOG.info("Cleanup::remove %s volumes" % len(vols))
for v in vols:
try: