Merge "Update compute base test to split up resource_setup"
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/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