Merge "Split resource_setup for object_storage tests"
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/base.py b/tempest/api/compute/base.py
index 4120a9a..c448975 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")
@@ -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/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..1e2b6e7 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')
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..33995f3 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,
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index c5148c1..58740fd 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()
diff --git a/tempest/api/compute/servers/test_server_addresses.py b/tempest/api/compute/servers/test_server_addresses.py
index 46e8642..5a63033 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')
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_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index a1658df..8d5c8f8 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
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index 0583106..58353e7 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
diff --git a/tempest/api/compute/servers/test_virtual_interfaces.py b/tempest/api/compute/servers/test_virtual_interfaces.py
index bc26881..5c76ba7 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']
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..1211db3 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'])
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/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/auth.py b/tempest/auth.py
index ffeae02..f78bb20 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -321,8 +321,9 @@
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):
diff --git a/tempest/common/credentials.py b/tempest/common/credentials.py
index 08b592f..6a4ee08c 100644
--- a/tempest/common/credentials.py
+++ b/tempest/common/credentials.py
@@ -12,6 +12,7 @@
# 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
@@ -37,3 +38,22 @@
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')
+ except NotImplementedError:
+ is_admin = False
+
+ return is_admin
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_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 265f9e5..aeb73a9 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -492,6 +492,9 @@
ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'])
self._check_dns_server(ssh_client, [alt_dns_server])
+ @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/services/identity/v3/json/token_client.py b/tempest/services/identity/v3/json/token_client.py
index 1467d7c..5d75efa 100644
--- a/tempest/services/identity/v3/json/token_client.py
+++ b/tempest/services/identity/v3/json/token_client.py
@@ -36,23 +36,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 +78,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 +119,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/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,