Merge "Omitting microseconds when creating a trust"
diff --git a/HACKING.rst b/HACKING.rst
index 607682b..81a7c2c 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -13,6 +13,7 @@
- [T104] Scenario tests require a services decorator
- [T105] Tests cannot use setUpClass/tearDownClass
- [T106] vim configuration should not be kept in source files.
+- [T107] Check that a service tag isn't in the module path
- [N322] Method's default argument shouldn't be mutable
Test Data/Configuration
diff --git a/tempest/api/baremetal/admin/base.py b/tempest/api/baremetal/admin/base.py
index 4f5c6c8..c93dfb8 100644
--- a/tempest/api/baremetal/admin/base.py
+++ b/tempest/api/baremetal/admin/base.py
@@ -115,21 +115,22 @@
@classmethod
@creates('node')
- def create_node(cls, chassis_id, cpu_arch='x86', cpu_num=8, storage=1024,
- memory=4096):
+ def create_node(cls, chassis_id, cpu_arch='x86', cpus=8, local_gb=10,
+ memory_mb=4096):
"""
Wrapper utility for creating test baremetal nodes.
:param cpu_arch: CPU architecture of the node. Default: x86.
- :param cpu_num: Number of CPUs. Default: 8.
- :param storage: Disk size. Default: 1024.
- :param memory: Available RAM. Default: 4096.
+ :param cpus: Number of CPUs. Default: 8.
+ :param local_gb: Disk size. Default: 10.
+ :param memory_mb: Available RAM. Default: 4096.
:return: Created node.
"""
resp, body = cls.client.create_node(chassis_id, cpu_arch=cpu_arch,
- cpu_num=cpu_num, storage=storage,
- memory=memory, driver=cls.driver)
+ cpus=cpus, local_gb=local_gb,
+ memory_mb=memory_mb,
+ driver=cls.driver)
return resp, body
diff --git a/tempest/api/baremetal/admin/test_nodes.py b/tempest/api/baremetal/admin/test_nodes.py
index 96f4b43..1919223 100644
--- a/tempest/api/baremetal/admin/test_nodes.py
+++ b/tempest/api/baremetal/admin/test_nodes.py
@@ -49,9 +49,9 @@
@test.attr(type='smoke')
def test_create_node(self):
params = {'cpu_arch': 'x86_64',
- 'cpu_num': '12',
- 'storage': '10240',
- 'memory': '1024'}
+ 'cpus': '12',
+ 'local_gb': '10',
+ 'memory_mb': '1024'}
_, body = self.create_node(self.chassis['uuid'], **params)
self._assertExpected(params, body['properties'])
@@ -107,16 +107,16 @@
@test.attr(type='smoke')
def test_update_node(self):
props = {'cpu_arch': 'x86_64',
- 'cpu_num': '12',
- 'storage': '10',
- 'memory': '128'}
+ 'cpus': '12',
+ 'local_gb': '10',
+ 'memory_mb': '128'}
_, node = self.create_node(self.chassis['uuid'], **props)
new_p = {'cpu_arch': 'x86',
- 'cpu_num': '1',
- 'storage': '10000',
- 'memory': '12300'}
+ 'cpus': '1',
+ 'local_gb': '10000',
+ 'memory_mb': '12300'}
_, body = self.client.update_node(node['uuid'], properties=new_p)
_, node = self.client.show_node(node['uuid'])
diff --git a/tempest/api/compute/admin/test_migrations.py b/tempest/api/compute/admin/test_migrations.py
index c51ad61..aaf7a78 100644
--- a/tempest/api/compute/admin/test_migrations.py
+++ b/tempest/api/compute/admin/test_migrations.py
@@ -41,8 +41,7 @@
server = self.create_test_server(wait_until="ACTIVE")
server_id = server['id']
- resp, _ = self.servers_client.resize(server_id, self.flavor_ref_alt)
- self.assertEqual(202, resp.status)
+ self.servers_client.resize(server_id, self.flavor_ref_alt)
self.servers_client.wait_for_server_status(server_id, 'VERIFY_RESIZE')
self.servers_client.confirm_resize(server_id)
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
diff --git a/tempest/api/compute/admin/test_networks.py b/tempest/api/compute/admin/test_networks.py
index 75f3199..898d085 100644
--- a/tempest/api/compute/admin/test_networks.py
+++ b/tempest/api/compute/admin/test_networks.py
@@ -34,7 +34,7 @@
cls.client = cls.os_adm.networks_client
def test_get_network(self):
- resp, networks = self.client.list_networks()
+ networks = self.client.list_networks()
configured_network = [x for x in networks if x['label'] ==
CONF.compute.fixed_network_name]
self.assertEqual(1, len(configured_network),
@@ -42,11 +42,11 @@
len(configured_network),
CONF.compute.fixed_network_name))
configured_network = configured_network[0]
- _, network = self.client.get_network(configured_network['id'])
+ network = self.client.get_network(configured_network['id'])
self.assertEqual(configured_network['label'], network['label'])
def test_list_all_networks(self):
- _, networks = self.client.list_networks()
+ networks = self.client.list_networks()
# Check the configured network is in the list
configured_network = CONF.compute.fixed_network_name
self.assertIn(configured_network, [x['label'] for x in networks])
diff --git a/tempest/api/compute/admin/test_security_group_default_rules.py b/tempest/api/compute/admin/test_security_group_default_rules.py
index 31103df..a0606cd 100644
--- a/tempest/api/compute/admin/test_security_group_default_rules.py
+++ b/tempest/api/compute/admin/test_security_group_default_rules.py
@@ -30,10 +30,14 @@
@testtools.skipIf(CONF.service_available.neutron,
"Skip as this functionality is not yet "
"implemented in Neutron. Related Bug#1311500")
- def resource_setup(cls):
+ def setup_credentials(cls):
# A network and a subnet will be created for these tests
cls.set_network_resources(network=True, subnet=True)
- super(SecurityGroupDefaultRulesTest, cls).resource_setup()
+ super(SecurityGroupDefaultRulesTest, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(SecurityGroupDefaultRulesTest, cls).setup_clients()
cls.adm_client = cls.os_adm.security_group_default_rules_client
def _create_security_group_default_rules(self, ip_protocol='tcp',
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 6110b89..84c38c1 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -47,19 +47,18 @@
@test.attr(type='gate')
def test_list_servers_by_admin(self):
# Listing servers by admin user returns empty list by default
- resp, body = self.client.list_servers_with_detail()
+ body = self.client.list_servers_with_detail()
servers = body['servers']
- self.assertEqual('200', resp['status'])
self.assertEqual([], servers)
@test.attr(type='gate')
def test_list_servers_filter_by_error_status(self):
# Filter the list of servers by server error status
params = {'status': 'error'}
- resp, server = self.client.reset_state(self.s1_id, state='error')
- resp, body = self.non_admin_client.list_servers(params)
+ self.client.reset_state(self.s1_id, state='error')
+ body = self.non_admin_client.list_servers(params)
# Reset server's state to 'active'
- resp, server = self.client.reset_state(self.s1_id, state='active')
+ self.client.reset_state(self.s1_id, state='active')
# Verify server's state
server = self.client.get_server(self.s1_id)
self.assertEqual(server['status'], 'ACTIVE')
@@ -73,7 +72,7 @@
# Listing servers by admin user with all tenants parameter
# Here should be listed all servers
params = {'all_tenants': ''}
- resp, body = self.client.list_servers_with_detail(params)
+ body = self.client.list_servers_with_detail(params)
servers = body['servers']
servers_name = map(lambda x: x['name'], servers)
@@ -87,14 +86,14 @@
# List the primary tenant but get nothing due to odd specified behavior
tenant_id = self.non_admin_client.tenant_id
params = {'tenant_id': tenant_id}
- resp, body = self.client.list_servers_with_detail(params)
+ body = self.client.list_servers_with_detail(params)
servers = body['servers']
self.assertEqual([], servers)
# List the admin tenant which has no servers
admin_tenant_id = self.client.tenant_id
params = {'all_tenants': '', 'tenant_id': admin_tenant_id}
- resp, body = self.client.list_servers_with_detail(params)
+ body = self.client.list_servers_with_detail(params)
servers = body['servers']
self.assertEqual([], servers)
@@ -111,13 +110,10 @@
self.assertEqual(server['status'], 'ACTIVE')
hostname = server[self._host_key]
params = {'host': hostname}
- resp, body = self.client.list_servers(params)
- self.assertEqual('200', resp['status'])
+ body = self.client.list_servers(params)
servers = body['servers']
nonexistent_params = {'host': 'nonexistent_host'}
- resp, nonexistent_body = self.client.list_servers(
- nonexistent_params)
- self.assertEqual('200', resp['status'])
+ nonexistent_body = self.client.list_servers(nonexistent_params)
nonexistent_servers = nonexistent_body['servers']
self.assertIn(test_server['id'], map(lambda x: x['id'], servers))
self.assertNotIn(test_server['id'],
@@ -126,16 +122,14 @@
@test.attr(type='gate')
def test_reset_state_server(self):
# Reset server's state to 'error'
- resp, server = self.client.reset_state(self.s1_id)
- self.assertEqual(202, resp.status)
+ self.client.reset_state(self.s1_id)
# Verify server's state
server = self.client.get_server(self.s1_id)
self.assertEqual(server['status'], 'ERROR')
# Reset server's state to 'active'
- resp, server = self.client.reset_state(self.s1_id, state='active')
- self.assertEqual(202, resp.status)
+ self.client.reset_state(self.s1_id, state='active')
# Verify server's state
server = self.client.get_server(self.s1_id)
@@ -145,8 +139,7 @@
@decorators.skip_because(bug="1240043")
def test_get_server_diagnostics_by_admin(self):
# Retrieve server diagnostics by admin user
- resp, diagnostic = self.client.get_server_diagnostics(self.s1_id)
- self.assertEqual(200, resp.status)
+ diagnostic = self.client.get_server_diagnostics(self.s1_id)
basic_attrs = ['rx_packets', 'rx_errors', 'rx_drop',
'tx_packets', 'tx_errors', 'tx_drop',
'read_req', 'write_req', 'cpu', 'memory']
@@ -159,9 +152,8 @@
# image and changed to ACTIVE state
# resetting vm state require admin privilege
- resp, server = self.client.reset_state(self.s1_id, state='error')
- self.assertEqual(202, resp.status)
- resp, rebuilt_server = self.non_admin_client.rebuild(
+ self.client.reset_state(self.s1_id, state='error')
+ rebuilt_server = self.non_admin_client.rebuild(
self.s1_id, self.image_ref_alt)
self.addCleanup(self.non_admin_client.wait_for_server_status,
self.s1_id, 'ACTIVE')
@@ -185,11 +177,9 @@
def test_reset_network_inject_network_info(self):
# Reset Network of a Server
server = self.create_test_server(wait_until='ACTIVE')
- resp, server_body = self.client.reset_network(server['id'])
- self.assertEqual(202, resp.status)
+ self.client.reset_network(server['id'])
# Inject the Network Info into Server
- resp, server_body = self.client.inject_network_info(server['id'])
- self.assertEqual(202, resp.status)
+ self.client.inject_network_info(server['id'])
@test.attr(type='gate')
def test_create_server_with_scheduling_hint(self):
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 7fd87f6..bbe289d 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -138,8 +138,7 @@
server = self.create_test_server(wait_until='ACTIVE')
server_id = server['id']
# suspend the server.
- resp, _ = self.client.suspend_server(server_id)
- self.assertEqual(202, resp.status)
+ self.client.suspend_server(server_id)
self.client.wait_for_server_status(server_id, 'SUSPENDED')
# migrate an suspended server should fail
self.assertRaises(lib_exc.Conflict,
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 4120a9a..89818b1 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -17,6 +17,7 @@
import time
from tempest import clients
+from tempest.common import credentials
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
@@ -36,15 +37,60 @@
force_tenant_isolation = False
@classmethod
- def resource_setup(cls):
- cls.set_network_resources()
- super(BaseComputeTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseComputeTest, cls).skip_checks()
+ if cls._api_version != 2:
+ msg = ("Unexpected API version is specified (%s)" %
+ cls._api_version)
+ raise exceptions.InvalidConfiguration(message=msg)
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseComputeTest, cls).setup_credentials()
# TODO(andreaf) WE should care also for the alt_manager here
# but only once client lazy load in the manager is done
cls.os = cls.get_client_manager()
+ # Note that we put this here and not in skip_checks because in
+ # the case of preprovisioned users we won't know if we can get
+ # two distinct users until we go and lock them
cls.multi_user = cls.check_multi_user()
+ @classmethod
+ def setup_clients(cls):
+ super(BaseComputeTest, cls).setup_clients()
+ cls.servers_client = cls.os.servers_client
+ cls.flavors_client = cls.os.flavors_client
+ cls.images_client = cls.os.images_client
+ cls.extensions_client = cls.os.extensions_client
+ cls.floating_ips_client = cls.os.floating_ips_client
+ cls.keypairs_client = cls.os.keypairs_client
+ cls.security_groups_client = cls.os.security_groups_client
+ cls.quotas_client = cls.os.quotas_client
+ # NOTE(mriedem): os-quota-class-sets is v2 API only
+ cls.quota_classes_client = cls.os.quota_classes_client
+ # NOTE(mriedem): os-networks is v2 API only
+ cls.networks_client = cls.os.networks_client
+ cls.limits_client = cls.os.limits_client
+ cls.volumes_extensions_client = cls.os.volumes_extensions_client
+ cls.volumes_client = cls.os.volumes_client
+ cls.interfaces_client = cls.os.interfaces_client
+ cls.fixed_ips_client = cls.os.fixed_ips_client
+ cls.availability_zone_client = cls.os.availability_zone_client
+ cls.agents_client = cls.os.agents_client
+ cls.aggregates_client = cls.os.aggregates_client
+ cls.services_client = cls.os.services_client
+ cls.instance_usages_audit_log_client = (
+ cls.os.instance_usages_audit_log_client)
+ cls.hypervisor_client = cls.os.hypervisor_client
+ cls.certificates_client = cls.os.certificates_client
+ cls.migrations_client = cls.os.migrations_client
+ cls.security_group_default_rules_client = (
+ cls.os.security_group_default_rules_client)
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseComputeTest, cls).resource_setup()
cls.build_interval = CONF.compute.build_interval
cls.build_timeout = CONF.compute.build_timeout
cls.ssh_user = CONF.compute.ssh_user
@@ -59,39 +105,13 @@
cls.security_groups = []
cls.server_groups = []
- if cls._api_version == 2:
- cls.servers_client = cls.os.servers_client
- cls.flavors_client = cls.os.flavors_client
- cls.images_client = cls.os.images_client
- cls.extensions_client = cls.os.extensions_client
- cls.floating_ips_client = cls.os.floating_ips_client
- cls.keypairs_client = cls.os.keypairs_client
- cls.security_groups_client = cls.os.security_groups_client
- cls.quotas_client = cls.os.quotas_client
- # NOTE(mriedem): os-quota-class-sets is v2 API only
- cls.quota_classes_client = cls.os.quota_classes_client
- # NOTE(mriedem): os-networks is v2 API only
- cls.networks_client = cls.os.networks_client
- cls.limits_client = cls.os.limits_client
- cls.volumes_extensions_client = cls.os.volumes_extensions_client
- cls.volumes_client = cls.os.volumes_client
- cls.interfaces_client = cls.os.interfaces_client
- cls.fixed_ips_client = cls.os.fixed_ips_client
- cls.availability_zone_client = cls.os.availability_zone_client
- cls.agents_client = cls.os.agents_client
- cls.aggregates_client = cls.os.aggregates_client
- cls.services_client = cls.os.services_client
- cls.instance_usages_audit_log_client = \
- cls.os.instance_usages_audit_log_client
- cls.hypervisor_client = cls.os.hypervisor_client
- cls.certificates_client = cls.os.certificates_client
- cls.migrations_client = cls.os.migrations_client
- cls.security_group_default_rules_client = (
- cls.os.security_group_default_rules_client)
- else:
- msg = ("Unexpected API version is specified (%s)" %
- cls._api_version)
- raise exceptions.InvalidConfiguration(message=msg)
+ @classmethod
+ def resource_cleanup(cls):
+ cls.clear_images()
+ cls.clear_servers()
+ cls.clear_security_groups()
+ cls.clear_server_groups()
+ super(BaseComputeTest, cls).resource_cleanup()
@classmethod
def check_multi_user(cls):
@@ -183,14 +203,6 @@
server_group_id)
@classmethod
- def resource_cleanup(cls):
- cls.clear_images()
- cls.clear_servers()
- cls.clear_security_groups()
- cls.clear_server_groups()
- super(BaseComputeTest, cls).resource_cleanup()
-
- @classmethod
def create_test_server(cls, **kwargs):
"""Wrapper utility that returns a test server."""
name = data_utils.rand_name(cls.__name__ + "-instance")
@@ -206,7 +218,7 @@
servers = [body]
if 'min_count' in kwargs or 'max_count' in kwargs:
# Get servers created which name match with name param.
- r, b = cls.servers_client.list_servers()
+ b = cls.servers_client.list_servers()
servers = [s for s in b['servers'] if s['name'].startswith(name)]
if 'wait_until' in kwargs:
@@ -248,9 +260,9 @@
name = data_utils.rand_name(cls.__name__ + "-Server-Group")
if policy is None:
policy = ['affinity']
- resp, body = cls.servers_client.create_server_group(name, policy)
+ body = cls.servers_client.create_server_group(name, policy)
cls.server_groups.append(body['id'])
- return resp, body
+ return body
def wait_for(self, condition):
"""Repeatedly calls condition() until a timeout."""
@@ -335,15 +347,21 @@
"""Base test case class for Compute Admin API tests."""
@classmethod
- def resource_setup(cls):
- super(BaseComputeAdminTest, cls).resource_setup()
- try:
- creds = cls.isolated_creds.get_admin_creds()
- cls.os_adm = clients.Manager(credentials=creds)
- except NotImplementedError:
- msg = ("Missing Compute Admin API credentials in configuration.")
+ def skip_checks(cls):
+ if not credentials.is_admin_available():
+ msg = ("Missing Identity Admin API credentials in configuration.")
raise cls.skipException(msg)
+ super(BaseComputeAdminTest, cls).skip_checks()
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseComputeAdminTest, cls).setup_credentials()
+ creds = cls.isolated_creds.get_admin_creds()
+ cls.os_adm = clients.Manager(credentials=creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseComputeAdminTest, cls).setup_clients()
cls.availability_zone_admin_client = (
cls.os_adm.availability_zone_client)
diff --git a/tempest/api/compute/floating_ips/base.py b/tempest/api/compute/floating_ips/base.py
index 19b6a50..142eaec 100644
--- a/tempest/api/compute/floating_ips/base.py
+++ b/tempest/api/compute/floating_ips/base.py
@@ -19,8 +19,8 @@
class BaseFloatingIPsTest(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# Floating IP actions might need a full network configuration
cls.set_network_resources(network=True, subnet=True,
router=True, dhcp=True)
- super(BaseFloatingIPsTest, cls).resource_setup()
+ super(BaseFloatingIPsTest, cls).setup_credentials()
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index 2fce564..46a6ddb 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -25,9 +25,13 @@
floating_ip = None
@classmethod
+ def setup_clients(cls):
+ super(FloatingIPsTestJSON, cls).setup_clients()
+ cls.client = cls.floating_ips_client
+
+ @classmethod
def resource_setup(cls):
super(FloatingIPsTestJSON, cls).resource_setup()
- cls.client = cls.floating_ips_client
cls.floating_ip_id = None
# Server creation
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
index 08e73ca..fa3fa16 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
@@ -29,9 +29,13 @@
server_id = None
@classmethod
+ def setup_clients(cls):
+ super(FloatingIPsNegativeTestJSON, cls).setup_clients()
+ cls.client = cls.floating_ips_client
+
+ @classmethod
def resource_setup(cls):
super(FloatingIPsNegativeTestJSON, cls).resource_setup()
- cls.client = cls.floating_ips_client
# Server creation
server = cls.create_test_server(wait_until='ACTIVE')
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index ca46918..25f13fc 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -20,9 +20,13 @@
class FloatingIPDetailsTestJSON(base.BaseV2ComputeTest):
@classmethod
+ def setup_clients(cls):
+ super(FloatingIPDetailsTestJSON, cls).setup_clients()
+ cls.client = cls.floating_ips_client
+
+ @classmethod
def resource_setup(cls):
super(FloatingIPDetailsTestJSON, cls).resource_setup()
- cls.client = cls.floating_ips_client
cls.floating_ip = []
cls.floating_ip_id = []
for i in range(3):
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
index b3ff132..d1d3517 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
@@ -28,8 +28,8 @@
class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(FloatingIPDetailsNegativeTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(FloatingIPDetailsNegativeTestJSON, cls).setup_clients()
cls.client = cls.floating_ips_client
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/limits/test_absolute_limits.py b/tempest/api/compute/limits/test_absolute_limits.py
index 520dfa9..de6eecb 100644
--- a/tempest/api/compute/limits/test_absolute_limits.py
+++ b/tempest/api/compute/limits/test_absolute_limits.py
@@ -20,8 +20,8 @@
class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(AbsoluteLimitsTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(AbsoluteLimitsTestJSON, cls).setup_clients()
cls.client = cls.limits_client
@test.attr(type='gate')
diff --git a/tempest/api/compute/limits/test_absolute_limits_negative.py b/tempest/api/compute/limits/test_absolute_limits_negative.py
index 9776db3..d82a2e5 100644
--- a/tempest/api/compute/limits/test_absolute_limits_negative.py
+++ b/tempest/api/compute/limits/test_absolute_limits_negative.py
@@ -28,8 +28,8 @@
super(AbsoluteLimitsNegativeTestJSON, self).setUp()
@classmethod
- def resource_setup(cls):
- super(AbsoluteLimitsNegativeTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(AbsoluteLimitsNegativeTestJSON, cls).setup_clients()
cls.client = cls.limits_client
cls.server_client = cls.servers_client
diff --git a/tempest/api/compute/security_groups/base.py b/tempest/api/compute/security_groups/base.py
index 05cad9a..f70f6d3 100644
--- a/tempest/api/compute/security_groups/base.py
+++ b/tempest/api/compute/security_groups/base.py
@@ -19,7 +19,7 @@
class BaseSecurityGroupsTest(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# A network and a subnet will be created for these tests
cls.set_network_resources(network=True, subnet=True)
- super(BaseSecurityGroupsTest, cls).resource_setup()
+ super(BaseSecurityGroupsTest, cls).setup_credentials()
diff --git a/tempest/api/compute/security_groups/test_security_group_rules.py b/tempest/api/compute/security_groups/test_security_group_rules.py
index 527f2dd..1871c73 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -23,9 +23,13 @@
class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest):
@classmethod
+ def setup_clients(cls):
+ super(SecurityGroupRulesTestJSON, cls).setup_clients()
+ cls.client = cls.security_groups_client
+
+ @classmethod
def resource_setup(cls):
super(SecurityGroupRulesTestJSON, cls).resource_setup()
- cls.client = cls.security_groups_client
cls.neutron_available = CONF.service_available.neutron
cls.ip_protocol = 'tcp'
cls.from_port = 22
diff --git a/tempest/api/compute/security_groups/test_security_group_rules_negative.py b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
index dc63936..bd48cbe 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules_negative.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
@@ -33,8 +33,8 @@
class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest):
@classmethod
- def resource_setup(cls):
- super(SecurityGroupRulesNegativeTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(SecurityGroupRulesNegativeTestJSON, cls).setup_clients()
cls.client = cls.security_groups_client
@test.attr(type=['negative', 'smoke'])
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 0f68665..743a4e7 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -23,8 +23,8 @@
class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest):
@classmethod
- def resource_setup(cls):
- super(SecurityGroupsTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(SecurityGroupsTestJSON, cls).setup_clients()
cls.client = cls.security_groups_client
@test.attr(type='smoke')
@@ -97,8 +97,7 @@
server = self.create_test_server(name=server_name)
server_id = server['id']
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
- resp, body = self.servers_client.add_security_group(server_id,
- sg['name'])
+ self.servers_client.add_security_group(server_id, sg['name'])
# Check that we are not able to delete the security
# group since it is in use by an active server
@@ -107,10 +106,9 @@
sg['id'])
# Reboot and add the other security group
- resp, body = self.servers_client.reboot(server_id, 'HARD')
+ self.servers_client.reboot(server_id, 'HARD')
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
- resp, body = self.servers_client.add_security_group(server_id,
- sg2['name'])
+ self.servers_client.add_security_group(server_id, sg2['name'])
# Check that we are not able to delete the other security
# group since it is in use by an active server
diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py
index 4c8de27..2cbea1a 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -28,9 +28,13 @@
class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest):
@classmethod
+ def setup_clients(cls):
+ super(SecurityGroupsNegativeTestJSON, cls).setup_clients()
+ cls.client = cls.security_groups_client
+
+ @classmethod
def resource_setup(cls):
super(SecurityGroupsNegativeTestJSON, cls).resource_setup()
- cls.client = cls.security_groups_client
cls.neutron_available = CONF.service_available.neutron
def _generate_a_non_existent_security_group_id(self):
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index c0b58ff..6422215 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -26,14 +26,22 @@
class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(AttachInterfacesTestJSON, cls).skip_checks()
if not CONF.service_available.neutron:
raise cls.skipException("Neutron is required")
if not CONF.compute_feature_enabled.interface_attach:
raise cls.skipException("Interface attachment is not available.")
+
+ @classmethod
+ def setup_credentials(cls):
# This test class requires network and subnet
cls.set_network_resources(network=True, subnet=True)
- super(AttachInterfacesTestJSON, cls).resource_setup()
+ super(AttachInterfacesTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(AttachInterfacesTestJSON, cls).setup_clients()
cls.client = cls.os.interfaces_client
def _check_interface(self, iface, port_id=None, network_id=None,
@@ -50,36 +58,32 @@
def _create_server_get_interfaces(self):
server = self.create_test_server(wait_until='ACTIVE')
- resp, ifs = self.client.list_interfaces(server['id'])
- self.assertEqual(200, resp.status)
- resp, body = self.client.wait_for_interface_status(
+ ifs = self.client.list_interfaces(server['id'])
+ body = self.client.wait_for_interface_status(
server['id'], ifs[0]['port_id'], 'ACTIVE')
ifs[0]['port_state'] = body['port_state']
return server, ifs
def _test_create_interface(self, server):
- resp, iface = self.client.create_interface(server['id'])
- self.assertEqual(200, resp.status)
- resp, iface = self.client.wait_for_interface_status(
+ iface = self.client.create_interface(server['id'])
+ iface = self.client.wait_for_interface_status(
server['id'], iface['port_id'], 'ACTIVE')
self._check_interface(iface)
return iface
def _test_create_interface_by_network_id(self, server, ifs):
network_id = ifs[0]['net_id']
- resp, iface = self.client.create_interface(server['id'],
- network_id=network_id)
- self.assertEqual(200, resp.status)
- resp, iface = self.client.wait_for_interface_status(
+ iface = self.client.create_interface(server['id'],
+ network_id=network_id)
+ iface = self.client.wait_for_interface_status(
server['id'], iface['port_id'], 'ACTIVE')
self._check_interface(iface, network_id=network_id)
return iface
def _test_show_interface(self, server, ifs):
iface = ifs[0]
- resp, _iface = self.client.show_interface(server['id'],
- iface['port_id'])
- self.assertEqual(200, resp.status)
+ _iface = self.client.show_interface(server['id'],
+ iface['port_id'])
self._check_interface(iface, port_id=_iface['port_id'],
network_id=_iface['net_id'],
fixed_ip=_iface['fixed_ips'][0]['ip_address'],
@@ -88,14 +92,13 @@
def _test_delete_interface(self, server, ifs):
# NOTE(danms): delete not the first or last, but one in the middle
iface = ifs[1]
- resp, _ = self.client.delete_interface(server['id'], iface['port_id'])
- self.assertEqual(202, resp.status)
- _ifs = self.client.list_interfaces(server['id'])[1]
+ self.client.delete_interface(server['id'], iface['port_id'])
+ _ifs = self.client.list_interfaces(server['id'])
start = int(time.time())
while len(ifs) == len(_ifs):
time.sleep(self.build_interval)
- _ifs = self.client.list_interfaces(server['id'])[1]
+ _ifs = self.client.list_interfaces(server['id'])
timed_out = int(time.time()) - start >= self.build_timeout
if len(ifs) == len(_ifs) and timed_out:
message = ('Failed to delete interface within '
@@ -127,7 +130,7 @@
iface = self._test_create_interface_by_network_id(server, ifs)
ifs.append(iface)
- resp, _ifs = self.client.list_interfaces(server['id'])
+ _ifs = self.client.list_interfaces(server['id'])
self._compare_iface_list(ifs, _ifs)
self._test_show_interface(server, ifs)
@@ -144,9 +147,7 @@
self.assertTrue(interface_count > 0)
self._check_interface(ifs[0])
network_id = ifs[0]['net_id']
- resp, body = self.client.add_fixed_ip(server['id'],
- network_id)
- self.assertEqual(202, resp.status)
+ self.client.add_fixed_ip(server['id'], network_id)
# Remove the fixed IP from server.
server_detail = self.os.servers_client.get_server(
server['id'])
@@ -159,6 +160,4 @@
break
if fixed_ip is not None:
break
- resp, body = self.client.remove_fixed_ip(server['id'],
- fixed_ip)
- self.assertEqual(202, resp.status)
+ self.client.remove_fixed_ip(server['id'], fixed_ip)
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 73e7d15..6711fa9 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -70,7 +70,7 @@
@test.attr(type='smoke')
def test_list_servers(self):
# The created server should be in the list of all servers
- resp, body = self.client.list_servers()
+ body = self.client.list_servers()
servers = body['servers']
found = any([i for i in servers if i['id'] == self.server['id']])
self.assertTrue(found)
@@ -78,7 +78,7 @@
@test.attr(type='smoke')
def test_list_servers_with_detail(self):
# The created server should be in the detailed list of all servers
- resp, body = self.client.list_servers_with_detail()
+ body = self.client.list_servers_with_detail()
servers = body['servers']
found = any([i for i in servers if i['id'] == self.server['id']])
self.assertTrue(found)
@@ -108,9 +108,8 @@
# Create a server with the scheduler hint "group".
name = data_utils.rand_name('server_group')
policies = ['affinity']
- resp, body = self.client.create_server_group(name=name,
- policies=policies)
- self.assertEqual(200, resp.status)
+ body = self.client.create_server_group(name=name,
+ policies=policies)
group_id = body['id']
self.addCleanup(self.client.delete_server_group, group_id)
@@ -119,8 +118,7 @@
wait_until='ACTIVE')
# Check a server is in the group
- resp, server_group = self.client.get_server_group(group_id)
- self.assertEqual(200, resp.status)
+ server_group = self.client.get_server_group(group_id)
self.assertIn(server['id'], server_group['members'])
@testtools.skipUnless(CONF.service_available.neutron,
@@ -170,7 +168,7 @@
self.addCleanup(cleanup_server)
- _, addresses = self.client.list_addresses(server_multi_nics['id'])
+ addresses = self.client.list_addresses(server_multi_nics['id'])
# We can't predict the ip addresses assigned to the server on networks.
# Sometimes the assigned addresses are ['19.80.0.2', '19.86.0.2'], at
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index aec2f6f..ba20229 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -50,7 +50,7 @@
def test_delete_server_while_in_shutoff_state(self):
# Delete a server while it's VM state is Shutoff
server = self.create_test_server(wait_until='ACTIVE')
- resp, body = self.client.stop(server['id'])
+ self.client.stop(server['id'])
self.client.wait_for_server_status(server['id'], 'SHUTOFF')
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@@ -61,7 +61,7 @@
def test_delete_server_while_in_pause_state(self):
# Delete a server while it's VM state is Pause
server = self.create_test_server(wait_until='ACTIVE')
- resp, body = self.client.pause_server(server['id'])
+ self.client.pause_server(server['id'])
self.client.wait_for_server_status(server['id'], 'PAUSED')
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@@ -83,8 +83,7 @@
def test_delete_server_while_in_shelved_state(self):
# Delete a server while it's VM state is Shelved
server = self.create_test_server(wait_until='ACTIVE')
- resp, body = self.client.shelve_server(server['id'])
- self.assertEqual(202, resp.status)
+ self.client.shelve_server(server['id'])
offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
@@ -103,8 +102,7 @@
def test_delete_server_while_in_verify_resize_state(self):
# Delete a server while it's VM state is VERIFY_RESIZE
server = self.create_test_server(wait_until='ACTIVE')
- resp, body = self.client.resize(server['id'], self.flavor_ref_alt)
- self.assertEqual(202, resp.status)
+ self.client.resize(server['id'], self.flavor_ref_alt)
self.client.wait_for_server_status(server['id'], 'VERIFY_RESIZE')
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@@ -144,8 +142,7 @@
def test_delete_server_while_in_error_state(self):
# Delete a server while it's VM state is error
server = self.create_test_server(wait_until='ACTIVE')
- resp, body = self.admin_client.reset_state(server['id'], state='error')
- self.assertEqual(202, resp.status)
+ self.admin_client.reset_state(server['id'], state='error')
# Verify server's state
server = self.non_admin_client.get_server(server['id'])
self.assertEqual(server['status'], 'ERROR')
diff --git a/tempest/api/compute/servers/test_disk_config.py b/tempest/api/compute/servers/test_disk_config.py
index f7a5bfb..76e6128 100644
--- a/tempest/api/compute/servers/test_disk_config.py
+++ b/tempest/api/compute/servers/test_disk_config.py
@@ -48,9 +48,9 @@
# A server should be rebuilt using the manual disk config option
self._update_server_with_disk_config(disk_config='AUTO')
- resp, server = self.client.rebuild(self.server_id,
- self.image_ref_alt,
- disk_config='MANUAL')
+ server = self.client.rebuild(self.server_id,
+ self.image_ref_alt,
+ disk_config='MANUAL')
# Wait for the server to become active
self.client.wait_for_server_status(server['id'], 'ACTIVE')
@@ -64,9 +64,9 @@
# A server should be rebuilt using the auto disk config option
self._update_server_with_disk_config(disk_config='MANUAL')
- resp, server = self.client.rebuild(self.server_id,
- self.image_ref_alt,
- disk_config='AUTO')
+ server = self.client.rebuild(self.server_id,
+ self.image_ref_alt,
+ disk_config='AUTO')
# Wait for the server to become active
self.client.wait_for_server_status(server['id'], 'ACTIVE')
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index 103c241..e02c41b 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -30,11 +30,10 @@
@test.attr(type='gate')
def test_list_instance_actions(self):
# List actions of the provided server
- resp, body = self.client.reboot(self.server_id, 'HARD')
+ self.client.reboot(self.server_id, 'HARD')
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
- resp, body = self.client.list_instance_actions(self.server_id)
- self.assertEqual(200, resp.status)
+ body = self.client.list_instance_actions(self.server_id)
self.assertTrue(len(body) == 2, str(body))
self.assertTrue(any([i for i in body if i['action'] == 'create']))
self.assertTrue(any([i for i in body if i['action'] == 'reboot']))
@@ -42,8 +41,7 @@
@test.attr(type='gate')
def test_get_instance_action(self):
# Get the action details of the provided server
- resp, body = self.client.get_instance_action(self.server_id,
- self.request_id)
- self.assertEqual(200, resp.status)
+ body = self.client.get_instance_action(self.server_id,
+ self.request_id)
self.assertEqual(self.server_id, body['instance_uuid'])
self.assertEqual('create', body['action'])
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index c5148c1..8cc7c80 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -28,11 +28,19 @@
class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
cls.set_network_resources(network=True, subnet=True, dhcp=True)
- super(ListServerFiltersTestJSON, cls).resource_setup()
+ super(ListServerFiltersTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(ListServerFiltersTestJSON, cls).setup_clients()
cls.client = cls.servers_client
+ @classmethod
+ def resource_setup(cls):
+ super(ListServerFiltersTestJSON, cls).resource_setup()
+
# Check to see if the alternate image ref actually exists...
images_client = cls.images_client
images = images_client.list_images()
@@ -83,7 +91,7 @@
def test_list_servers_filter_by_image(self):
# Filter the list of servers by image
params = {'image': self.image_ref}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertIn(self.s1['id'], map(lambda x: x['id'], servers))
@@ -94,7 +102,7 @@
def test_list_servers_filter_by_flavor(self):
# Filter the list of servers by flavor
params = {'flavor': self.flavor_ref_alt}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertNotIn(self.s1['id'], map(lambda x: x['id'], servers))
@@ -105,7 +113,7 @@
def test_list_servers_filter_by_server_name(self):
# Filter the list of servers by server name
params = {'name': self.s1_name}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
@@ -116,7 +124,7 @@
def test_list_servers_filter_by_server_status(self):
# Filter the list of servers by server status
params = {'status': 'active'}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertIn(self.s1['id'], map(lambda x: x['id'], servers))
@@ -130,7 +138,7 @@
self.client.stop(self.s1['id'])
self.client.wait_for_server_status(self.s1['id'],
'SHUTOFF')
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
self.client.start(self.s1['id'])
self.client.wait_for_server_status(self.s1['id'],
'ACTIVE')
@@ -144,22 +152,22 @@
def test_list_servers_filter_by_limit(self):
# Verify only the expected number of servers are returned
params = {'limit': 1}
- resp, servers = self.client.list_servers(params)
+ servers = self.client.list_servers(params)
self.assertEqual(1, len([x for x in servers['servers'] if 'id' in x]))
@test.attr(type='gate')
def test_list_servers_filter_by_zero_limit(self):
# Verify only the expected number of servers are returned
params = {'limit': 0}
- resp, servers = self.client.list_servers(params)
+ servers = self.client.list_servers(params)
self.assertEqual(0, len(servers['servers']))
@test.attr(type='gate')
def test_list_servers_filter_by_exceed_limit(self):
# Verify only the expected number of servers are returned
params = {'limit': 100000}
- resp, servers = self.client.list_servers(params)
- resp, all_servers = self.client.list_servers()
+ servers = self.client.list_servers(params)
+ all_servers = self.client.list_servers()
self.assertEqual(len([x for x in all_servers['servers'] if 'id' in x]),
len([x for x in servers['servers'] if 'id' in x]))
@@ -179,7 +187,7 @@
def test_list_servers_detailed_filter_by_flavor(self):
# Filter the detailed list of servers by flavor
params = {'flavor': self.flavor_ref_alt}
- resp, body = self.client.list_servers_with_detail(params)
+ body = self.client.list_servers_with_detail(params)
servers = body['servers']
self.assertNotIn(self.s1['id'], map(lambda x: x['id'], servers))
@@ -190,7 +198,7 @@
def test_list_servers_detailed_filter_by_server_name(self):
# Filter the detailed list of servers by server name
params = {'name': self.s1_name}
- resp, body = self.client.list_servers_with_detail(params)
+ body = self.client.list_servers_with_detail(params)
servers = body['servers']
self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
@@ -201,7 +209,7 @@
def test_list_servers_detailed_filter_by_server_status(self):
# Filter the detailed list of servers by server status
params = {'status': 'active'}
- resp, body = self.client.list_servers_with_detail(params)
+ body = self.client.list_servers_with_detail(params)
servers = body['servers']
test_ids = [s['id'] for s in (self.s1, self.s2, self.s3)]
@@ -215,7 +223,7 @@
def test_list_servers_filtered_by_name_wildcard(self):
# List all servers that contains '-instance' in name
params = {'name': '-instance'}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
@@ -226,7 +234,7 @@
part_name = self.s1_name[6:-1]
params = {'name': part_name}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
@@ -239,7 +247,7 @@
regexes = ['^.*\-instance\-[0-9]+$', '^.*\-instance\-.*$']
for regex in regexes:
params = {'name': regex}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
@@ -250,7 +258,7 @@
part_name = self.s1_name[-10:]
params = {'name': part_name}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
@@ -264,7 +272,7 @@
self.s1 = self.client.get_server(self.s1['id'])
ip = self.s1['addresses'][self.fixed_network_name][0]['addr']
params = {'ip': ip}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
@@ -281,7 +289,7 @@
self.s1 = self.client.get_server(self.s1['id'])
ip = self.s1['addresses'][self.fixed_network_name][0]['addr'][0:-3]
params = {'ip': ip}
- resp, body = self.client.list_servers(params)
+ body = self.client.list_servers(params)
servers = body['servers']
self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
@@ -292,5 +300,5 @@
def test_list_servers_detailed_limit_results(self):
# Verify only the expected number of detailed results are returned
params = {'limit': 1}
- resp, servers = self.client.list_servers_with_detail(params)
+ servers = self.client.list_servers_with_detail(params)
self.assertEqual(1, len(servers['servers']))
diff --git a/tempest/api/compute/servers/test_list_servers_negative.py b/tempest/api/compute/servers/test_list_servers_negative.py
index 2f12882..7ede69c 100644
--- a/tempest/api/compute/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/servers/test_list_servers_negative.py
@@ -52,62 +52,55 @@
def test_list_servers_with_a_deleted_server(self):
# Verify deleted servers do not show by default in list servers
# List servers and verify server not returned
- resp, body = self.client.list_servers()
+ body = self.client.list_servers()
servers = body['servers']
deleted_ids = [s['id'] for s in self.deleted_fixtures]
actual = [srv for srv in servers
if srv['id'] in deleted_ids]
- self.assertEqual('200', resp['status'])
self.assertEqual([], actual)
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_non_existing_image(self):
# Listing servers for a non existing image returns empty list
non_existing_image = '1234abcd-zzz0-aaa9-ppp3-0987654abcde'
- resp, body = self.client.list_servers(dict(image=non_existing_image))
+ body = self.client.list_servers(dict(image=non_existing_image))
servers = body['servers']
- self.assertEqual('200', resp['status'])
self.assertEqual([], servers)
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_non_existing_flavor(self):
# Listing servers by non existing flavor returns empty list
non_existing_flavor = 1234
- resp, body = self.client.list_servers(dict(flavor=non_existing_flavor))
+ body = self.client.list_servers(dict(flavor=non_existing_flavor))
servers = body['servers']
- self.assertEqual('200', resp['status'])
self.assertEqual([], servers)
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_non_existing_server_name(self):
# Listing servers for a non existent server name returns empty list
non_existing_name = 'junk_server_1234'
- resp, body = self.client.list_servers(dict(name=non_existing_name))
+ body = self.client.list_servers(dict(name=non_existing_name))
servers = body['servers']
- self.assertEqual('200', resp['status'])
self.assertEqual([], servers)
@test.attr(type=['negative', 'gate'])
def test_list_servers_status_non_existing(self):
# Return an empty list when invalid status is specified
non_existing_status = 'BALONEY'
- resp, body = self.client.list_servers(dict(status=non_existing_status))
+ body = self.client.list_servers(dict(status=non_existing_status))
servers = body['servers']
- self.assertEqual('200', resp['status'])
self.assertEqual([], servers)
@test.attr(type='gate')
def test_list_servers_by_limits(self):
# List servers by specifying limits
- resp, body = self.client.list_servers({'limit': 1})
- self.assertEqual('200', resp['status'])
+ body = self.client.list_servers({'limit': 1})
self.assertEqual(1, len([x for x in body['servers'] if 'id' in x]))
@test.attr(type=['negative', 'gate'])
def test_list_servers_by_limits_greater_than_actual_count(self):
# List servers by specifying a greater value for limit
- resp, body = self.client.list_servers({'limit': 100})
- self.assertEqual('200', resp['status'])
+ body = self.client.list_servers({'limit': 100})
self.assertEqual(len(self.existing_fixtures), len(body['servers']))
@test.attr(type=['negative', 'gate'])
@@ -132,17 +125,15 @@
def test_list_servers_by_changes_since_future_date(self):
# Return an empty list when a date in the future is passed
changes_since = {'changes-since': '2051-01-01T12:34:00Z'}
- resp, body = self.client.list_servers(changes_since)
- self.assertEqual('200', resp['status'])
+ body = self.client.list_servers(changes_since)
self.assertEqual(0, len(body['servers']))
@test.attr(type=['negative', 'gate'])
def test_list_servers_detail_server_is_deleted(self):
# Server details are not listed for a deleted server
deleted_ids = [s['id'] for s in self.deleted_fixtures]
- resp, body = self.client.list_servers_with_detail()
+ body = self.client.list_servers_with_detail()
servers = body['servers']
actual = [srv for srv in servers
if srv['id'] in deleted_ids]
- self.assertEqual('200', resp['status'])
self.assertEqual([], actual)
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index f849b8c..a2a71ae 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -65,8 +65,7 @@
def test_change_server_password(self):
# The server's password should be set to the provided password
new_password = 'Newpass1234'
- resp, body = self.client.change_password(self.server_id, new_password)
- self.assertEqual(202, resp.status)
+ self.client.change_password(self.server_id, new_password)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
if self.run_ssh:
@@ -84,8 +83,7 @@
self.password)
boot_time = linux_client.get_boot_time()
- resp, body = self.client.reboot(self.server_id, reboot_type)
- self.assertEqual(202, resp.status)
+ self.client.reboot(self.server_id, reboot_type)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
if self.run_ssh:
@@ -116,12 +114,12 @@
personality = [{'path': 'rebuild.txt',
'contents': base64.b64encode(file_contents)}]
password = 'rebuildPassw0rd'
- resp, rebuilt_server = self.client.rebuild(self.server_id,
- self.image_ref_alt,
- name=new_name,
- metadata=meta,
- personality=personality,
- adminPass=password)
+ rebuilt_server = self.client.rebuild(self.server_id,
+ self.image_ref_alt,
+ name=new_name,
+ metadata=meta,
+ personality=personality,
+ adminPass=password)
# Verify the properties in the initial response are correct
self.assertEqual(self.server_id, rebuilt_server['id'])
@@ -152,10 +150,9 @@
old_image = server['image']['id']
new_image = self.image_ref_alt \
if old_image == self.image_ref else self.image_ref
- resp, server = self.client.stop(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.stop(self.server_id)
self.client.wait_for_server_status(self.server_id, 'SHUTOFF')
- resp, rebuilt_server = self.client.rebuild(self.server_id, new_image)
+ rebuilt_server = self.client.rebuild(self.server_id, new_image)
# Verify the properties in the initial response are correct
self.assertEqual(self.server_id, rebuilt_server['id'])
@@ -191,13 +188,11 @@
self._detect_server_image_flavor(self.server_id)
if stop:
- resp = self.servers_client.stop(self.server_id)[0]
- self.assertEqual(202, resp.status)
+ self.servers_client.stop(self.server_id)
self.servers_client.wait_for_server_status(self.server_id,
'SHUTOFF')
- resp, server = self.client.resize(self.server_id, new_flavor_ref)
- self.assertEqual(202, resp.status)
+ self.client.resize(self.server_id, new_flavor_ref)
self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')
self.client.confirm_resize(self.server_id)
@@ -233,8 +228,7 @@
previous_flavor_ref, new_flavor_ref = \
self._detect_server_image_flavor(self.server_id)
- resp, server = self.client.resize(self.server_id, new_flavor_ref)
- self.assertEqual(202, resp.status)
+ self.client.resize(self.server_id, new_flavor_ref)
self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')
self.client.revert_resize(self.server_id)
@@ -251,10 +245,10 @@
# Positive test:create backup successfully and rotate backups correctly
# create the first and the second backup
backup1 = data_utils.rand_name('backup-1')
- resp, _ = self.servers_client.create_backup(self.server_id,
- 'daily',
- 2,
- backup1)
+ resp = self.servers_client.create_backup(self.server_id,
+ 'daily',
+ 2,
+ backup1).response
oldest_backup_exist = True
# the oldest one should be deleted automatically in this test
@@ -271,18 +265,16 @@
image1_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(_clean_oldest_backup, image1_id)
- self.assertEqual(202, resp.status)
self.os.image_client.wait_for_image_status(image1_id, 'active')
backup2 = data_utils.rand_name('backup-2')
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
- resp, _ = self.servers_client.create_backup(self.server_id,
- 'daily',
- 2,
- backup2)
+ resp = self.servers_client.create_backup(self.server_id,
+ 'daily',
+ 2,
+ backup2).response
image2_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(self.os.image_client.delete_image, image2_id)
- self.assertEqual(202, resp.status)
self.os.image_client.wait_for_image_status(image2_id, 'active')
# verify they have been created
@@ -304,13 +296,12 @@
# the first one will be deleted
backup3 = data_utils.rand_name('backup-3')
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
- resp, _ = self.servers_client.create_backup(self.server_id,
- 'daily',
- 2,
- backup3)
+ resp = self.servers_client.create_backup(self.server_id,
+ 'daily',
+ 2,
+ backup3).response
image3_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(self.os.image_client.delete_image, image3_id)
- self.assertEqual(202, resp.status)
# the first back up should be deleted
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
self.os.image_client.wait_for_resource_deletion(image1_id)
@@ -329,9 +320,8 @@
(image_list[0]['name'], image_list[1]['name']))
def _get_output(self):
- resp, output = self.servers_client.get_console_output(
- self.server_id, 10)
- self.assertEqual(200, resp.status)
+ output = self.servers_client.get_console_output(
+ self.server_id, 10).data
self.assertTrue(output, "Console output was empty.")
lines = len(output.split('\n'))
self.assertEqual(lines, 10)
@@ -348,8 +338,7 @@
# log file is truncated and we cannot get any console log through
# "console-log" API.
# The detail is https://bugs.launchpad.net/nova/+bug/1251920
- resp, body = self.servers_client.reboot(self.server_id, 'HARD')
- self.assertEqual(202, resp.status)
+ self.servers_client.reboot(self.server_id, 'HARD')
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
self.wait_for(self._get_output)
@@ -361,8 +350,8 @@
server = self.create_test_server(wait_until='ACTIVE')
def _check_full_length_console_log():
- _, output = self.servers_client.get_console_output(server['id'],
- None)
+ output = self.servers_client.get_console_output(server['id'],
+ None).data
self.assertTrue(output, "Console output was empty.")
lines = len(output.split('\n'))
@@ -386,8 +375,7 @@
server = self.create_test_server(wait_until='ACTIVE')
temp_server_id = server['id']
- resp, server = self.servers_client.stop(temp_server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.stop(temp_server_id)
self.servers_client.wait_for_server_status(temp_server_id, 'SHUTOFF')
self.wait_for(self._get_output)
@@ -396,30 +384,25 @@
'Pause is not available.')
@test.attr(type='gate')
def test_pause_unpause_server(self):
- resp, server = self.client.pause_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.pause_server(self.server_id)
self.client.wait_for_server_status(self.server_id, 'PAUSED')
- resp, server = self.client.unpause_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.unpause_server(self.server_id)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
'Suspend is not available.')
@test.attr(type='gate')
def test_suspend_resume_server(self):
- resp, server = self.client.suspend_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.suspend_server(self.server_id)
self.client.wait_for_server_status(self.server_id, 'SUSPENDED')
- resp, server = self.client.resume_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.resume_server(self.server_id)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
'Shelve is not available.')
@test.attr(type='gate')
def test_shelve_unshelve_server(self):
- resp, server = self.client.shelve_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.shelve_server(self.server_id)
offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
@@ -430,8 +413,7 @@
self.client.wait_for_server_status(self.server_id,
'SHELVED')
- resp, server = self.client.shelve_offload_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.shelve_offload_server(self.server_id)
self.client.wait_for_server_status(self.server_id,
'SHELVED_OFFLOADED')
@@ -442,36 +424,29 @@
self.assertEqual(1, len(images))
self.assertEqual(image_name, images[0]['name'])
- resp, server = self.client.unshelve_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.unshelve_server(self.server_id)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
@test.attr(type='gate')
def test_stop_start_server(self):
- resp, server = self.servers_client.stop(self.server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.stop(self.server_id)
self.servers_client.wait_for_server_status(self.server_id, 'SHUTOFF')
- resp, server = self.servers_client.start(self.server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.start(self.server_id)
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
@test.attr(type='gate')
def test_lock_unlock_server(self):
# Lock the server,try server stop(exceptions throw),unlock it and retry
- resp, server = self.servers_client.lock_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.lock_server(self.server_id)
server = self.servers_client.get_server(self.server_id)
self.assertEqual(server['status'], 'ACTIVE')
# Locked server is not allowed to be stopped by non-admin user
self.assertRaises(lib_exc.Conflict,
self.servers_client.stop, self.server_id)
- resp, server = self.servers_client.unlock_server(self.server_id)
- self.assertEqual(202, resp.status)
- resp, server = self.servers_client.stop(self.server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.unlock_server(self.server_id)
+ self.servers_client.stop(self.server_id)
self.servers_client.wait_for_server_status(self.server_id, 'SHUTOFF')
- resp, server = self.servers_client.start(self.server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.start(self.server_id)
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
def _validate_url(self, url):
@@ -488,11 +463,8 @@
# Get the VNC console of type 'novnc' and 'xvpvnc'
console_types = ['novnc', 'xvpvnc']
for console_type in console_types:
- resp, body = self.servers_client.get_vnc_console(self.server_id,
- console_type)
- self.assertEqual(
- 200, resp.status,
- "Failed to get Console Type: %s" % (console_types))
+ body = self.servers_client.get_vnc_console(self.server_id,
+ console_type)
self.assertEqual(console_type, body['type'])
self.assertNotEqual('', body['url'])
self._validate_url(body['url'])
diff --git a/tempest/api/compute/servers/test_server_addresses.py b/tempest/api/compute/servers/test_server_addresses.py
index 46e8642..1c7915a 100644
--- a/tempest/api/compute/servers/test_server_addresses.py
+++ b/tempest/api/compute/servers/test_server_addresses.py
@@ -20,12 +20,20 @@
class ServerAddressesTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# This test module might use a network and a subnet
cls.set_network_resources(network=True, subnet=True)
- super(ServerAddressesTestJSON, cls).resource_setup()
+ super(ServerAddressesTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(ServerAddressesTestJSON, cls).setup_clients()
cls.client = cls.servers_client
+ @classmethod
+ def resource_setup(cls):
+ super(ServerAddressesTestJSON, cls).resource_setup()
+
cls.server = cls.create_test_server(wait_until='ACTIVE')
@test.attr(type='smoke')
@@ -34,8 +42,7 @@
# All public and private addresses for
# a server should be returned
- resp, addresses = self.client.list_addresses(self.server['id'])
- self.assertEqual('200', resp['status'])
+ addresses = self.client.list_addresses(self.server['id'])
# We do not know the exact network configuration, but an instance
# should at least have a single public or private address
@@ -52,15 +59,14 @@
# Providing a network type should filter
# the addresses return by that type
- resp, addresses = self.client.list_addresses(self.server['id'])
+ addresses = self.client.list_addresses(self.server['id'])
# Once again we don't know the environment's exact network config,
# but the response for each individual network should be the same
# as the partial result of the full address list
id = self.server['id']
for addr_type in addresses:
- resp, addr = self.client.list_addresses_by_network(id, addr_type)
- self.assertEqual('200', resp['status'])
+ addr = self.client.list_addresses_by_network(id, addr_type)
addr = addr[addr_type]
for address in addresses[addr_type]:
diff --git a/tempest/api/compute/servers/test_server_addresses_negative.py b/tempest/api/compute/servers/test_server_addresses_negative.py
index 3329583..b32231a 100644
--- a/tempest/api/compute/servers/test_server_addresses_negative.py
+++ b/tempest/api/compute/servers/test_server_addresses_negative.py
@@ -22,11 +22,18 @@
class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
cls.set_network_resources(network=True, subnet=True)
- super(ServerAddressesNegativeTestJSON, cls).resource_setup()
+ super(ServerAddressesNegativeTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(ServerAddressesNegativeTestJSON, cls).setup_clients()
cls.client = cls.servers_client
+ @classmethod
+ def resource_setup(cls):
+ super(ServerAddressesNegativeTestJSON, cls).resource_setup()
cls.server = cls.create_test_server(wait_until='ACTIVE')
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/servers/test_server_group.py b/tempest/api/compute/servers/test_server_group.py
index fe5dca0..58ff460 100644
--- a/tempest/api/compute/servers/test_server_group.py
+++ b/tempest/api/compute/servers/test_server_group.py
@@ -37,26 +37,23 @@
server_group_name = data_utils.rand_name('server-group')
cls.policy = ['affinity']
- _, cls.created_server_group = cls.create_test_server_group(
+ cls.created_server_group = cls.create_test_server_group(
server_group_name,
cls.policy)
def _create_server_group(self, name, policy):
# create the test server-group with given policy
server_group = {'name': name, 'policies': policy}
- resp, body = self.create_test_server_group(name, policy)
- self.assertEqual(200, resp.status)
+ body = self.create_test_server_group(name, policy)
for key in ['name', 'policies']:
self.assertEqual(server_group[key], body[key])
return body
def _delete_server_group(self, server_group):
# delete the test server-group
- resp, _ = self.client.delete_server_group(server_group['id'])
- self.assertEqual(204, resp.status)
+ self.client.delete_server_group(server_group['id'])
# validation of server-group deletion
- resp, server_group_list = self.client.list_server_groups()
- self.assertEqual(200, resp.status)
+ server_group_list = self.client.list_server_groups()
self.assertNotIn(server_group, server_group_list)
def _create_delete_server_group(self, policy):
@@ -101,14 +98,12 @@
@test.attr(type='gate')
def test_get_server_group(self):
# Get the server-group
- resp, body = self.client.get_server_group(
+ body = self.client.get_server_group(
self.created_server_group['id'])
- self.assertEqual(200, resp.status)
self.assertEqual(self.created_server_group, body)
@test.attr(type='gate')
def test_list_server_groups(self):
# List the server-group
- resp, body = self.client.list_server_groups()
- self.assertEqual(200, resp.status)
+ body = self.client.list_server_groups()
self.assertIn(self.created_server_group, body)
diff --git a/tempest/api/compute/servers/test_server_metadata.py b/tempest/api/compute/servers/test_server_metadata.py
index 7e8247f..c7c74f7 100644
--- a/tempest/api/compute/servers/test_server_metadata.py
+++ b/tempest/api/compute/servers/test_server_metadata.py
@@ -30,16 +30,14 @@
def setUp(self):
super(ServerMetadataTestJSON, self).setUp()
meta = {'key1': 'value1', 'key2': 'value2'}
- resp, _ = self.client.set_server_metadata(self.server_id, meta)
- self.assertEqual(resp.status, 200)
+ self.client.set_server_metadata(self.server_id, meta)
@test.attr(type='gate')
def test_list_server_metadata(self):
# All metadata key/value pairs for a server should be returned
- resp, resp_metadata = self.client.list_server_metadata(self.server_id)
+ resp_metadata = self.client.list_server_metadata(self.server_id)
# Verify the expected metadata items are in the list
- self.assertEqual(200, resp.status)
expected = {'key1': 'value1', 'key2': 'value2'}
self.assertEqual(expected, resp_metadata)
@@ -48,13 +46,11 @@
# The server's metadata should be replaced with the provided values
# Create a new set of metadata for the server
req_metadata = {'meta2': 'data2', 'meta3': 'data3'}
- resp, metadata = self.client.set_server_metadata(self.server_id,
- req_metadata)
- self.assertEqual(200, resp.status)
+ self.client.set_server_metadata(self.server_id, req_metadata)
# Verify the expected values are correct, and that the
# previous values have been removed
- resp, resp_metadata = self.client.list_server_metadata(self.server_id)
+ resp_metadata = self.client.list_server_metadata(self.server_id)
self.assertEqual(resp_metadata, req_metadata)
@test.attr(type='gate')
@@ -62,12 +58,10 @@
# The server's metadata values should be updated to the
# provided values
meta = {'key1': 'alt1', 'key3': 'value3'}
- resp, metadata = self.client.update_server_metadata(self.server_id,
- meta)
- self.assertEqual(200, resp.status)
+ self.client.update_server_metadata(self.server_id, meta)
# Verify the values have been updated to the proper values
- resp, resp_metadata = self.client.list_server_metadata(self.server_id)
+ resp_metadata = self.client.list_server_metadata(self.server_id)
expected = {'key1': 'alt1', 'key2': 'value2', 'key3': 'value3'}
self.assertEqual(expected, resp_metadata)
@@ -76,16 +70,15 @@
# The original metadata should not be lost if empty metadata body is
# passed
meta = {}
- _, metadata = self.client.update_server_metadata(self.server_id, meta)
- resp, resp_metadata = self.client.list_server_metadata(self.server_id)
+ self.client.update_server_metadata(self.server_id, meta)
+ resp_metadata = self.client.list_server_metadata(self.server_id)
expected = {'key1': 'value1', 'key2': 'value2'}
self.assertEqual(expected, resp_metadata)
@test.attr(type='gate')
def test_get_server_metadata_item(self):
# The value for a specific metadata key should be returned
- resp, meta = self.client.get_server_metadata_item(self.server_id,
- 'key2')
+ meta = self.client.get_server_metadata_item(self.server_id, 'key2')
self.assertEqual('value2', meta['key2'])
@test.attr(type='gate')
@@ -93,23 +86,19 @@
# The item's value should be updated to the provided value
# Update the metadata value
meta = {'nova': 'alt'}
- resp, body = self.client.set_server_metadata_item(self.server_id,
- 'nova', meta)
- self.assertEqual(200, resp.status)
+ self.client.set_server_metadata_item(self.server_id, 'nova', meta)
# Verify the meta item's value has been updated
- resp, resp_metadata = self.client.list_server_metadata(self.server_id)
+ resp_metadata = self.client.list_server_metadata(self.server_id)
expected = {'key1': 'value1', 'key2': 'value2', 'nova': 'alt'}
self.assertEqual(expected, resp_metadata)
@test.attr(type='gate')
def test_delete_server_metadata_item(self):
# The metadata value/key pair should be deleted from the server
- resp, meta = self.client.delete_server_metadata_item(self.server_id,
- 'key1')
- self.assertEqual(204, resp.status)
+ self.client.delete_server_metadata_item(self.server_id, 'key1')
# Verify the metadata item has been removed
- resp, resp_metadata = self.client.list_server_metadata(self.server_id)
+ resp_metadata = self.client.list_server_metadata(self.server_id)
expected = {'key2': 'value2'}
self.assertEqual(expected, resp_metadata)
diff --git a/tempest/api/compute/servers/test_server_password.py b/tempest/api/compute/servers/test_server_password.py
index b2e09f2..a814359 100644
--- a/tempest/api/compute/servers/test_server_password.py
+++ b/tempest/api/compute/servers/test_server_password.py
@@ -28,10 +28,8 @@
@test.attr(type='gate')
def test_get_server_password(self):
- resp, body = self.client.get_password(self.server['id'])
- self.assertEqual(200, resp.status)
+ self.client.get_password(self.server['id'])
@test.attr(type='gate')
def test_delete_server_password(self):
- resp, body = self.client.delete_password(self.server['id'])
- self.assertEqual(204, resp.status)
+ self.client.delete_password(self.server['id'])
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index a1658df..a096fd8 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -24,12 +24,19 @@
class ServerRescueTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(ServerRescueTestJSON, cls).skip_checks()
if not CONF.compute_feature_enabled.rescue:
msg = "Server rescue not available."
raise cls.skipException(msg)
+ @classmethod
+ def setup_credentials(cls):
cls.set_network_resources(network=True, subnet=True, router=True)
+ super(ServerRescueTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def resource_setup(cls):
super(ServerRescueTestJSON, cls).resource_setup()
# Floating IP creation
@@ -66,18 +73,15 @@
super(ServerRescueTestJSON, self).tearDown()
def _unrescue(self, server_id):
- resp, body = self.servers_client.unrescue_server(server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.unrescue_server(server_id)
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
@test.attr(type='smoke')
def test_rescue_unrescue_instance(self):
- resp, body = self.servers_client.rescue_server(
+ self.servers_client.rescue_server(
self.server_id, adminPass=self.password)
- self.assertEqual(200, resp.status)
self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
- resp, body = self.servers_client.unrescue_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.unrescue_server(self.server_id)
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
@test.attr(type='gate')
@@ -106,11 +110,8 @@
self.addCleanup(self._unrescue, self.server_id)
# Add Security group
- resp, body = self.servers_client.add_security_group(self.server_id,
- self.sg_name)
- self.assertEqual(202, resp.status)
+ self.servers_client.add_security_group(self.server_id, self.sg_name)
# Delete Security group
- resp, body = self.servers_client.remove_security_group(self.server_id,
- self.sg_name)
- self.assertEqual(202, resp.status)
+ self.servers_client.remove_security_group(self.server_id,
+ self.sg_name)
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index 0583106..904e42b 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -27,12 +27,19 @@
class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(ServerRescueNegativeTestJSON, cls).skip_checks()
if not CONF.compute_feature_enabled.rescue:
msg = "Server rescue not available."
raise cls.skipException(msg)
+ @classmethod
+ def setup_credentials(cls):
cls.set_network_resources(network=True, subnet=True, router=True)
+ super(ServerRescueNegativeTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def resource_setup(cls):
super(ServerRescueNegativeTestJSON, cls).resource_setup()
cls.device = CONF.compute.volume_device_name
@@ -64,13 +71,11 @@
'available')
def _unrescue(self, server_id):
- resp, body = self.servers_client.unrescue_server(server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.unrescue_server(server_id)
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
def _unpause(self, server_id):
- resp, body = self.servers_client.unpause_server(server_id)
- self.assertEqual(202, resp.status)
+ self.servers_client.unpause_server(server_id)
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -78,9 +83,8 @@
@test.attr(type=['negative', 'gate'])
def test_rescue_paused_instance(self):
# Rescue a paused server
- resp, body = self.servers_client.pause_server(self.server_id)
+ self.servers_client.pause_server(self.server_id)
self.addCleanup(self._unpause, self.server_id)
- self.assertEqual(202, resp.status)
self.servers_client.wait_for_server_status(self.server_id, 'PAUSED')
self.assertRaises(lib_exc.Conflict,
self.servers_client.rescue_server,
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index d89aff4..d973242 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -345,8 +345,7 @@
@test.attr(type=['negative', 'gate'])
def test_suspend_server_invalid_state(self):
# suspend a suspended server.
- resp, _ = self.client.suspend_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.suspend_server(self.server_id)
self.client.wait_for_server_status(self.server_id, 'SUSPENDED')
self.assertRaises(lib_exc.Conflict,
self.client.suspend_server,
@@ -416,8 +415,7 @@
@test.attr(type=['negative', 'gate'])
def test_shelve_shelved_server(self):
# shelve a shelved server.
- resp, server = self.client.shelve_server(self.server_id)
- self.assertEqual(202, resp.status)
+ self.client.shelve_server(self.server_id)
offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
diff --git a/tempest/api/compute/servers/test_virtual_interfaces.py b/tempest/api/compute/servers/test_virtual_interfaces.py
index bc26881..564704e 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces.py
@@ -26,11 +26,19 @@
class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# This test needs a network and a subnet
cls.set_network_resources(network=True, subnet=True)
- super(VirtualInterfacesTestJSON, cls).resource_setup()
+ super(VirtualInterfacesTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(VirtualInterfacesTestJSON, cls).setup_clients()
cls.client = cls.servers_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(VirtualInterfacesTestJSON, cls).resource_setup()
server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
@@ -41,8 +49,7 @@
def test_list_virtual_interfaces(self):
# Positive test:Should be able to GET the virtual interfaces list
# for a given server_id
- resp, output = self.client.list_virtual_interfaces(self.server_id)
- self.assertEqual(200, resp.status)
+ output = self.client.list_virtual_interfaces(self.server_id)
self.assertIsNotNone(output)
virt_ifaces = output
self.assertNotEqual(0, len(virt_ifaces['virtual_interfaces']),
diff --git a/tempest/api/compute/servers/test_virtual_interfaces_negative.py b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
index d66b7ba..58c4fcd 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces_negative.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
@@ -24,10 +24,14 @@
class VirtualInterfacesNegativeTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
# For this test no network resources are needed
cls.set_network_resources()
- super(VirtualInterfacesNegativeTestJSON, cls).resource_setup()
+ super(VirtualInterfacesNegativeTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(VirtualInterfacesNegativeTestJSON, cls).setup_clients()
cls.client = cls.servers_client
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 754b15a..b64981f 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -30,30 +30,42 @@
class AuthorizationTestJSON(base.BaseV2ComputeTest):
+
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(AuthorizationTestJSON, cls).skip_checks()
if not CONF.service_available.glance:
raise cls.skipException('Glance is not available.')
+
+ @classmethod
+ def setup_credentials(cls):
# No network resources required for this test
cls.set_network_resources()
- super(AuthorizationTestJSON, cls).resource_setup()
+ super(AuthorizationTestJSON, cls).setup_credentials()
if not cls.multi_user:
msg = "Need >1 user"
raise cls.skipException(msg)
+
+ creds = cls.isolated_creds.get_alt_creds()
+ cls.alt_manager = clients.Manager(credentials=creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(AuthorizationTestJSON, cls).setup_clients()
cls.client = cls.os.servers_client
cls.images_client = cls.os.images_client
cls.glance_client = cls.os.image_client
cls.keypairs_client = cls.os.keypairs_client
cls.security_client = cls.os.security_groups_client
- creds = cls.isolated_creds.get_alt_creds()
- cls.alt_manager = clients.Manager(credentials=creds)
-
cls.alt_client = cls.alt_manager.servers_client
cls.alt_images_client = cls.alt_manager.images_client
cls.alt_keypairs_client = cls.alt_manager.keypairs_client
cls.alt_security_client = cls.alt_manager.security_groups_client
+ @classmethod
+ def resource_setup(cls):
+ super(AuthorizationTestJSON, cls).resource_setup()
server = cls.create_test_server(wait_until='ACTIVE')
cls.server = cls.client.get_server(server['id'])
@@ -129,7 +141,7 @@
# show on alternate tenant
# Listing servers from alternate tenant
alt_server_ids = []
- resp, body = self.alt_client.list_servers()
+ body = self.alt_client.list_servers()
alt_server_ids = [s['id'] for s in body['servers']]
self.assertNotIn(self.server['id'], alt_server_ids)
diff --git a/tempest/api/compute/test_live_block_migration.py b/tempest/api/compute/test_live_block_migration.py
index 6da6b79..235b058 100644
--- a/tempest/api/compute/test_live_block_migration.py
+++ b/tempest/api/compute/test_live_block_migration.py
@@ -51,7 +51,7 @@
return self._get_server_details(server_id)[self._host_key]
def _migrate_server_to(self, server_id, dest_host):
- _resp, body = self.admin_servers_client.live_migrate_server(
+ body = self.admin_servers_client.live_migrate_server(
server_id, dest_host,
CONF.compute_feature_enabled.block_migration_for_live_migration)
return body
diff --git a/tempest/api/compute/test_live_block_migration_negative.py b/tempest/api/compute/test_live_block_migration_negative.py
index 586bc5c..34c75d5 100644
--- a/tempest/api/compute/test_live_block_migration_negative.py
+++ b/tempest/api/compute/test_live_block_migration_negative.py
@@ -35,7 +35,7 @@
cls.admin_servers_client = cls.os_adm.servers_client
def _migrate_server_to(self, server_id, dest_host):
- _resp, body = self.admin_servers_client.live_migrate_server(
+ body = self.admin_servers_client.live_migrate_server(
server_id, dest_host,
CONF.compute_feature_enabled.
block_migration_for_live_migration)
diff --git a/tempest/api/compute/test_networks.py b/tempest/api/compute/test_networks.py
index 86779b3..033f4a5 100644
--- a/tempest/api/compute/test_networks.py
+++ b/tempest/api/compute/test_networks.py
@@ -29,5 +29,5 @@
@test.attr(type='gate')
def test_list_networks(self):
- _, networks = self.client.list_networks()
+ networks = self.client.list_networks()
self.assertNotEmpty(networks, "No networks found.")
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 64ea555..424b0fa 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -30,14 +30,22 @@
self.attachment = None
@classmethod
- def resource_setup(cls):
- cls.prepare_instance_network()
- super(AttachVolumeTestJSON, cls).resource_setup()
- cls.device = CONF.compute.volume_device_name
+ def skip_checks(cls):
+ super(AttachVolumeTestJSON, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_credentials(cls):
+ cls.prepare_instance_network()
+ super(AttachVolumeTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def resource_setup(cls):
+ super(AttachVolumeTestJSON, cls).resource_setup()
+ cls.device = CONF.compute.volume_device_name
+
def _detach(self, server_id, volume_id):
if self.attachment:
self.servers_client.detach_volume(server_id, volume_id)
@@ -57,7 +65,7 @@
adminPass=admin_pass)
# Record addresses so that we can ssh later
- _, self.server['addresses'] = (
+ self.server['addresses'] = (
self.servers_client.list_addresses(self.server['id']))
# Create a volume and wait for it to become ready
diff --git a/tempest/api/compute/volumes/test_volumes_get.py b/tempest/api/compute/volumes/test_volumes_get.py
index 69998d2..aa4fb52 100644
--- a/tempest/api/compute/volumes/test_volumes_get.py
+++ b/tempest/api/compute/volumes/test_volumes_get.py
@@ -27,13 +27,17 @@
class VolumesGetTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesGetTestJSON, cls).resource_setup()
- cls.client = cls.volumes_extensions_client
+ def skip_checks(cls):
+ super(VolumesGetTestJSON, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesGetTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_extensions_client
+
@test.attr(type='smoke')
def test_volume_create_get_delete(self):
# CREATE, GET, DELETE Volume
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index ba7ee6b..cb74876 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -32,12 +32,20 @@
"""
@classmethod
- def resource_setup(cls):
- super(VolumesTestJSON, cls).resource_setup()
- cls.client = cls.volumes_extensions_client
+ def skip_checks(cls):
+ super(VolumesTestJSON, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_extensions_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesTestJSON, cls).resource_setup()
# Create 3 Volumes
cls.volume_list = []
cls.volume_id_list = []
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index ed54aaf..53217c9 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -28,13 +28,17 @@
class VolumesNegativeTest(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesNegativeTest, cls).resource_setup()
- cls.client = cls.volumes_extensions_client
+ def skip_checks(cls):
+ super(VolumesNegativeTest, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesNegativeTest, cls).setup_clients()
+ cls.client = cls.volumes_extensions_client
+
@test.attr(type=['negative', 'gate'])
def test_volume_get_nonexistent_volume_id(self):
# Negative: Should not be able to get details of nonexistent volume
diff --git a/tempest/api/database/flavors/test_flavors.py b/tempest/api/database/flavors/test_flavors.py
index bb7035b..db8939e 100644
--- a/tempest/api/database/flavors/test_flavors.py
+++ b/tempest/api/database/flavors/test_flavors.py
@@ -27,7 +27,7 @@
@test.attr(type='smoke')
def test_get_db_flavor(self):
# The expected flavor details should be returned
- _, flavor = self.client.get_db_flavor_details(self.db_flavor_ref)
+ flavor = self.client.get_db_flavor_details(self.db_flavor_ref)
self.assertEqual(self.db_flavor_ref, str(flavor['id']))
self.assertIn('ram', flavor)
self.assertIn('links', flavor)
@@ -35,9 +35,9 @@
@test.attr(type='smoke')
def test_list_db_flavors(self):
- _, flavor = self.client.get_db_flavor_details(self.db_flavor_ref)
+ flavor = self.client.get_db_flavor_details(self.db_flavor_ref)
# List of all flavors should contain the expected flavor
- _, flavors = self.client.list_db_flavors()
+ flavors = self.client.list_db_flavors()
self.assertIn(flavor, flavors)
def _check_values(self, names, db_flavor, os_flavor, in_db=True):
@@ -54,13 +54,13 @@
@test.attr(type='smoke')
@test.services('compute')
def test_compare_db_flavors_with_os(self):
- _, db_flavors = self.client.list_db_flavors()
+ db_flavors = self.client.list_db_flavors()
os_flavors = self.os_flavors_client.list_flavors_with_detail()
self.assertEqual(len(os_flavors), len(db_flavors),
"OS flavors %s do not match DB flavors %s" %
(os_flavors, db_flavors))
for os_flavor in os_flavors:
- _, db_flavor =\
+ db_flavor =\
self.client.get_db_flavor_details(os_flavor['id'])
self._check_values(['id', 'name', 'ram'], db_flavor, os_flavor)
self._check_values(['disk', 'vcpus', 'swap'], db_flavor, os_flavor,
diff --git a/tempest/api/database/limits/test_limits.py b/tempest/api/database/limits/test_limits.py
index 68a3884..d1c9baf 100644
--- a/tempest/api/database/limits/test_limits.py
+++ b/tempest/api/database/limits/test_limits.py
@@ -28,7 +28,7 @@
def test_absolute_limits(self):
# Test to verify if all absolute limit paramaters are
# present when verb is ABSOLUTE
- _, limits = self.client.list_db_limits()
+ limits = self.client.list_db_limits()
expected_abs_limits = ['max_backups', 'max_volumes',
'max_instances', 'verb']
absolute_limit = [l for l in limits
diff --git a/tempest/api/database/versions/test_versions.py b/tempest/api/database/versions/test_versions.py
index 37a7407..8960437 100644
--- a/tempest/api/database/versions/test_versions.py
+++ b/tempest/api/database/versions/test_versions.py
@@ -26,7 +26,7 @@
@test.attr(type='smoke')
def test_list_db_versions(self):
- _, versions = self.client.list_db_versions()
+ versions = self.client.list_db_versions()
self.assertTrue(len(versions) > 0, "No database versions found")
# List of all versions should contain the current version, and there
# should only be one 'current' version
diff --git a/tempest/api/identity/admin/v3/test_default_project_id.py b/tempest/api/identity/admin/v3/test_default_project_id.py
index 72d323a..649ca34 100644
--- a/tempest/api/identity/admin/v3/test_default_project_id.py
+++ b/tempest/api/identity/admin/v3/test_default_project_id.py
@@ -14,15 +14,18 @@
from tempest import auth
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import test
+CONF = config.CONF
+
class TestDefaultProjectId (base.BaseIdentityV3AdminTest):
@classmethod
- def resource_setup(cls):
+ def setup_credentials(cls):
cls.set_network_resources()
- super(TestDefaultProjectId, cls).resource_setup()
+ super(TestDefaultProjectId, cls).setup_credentials()
def _delete_domain(self, domain_id):
# It is necessary to disable the domain before deleting,
@@ -71,7 +74,8 @@
creds = auth.KeystoneV3Credentials(username=user_name,
password=user_name,
domain_name=dom_name)
- auth_provider = auth.KeystoneV3AuthProvider(creds)
+ auth_provider = auth.KeystoneV3AuthProvider(creds,
+ CONF.identity.uri_v3)
creds = auth_provider.fill_credentials()
admin_client = clients.Manager(credentials=creds)
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 2283c21..75cb6bd 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -21,10 +21,14 @@
class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
@classmethod
- def resource_setup(cls):
- super(EndPointsTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(EndPointsTestJSON, cls).setup_clients()
cls.identity_client = cls.client
cls.client = cls.endpoints_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(EndPointsTestJSON, cls).resource_setup()
cls.service_ids = list()
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index cf41f9c..ff450e1 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -24,10 +24,14 @@
class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
@classmethod
- def resource_setup(cls):
- super(EndpointsNegativeTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(EndpointsNegativeTestJSON, cls).setup_clients()
cls.identity_client = cls.client
cls.client = cls.endpoints_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(EndpointsNegativeTestJSON, cls).resource_setup()
cls.service_ids = list()
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index 6dfddb0..d4a83e2 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -20,10 +20,6 @@
class GroupsV3TestJSON(base.BaseIdentityV3AdminTest):
- @classmethod
- def resource_setup(cls):
- super(GroupsV3TestJSON, cls).resource_setup()
-
@test.attr(type='smoke')
def test_group_create_update_get(self):
name = data_utils.rand_name('Group')
diff --git a/tempest/api/identity/admin/v3/test_regions.py b/tempest/api/identity/admin/v3/test_regions.py
index 359c0cf..2ea7107 100644
--- a/tempest/api/identity/admin/v3/test_regions.py
+++ b/tempest/api/identity/admin/v3/test_regions.py
@@ -23,10 +23,14 @@
class RegionsTestJSON(base.BaseIdentityV3AdminTest):
@classmethod
+ def setup_clients(cls):
+ super(RegionsTestJSON, cls).setup_clients()
+ cls.client = cls.region_client
+
+ @classmethod
def resource_setup(cls):
super(RegionsTestJSON, cls).resource_setup()
cls.setup_regions = list()
- cls.client = cls.region_client
for i in range(2):
r_description = data_utils.rand_name('description-')
region = cls.client.create_region(r_description)
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index 15ca21e..747911b 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -139,9 +139,11 @@
self.client.add_group_user(self.group_body['id'], self.user_body['id'])
self.addCleanup(self.client.delete_group_user,
self.group_body['id'], self.user_body['id'])
- body = self.token.auth(self.user_body['id'], self.u_password,
- self.project['name'],
- domain=self.domain['name'])
+ body = self.token.auth(user=self.user_body['id'],
+ password=self.u_password,
+ user_domain=self.domain['name'],
+ project=self.project['name'],
+ project_domain=self.domain['name'])
roles = body['token']['roles']
self.assertEqual(len(roles), 1)
self.assertEqual(roles[0]['id'], self.role['id'])
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index 36be098..919eab9 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -108,8 +108,8 @@
# Use the unscoped token to get a scoped token.
token_auth = self.token.auth(token=token_id,
- tenant=project1_name,
- domain='Default')
+ project=project1_name,
+ project_domain='Default')
token1_id = token_auth.response['x-subject-token']
self.assertEqual(orig_expires_at, token_auth['token']['expires_at'],
@@ -138,8 +138,8 @@
# Now get another scoped token using the unscoped token.
token_auth = self.token.auth(token=token_id,
- tenant=project2_name,
- domain='Default')
+ project=project2_name,
+ project_domain='Default')
self.assertEqual(project2['id'],
token_auth['token']['project']['id'])
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 8f07a6a..ce54baa 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -29,8 +29,8 @@
class BaseIdentityAdminTest(tempest.test.BaseTestCase):
@classmethod
- def resource_setup(cls):
- super(BaseIdentityAdminTest, cls).resource_setup()
+ def setup_credentials(cls):
+ super(BaseIdentityAdminTest, cls).setup_credentials()
cls.os_adm = clients.AdminManager()
cls.os = clients.Manager()
@@ -72,18 +72,27 @@
class BaseIdentityV2AdminTest(BaseIdentityAdminTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(BaseIdentityV2AdminTest, cls).skip_checks()
if not CONF.identity_feature_enabled.api_v2:
raise cls.skipException("Identity api v2 is not enabled")
- super(BaseIdentityV2AdminTest, cls).resource_setup()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseIdentityV2AdminTest, cls).setup_clients()
cls.client = cls.os_adm.identity_client
cls.token_client = cls.os_adm.token_client
if not cls.client.has_admin_extensions():
raise cls.skipException("Admin extensions disabled")
- cls.data = DataGenerator(cls.client)
+
cls.non_admin_client = cls.os.identity_client
@classmethod
+ def resource_setup(cls):
+ super(BaseIdentityV2AdminTest, cls).resource_setup()
+ cls.data = DataGenerator(cls.client)
+
+ @classmethod
def resource_cleanup(cls):
cls.data.teardown_all()
super(BaseIdentityV2AdminTest, cls).resource_cleanup()
@@ -92,10 +101,14 @@
class BaseIdentityV3AdminTest(BaseIdentityAdminTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(BaseIdentityV3AdminTest, cls).skip_checks()
if not CONF.identity_feature_enabled.api_v3:
raise cls.skipException("Identity api v3 is not enabled")
- super(BaseIdentityV3AdminTest, cls).resource_setup()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseIdentityV3AdminTest, cls).setup_clients()
cls.client = cls.os_adm.identity_v3_client
cls.token = cls.os_adm.token_v3_client
cls.endpoints_client = cls.os_adm.endpoints_client
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 344742b..ffc3071 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -31,16 +31,24 @@
"""Base test class for Image API tests."""
@classmethod
+ def skip_checks(cls):
+ super(BaseImageTest, cls).skip_checks()
+ if not CONF.service_available.glance:
+ skip_msg = ("%s skipped as glance is not available" % cls.__name__)
+ raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseImageTest, cls).setup_credentials()
+ cls.isolated_creds = credentials.get_isolated_credentials(
+ cls.__name__, network_resources=cls.network_resources)
+ cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
+
+ @classmethod
def resource_setup(cls):
cls.set_network_resources()
super(BaseImageTest, cls).resource_setup()
cls.created_images = []
- cls.isolated_creds = credentials.get_isolated_credentials(
- cls.__name__, network_resources=cls.network_resources)
- if not CONF.service_available.glance:
- skip_msg = ("%s skipped as glance is not available" % cls.__name__)
- raise cls.skipException(skip_msg)
- cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
@classmethod
def resource_cleanup(cls):
@@ -75,21 +83,33 @@
class BaseV1ImageTest(BaseImageTest):
@classmethod
- def resource_setup(cls):
- super(BaseV1ImageTest, cls).resource_setup()
- cls.client = cls.os.image_client
+ def skip_checks(cls):
+ super(BaseV1ImageTest, cls).skip_checks()
if not CONF.image_feature_enabled.api_v1:
msg = "Glance API v1 not supported"
raise cls.skipException(msg)
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV1ImageTest, cls).setup_clients()
+ cls.client = cls.os.image_client
+
class BaseV1ImageMembersTest(BaseV1ImageTest):
+
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseV1ImageMembersTest, cls).setup_credentials()
+ cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV1ImageMembersTest, cls).setup_clients()
+ cls.alt_img_cli = cls.os_alt.image_client
+
@classmethod
def resource_setup(cls):
super(BaseV1ImageMembersTest, cls).resource_setup()
- cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
-
- cls.alt_img_cli = cls.os_alt.image_client
cls.alt_tenant_id = cls.alt_img_cli.tenant_id
def _create_image(self):
@@ -105,23 +125,35 @@
class BaseV2ImageTest(BaseImageTest):
@classmethod
- def resource_setup(cls):
- super(BaseV2ImageTest, cls).resource_setup()
- cls.client = cls.os.image_client_v2
+ def skip_checks(cls):
+ super(BaseV2ImageTest, cls).skip_checks()
if not CONF.image_feature_enabled.api_v2:
msg = "Glance API v2 not supported"
raise cls.skipException(msg)
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV2ImageTest, cls).setup_clients()
+ cls.client = cls.os.image_client_v2
+
class BaseV2MemberImageTest(BaseV2ImageTest):
@classmethod
- def resource_setup(cls):
- super(BaseV2MemberImageTest, cls).resource_setup()
+ def setup_credentials(cls):
+ super(BaseV2MemberImageTest, cls).setup_credentials()
creds = cls.isolated_creds.get_alt_creds()
cls.os_alt = clients.Manager(creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV2MemberImageTest, cls).setup_clients()
cls.os_img_client = cls.os.image_client_v2
cls.alt_img_client = cls.os_alt.image_client_v2
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseV2MemberImageTest, cls).resource_setup()
cls.alt_tenant_id = cls.alt_img_client.tenant_id
def _list_image_ids_as_alt(self):
diff --git a/tempest/api/messaging/base.py b/tempest/api/messaging/base.py
index eae0707..c8dc5e0 100644
--- a/tempest/api/messaging/base.py
+++ b/tempest/api/messaging/base.py
@@ -58,114 +58,114 @@
@classmethod
def create_queue(cls, queue_name):
"""Wrapper utility that returns a test queue."""
- resp, body = cls.client.create_queue(queue_name)
- return resp, body
+ body = cls.client.create_queue(queue_name)
+ return body
@classmethod
def delete_queue(cls, queue_name):
"""Wrapper utility that deletes a test queue."""
- resp, body = cls.client.delete_queue(queue_name)
- return resp, body
+ body = cls.client.delete_queue(queue_name)
+ return body
@classmethod
def check_queue_exists(cls, queue_name):
"""Wrapper utility that checks the existence of a test queue."""
- resp, body = cls.client.get_queue(queue_name)
- return resp, body
+ body = cls.client.get_queue(queue_name)
+ return body
@classmethod
def check_queue_exists_head(cls, queue_name):
"""Wrapper utility checks the head of a queue via http HEAD."""
- resp, body = cls.client.head_queue(queue_name)
- return resp, body
+ body = cls.client.head_queue(queue_name)
+ return body
@classmethod
def list_queues(cls):
"""Wrapper utility that lists queues."""
- resp, body = cls.client.list_queues()
- return resp, body
+ body = cls.client.list_queues()
+ return body
@classmethod
def get_queue_stats(cls, queue_name):
"""Wrapper utility that returns the queue stats."""
- resp, body = cls.client.get_queue_stats(queue_name)
- return resp, body
+ body = cls.client.get_queue_stats(queue_name)
+ return body
@classmethod
def get_queue_metadata(cls, queue_name):
"""Wrapper utility that gets a queue metadata."""
- resp, body = cls.client.get_queue_metadata(queue_name)
- return resp, body
+ body = cls.client.get_queue_metadata(queue_name)
+ return body
@classmethod
def set_queue_metadata(cls, queue_name, rbody):
"""Wrapper utility that sets the metadata of a queue."""
- resp, body = cls.client.set_queue_metadata(queue_name, rbody)
- return resp, body
+ body = cls.client.set_queue_metadata(queue_name, rbody)
+ return body
@classmethod
def post_messages(cls, queue_name, rbody):
"""Wrapper utility that posts messages to a queue."""
- resp, body = cls.client.post_messages(queue_name, rbody)
+ body = cls.client.post_messages(queue_name, rbody)
- return resp, body
+ return body
@classmethod
def list_messages(cls, queue_name):
"""Wrapper utility that lists the messages in a queue."""
- resp, body = cls.client.list_messages(queue_name)
+ body = cls.client.list_messages(queue_name)
- return resp, body
+ return body
@classmethod
def get_single_message(cls, message_uri):
"""Wrapper utility that gets a single message."""
- resp, body = cls.client.get_single_message(message_uri)
+ body = cls.client.get_single_message(message_uri)
- return resp, body
+ return body
@classmethod
def get_multiple_messages(cls, message_uri):
"""Wrapper utility that gets multiple messages."""
- resp, body = cls.client.get_multiple_messages(message_uri)
+ body = cls.client.get_multiple_messages(message_uri)
- return resp, body
+ return body
@classmethod
def delete_messages(cls, message_uri):
"""Wrapper utility that deletes messages."""
- resp, body = cls.client.delete_messages(message_uri)
+ body = cls.client.delete_messages(message_uri)
- return resp, body
+ return body
@classmethod
def post_claims(cls, queue_name, rbody, url_params=False):
"""Wrapper utility that claims messages."""
- resp, body = cls.client.post_claims(
+ body = cls.client.post_claims(
queue_name, rbody, url_params=False)
- return resp, body
+ return body
@classmethod
def query_claim(cls, claim_uri):
"""Wrapper utility that gets a claim."""
- resp, body = cls.client.query_claim(claim_uri)
+ body = cls.client.query_claim(claim_uri)
- return resp, body
+ return body
@classmethod
def update_claim(cls, claim_uri, rbody):
"""Wrapper utility that updates a claim."""
- resp, body = cls.client.update_claim(claim_uri, rbody)
+ body = cls.client.update_claim(claim_uri, rbody)
- return resp, body
+ return body
@classmethod
def release_claim(cls, claim_uri):
"""Wrapper utility that deletes a claim."""
- resp, body = cls.client.release_claim(claim_uri)
+ body = cls.client.release_claim(claim_uri)
- return resp, body
+ return body
@classmethod
def generate_message_body(cls, repeat=1):
diff --git a/tempest/api/messaging/test_claims.py b/tempest/api/messaging/test_claims.py
index c9064b0..ef5e4f7 100644
--- a/tempest/api/messaging/test_claims.py
+++ b/tempest/api/messaging/test_claims.py
@@ -49,14 +49,14 @@
claim_grace = data_utils.\
rand_int_id(start=60, end=CONF.messaging.max_claim_grace)
claim_body = {"ttl": claim_ttl, "grace": claim_grace}
- resp, body = self.client.post_claims(queue_name=self.queue_name,
- rbody=claim_body)
+ body = self.client.post_claims(queue_name=self.queue_name,
+ rbody=claim_body)
- return resp, body
+ return body
@test.attr(type='smoke')
def test_post_claim(self):
- _, body = self._post_and_claim_messages(queue_name=self.queue_name)
+ body = self._post_and_claim_messages(queue_name=self.queue_name)
claimed_message_uri = body[0]['href']
# Skipping this step till bug-1331517 is fixed
@@ -70,10 +70,10 @@
@test.attr(type='smoke')
def test_query_claim(self):
# Post a Claim
- resp, body = self._post_and_claim_messages(queue_name=self.queue_name)
+ body = self._post_and_claim_messages(queue_name=self.queue_name)
# Query Claim
- claim_uri = resp['location']
+ claim_uri = body.response['location']
self.client.query_claim(claim_uri)
# Delete Claimed message
@@ -84,9 +84,9 @@
@test.attr(type='smoke')
def test_update_claim(self):
# Post a Claim
- resp, body = self._post_and_claim_messages(queue_name=self.queue_name)
+ body = self._post_and_claim_messages(queue_name=self.queue_name)
- claim_uri = resp['location']
+ claim_uri = body.response['location']
claimed_message_uri = body[0]['href']
# Update Claim
@@ -97,7 +97,7 @@
self.client.update_claim(claim_uri, rbody=update_rbody)
# Verify claim ttl >= updated ttl value
- _, body = self.client.query_claim(claim_uri)
+ body = self.client.query_claim(claim_uri)
updated_claim_ttl = body["ttl"]
self.assertTrue(updated_claim_ttl >= claim_ttl)
@@ -107,8 +107,8 @@
@test.attr(type='smoke')
def test_release_claim(self):
# Post a Claim
- resp, body = self._post_and_claim_messages(queue_name=self.queue_name)
- claim_uri = resp['location']
+ body = self._post_and_claim_messages(queue_name=self.queue_name)
+ claim_uri = body.response['location']
# Release Claim
self.client.release_claim(claim_uri)
diff --git a/tempest/api/messaging/test_messages.py b/tempest/api/messaging/test_messages.py
index dca95fc..2345e9e 100644
--- a/tempest/api/messaging/test_messages.py
+++ b/tempest/api/messaging/test_messages.py
@@ -36,18 +36,18 @@
def _post_messages(self, repeat=CONF.messaging.max_messages_per_page):
message_body = self.generate_message_body(repeat=repeat)
- resp, body = self.post_messages(queue_name=self.queue_name,
- rbody=message_body)
- return resp, body
+ body = self.post_messages(queue_name=self.queue_name,
+ rbody=message_body)
+ return body
@test.attr(type='smoke')
def test_post_messages(self):
# Post Messages
- resp, _ = self._post_messages()
+ resp = self._post_messages().response
# Get on the posted messages
message_uri = resp['location']
- resp, _ = self.client.get_multiple_messages(message_uri)
+ resp = self.client.get_multiple_messages(message_uri).response
# The test has an assertion here, because the response cannot be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('200', resp['status'])
@@ -58,7 +58,7 @@
self._post_messages()
# List Messages
- resp, _ = self.list_messages(queue_name=self.queue_name)
+ resp = self.list_messages(queue_name=self.queue_name).response
# The test has an assertion here, because the response cannot be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('200', resp['status'])
@@ -66,11 +66,11 @@
@test.attr(type='smoke')
def test_get_message(self):
# Post Messages
- _, body = self._post_messages()
+ body = self._post_messages()
message_uri = body['resources'][0]
# Get posted message
- resp, _ = self.client.get_single_message(message_uri)
+ resp = self.client.get_single_message(message_uri).response
# The test has an assertion here, because the response cannot be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('200', resp['status'])
@@ -78,11 +78,11 @@
@test.attr(type='smoke')
def test_get_multiple_messages(self):
# Post Messages
- resp, _ = self._post_messages()
+ resp = self._post_messages().response
message_uri = resp['location']
# Get posted messages
- resp, _ = self.client.get_multiple_messages(message_uri)
+ resp = self.client.get_multiple_messages(message_uri).response
# The test has an assertion here, because the response cannot be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('200', resp['status'])
@@ -90,14 +90,14 @@
@test.attr(type='smoke')
def test_delete_single_message(self):
# Post Messages
- _, body = self._post_messages()
+ body = self._post_messages()
message_uri = body['resources'][0]
# Delete posted message & verify the delete operration
self.client.delete_messages(message_uri)
message_uri = message_uri.replace('/messages/', '/messages?ids=')
- resp, _ = self.client.get_multiple_messages(message_uri)
+ resp = self.client.get_multiple_messages(message_uri).response
# The test has an assertion here, because the response has to be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('204', resp['status'])
@@ -105,12 +105,12 @@
@test.attr(type='smoke')
def test_delete_multiple_messages(self):
# Post Messages
- resp, _ = self._post_messages()
+ resp = self._post_messages().response
message_uri = resp['location']
# Delete multiple messages
self.client.delete_messages(message_uri)
- resp, _ = self.client.get_multiple_messages(message_uri)
+ resp = self.client.get_multiple_messages(message_uri).response
# The test has an assertion here, because the response has to be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('204', resp['status'])
diff --git a/tempest/api/messaging/test_queues.py b/tempest/api/messaging/test_queues.py
index 24656bf..a8860f0 100644
--- a/tempest/api/messaging/test_queues.py
+++ b/tempest/api/messaging/test_queues.py
@@ -33,7 +33,7 @@
def test_create_delete_queue(self):
# Create & Delete Queue
queue_name = data_utils.rand_name('test-')
- _, body = self.create_queue(queue_name)
+ body = self.create_queue(queue_name)
self.addCleanup(self.client.delete_queue, queue_name)
# NOTE(gmann): create_queue returns response status code as 201
@@ -74,7 +74,7 @@
@test.attr(type='smoke')
def test_list_queues(self):
# Listing queues
- _, body = self.list_queues()
+ body = self.list_queues()
self.assertEqual(len(body['queues']), len(self.queues))
for item in body['queues']:
self.assertIn(item['name'], self.queues)
@@ -85,7 +85,7 @@
queue_name = self.queues[data_utils.rand_int_id(0,
len(self.queues) - 1)]
# Get Queue Stats for a newly created Queue
- _, body = self.get_queue_stats(queue_name)
+ body = self.get_queue_stats(queue_name)
msgs = body['messages']
for element in ('free', 'claimed', 'total'):
self.assertEqual(0, msgs[element])
@@ -98,7 +98,7 @@
queue_name = self.queues[data_utils.rand_int_id(0,
len(self.queues) - 1)]
# Check the Queue has no metadata
- _, body = self.get_queue_metadata(queue_name)
+ body = self.get_queue_metadata(queue_name)
self.assertThat(body, matchers.HasLength(0))
# Create metadata
key3 = [0, 1, 2, 3, 4]
@@ -112,7 +112,7 @@
self.set_queue_metadata(queue_name, req_body)
# Get Queue Metadata
- _, body = self.get_queue_metadata(queue_name)
+ body = self.get_queue_metadata(queue_name)
self.assertThat(body, matchers.Equals(req_body))
@classmethod
diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py
new file mode 100644
index 0000000..c6d8165
--- /dev/null
+++ b/tempest/api/network/admin/test_routers_dvr.py
@@ -0,0 +1,98 @@
+# Copyright 2015 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.network import base_routers as base
+from tempest.common.utils import data_utils
+from tempest import test
+
+
+class RoutersTestDVR(base.BaseRouterTest):
+
+ @classmethod
+ def resource_setup(cls):
+ for ext in ['router', 'dvr']:
+ if not test.is_extension_enabled(ext, 'network'):
+ msg = "%s extension not enabled." % ext
+ raise cls.skipException(msg)
+ # The check above will pass if api_extensions=all, which does
+ # not mean DVR extension itself is present.
+ # Instead, we have to check whether DVR is actually present by using
+ # admin credentials to create router with distributed=True attribute
+ # and checking for BadRequest exception and that the resulting router
+ # has a distributed attribute.
+ super(RoutersTestDVR, cls).resource_setup()
+ name = data_utils.rand_name('pretest-check')
+ router = cls.admin_client.create_router(name)
+ if 'distributed' not in router['router']:
+ msg = "'distributed' attribute not found. DVR Possibly not enabled"
+ raise cls.skipException(msg)
+ cls.admin_client.delete_router(router['router']['id'])
+
+ @test.attr(type='smoke')
+ def test_distributed_router_creation(self):
+ """
+ Test uses administrative credentials to creates a
+ DVR (Distributed Virtual Routing) router using the
+ distributed=True.
+
+ Acceptance
+ The router is created and the "distributed" attribute is
+ set to True
+ """
+ name = data_utils.rand_name('router')
+ router = self.admin_client.create_router(name, distributed=True)
+ self.addCleanup(self.admin_client.delete_router,
+ router['router']['id'])
+ self.assertTrue(router['router']['distributed'])
+
+ @test.attr(type='smoke')
+ def test_centralized_router_creation(self):
+ """
+ Test uses administrative credentials to creates a
+ CVR (Centralized Virtual Routing) router using the
+ distributed=False.
+
+ Acceptance
+ The router is created and the "distributed" attribute is
+ set to False, thus making it a "Centralized Virtual Router"
+ as opposed to a "Distributed Virtual Router"
+ """
+ name = data_utils.rand_name('router')
+ router = self.admin_client.create_router(name, distributed=False)
+ self.addCleanup(self.admin_client.delete_router,
+ router['router']['id'])
+ self.assertFalse(router['router']['distributed'])
+
+ @test.attr(type='smoke')
+ def test_centralized_router_update_to_dvr(self):
+ """
+ Test uses administrative credentials to creates a
+ CVR (Centralized Virtual Routing) router using the
+ distributed=False.Then it will "update" the router
+ distributed attribute to True
+
+ Acceptance
+ The router is created and the "distributed" attribute is
+ set to False. Once the router is updated, the distributed
+ attribute will be set to True
+ """
+ name = data_utils.rand_name('router')
+ router = self.admin_client.create_router(name, distributed=False)
+ self.addCleanup(self.admin_client.delete_router,
+ router['router']['id'])
+ self.assertFalse(router['router']['distributed'])
+ router = self.admin_client.update_router(router['router']['id'],
+ distributed=True)
+ self.assertTrue(router['router']['distributed'])
diff --git a/tempest/api/network/test_security_groups.py b/tempest/api/network/test_security_groups.py
index 3d26b48..f9af3cc 100644
--- a/tempest/api/network/test_security_groups.py
+++ b/tempest/api/network/test_security_groups.py
@@ -162,7 +162,7 @@
"""Verify security group rule for icmp protocol works.
Specify icmp type (port_range_min) and icmp code
- (port_range_max) with different values. A seperate testcase
+ (port_range_max) with different values. A separate testcase
is added for icmp protocol as icmp validation would be
different from tcp/udp.
"""
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index 79a1960..6a025d9 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -28,21 +28,31 @@
class BaseObjectTest(tempest.test.BaseTestCase):
@classmethod
- def resource_setup(cls):
- cls.set_network_resources()
- super(BaseObjectTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseObjectTest, cls).skip_checks()
if not CONF.service_available.swift:
skip_msg = ("%s skipped as swift is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseObjectTest, cls).setup_credentials()
+
cls.isolated_creds = credentials.get_isolated_credentials(
cls.__name__, network_resources=cls.network_resources)
# Get isolated creds for normal user
cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
# Get isolated creds for admin user
cls.os_admin = clients.Manager(cls.isolated_creds.get_admin_creds())
+ cls.data = SwiftDataGenerator(cls.os_admin.identity_client)
# Get isolated creds for alt user
cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
+ @classmethod
+ def setup_clients(cls):
+ super(BaseObjectTest, cls).setup_clients()
+
cls.object_client = cls.os.object_client
cls.container_client = cls.os.container_client
cls.account_client = cls.os.account_client
@@ -52,6 +62,10 @@
cls.container_client_alt = cls.os_alt.container_client
cls.identity_client_alt = cls.os_alt.identity_client
+ @classmethod
+ def resource_setup(cls):
+ super(BaseObjectTest, cls).resource_setup()
+
# Make sure we get fresh auth data after assigning swift role
cls.object_client.auth_provider.clear_auth()
cls.container_client.auth_provider.clear_auth()
@@ -59,8 +73,6 @@
cls.object_client_alt.auth_provider.clear_auth()
cls.container_client_alt.auth_provider.clear_auth()
- cls.data = SwiftDataGenerator(cls.identity_admin_client)
-
@classmethod
def resource_cleanup(cls):
cls.data.teardown_all()
diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py
index 1832b37..e3f5f3d 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -26,15 +26,17 @@
class AccountQuotasTest(base.BaseObjectTest):
@classmethod
+ def setup_credentials(cls):
+ super(AccountQuotasTest, cls).setup_credentials()
+ cls.data.setup_test_user(reseller=True)
+ cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
+
+ @classmethod
def resource_setup(cls):
super(AccountQuotasTest, cls).resource_setup()
cls.container_name = data_utils.rand_name(name="TestContainer")
cls.container_client.create_container(cls.container_name)
- cls.data.setup_test_user(reseller=True)
-
- cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
-
# Retrieve a ResellerAdmin auth data and use it to set a quota
# on the client's account
cls.reselleradmin_auth_data = \
diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index 0e136bf..783bf1a 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -29,15 +29,17 @@
class AccountQuotasNegativeTest(base.BaseObjectTest):
@classmethod
+ def setup_credentials(cls):
+ super(AccountQuotasNegativeTest, cls).setup_credentials()
+ cls.data.setup_test_user(reseller=True)
+ cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
+
+ @classmethod
def resource_setup(cls):
super(AccountQuotasNegativeTest, cls).resource_setup()
cls.container_name = data_utils.rand_name(name="TestContainer")
cls.container_client.create_container(cls.container_name)
- cls.data.setup_test_user(reseller=True)
-
- cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
-
# Retrieve a ResellerAdmin auth data and use it to set a quota
# on the client's account
cls.reselleradmin_auth_data = \
diff --git a/tempest/api/object_storage/test_container_acl.py b/tempest/api/object_storage/test_container_acl.py
index 205bc91..44763a1 100644
--- a/tempest/api/object_storage/test_container_acl.py
+++ b/tempest/api/object_storage/test_container_acl.py
@@ -20,12 +20,17 @@
class ObjectTestACLs(base.BaseObjectTest):
+
+ @classmethod
+ def setup_credentials(cls):
+ super(ObjectTestACLs, cls).setup_credentials()
+ cls.data.setup_test_user()
+ cls.test_os = clients.Manager(cls.data.test_credentials)
+
@classmethod
def resource_setup(cls):
super(ObjectTestACLs, cls).resource_setup()
- cls.data.setup_test_user()
- test_os = clients.Manager(cls.data.test_credentials)
- cls.test_auth_data = test_os.auth_provider.auth_data
+ cls.test_auth_data = cls.test_os.auth_provider.auth_data
def setUp(self):
super(ObjectTestACLs, self).setUp()
diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py
index 7fe472c..edc052e 100644
--- a/tempest/api/object_storage/test_container_acl_negative.py
+++ b/tempest/api/object_storage/test_container_acl_negative.py
@@ -23,12 +23,17 @@
class ObjectACLsNegativeTest(base.BaseObjectTest):
+
+ @classmethod
+ def setup_credentials(cls):
+ super(ObjectACLsNegativeTest, cls).setup_credentials()
+ cls.data.setup_test_user()
+ cls.test_os = clients.Manager(cls.data.test_credentials)
+
@classmethod
def resource_setup(cls):
super(ObjectACLsNegativeTest, cls).resource_setup()
- cls.data.setup_test_user()
- test_os = clients.Manager(cls.data.test_credentials)
- cls.test_auth_data = test_os.auth_provider.auth_data
+ cls.test_auth_data = cls.test_os.auth_provider.auth_data
def setUp(self):
super(ObjectACLsNegativeTest, self).setUp()
diff --git a/tempest/api/object_storage/test_healthcheck.py b/tempest/api/object_storage/test_healthcheck.py
index 53c0347..6fbd77b 100644
--- a/tempest/api/object_storage/test_healthcheck.py
+++ b/tempest/api/object_storage/test_healthcheck.py
@@ -22,10 +22,6 @@
class HealthcheckTest(base.BaseObjectTest):
- @classmethod
- def resource_setup(cls):
- super(HealthcheckTest, cls).resource_setup()
-
def setUp(self):
super(HealthcheckTest, self).setUp()
# Turning http://.../v1/foobar into http://.../
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index 3987ee3..b8a93f0 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -87,8 +87,8 @@
'Server')
server_id = body['physical_resource_id']
LOG.debug('Console output for %s', server_id)
- _, output = cls.servers_client.get_console_output(
- server_id, None)
+ output = cls.servers_client.get_console_output(
+ server_id, None).data
LOG.debug(output)
raise e
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 7ec0646..c521b37 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -28,18 +28,29 @@
"""Base test case class for all Telemetry API tests."""
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(BaseTelemetryTest, cls).skip_checks()
if not CONF.service_available.ceilometer:
raise cls.skipException("Ceilometer support is required")
- cls.set_network_resources()
- super(BaseTelemetryTest, cls).resource_setup()
- os = cls.get_client_manager()
- cls.telemetry_client = os.telemetry_client
- cls.servers_client = os.servers_client
- cls.flavors_client = os.flavors_client
- cls.image_client = os.image_client
- cls.image_client_v2 = os.image_client_v2
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseTelemetryTest, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseTelemetryTest, cls).setup_clients()
+ cls.telemetry_client = cls.os.telemetry_client
+ cls.servers_client = cls.os.servers_client
+ cls.flavors_client = cls.os.flavors_client
+ cls.image_client = cls.os.image_client
+ cls.image_client_v2 = cls.os.image_client_v2
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseTelemetryTest, cls).resource_setup()
cls.nova_notifications = ['memory', 'vcpus', 'disk.root.size',
'disk.ephemeral.size']
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 048e305..a0256af 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -23,11 +23,11 @@
class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(TelemetryNotificationAPITestJSON, cls).skip_checks()
if CONF.telemetry.too_slow_to_test:
raise cls.skipException("Ceilometer feature for fast work mysql "
"is disabled")
- super(TelemetryNotificationAPITestJSON, cls).resource_setup()
@test.attr(type="gate")
@testtools.skipIf(not CONF.service_available.nova,
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 245161a..32cdb01 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -24,11 +24,16 @@
class VolumeMultiBackendV2Test(base.BaseVolumeAdminTest):
@classmethod
- def resource_setup(cls):
- super(VolumeMultiBackendV2Test, cls).resource_setup()
+ def skip_checks(cls):
+ super(VolumeMultiBackendV2Test, cls).skip_checks()
+
if not CONF.volume_feature_enabled.multi_backend:
raise cls.skipException("Cinder multi-backend feature disabled")
+ @classmethod
+ def resource_setup(cls):
+ super(VolumeMultiBackendV2Test, cls).resource_setup()
+
cls.backend1_name = CONF.volume.backend1_name
cls.backend2_name = CONF.volume.backend2_name
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index e7d9d7b..a4b4e3e 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -21,9 +21,13 @@
class SnapshotsActionsV2Test(base.BaseVolumeAdminTest):
@classmethod
+ def setup_clients(cls):
+ super(SnapshotsActionsV2Test, cls).setup_clients()
+ cls.client = cls.snapshots_client
+
+ @classmethod
def resource_setup(cls):
super(SnapshotsActionsV2Test, cls).resource_setup()
- cls.client = cls.snapshots_client
# Create a test shared volume for tests
vol_name = data_utils.rand_name(cls.__name__ + '-Volume-')
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index 2a30b54..f41a97e 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -26,8 +26,8 @@
force_tenant_isolation = True
@classmethod
- def resource_setup(cls):
- super(BaseVolumeQuotasAdminV2TestJSON, cls).resource_setup()
+ def setup_credentials(cls):
+ super(BaseVolumeQuotasAdminV2TestJSON, cls).setup_credentials()
cls.demo_tenant_id = cls.isolated_creds.get_primary_creds().tenant_id
@test.attr(type='gate')
diff --git a/tempest/api/volume/admin/test_volume_quotas_negative.py b/tempest/api/volume/admin/test_volume_quotas_negative.py
index f972457..e37d8f2 100644
--- a/tempest/api/volume/admin/test_volume_quotas_negative.py
+++ b/tempest/api/volume/admin/test_volume_quotas_negative.py
@@ -23,10 +23,14 @@
force_tenant_isolation = True
@classmethod
+ def setup_credentials(cls):
+ super(BaseVolumeQuotasNegativeV2TestJSON, cls).setup_credentials()
+ cls.demo_user = cls.isolated_creds.get_primary_creds()
+ cls.demo_tenant_id = cls.demo_user.tenant_id
+
+ @classmethod
def resource_setup(cls):
super(BaseVolumeQuotasNegativeV2TestJSON, cls).resource_setup()
- demo_user = cls.isolated_creds.get_primary_creds()
- cls.demo_tenant_id = demo_user.tenant_id
cls.shared_quota_set = {'gigabytes': 3, 'volumes': 1, 'snapshots': 1}
# NOTE(gfidente): no need to restore original quota set
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index f2c1dda..d4062cc 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -37,45 +37,54 @@
self.assertIsInstance(body, list)
@test.attr(type='smoke')
- def test_create_get_delete_volume_with_volume_type_and_extra_specs(self):
- # Create/get/delete volume with volume_type and extra spec.
- volume = {}
+ def test_volume_crud_with_volume_type_and_extra_specs(self):
+ # Create/update/get/delete volume with volume_type and extra spec.
+ volume_types = list()
vol_name = data_utils.rand_name("volume-")
- vol_type_name = data_utils.rand_name("volume-type-")
self.name_field = self.special_fields['name_field']
proto = CONF.volume.storage_protocol
vendor = CONF.volume.vendor_name
extra_specs = {"storage_protocol": proto,
"vendor_name": vendor}
- body = {}
- body = self.volume_types_client.create_volume_type(
- vol_type_name,
- extra_specs=extra_specs)
- self.assertIn('id', body)
- self.addCleanup(self._delete_volume_type, body['id'])
- self.assertIn('name', body)
- params = {self.name_field: vol_name, 'volume_type': vol_type_name}
- volume = self.volumes_client.create_volume(
- size=1, **params)
- self.assertIn('id', volume)
+ # Create two volume_types
+ for i in range(2):
+ vol_type_name = data_utils.rand_name("volume-type-")
+ vol_type = self.volume_types_client.create_volume_type(
+ vol_type_name,
+ extra_specs=extra_specs)
+ volume_types.append(vol_type)
+ self.addCleanup(self._delete_volume_type, vol_type['id'])
+ params = {self.name_field: vol_name,
+ 'volume_type': volume_types[0]['id']}
+
+ # Create volume
+ volume = self.volumes_client.create_volume(size=1, **params)
self.addCleanup(self._delete_volume, volume['id'])
- self.assertIn(self.name_field, volume)
+ self.assertEqual(volume_types[0]['name'], volume["volume_type"])
self.assertEqual(volume[self.name_field], vol_name,
"The created volume name is not equal "
"to the requested name")
- self.assertTrue(volume['id'] is not None,
- "Field volume id is empty or not found.")
+ self.assertIsNotNone(volume['id'],
+ "Field volume id is empty or not found.")
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
+
+ # Update volume with new volume_type
+ self.volumes_client.retype_volume(volume['id'],
+ volume_type=volume_types[1]['id'])
+ self.volumes_client.wait_for_volume_status(volume['id'], 'available')
+
+ # Get volume details and Verify
fetched_volume = self.volumes_client.get_volume(volume['id'])
+ self.assertEqual(volume_types[1]['name'],
+ fetched_volume['volume_type'],
+ 'The fetched Volume type is different '
+ 'from updated volume type')
self.assertEqual(vol_name, fetched_volume[self.name_field],
'The fetched Volume is different '
'from the created Volume')
self.assertEqual(volume['id'], fetched_volume['id'],
'The fetched Volume is different '
'from the created Volume')
- self.assertEqual(vol_type_name, fetched_volume['volume_type'],
- 'The fetched Volume is different '
- 'from the created Volume')
@test.attr(type='smoke')
def test_volume_type_create_get_delete(self):
diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py
index 439dd35..fb16872 100644
--- a/tempest/api/volume/admin/test_volumes_actions.py
+++ b/tempest/api/volume/admin/test_volumes_actions.py
@@ -21,9 +21,13 @@
class VolumesActionsV2Test(base.BaseVolumeAdminTest):
@classmethod
+ def setup_clients(cls):
+ super(VolumesActionsV2Test, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesActionsV2Test, cls).resource_setup()
- cls.client = cls.volumes_client
# Create a test shared volume for tests
vol_name = utils.rand_name(cls.__name__ + '-Volume-')
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index d572893..4db9f7e 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -26,12 +26,15 @@
class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
@classmethod
- def resource_setup(cls):
- super(VolumesBackupsV2Test, cls).resource_setup()
-
+ def skip_checks(cls):
+ super(VolumesBackupsV2Test, cls).skip_checks()
if not CONF.volume_feature_enabled.backup:
raise cls.skipException("Cinder backup feature disabled")
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesBackupsV2Test, cls).resource_setup()
+
cls.volume = cls.create_volume()
@test.attr(type='smoke')
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 2489b79..c672607 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -33,28 +33,37 @@
_api_version = 2
@classmethod
- def resource_setup(cls):
- cls.set_network_resources()
- super(BaseVolumeTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseVolumeTest, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
-
- cls.os = cls.get_client_manager()
-
- cls.servers_client = cls.os.servers_client
- cls.image_ref = CONF.compute.image_ref
- cls.flavor_ref = CONF.compute.flavor_ref
- cls.build_interval = CONF.volume.build_interval
- cls.build_timeout = CONF.volume.build_timeout
- cls.snapshots = []
- cls.volumes = []
-
if cls._api_version == 1:
if not CONF.volume_feature_enabled.api_v1:
msg = "Volume API v1 is disabled"
raise cls.skipException(msg)
+ elif cls._api_version == 2:
+ if not CONF.volume_feature_enabled.api_v2:
+ msg = "Volume API v2 is disabled"
+ raise cls.skipException(msg)
+ else:
+ msg = ("Invalid Cinder API version (%s)" % cls._api_version)
+ raise exceptions.InvalidConfiguration(message=msg)
+
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseVolumeTest, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseVolumeTest, cls).setup_clients()
+
+ cls.servers_client = cls.os.servers_client
+
+ if cls._api_version == 1:
cls.snapshots_client = cls.os.snapshots_client
cls.volumes_client = cls.os.volumes_client
cls.backups_client = cls.os.backups_client
@@ -62,27 +71,33 @@
cls.volumes_extension_client = cls.os.volumes_extension_client
cls.availability_zone_client = (
cls.os.volume_availability_zone_client)
- # Special fields and resp code for cinder v1
- cls.special_fields = {'name_field': 'display_name',
- 'descrip_field': 'display_description'}
-
- elif cls._api_version == 2:
- if not CONF.volume_feature_enabled.api_v2:
- msg = "Volume API v2 is disabled"
- raise cls.skipException(msg)
+ else:
cls.snapshots_client = cls.os.snapshots_v2_client
cls.volumes_client = cls.os.volumes_v2_client
cls.volumes_extension_client = cls.os.volumes_v2_extension_client
cls.availability_zone_client = (
cls.os.volume_v2_availability_zone_client)
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseVolumeTest, cls).resource_setup()
+
+ cls.snapshots = []
+ cls.volumes = []
+ cls.image_ref = CONF.compute.image_ref
+ cls.flavor_ref = CONF.compute.flavor_ref
+ cls.build_interval = CONF.volume.build_interval
+ cls.build_timeout = CONF.volume.build_timeout
+
+ if cls._api_version == 1:
+ # Special fields and resp code for cinder v1
+ cls.special_fields = {'name_field': 'display_name',
+ 'descrip_field': 'display_description'}
+ else:
# Special fields and resp code for cinder v2
cls.special_fields = {'name_field': 'name',
'descrip_field': 'description'}
- else:
- msg = ("Invalid Cinder API version (%s)" % cls._api_version)
- raise exceptions.InvalidConfiguration(message=msg)
-
@classmethod
def resource_cleanup(cls):
cls.clear_snapshots()
@@ -148,10 +163,10 @@
class BaseVolumeAdminTest(BaseVolumeTest):
"""Base test case class for all Volume Admin API tests."""
- @classmethod
- def resource_setup(cls):
- super(BaseVolumeAdminTest, cls).resource_setup()
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseVolumeAdminTest, cls).setup_credentials()
try:
cls.adm_creds = cls.isolated_creds.get_admin_creds()
cls.os_adm = clients.Manager(credentials=cls.adm_creds)
@@ -159,12 +174,11 @@
msg = "Missing Volume Admin API credentials in configuration."
raise cls.skipException(msg)
- cls.qos_specs = []
+ @classmethod
+ def setup_clients(cls):
+ super(BaseVolumeAdminTest, cls).setup_clients()
if cls._api_version == 1:
- if not CONF.volume_feature_enabled.api_v1:
- msg = "Volume API v1 is disabled"
- raise cls.skipException(msg)
cls.volume_qos_client = cls.os_adm.volume_qos_client
cls.admin_volume_services_client = \
cls.os_adm.volume_services_client
@@ -175,9 +189,6 @@
cls.backups_adm_client = cls.os_adm.backups_client
cls.quotas_client = cls.os_adm.volume_quotas_client
elif cls._api_version == 2:
- if not CONF.volume_feature_enabled.api_v2:
- msg = "Volume API v2 is disabled"
- raise cls.skipException(msg)
cls.volume_qos_client = cls.os_adm.volume_qos_v2_client
cls.admin_volume_services_client = \
cls.os_adm.volume_services_v2_client
@@ -189,6 +200,12 @@
cls.quotas_client = cls.os_adm.volume_quotas_v2_client
@classmethod
+ def resource_setup(cls):
+ super(BaseVolumeAdminTest, cls).resource_setup()
+
+ cls.qos_specs = []
+
+ @classmethod
def resource_cleanup(cls):
cls.clear_qos_specs()
super(BaseVolumeAdminTest, cls).resource_cleanup()
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index bd3d2a1..b6e226d 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -24,8 +24,8 @@
"""
@classmethod
- def resource_setup(cls):
- super(AvailabilityZoneV2TestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(AvailabilityZoneV2TestJSON, cls).setup_clients()
cls.client = cls.availability_zone_client
@test.attr(type='gate')
diff --git a/tempest/api/volume/test_snapshot_metadata.py b/tempest/api/volume/test_snapshot_metadata.py
index 03474ba..e1fe779 100644
--- a/tempest/api/volume/test_snapshot_metadata.py
+++ b/tempest/api/volume/test_snapshot_metadata.py
@@ -20,9 +20,13 @@
class SnapshotV2MetadataTestJSON(base.BaseVolumeTest):
@classmethod
+ def setup_clients(cls):
+ super(SnapshotV2MetadataTestJSON, cls).setup_clients()
+ cls.client = cls.snapshots_client
+
+ @classmethod
def resource_setup(cls):
super(SnapshotV2MetadataTestJSON, cls).resource_setup()
- cls.client = cls.snapshots_client
# Create a volume
cls.volume = cls.create_volume()
# Create a snapshot
diff --git a/tempest/api/volume/test_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index 7451050..6f75403 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -17,6 +17,7 @@
from tempest.api.volume import base
from tempest import clients
+from tempest.common import credentials
from tempest import config
from tempest import test
@@ -26,18 +27,24 @@
class VolumesV2TransfersTest(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2TransfersTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(VolumesV2TransfersTest, cls).skip_checks()
+ if not credentials.is_admin_available():
+ msg = "Missing Volume Admin API credentials in configuration."
+ raise cls.skipException(msg)
+ @classmethod
+ def setup_credentials(cls):
+ super(VolumesV2TransfersTest, cls).setup_credentials()
# Add another tenant to test volume-transfer
cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
# Add admin tenant to cleanup resources
- try:
- creds = cls.isolated_creds.get_admin_creds()
- cls.os_adm = clients.Manager(credentials=creds)
- except NotImplementedError:
- msg = "Missing Volume Admin API credentials in configuration."
- raise cls.skipException(msg)
+ creds = cls.isolated_creds.get_admin_creds()
+ cls.os_adm = clients.Manager(credentials=creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesV2TransfersTest, cls).setup_clients()
cls.client = cls.volumes_client
cls.alt_client = cls.os_alt.volumes_client
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 8b91c7f..e5f7aa4 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -24,11 +24,15 @@
class VolumesV2ActionsTest(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2ActionsTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(VolumesV2ActionsTest, cls).setup_clients()
cls.client = cls.volumes_client
cls.image_client = cls.os.image_client
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesV2ActionsTest, cls).resource_setup()
+
# Create a test shared instance
srv_name = data_utils.rand_name(cls.__name__ + '-Instance-')
cls.server = cls.servers_client.create_server(srv_name,
@@ -38,6 +42,7 @@
# Create a test shared volume for attach/detach tests
cls.volume = cls.create_volume()
+ cls.client.wait_for_volume_status(cls.volume['id'], 'available')
def _delete_image_with_wait(self, image_id):
self.image_client.delete_image(image_id)
diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py
index ebe6084..fab25ec 100644
--- a/tempest/api/volume/test_volumes_extend.py
+++ b/tempest/api/volume/test_volumes_extend.py
@@ -23,8 +23,8 @@
class VolumesV2ExtendTest(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2ExtendTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(VolumesV2ExtendTest, cls).setup_clients()
cls.client = cls.volumes_client
@test.attr(type='gate')
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index 2a49210..3133df4 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -26,9 +26,13 @@
class VolumesV2GetTest(base.BaseVolumeTest):
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2GetTest, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2GetTest, cls).resource_setup()
- cls.client = cls.volumes_client
cls.name_field = cls.special_fields['name_field']
cls.descrip_field = cls.special_fields['descrip_field']
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 91beae9..9a8746a 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -55,9 +55,13 @@
[str_vol(v) for v in fetched_list]))
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2ListTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2ListTestJSON, cls).resource_setup()
- cls.client = cls.volumes_client
cls.name = cls.VOLUME_FIELDS[1]
# Create 3 test volumes
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 595ddf4..c827f9e 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -25,9 +25,13 @@
class VolumesV2NegativeTest(base.BaseVolumeTest):
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2NegativeTest, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2NegativeTest, cls).resource_setup()
- cls.client = cls.volumes_client
cls.name_field = cls.special_fields['name_field']
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 98598c1..c4f8096 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -23,13 +23,16 @@
class VolumesV2SnapshotTestJSON(base.BaseVolumeTest):
@classmethod
+ def skip_checks(cls):
+ super(VolumesV2SnapshotTestJSON, cls).skip_checks()
+ if not CONF.volume_feature_enabled.snapshot:
+ raise cls.skipException("Cinder volume snapshots are disabled")
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2SnapshotTestJSON, cls).resource_setup()
cls.volume_origin = cls.create_volume()
- if not CONF.volume_feature_enabled.snapshot:
- raise cls.skipException("Cinder volume snapshots are disabled")
-
cls.name_field = cls.special_fields['name_field']
cls.descrip_field = cls.special_fields['descrip_field']
diff --git a/tempest/api/volume/test_volumes_snapshots_negative.py b/tempest/api/volume/test_volumes_snapshots_negative.py
index 8b68ea9..3ad23f7 100644
--- a/tempest/api/volume/test_volumes_snapshots_negative.py
+++ b/tempest/api/volume/test_volumes_snapshots_negative.py
@@ -25,9 +25,8 @@
class VolumesV2SnapshotNegativeTestJSON(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2SnapshotNegativeTestJSON, cls).resource_setup()
-
+ def skip_checks(cls):
+ super(VolumesV2SnapshotNegativeTestJSON, cls).skip_checks()
if not CONF.volume_feature_enabled.snapshot:
raise cls.skipException("Cinder volume snapshots are disabled")
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index bc14b2c..3a21f41 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -31,9 +31,13 @@
"""
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2ListTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2ListTestJSON, cls).resource_setup()
- cls.client = cls.volumes_client
# Create 3 test volumes
cls.volume_list = []
diff --git a/tempest/api_schema/response/compute/baremetal_nodes.py b/tempest/api_schema/response/compute/baremetal_nodes.py
index 2f67d37..e82792c 100644
--- a/tempest/api_schema/response/compute/baremetal_nodes.py
+++ b/tempest/api_schema/response/compute/baremetal_nodes.py
@@ -19,9 +19,9 @@
'interfaces': {'type': 'array'},
'host': {'type': 'string'},
'task_state': {'type': ['string', 'null']},
- 'cpus': {'type': 'integer'},
- 'memory_mb': {'type': 'integer'},
- 'disk_gb': {'type': 'integer'},
+ 'cpus': {'type': ['integer', 'string']},
+ 'memory_mb': {'type': ['integer', 'string']},
+ 'disk_gb': {'type': ['integer', 'string']},
},
'required': ['id', 'interfaces', 'host', 'task_state', 'cpus', 'memory_mb',
'disk_gb']
diff --git a/tempest/api_schema/response/compute/hypervisors.py b/tempest/api_schema/response/compute/hypervisors.py
index e9e1bc9..273b579 100644
--- a/tempest/api_schema/response/compute/hypervisors.py
+++ b/tempest/api_schema/response/compute/hypervisors.py
@@ -160,9 +160,14 @@
'items': {
'type': 'object',
'properties': {
+ 'status': {'type': 'string'},
+ 'state': {'type': 'string'},
'id': {'type': ['integer', 'string']},
'hypervisor_hostname': {'type': 'string'}
},
+ # NOTE: When loading os-hypervisor-status extension,
+ # a response contains status and state. So these params
+ # should not be required.
'required': ['id', 'hypervisor_hostname']
}
}
diff --git a/tempest/api_schema/response/compute/quotas.py b/tempest/api_schema/response/compute/quotas.py
index f49771e..863104c 100644
--- a/tempest/api_schema/response/compute/quotas.py
+++ b/tempest/api_schema/response/compute/quotas.py
@@ -28,8 +28,13 @@
'metadata_items': {'type': 'integer'},
'key_pairs': {'type': 'integer'},
'security_groups': {'type': 'integer'},
- 'security_group_rules': {'type': 'integer'}
+ 'security_group_rules': {'type': 'integer'},
+ 'server_group_members': {'type': 'integer'},
+ 'server_groups': {'type': 'integer'},
},
+ # NOTE: server_group_members and server_groups are represented
+ # when enabling quota_server_group extension. So they should
+ # not be required.
'required': ['instances', 'cores', 'ram',
'floating_ips', 'fixed_ips',
'metadata_items', 'key_pairs',
diff --git a/tempest/auth.py b/tempest/auth.py
index ffeae02..7b00f2a 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -186,9 +186,9 @@
token_expiry_threshold = datetime.timedelta(seconds=60)
- def __init__(self, credentials):
+ def __init__(self, credentials, auth_url):
super(KeystoneAuthProvider, self).__init__(credentials)
- self.auth_client = self._auth_client()
+ self.auth_client = self._auth_client(auth_url)
def _decorate_request(self, filters, method, url, headers=None, body=None,
auth_data=None):
@@ -236,8 +236,8 @@
EXPIRY_DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
- def _auth_client(self):
- return json_id.TokenClientJSON()
+ def _auth_client(self, auth_url):
+ return json_id.TokenClientJSON(auth_url)
def _auth_params(self):
return dict(
@@ -314,15 +314,16 @@
EXPIRY_DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
- def _auth_client(self):
- return json_v3id.V3TokenClientJSON()
+ def _auth_client(self, auth_url):
+ return json_v3id.V3TokenClientJSON(auth_url)
def _auth_params(self):
return dict(
user=self.credentials.username,
password=self.credentials.password,
- tenant=self.credentials.tenant_name,
- domain=self.credentials.user_domain_name,
+ project=self.credentials.tenant_name,
+ user_domain=self.credentials.user_domain_name,
+ project_domain=self.credentials.project_domain_name,
auth_data=True)
def _fill_credentials(self, auth_data_body):
@@ -429,10 +430,12 @@
return identity_version in IDENTITY_VERSION
-def get_credentials(fill_in=True, identity_version='v2', **kwargs):
+def get_credentials(auth_url, fill_in=True, identity_version='v2', **kwargs):
"""
Builds a credentials object based on the configured auth_version
+ :param auth_url (string): Full URI of the OpenStack Identity API(Keystone)
+ which is used to fetch the token from Identity service.
:param fill_in (boolean): obtain a token and fill in all credential
details provided by the identity service. When fill_in is not
specified, credentials are not validated. Validation can be invoked
@@ -459,7 +462,7 @@
creds = credential_class(**kwargs)
# Fill in the credentials fields that were not specified
if fill_in:
- auth_provider = auth_provider_class(creds)
+ auth_provider = auth_provider_class(creds, auth_url)
creds = auth_provider.fill_credentials()
return creds
diff --git a/tempest/clients.py b/tempest/clients.py
index 096470e..fa3f65e 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -302,16 +302,27 @@
**self.default_params_with_timeout_values)
def _set_identity_clients(self):
- self.identity_client = IdentityClientJSON(self.auth_provider)
- self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider)
- self.endpoints_client = EndPointClientJSON(self.auth_provider)
- self.service_client = ServiceClientJSON(self.auth_provider)
- self.policy_client = PolicyClientJSON(self.auth_provider)
- self.region_client = RegionClientJSON(self.auth_provider)
- self.token_client = TokenClientJSON()
+ params = {
+ 'service': CONF.identity.catalog_type,
+ 'region': CONF.identity.region,
+ 'endpoint_type': 'adminURL'
+ }
+ params.update(self.default_params_with_timeout_values)
+
+ self.identity_client = IdentityClientJSON(self.auth_provider,
+ **params)
+ self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider,
+ **params)
+ self.endpoints_client = EndPointClientJSON(self.auth_provider,
+ **params)
+ self.service_client = ServiceClientJSON(self.auth_provider, **params)
+ self.policy_client = PolicyClientJSON(self.auth_provider, **params)
+ self.region_client = RegionClientJSON(self.auth_provider, **params)
+ self.credentials_client = CredentialsClientJSON(self.auth_provider,
+ **params)
+ self.token_client = TokenClientJSON(CONF.identity.uri)
if CONF.identity_feature_enabled.api_v3:
- self.token_v3_client = V3TokenClientJSON()
- self.credentials_client = CredentialsClientJSON(self.auth_provider)
+ self.token_v3_client = V3TokenClientJSON(CONF.identity.uri_v3)
def _set_volume_clients(self):
params = {
diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py
index c52704a..669f506 100755
--- a/tempest/cmd/cleanup.py
+++ b/tempest/cmd/cleanup.py
@@ -222,7 +222,7 @@
needs_role = False
LOG.debug("User already had admin privilege for this tenant")
if needs_role:
- LOG.debug("Adding admin priviledge for : %s" % tenant_id)
+ LOG.debug("Adding admin privilege for : %s" % tenant_id)
id_cl.assign_user_role(tenant_id, self.admin_id,
self.admin_role_id)
self.admin_role_added.append(tenant_id)
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 67eb182..480ddd5 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -168,7 +168,7 @@
def list(self):
client = self.client
- _, servers_body = client.list_servers()
+ servers_body = client.list_servers()
servers = servers_body['servers']
LOG.debug("List count, %s Servers" % len(servers))
return servers
@@ -192,7 +192,7 @@
def list(self):
client = self.client
- _, sgs = client.list_server_groups()
+ sgs = client.list_server_groups()
LOG.debug("List count, %s Server Groups" % len(sgs))
return sgs
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index e9b6621..b06968e 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -176,8 +176,13 @@
username=user,
password=pw,
tenant_name=tenant)
- _auth = tempest.auth.KeystoneV2AuthProvider(_creds)
- self.identity = identity_client.IdentityClientJSON(_auth)
+ _auth = tempest.auth.KeystoneV2AuthProvider(_creds, CONF.identity.uri)
+ self.identity = identity_client.IdentityClientJSON(
+ _auth,
+ CONF.identity.catalog_type,
+ CONF.identity.region,
+ endpoint_type='adminURL',
+ **default_params_with_timeout_values)
self.servers = servers_client.ServersClientJSON(_auth,
**compute_params)
self.flavors = flavors_client.FlavorsClientJSON(_auth,
@@ -402,8 +407,7 @@
# on the cloud. We don't care about the results except that it
# remains authorized.
client = client_for_user(user['name'])
- resp, body = client.servers.list_servers()
- self.assertEqual(resp['status'], '200')
+ client.servers.list_servers()
def check_objects(self):
"""Check that the objects created are still there."""
@@ -777,7 +781,7 @@
#######################
def _get_server_by_name(client, name):
- r, body = client.servers.list_servers()
+ body = client.servers.list_servers()
for server in body['servers']:
if name == server['name']:
return server
diff --git a/tempest/common/cred_provider.py b/tempest/common/cred_provider.py
index d899303..033410e 100644
--- a/tempest/common/cred_provider.py
+++ b/tempest/common/cred_provider.py
@@ -76,7 +76,11 @@
if 'domain' in x)
if not domain_fields.intersection(kwargs.keys()):
kwargs['user_domain_name'] = CONF.identity.admin_domain_name
- return auth.get_credentials(fill_in=fill_in,
+ auth_url = CONF.identity.uri_v3
+ else:
+ auth_url = CONF.identity.uri
+ return auth.get_credentials(auth_url,
+ fill_in=fill_in,
identity_version=identity_version,
**kwargs)
diff --git a/tempest/common/credentials.py b/tempest/common/credentials.py
index 08b592f..40761c8 100644
--- a/tempest/common/credentials.py
+++ b/tempest/common/credentials.py
@@ -12,8 +12,10 @@
# limitations under the License.
from tempest.common import accounts
+from tempest.common import cred_provider
from tempest.common import isolated_creds
from tempest import config
+from tempest import exceptions
CONF = config.CONF
@@ -37,3 +39,31 @@
return accounts.Accounts(name=name)
else:
return accounts.NotLockingAccounts(name=name)
+
+
+# We want a helper function here to check and see if admin credentials
+# are available so we can do a single call from skip_checks if admin
+# creds area vailable.
+def is_admin_available():
+ is_admin = True
+ # In the case of a pre-provisioned account, if even if creds were
+ # configured, the admin credentials won't be available
+ if (CONF.auth.locking_credentials_provider and
+ not CONF.auth.allow_tenant_isolation):
+ is_admin = False
+ else:
+ try:
+ cred_provider.get_configured_credentials('identity_admin')
+ # NOTE(mtreinish) This should never be caught because of the if above.
+ # NotImplementedError is only raised if admin credentials are requested
+ # and the locking test accounts cred provider is being used.
+ except NotImplementedError:
+ is_admin = False
+ # NOTE(mtreinish): This will be raised by the non-locking accounts
+ # provider if there aren't admin credentials provided in the config
+ # file. This exception originates from the auth call to get configured
+ # credentials
+ except exceptions.InvalidConfiguration:
+ is_admin = False
+
+ return is_admin
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index f81c3ed..3eed689 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -333,6 +333,7 @@
if (not self.network_resources or
self.network_resources.get('network')):
self._clear_isolated_network(network['id'], network['name'])
+ self.isolated_net_resources = {}
def clear_isolated_creds(self):
if not self.isolated_creds:
@@ -349,6 +350,7 @@
except lib_exc.NotFound:
LOG.warn("tenant with name: %s not found for delete" %
creds.tenant_name)
+ self.isolated_creds = {}
def is_multi_user(self):
return True
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
index 8949609..fde05af 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -79,7 +79,7 @@
self.response = response
def __str__(self):
- body = super.__str__(self)
+ body = super(ResponseBody, self).__str__()
return "response: %s\nBody: %s" % (self.response, body)
@@ -108,5 +108,5 @@
self.response = response
def __str__(self):
- body = super.__str__(self)
+ body = super(ResponseBodyList, self).__str__()
return "response: %s\nBody: %s" % (self.response, body)
diff --git a/tempest/manager.py b/tempest/manager.py
index 421d2de..50f7e6e 100644
--- a/tempest/manager.py
+++ b/tempest/manager.py
@@ -54,14 +54,14 @@
@classmethod
def get_auth_provider_class(cls, credentials):
if isinstance(credentials, auth.KeystoneV3Credentials):
- return auth.KeystoneV3AuthProvider
+ return auth.KeystoneV3AuthProvider, CONF.identity.uri_v3
else:
- return auth.KeystoneV2AuthProvider
+ return auth.KeystoneV2AuthProvider, CONF.identity.uri
def get_auth_provider(self, credentials):
if credentials is None:
raise exceptions.InvalidCredentials(
'Credentials must be specified')
- auth_provider_class = self.get_auth_provider_class(credentials)
- return auth_provider_class(
- credentials=credentials)
+ auth_provider_class, auth_url = self.get_auth_provider_class(
+ credentials)
+ return auth_provider_class(credentials, auth_url)
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index eb7265f..2af96c7 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -379,13 +379,13 @@
LOG.debug('Console output not supported, cannot log')
return
if not servers:
- _, servers = self.servers_client.list_servers()
+ servers = self.servers_client.list_servers()
servers = servers['servers']
for server in servers:
console_output = self.servers_client.get_console_output(
- server['id'], length=None)
- LOG.debug('Console output for %s\nhead=%s\nbody=\n%s',
- server['id'], console_output[0], console_output[1])
+ server['id'], length=None).data
+ LOG.debug('Console output for %s\nbody=\n%s',
+ server['id'], console_output)
def _log_net_info(self, exc):
# network debug is called as part of ssh init
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index ac766ea..fca0a2a 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -87,7 +87,7 @@
security_groups=[{'name': secgroup['name']}])
# needed because of bug 1199788
params = {'name': name}
- _, server_list = self.servers_client.list_servers(params)
+ server_list = self.servers_client.list_servers(params)
self.servers = server_list['servers']
for server in self.servers:
# after deleting all servers - wait for all servers to clear
diff --git a/tempest/scenario/test_load_balancer_basic.py b/tempest/scenario/test_load_balancer_basic.py
index 5ec1d6c..426ada3 100644
--- a/tempest/scenario/test_load_balancer_basic.py
+++ b/tempest/scenario/test_load_balancer_basic.py
@@ -185,7 +185,7 @@
# Start netcat
start_server = ('while true; do '
- 'sudo nc -l -p %(port)s -e sh /tmp/%(script)s; '
+ 'sudo nc -ll -p %(port)s -e sh /tmp/%(script)s; '
'done &')
cmd = start_server % {'port': self.port1,
'script': 'script1'}
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index f13ff0f..e4d7ece 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -53,7 +53,7 @@
create_kwargs=create_kwargs)
def nova_list(self):
- _, servers = self.servers_client.list_servers()
+ servers = self.servers_client.list_servers()
# The list servers in the compute client is inconsistent...
servers = servers['servers']
self.assertIn(self.server['id'], [x['id'] for x in servers])
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 265f9e5..7f01182 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -16,8 +16,8 @@
import collections
import re
-from tempest_lib import decorators
import testtools
+from testtools.tests import matchers
from tempest.common.utils import data_utils
from tempest import config
@@ -230,7 +230,7 @@
port_list = self._list_ports(device_id=server['id'])
self.assertEqual(1, len(port_list))
old_port = port_list[0]
- _, interface = self.interface_client.create_interface(
+ interface = self.interface_client.create_interface(
server=server['id'],
network_id=self.new_net.id)
self.addCleanup(self.network_client.wait_for_resource_deletion,
@@ -442,7 +442,6 @@
act_serv=servers,
trgt_serv=dns_servers))
- @decorators.skip_because(bug="1412325")
@testtools.skipUnless(CONF.scenario.dhcp_client,
"DHCP client is not available.")
@test.attr(type='smoke')
@@ -472,6 +471,13 @@
# arbitrary ip addresses as nameservers, instead of parsing CONF
initial_dns_server = '1.2.3.4'
alt_dns_server = '9.8.7.6'
+
+ # renewal should be immediate.
+ # Timeouts are suggested by salvatore-orlando in
+ # https://bugs.launchpad.net/neutron/+bug/1412325/comments/3
+ renew_delay = CONF.network.build_interval
+ renew_timeout = CONF.network.build_timeout
+
self._setup_network_and_servers(dns_nameservers=[initial_dns_server])
self.check_public_network_connectivity(should_connect=True)
@@ -487,11 +493,30 @@
self.assertEqual([alt_dns_server], self.subnet.dns_nameservers,
"Failed to update subnet's nameservers")
- # server needs to renew its dhcp lease in order to get the new dns
- # definitions from subnet
- ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'])
- self._check_dns_server(ssh_client, [alt_dns_server])
+ def check_new_dns_server():
+ """Server needs to renew its dhcp lease in order to get the new dns
+ definitions from subnet
+ NOTE(amuller): we are renewing the lease as part of the retry
+ because Neutron updates dnsmasq asynchronously after the
+ subnet-update API call returns.
+ """
+ ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'])
+ try:
+ self._check_dns_server(ssh_client, [alt_dns_server])
+ except matchers.MismatchError:
+ LOG.debug("Failed to update DNS nameservers")
+ return False
+ return True
+ self.assertTrue(test.call_until_true(check_new_dns_server,
+ renew_timeout,
+ renew_delay),
+ msg="DHCP renewal failed to fetch "
+ "new DNS nameservers")
+
+ @testtools.skipIf(CONF.baremetal.driver_enabled,
+ 'admin_state of instance ports cannot be altered '
+ 'for baremetal nodes')
@test.attr(type='smoke')
@test.services('compute', 'network')
def test_update_instance_port_admin_state(self):
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 55ab18f..394aed0 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -76,6 +76,8 @@
* test that traffic is blocked with default security group
* test that traffic is enabled after updating port with new security
group having appropriate rule
+ 8. _test_multiple_security_groups: test multiple security groups can be
+ associated with the vm
assumptions:
1. alt_tenant/user existed and is different from primary_tenant/user
@@ -512,3 +514,37 @@
for tenant in self.tenants.values():
self._log_console_output(servers=tenant.servers)
raise
+
+ @test.attr(type='smoke')
+ @test.services('compute', 'network')
+ def test_multiple_security_groups(self):
+ """
+ This test verifies multiple security groups and checks that rules
+ provided in the both the groups is applied onto VM
+ """
+ tenant = self.primary_tenant
+ ip = self._get_server_ip(tenant.access_point,
+ floating=self.floating_ip_access)
+ ssh_login = CONF.compute.image_ssh_user
+ private_key = tenant.keypair['private_key']
+ self.check_vm_connectivity(ip,
+ should_connect=False)
+ ruleset = dict(
+ protocol='icmp',
+ direction='ingress'
+ )
+ self._create_security_group_rule(
+ secgroup=tenant.security_groups['default'],
+ **ruleset
+ )
+ """
+ Vm now has 2 security groups one with ssh rule(
+ already added in setUp() method),and other with icmp rule
+ (added in the above step).The check_vm_connectivity tests
+ -that vm ping test is successful
+ -ssh to vm is successful
+ """
+ self.check_vm_connectivity(ip,
+ username=ssh_login,
+ private_key=private_key,
+ should_connect=True)
diff --git a/tempest/scenario/utils.py b/tempest/scenario/utils.py
index 061f5c8..68ec6e7 100644
--- a/tempest/scenario/utils.py
+++ b/tempest/scenario/utils.py
@@ -120,12 +120,15 @@
if not CONF.service_available.glance:
return []
if not hasattr(self, '_scenario_images'):
- images = self.images_client.list_images()
- self._scenario_images = [
- (self._normalize_name(i['name']), dict(image_ref=i['id']))
- for i in images if re.search(self.image_pattern,
- str(i['name']))
- ]
+ try:
+ images = self.images_client.list_images()
+ self._scenario_images = [
+ (self._normalize_name(i['name']), dict(image_ref=i['id']))
+ for i in images if re.search(self.image_pattern,
+ str(i['name']))
+ ]
+ except Exception:
+ self._scenario_images = []
return self._scenario_images
@property
@@ -134,12 +137,15 @@
:return: a scenario with name and uuid of flavors
"""
if not hasattr(self, '_scenario_flavors'):
- flavors = self.flavors_client.list_flavors()
- self._scenario_flavors = [
- (self._normalize_name(f['name']), dict(flavor_ref=f['id']))
- for f in flavors if re.search(self.flavor_pattern,
- str(f['name']))
- ]
+ try:
+ flavors = self.flavors_client.list_flavors()
+ self._scenario_flavors = [
+ (self._normalize_name(f['name']), dict(flavor_ref=f['id']))
+ for f in flavors if re.search(self.flavor_pattern,
+ str(f['name']))
+ ]
+ except Exception:
+ self._scenario_flavors = []
return self._scenario_flavors
diff --git a/tempest/services/baremetal/v1/json/baremetal_client.py b/tempest/services/baremetal/v1/json/baremetal_client.py
index 1c72a2b..09b6cd1 100644
--- a/tempest/services/baremetal/v1/json/baremetal_client.py
+++ b/tempest/services/baremetal/v1/json/baremetal_client.py
@@ -136,18 +136,18 @@
Create a baremetal node with the specified parameters.
:param cpu_arch: CPU architecture of the node. Default: x86_64.
- :param cpu_num: Number of CPUs. Default: 8.
- :param storage: Disk size. Default: 1024.
- :param memory: Available RAM. Default: 4096.
+ :param cpus: Number of CPUs. Default: 8.
+ :param local_gb: Disk size. Default: 1024.
+ :param memory_mb: Available RAM. Default: 4096.
:param driver: Driver name. Default: "fake"
:return: A tuple with the server response and the created node.
"""
node = {'chassis_uuid': chassis_id,
'properties': {'cpu_arch': kwargs.get('cpu_arch', 'x86_64'),
- 'cpu_num': kwargs.get('cpu_num', 8),
- 'storage': kwargs.get('storage', 1024),
- 'memory': kwargs.get('memory', 4096)},
+ 'cpus': kwargs.get('cpus', 8),
+ 'local_gb': kwargs.get('local_gb', 1024),
+ 'memory_mb': kwargs.get('memory_mb', 4096)},
'driver': kwargs.get('driver', 'fake')}
return self._create_request('nodes', node)
@@ -232,9 +232,9 @@
"""
node_attributes = ('properties/cpu_arch',
- 'properties/cpu_num',
- 'properties/storage',
- 'properties/memory',
+ 'properties/cpus',
+ 'properties/local_gb',
+ 'properties/memory_mb',
'driver',
'instance_uuid')
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 8e3a3c9..0354ba4 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -40,8 +40,6 @@
url = "os-floating-ips/%s" % str(floating_ip_id)
resp, body = self.get(url)
body = json.loads(body)
- if resp.status == 404:
- raise lib_exc.NotFound(body)
self.validate_response(schema.floating_ip, resp, body)
return service_client.ResponseBody(resp, body['floating_ip'])
diff --git a/tempest/services/compute/json/interfaces_client.py b/tempest/services/compute/json/interfaces_client.py
index 595b23c..0c5516c 100644
--- a/tempest/services/compute/json/interfaces_client.py
+++ b/tempest/services/compute/json/interfaces_client.py
@@ -29,7 +29,8 @@
resp, body = self.get('servers/%s/os-interface' % server)
body = json.loads(body)
self.validate_response(schema.list_interfaces, resp, body)
- return resp, body['interfaceAttachments']
+ return service_client.ResponseBodyList(resp,
+ body['interfaceAttachments'])
def create_interface(self, server, port_id=None, network_id=None,
fixed_ip=None):
@@ -45,28 +46,28 @@
resp, body = self.post('servers/%s/os-interface' % server,
body=post_body)
body = json.loads(body)
- return resp, body['interfaceAttachment']
+ return service_client.ResponseBody(resp, body['interfaceAttachment'])
def show_interface(self, server, port_id):
resp, body = self.get('servers/%s/os-interface/%s' % (server, port_id))
body = json.loads(body)
- return resp, body['interfaceAttachment']
+ return service_client.ResponseBody(resp, body['interfaceAttachment'])
def delete_interface(self, server, port_id):
resp, body = self.delete('servers/%s/os-interface/%s' % (server,
port_id))
self.validate_response(common_schema.delete_interface, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def wait_for_interface_status(self, server, port_id, status):
"""Waits for a interface to reach a given status."""
- resp, body = self.show_interface(server, port_id)
+ body = self.show_interface(server, port_id)
interface_status = body['port_state']
start = int(time.time())
while(interface_status != status):
time.sleep(self.build_interval)
- resp, body = self.show_interface(server, port_id)
+ body = self.show_interface(server, port_id)
interface_status = body['port_state']
timed_out = int(time.time()) - start >= self.build_timeout
@@ -78,7 +79,7 @@
self.build_timeout))
raise exceptions.TimeoutException(message)
- return resp, body
+ return body
def add_fixed_ip(self, server_id, network_id):
"""Add a fixed IP to input server instance."""
@@ -91,7 +92,7 @@
post_body)
self.validate_response(servers_schema.server_actions_common_schema,
resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def remove_fixed_ip(self, server_id, ip_address):
"""Remove input fixed IP from input server instance."""
@@ -104,4 +105,4 @@
post_body)
self.validate_response(servers_schema.server_actions_common_schema,
resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/networks_client.py b/tempest/services/compute/json/networks_client.py
index 361258a..ef1c058 100644
--- a/tempest/services/compute/json/networks_client.py
+++ b/tempest/services/compute/json/networks_client.py
@@ -24,10 +24,10 @@
resp, body = self.get("os-networks")
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['networks']
+ return service_client.ResponseBodyList(resp, body['networks'])
def get_network(self, network_id):
resp, body = self.get("os-networks/%s" % str(network_id))
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['network']
+ return service_client.ResponseBody(resp, body['network'])
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 6a5bce7..b01fbf1 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -157,7 +157,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(common_schema.list_servers, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_servers_with_detail(self, params=None):
"""Lists all servers in detail for a user."""
@@ -169,7 +169,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_servers_detail, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def wait_for_server_status(self, server_id, status, extra_timeout=0,
raise_on_error=True, ready_wait=True):
@@ -202,7 +202,7 @@
resp, body = self.get("servers/%s/ips" % str(server_id))
body = json.loads(body)
self.validate_response(schema.list_addresses, resp, body)
- return resp, body['addresses']
+ return service_client.ResponseBody(resp, body['addresses'])
def list_addresses_by_network(self, server_id, network_id):
"""Lists all addresses of a specific network type for a server."""
@@ -210,10 +210,11 @@
(str(server_id), network_id))
body = json.loads(body)
self.validate_response(schema.list_addresses_by_network, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def action(self, server_id, action_name, response_key,
- schema=common_schema.server_actions_common_schema, **kwargs):
+ schema=common_schema.server_actions_common_schema,
+ response_class=service_client.ResponseBody, **kwargs):
post_body = json.dumps({action_name: kwargs})
resp, body = self.post('servers/%s/action' % str(server_id),
post_body)
@@ -231,7 +232,7 @@
body = body[response_key]
else:
self.validate_response(schema, resp, body)
- return resp, body
+ return response_class(resp, body)
def create_backup(self, server_id, backup_type, rotation, name):
"""Backup a server instance."""
@@ -250,7 +251,7 @@
str(server_id))
body = json.loads(body)
self.validate_response(common_schema.get_password, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_password(self, server_id):
"""
@@ -262,7 +263,7 @@
str(server_id))
self.validate_response(common_schema.server_actions_delete_password,
resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def reboot(self, server_id, reboot_type):
"""Reboots a server."""
@@ -303,7 +304,7 @@
resp, body = self.get("servers/%s/metadata" % str(server_id))
body = json.loads(body)
self.validate_response(common_schema.list_server_metadata, resp, body)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def set_server_metadata(self, server_id, meta, no_metadata_field=False):
if no_metadata_field:
@@ -314,7 +315,7 @@
post_body)
body = json.loads(body)
self.validate_response(common_schema.set_server_metadata, resp, body)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_server_metadata(self, server_id, meta):
post_body = json.dumps({'metadata': meta})
@@ -323,14 +324,14 @@
body = json.loads(body)
self.validate_response(common_schema.update_server_metadata,
resp, body)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def get_server_metadata_item(self, server_id, key):
resp, body = self.get("servers/%s/metadata/%s" % (str(server_id), key))
body = json.loads(body)
self.validate_response(schema.set_get_server_metadata_item,
resp, body)
- return resp, body['meta']
+ return service_client.ResponseBody(resp, body['meta'])
def set_server_metadata_item(self, server_id, key, meta):
post_body = json.dumps({'meta': meta})
@@ -339,14 +340,14 @@
body = json.loads(body)
self.validate_response(schema.set_get_server_metadata_item,
resp, body)
- return resp, body['meta']
+ return service_client.ResponseBody(resp, body['meta'])
def delete_server_metadata_item(self, server_id, key):
resp, body = self.delete("servers/%s/metadata/%s" %
(str(server_id), key))
self.validate_response(common_schema.delete_server_metadata_item,
resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def stop(self, server_id, **kwargs):
return self.action(server_id, 'os-stop', None, **kwargs)
@@ -413,7 +414,7 @@
resp, body = self.post("servers/%s/action" % str(server_id), req_body)
self.validate_response(common_schema.server_actions_common_schema,
resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def migrate_server(self, server_id, **kwargs):
"""Migrates a server to a new host."""
@@ -462,7 +463,9 @@
def get_console_output(self, server_id, length):
kwargs = {'length': length} if length else {}
return self.action(server_id, 'os-getConsoleOutput', 'output',
- common_schema.get_console_output, **kwargs)
+ common_schema.get_console_output,
+ response_class=service_client.ResponseBodyData,
+ **kwargs)
def list_virtual_interfaces(self, server_id):
"""
@@ -472,12 +475,14 @@
'os-virtual-interfaces']))
body = json.loads(body)
self.validate_response(schema.list_virtual_interfaces, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def rescue_server(self, server_id, **kwargs):
"""Rescue the provided server."""
return self.action(server_id, 'rescue', 'adminPass',
- schema.rescue_server, **kwargs)
+ schema.rescue_server,
+ response_class=service_client.ResponseBodyData,
+ **kwargs)
def unrescue_server(self, server_id):
"""Unrescue the provided server."""
@@ -486,7 +491,7 @@
def get_server_diagnostics(self, server_id):
"""Get the usage data for a server."""
resp, body = self.get("servers/%s/diagnostics" % str(server_id))
- return resp, json.loads(body)
+ return service_client.ResponseBody(resp, json.loads(body))
def list_instance_actions(self, server_id):
"""List the provided server action."""
@@ -494,7 +499,7 @@
str(server_id))
body = json.loads(body)
self.validate_response(schema.list_instance_actions, resp, body)
- return resp, body['instanceActions']
+ return service_client.ResponseBodyList(resp, body['instanceActions'])
def get_instance_action(self, server_id, request_id):
"""Returns the action details of the provided server."""
@@ -502,7 +507,7 @@
(str(server_id), str(request_id)))
body = json.loads(body)
self.validate_response(schema.get_instance_action, resp, body)
- return resp, body['instanceAction']
+ return service_client.ResponseBody(resp, body['instanceAction'])
def force_delete_server(self, server_id, **kwargs):
"""Force delete a server."""
@@ -542,24 +547,24 @@
body = json.loads(body)
self.validate_response(schema.create_get_server_group, resp, body)
- return resp, body['server_group']
+ return service_client.ResponseBody(resp, body['server_group'])
def delete_server_group(self, server_group_id):
"""Delete the given server-group."""
resp, body = self.delete("os-server-groups/%s" % str(server_group_id))
self.validate_response(schema.delete_server_group, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_server_groups(self):
"""List the server-groups."""
resp, body = self.get("os-server-groups")
body = json.loads(body)
self.validate_response(schema.list_server_groups, resp, body)
- return resp, body['server_groups']
+ return service_client.ResponseBodyList(resp, body['server_groups'])
def get_server_group(self, server_group_id):
"""Get the details of given server_group."""
resp, body = self.get("os-server-groups/%s" % str(server_group_id))
body = json.loads(body)
self.validate_response(schema.create_get_server_group, resp, body)
- return resp, body['server_group']
+ return service_client.ResponseBody(resp, body['server_group'])
diff --git a/tempest/services/database/json/flavors_client.py b/tempest/services/database/json/flavors_client.py
index dfb2eb3..c956e27 100644
--- a/tempest/services/database/json/flavors_client.py
+++ b/tempest/services/database/json/flavors_client.py
@@ -27,9 +27,9 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def get_db_flavor_details(self, db_flavor_id):
resp, body = self.get("flavors/%s" % str(db_flavor_id))
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
diff --git a/tempest/services/database/json/limits_client.py b/tempest/services/database/json/limits_client.py
index 6168bfd..ae758bc 100644
--- a/tempest/services/database/json/limits_client.py
+++ b/tempest/services/database/json/limits_client.py
@@ -15,10 +15,10 @@
import urllib
-from tempest_lib.common import rest_client
+from tempest.common import service_client
-class DatabaseLimitsClientJSON(rest_client.RestClient):
+class DatabaseLimitsClientJSON(service_client.ServiceClient):
def list_db_limits(self, params=None):
"""List all limits."""
@@ -27,4 +27,4 @@
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
diff --git a/tempest/services/database/json/versions_client.py b/tempest/services/database/json/versions_client.py
index c3388bb..aa2fef7 100644
--- a/tempest/services/database/json/versions_client.py
+++ b/tempest/services/database/json/versions_client.py
@@ -43,4 +43,4 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
diff --git a/tempest/services/identity/json/identity_client.py b/tempest/services/identity/json/identity_client.py
index 6fbb3a9..6c4a6b4 100644
--- a/tempest/services/identity/json/identity_client.py
+++ b/tempest/services/identity/json/identity_client.py
@@ -14,20 +14,10 @@
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
class IdentityClientJSON(service_client.ServiceClient):
- def __init__(self, auth_provider):
- super(IdentityClientJSON, self).__init__(
- auth_provider,
- CONF.identity.catalog_type,
- CONF.identity.region,
- endpoint_type='adminURL')
-
def has_admin_extensions(self):
"""
Returns True if the KSADM Admin Extensions are supported
diff --git a/tempest/services/identity/json/token_client.py b/tempest/services/identity/json/token_client.py
index 1e8b31e..b28dabb 100644
--- a/tempest/services/identity/json/token_client.py
+++ b/tempest/services/identity/json/token_client.py
@@ -16,17 +16,13 @@
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
-from tempest import config
from tempest import exceptions
-CONF = config.CONF
-
class TokenClientJSON(service_client.ServiceClient):
- def __init__(self):
+ def __init__(self, auth_url):
super(TokenClientJSON, self).__init__(None, None, None)
- auth_url = CONF.identity.uri
# Normalize URI to ensure /tokens is in it.
if 'tokens' not in auth_url:
diff --git a/tempest/services/identity/v3/json/base.py b/tempest/services/identity/v3/json/base.py
deleted file mode 100644
index cba480a..0000000
--- a/tempest/services/identity/v3/json/base.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class IdentityV3Client(service_client.ServiceClient):
- """
- Base identity v3 client class
- """
-
- def __init__(self, auth_provider):
- super(IdentityV3Client, self).__init__(
- auth_provider,
- CONF.identity.catalog_type,
- CONF.identity.region,
- endpoint_type='adminURL')
- self.api_version = "v3"
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
index 1289e48..0a614cd 100644
--- a/tempest/services/identity/v3/json/credentials_client.py
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -16,10 +16,10 @@
import json
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class CredentialsClientJSON(base.IdentityV3Client):
+class CredentialsClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def create_credential(self, access_key, secret_key, user_id, project_id):
"""Creates a credential."""
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index d71836e..5b7e812 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -16,10 +16,10 @@
import json
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class EndPointClientJSON(base.IdentityV3Client):
+class EndPointClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def list_endpoints(self):
"""GET endpoints."""
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 95c52bf..be5aa80 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -17,10 +17,10 @@
import urllib
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class IdentityV3ClientJSON(base.IdentityV3Client):
+class IdentityV3ClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def create_user(self, user_name, password=None, project_id=None,
email=None, domain_id='default', **kwargs):
diff --git a/tempest/services/identity/v3/json/policy_client.py b/tempest/services/identity/v3/json/policy_client.py
index 25931c8..8c9c9ce 100644
--- a/tempest/services/identity/v3/json/policy_client.py
+++ b/tempest/services/identity/v3/json/policy_client.py
@@ -16,10 +16,10 @@
import json
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class PolicyClientJSON(base.IdentityV3Client):
+class PolicyClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def create_policy(self, blob, type):
"""Creates a Policy."""
diff --git a/tempest/services/identity/v3/json/region_client.py b/tempest/services/identity/v3/json/region_client.py
index 482cbc6..faaf43c 100644
--- a/tempest/services/identity/v3/json/region_client.py
+++ b/tempest/services/identity/v3/json/region_client.py
@@ -17,10 +17,10 @@
import urllib
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class RegionClientJSON(base.IdentityV3Client):
+class RegionClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def create_region(self, description, **kwargs):
"""Create region."""
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index 2e2df13..e039dc6 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -16,10 +16,10 @@
import json
from tempest.common import service_client
-from tempest.services.identity.v3.json import base
-class ServiceClientJSON(base.IdentityV3Client):
+class ServiceClientJSON(service_client.ServiceClient):
+ api_version = "v3"
def update_service(self, service_id, **kwargs):
"""Updates a service."""
diff --git a/tempest/services/identity/v3/json/token_client.py b/tempest/services/identity/v3/json/token_client.py
index 1467d7c..582897a 100644
--- a/tempest/services/identity/v3/json/token_client.py
+++ b/tempest/services/identity/v3/json/token_client.py
@@ -16,17 +16,13 @@
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
-from tempest import config
from tempest import exceptions
-CONF = config.CONF
-
class V3TokenClientJSON(service_client.ServiceClient):
- def __init__(self):
+ def __init__(self, auth_url):
super(V3TokenClientJSON, self).__init__(None, None, None)
- auth_url = CONF.identity.uri_v3
if not auth_url:
raise exceptions.InvalidConfiguration('you must specify a v3 uri '
'if using the v3 identity '
@@ -36,23 +32,22 @@
self.auth_url = auth_url
- def auth(self, user=None, password=None, tenant=None, user_type='id',
- domain=None, token=None):
+ def auth(self, user=None, password=None, project=None, user_type='id',
+ user_domain=None, project_domain=None, token=None):
"""
:param user: user id or name, as specified in user_type
- :param domain: the user and tenant domain
+ :param user_domain: the user domain
+ :param project_domain: the project domain
:param token: a token to re-scope.
Accepts different combinations of credentials. Restrictions:
- - tenant and domain are only name (no id)
- - user domain and tenant domain are assumed identical
- - domain scope is not supported here
+ - project and domain are only name (no id)
Sample sample valid combinations:
- token
- - token, tenant, domain
+ - token, project, project_domain
- user_id, password
- - username, password, domain
- - username, password, tenant, domain
+ - username, password, user_domain
+ - username, password, project, user_domain, project_domain
Validation is left to the server side.
"""
creds = {
@@ -79,13 +74,13 @@
id_obj['password']['user']['id'] = user
else:
id_obj['password']['user']['name'] = user
- if domain is not None:
- _domain = dict(name=domain)
+ if user_domain is not None:
+ _domain = dict(name=user_domain)
id_obj['password']['user']['domain'] = _domain
- if tenant is not None:
- _domain = dict(name=domain)
- project = dict(name=tenant, domain=_domain)
- scope = dict(project=project)
+ if project is not None:
+ _domain = dict(name=project_domain)
+ _project = dict(name=project, domain=_domain)
+ scope = dict(project=_project)
creds['auth']['scope'] = scope
body = json.dumps(creds)
@@ -120,14 +115,15 @@
return resp, json.loads(resp_body)
- def get_token(self, user, password, tenant, domain='Default',
- auth_data=False):
+ def get_token(self, user, password, project=None, project_domain='Default',
+ user_domain='Default', auth_data=False):
"""
:param user: username
Returns (token id, token data) for supplied credentials
"""
- body = self.auth(user, password, tenant, user_type='name',
- domain=domain)
+ body = self.auth(user, password, project, user_type='name',
+ user_domain=user_domain,
+ project_domain=project_domain)
token = body.response.get('x-subject-token')
if auth_data:
diff --git a/tempest/services/messaging/json/messaging_client.py b/tempest/services/messaging/json/messaging_client.py
index 36444a9..89aa87b 100644
--- a/tempest/services/messaging/json/messaging_client.py
+++ b/tempest/services/messaging/json/messaging_client.py
@@ -50,51 +50,51 @@
if resp['status'] != '204':
body = json.loads(body)
self.validate_response(queues_schema.list_queues, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.put(uri, body=None)
self.expected_success(201, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.get(uri)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def head_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.head(uri)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_queue_stats(self, queue_name):
uri = '{0}/queues/{1}/stats'.format(self.uri_prefix, queue_name)
resp, body = self.get(uri)
body = json.loads(body)
self.validate_response(queues_schema.queue_stats, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_queue_metadata(self, queue_name):
uri = '{0}/queues/{1}/metadata'.format(self.uri_prefix, queue_name)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def set_queue_metadata(self, queue_name, rbody):
uri = '{0}/queues/{1}/metadata'.format(self.uri_prefix, queue_name)
resp, body = self.put(uri, body=json.dumps(rbody))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def post_messages(self, queue_name, rbody):
uri = '{0}/queues/{1}/messages'.format(self.uri_prefix, queue_name)
@@ -104,7 +104,7 @@
body = json.loads(body)
self.validate_response(queues_schema.post_messages, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_messages(self, queue_name):
uri = '{0}/queues/{1}/messages?echo=True'.format(self.uri_prefix,
@@ -115,7 +115,7 @@
body = json.loads(body)
self.validate_response(queues_schema.list_messages, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_single_message(self, message_uri):
resp, body = self.get(message_uri, extra_headers=True,
@@ -124,7 +124,7 @@
body = json.loads(body)
self.validate_response(queues_schema.get_single_message, resp,
body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_multiple_messages(self, message_uri):
resp, body = self.get(message_uri, extra_headers=True,
@@ -136,12 +136,12 @@
resp,
body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_messages(self, message_uri):
resp, body = self.delete(message_uri)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def post_claims(self, queue_name, rbody, url_params=False):
uri = '{0}/queues/{1}/claims'.format(self.uri_prefix, queue_name)
@@ -154,7 +154,7 @@
body = json.loads(body)
self.validate_response(queues_schema.claim_messages, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def query_claim(self, claim_uri):
resp, body = self.get(claim_uri)
@@ -162,14 +162,14 @@
if resp['status'] != '204':
body = json.loads(body)
self.validate_response(queues_schema.query_claim, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_claim(self, claim_uri, rbody):
resp, body = self.patch(claim_uri, body=json.dumps(rbody))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def release_claim(self, claim_uri):
resp, body = self.delete(claim_uri)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 5106225..ba069e8 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -320,6 +320,8 @@
cur_gw_info.pop('enable_snat', None)
update_body['external_gateway_info'] = kwargs.get(
'external_gateway_info', body['router']['external_gateway_info'])
+ if 'distributed' in kwargs:
+ update_body['distributed'] = kwargs['distributed']
update_body = dict(router=update_body)
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 9ef1686..059664c 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -336,6 +336,14 @@
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
+ def retype_volume(self, volume_id, volume_type, **kwargs):
+ """Updates volume with new volume type."""
+ post_body = {'new_type': volume_type}
+ post_body.update(kwargs)
+ post_body = json.dumps({'os-retype': post_body})
+ resp, body = self.post('volumes/%s/action' % volume_id, post_body)
+ self.expected_success(202, resp.status)
+
class VolumesClientJSON(BaseVolumesClientJSON):
"""
diff --git a/tempest/stress/actions/server_create_destroy.py b/tempest/stress/actions/server_create_destroy.py
index 34e299d..d0e4eea 100644
--- a/tempest/stress/actions/server_create_destroy.py
+++ b/tempest/stress/actions/server_create_destroy.py
@@ -28,7 +28,7 @@
def run(self):
name = data_utils.rand_name("instance")
self.logger.info("creating %s" % name)
- _, server = self.manager.servers_client.create_server(
+ server = self.manager.servers_client.create_server(
name, self.image, self.flavor)
server_id = server['id']
self.manager.servers_client.wait_for_server_status(server_id,
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index c473df6..b2c612e 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -74,9 +74,9 @@
self.logger.info("creating %s" % name)
vm_args = self.vm_extra_args.copy()
vm_args['security_groups'] = [self.sec_grp]
- _, server = servers_client.create_server(name, self.image,
- self.flavor,
- **vm_args)
+ server = servers_client.create_server(name, self.image,
+ self.flavor,
+ **vm_args)
self.server_id = server['id']
if self.wait_after_vm_create:
self.manager.servers_client.wait_for_server_status(self.server_id,
@@ -104,7 +104,7 @@
def _create_floating_ip(self):
floating_cli = self.manager.floating_ips_client
- _, self.floating = floating_cli.create_floating_ip(self.floating_pool)
+ self.floating = floating_cli.create_floating_ip(self.floating_pool)
def _destroy_floating_ip(self):
cli = self.manager.floating_ips_client
@@ -144,7 +144,7 @@
cli = self.manager.floating_ips_client
def func():
- _, floating = cli.get_floating_ip_details(self.floating['id'])
+ floating = cli.get_floating_ip_details(self.floating['id'])
return floating['instance_id'] is None
if not tempest.test.call_until_true(func, self.check_timeout,
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
index 9c4070f..2e1d623 100644
--- a/tempest/stress/actions/volume_attach_delete.py
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -28,7 +28,7 @@
# Step 1: create volume
name = data_utils.rand_name("volume")
self.logger.info("creating volume: %s" % name)
- _, volume = self.manager.volumes_client.create_volume(
+ volume = self.manager.volumes_client.create_volume(
size=1,
display_name=name)
self.manager.volumes_client.wait_for_volume_status(volume['id'],
@@ -38,7 +38,7 @@
# Step 2: create vm instance
vm_name = data_utils.rand_name("instance")
self.logger.info("creating vm: %s" % vm_name)
- _, server = self.manager.servers_client.create_server(
+ server = self.manager.servers_client.create_server(
vm_name, self.image, self.flavor)
server_id = server['id']
self.manager.servers_client.wait_for_server_status(server_id, 'ACTIVE')
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 3c052ac..c013af3 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -36,9 +36,9 @@
vm_args = self.vm_extra_args.copy()
vm_args['security_groups'] = [self.sec_grp]
vm_args['key_name'] = self.key['name']
- _, server = servers_client.create_server(name, self.image,
- self.flavor,
- **vm_args)
+ server = servers_client.create_server(name, self.image,
+ self.flavor,
+ **vm_args)
self.server_id = server['id']
self.manager.servers_client.wait_for_server_status(self.server_id,
'ACTIVE')
@@ -65,7 +65,7 @@
def _create_floating_ip(self):
floating_cli = self.manager.floating_ips_client
- _, self.floating = floating_cli.create_floating_ip(self.floating_pool)
+ self.floating = floating_cli.create_floating_ip(self.floating_pool)
def _destroy_floating_ip(self):
cli = self.manager.floating_ips_client
@@ -77,7 +77,7 @@
name = data_utils.rand_name("volume")
self.logger.info("creating volume: %s" % name)
volumes_client = self.manager.volumes_client
- _, self.volume = volumes_client.create_volume(
+ self.volume = volumes_client.create_volume(
size=1,
display_name=name)
volumes_client.wait_for_volume_status(self.volume['id'],
@@ -95,7 +95,7 @@
cli = self.manager.floating_ips_client
def func():
- _, floating = cli.get_floating_ip_details(self.floating['id'])
+ floating = cli.get_floating_ip_details(self.floating['id'])
return floating['instance_id'] is None
if not tempest.test.call_until_true(func, CONF.compute.build_timeout,
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index 86325f5..161d93f 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -23,7 +23,7 @@
def cleanup():
admin_manager = clients.AdminManager()
- _, body = admin_manager.servers_client.list_servers({"all_tenants": True})
+ body = admin_manager.servers_client.list_servers({"all_tenants": True})
LOG.info("Cleanup::remove %s servers" % len(body['servers']))
for s in body['servers']:
try:
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index f45f2cf..a836a20 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -73,7 +73,8 @@
test_account_class = accounts.Accounts('test_name')
hash_list = self._get_hash_list(self.test_accounts)
test_cred_dict = self.test_accounts[3]
- test_creds = auth.get_credentials(**test_cred_dict)
+ test_creds = auth.get_credentials(fake_identity.FAKE_AUTH_URL,
+ **test_cred_dict)
results = test_account_class.get_hash(test_creds)
self.assertEqual(hash_list[3], results)
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index 443b67e..afe4abc 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -46,6 +46,15 @@
from tempest.services.data_processing.v1_1 import data_processing_client
from tempest.services.database.json import flavors_client as db_flavor_client
from tempest.services.database.json import versions_client as db_version_client
+from tempest.services.identity.json import identity_client as \
+ identity_v2_identity_client
+from tempest.services.identity.v3.json import credentials_client
+from tempest.services.identity.v3.json import endpoints_client
+from tempest.services.identity.v3.json import identity_client as \
+ identity_v3_identity_client
+from tempest.services.identity.v3.json import policy_client
+from tempest.services.identity.v3.json import region_client
+from tempest.services.identity.v3.json import service_client
from tempest.services.messaging.json import messaging_client
from tempest.services.network.json import network_client
from tempest.services.object_storage import account_client
@@ -148,6 +157,13 @@
volume_v2_qos_client.QosSpecsV2ClientJSON,
volume_v2_snapshots_client.SnapshotsV2ClientJSON,
volume_v2_volumes_client.VolumesV2ClientJSON,
+ identity_v2_identity_client.IdentityClientJSON,
+ credentials_client.CredentialsClientJSON,
+ endpoints_client.EndPointClientJSON,
+ identity_v3_identity_client.IdentityV3ClientJSON,
+ policy_client.PolicyClientJSON,
+ region_client.RegionClientJSON,
+ service_client.ServiceClientJSON
]
for client in test_clients:
diff --git a/tempest/tests/fake_identity.py b/tempest/tests/fake_identity.py
index 97098e1..ad78f85 100644
--- a/tempest/tests/fake_identity.py
+++ b/tempest/tests/fake_identity.py
@@ -17,6 +17,7 @@
import httplib2
+FAKE_AUTH_URL = 'http://fake_uri.com/auth'
TOKEN = "fake_token"
ALT_TOKEN = "alt_fake_token"
diff --git a/tempest/tests/test_auth.py b/tempest/tests/test_auth.py
index 0317ad6..c236dbe 100644
--- a/tempest/tests/test_auth.py
+++ b/tempest/tests/test_auth.py
@@ -38,11 +38,11 @@
_auth_provider_class = None
credentials = fake_credentials.FakeCredentials()
- def _auth(self, credentials, **params):
+ def _auth(self, credentials, auth_url, **params):
"""
returns auth method according to keystone
"""
- return self._auth_provider_class(credentials, **params)
+ return self._auth_provider_class(credentials, auth_url, **params)
def setUp(self):
super(BaseAuthTestsSetUp, self).setUp()
@@ -50,7 +50,8 @@
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
- self.auth_provider = self._auth(self.credentials)
+ self.auth_provider = self._auth(self.credentials,
+ fake_identity.FAKE_AUTH_URL)
class TestBaseAuthProvider(BaseAuthTestsSetUp):
@@ -78,6 +79,12 @@
_auth_provider_class = FakeAuthProviderImpl
+ def _auth(self, credentials, auth_url, **params):
+ """
+ returns auth method according to keystone
+ """
+ return self._auth_provider_class(credentials, **params)
+
def test_check_credentials_bad_type(self):
self.assertFalse(self.auth_provider.check_credentials([]))
diff --git a/tempest/tests/test_credentials.py b/tempest/tests/test_credentials.py
index 7621f6e..54a3360 100644
--- a/tempest/tests/test_credentials.py
+++ b/tempest/tests/test_credentials.py
@@ -84,7 +84,8 @@
self.identity_response)
def _verify_credentials(self, credentials_class, creds_dict, filled=True):
- creds = auth.get_credentials(fill_in=filled,
+ creds = auth.get_credentials(fake_identity.FAKE_AUTH_URL,
+ fill_in=filled,
identity_version=self.identity_version,
**creds_dict)
self._check(creds, credentials_class, filled)