Merge "Fix flavors tests so they can be run in parallel"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 8429cd0..f837e69 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -155,13 +155,6 @@
# Port that the Image API is running on
port = 9292
-# This should be the username of a user WITHOUT administrative privileges
-username = demo
-# The above non-administrative user's password
-password = pass
-# The above non-administrative user's tenant name
-tenant_name = demo
-
[compute-admin]
# This section contains configuration options for an administrative
# user of the Compute API. These options are used in tests that stress
@@ -210,29 +203,6 @@
# for each tenant to have their own router.
public_router_id = {$PUBLIC_ROUTER_ID}
-[network-admin]
-# This section contains configuration options for an administrative
-# user of the Network API.
-
-# This should be the username of a user WITH administrative privileges
-username = admin
-# The above administrative user's password
-password = pass
-# The above administrative user's tenant name
-tenant_name = admin
-
-[identity-admin]
-# This section contains configuration options for an administrative
-# user of the Compute API. These options are used in tests that stress
-# the admin-only parts of the Compute API
-
-# This should be the username of a user WITH administrative privileges
-username = admin
-# The above administrative user's password
-password = pass
-# The above administrative user's tenant name
-tenant_name = admin
-
[volume]
# This section contains the configuration options used when executing tests
# against the OpenStack Block Storage API service
diff --git a/tempest/clients.py b/tempest/clients.py
index ac163b6..801bdcf 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -51,10 +51,10 @@
VolumesExtensionsClientXML
from tempest.services.compute.xml.console_output_client import \
ConsoleOutputsClientXML
-from tempest.services.identity.json.admin_client import AdminClientJSON
-from tempest.services.identity.json.admin_client import TokenClientJSON
-from tempest.services.identity.xml.admin_client import AdminClientXML
-from tempest.services.identity.xml.admin_client import TokenClientXML
+from tempest.services.identity.json.identity_client import IdentityClientJSON
+from tempest.services.identity.json.identity_client import TokenClientJSON
+from tempest.services.identity.xml.identity_client import IdentityClientXML
+from tempest.services.identity.xml.identity_client import TokenClientXML
from tempest.services.image import service as image_service
from tempest.services.network.json.network_client import NetworkClient
from tempest.services.object_storage.account_client import AccountClient
@@ -114,9 +114,9 @@
"xml": VolumesClientXML,
}
-ADMIN_CLIENT = {
- "json": AdminClientJSON,
- "xml": AdminClientXML,
+IDENTITY_CLIENT = {
+ "json": IdentityClientJSON,
+ "xml": IdentityClientXML,
}
TOKEN_CLIENT = {
@@ -187,7 +187,7 @@
self.volumes_extensions_client = vol_ext_cli
self.floating_ips_client = FLOAT_CLIENTS[interface](*client_args)
self.volumes_client = VOLUMES_CLIENTS[interface](*client_args)
- self.admin_client = ADMIN_CLIENT[interface](*client_args)
+ self.identity_client = IDENTITY_CLIENT[interface](*client_args)
self.token_client = TOKEN_CLIENT[interface](self.config)
self.security_groups_client = \
SECURITY_GROUPS_CLIENT[interface](*client_args)
@@ -208,6 +208,21 @@
AccountClientCustomizedHeader(*client_args)
+class NonAdminManager(Manager):
+
+ """
+ Manager object that uses the alt_XXX credentials for its
+ managed client objects
+ """
+
+ def __init__(self, interface='json'):
+ conf = config.TempestConfig()
+ super(NonAdminManager, self).__init__(conf.compute.username,
+ conf.compute.password,
+ conf.compute.tenant_name,
+ interface=interface)
+
+
class AltManager(Manager):
"""
@@ -248,33 +263,3 @@
self.services = {}
self.services['image'] = image_service.Service(self.config)
self.images = self.services['image']
-
-
-class IdentityManager(Manager):
-
- """
- Manager object that uses the alt_XXX credentials for its
- managed client objects
- """
-
- def __init__(self, interface='json'):
- conf = config.TempestConfig()
- super(IdentityManager, self).__init__(conf.identity_admin.username,
- conf.identity_admin.password,
- conf.identity_admin.tenant_name,
- interface)
-
-
-class IdentityNaManager(Manager):
-
- """
- Manager object that uses the alt_XXX credentials for its
- managed client objects
- """
-
- def __init__(self, interface='json'):
- conf = config.TempestConfig()
- super(IdentityNaManager, self).__init__(conf.compute.username,
- conf.compute.password,
- conf.compute.tenant_name,
- interface)
diff --git a/tempest/common/utils/data_utils.py b/tempest/common/utils/data_utils.py
index 8f90c1f..82982b8 100644
--- a/tempest/common/utils/data_utils.py
+++ b/tempest/common/utils/data_utils.py
@@ -64,7 +64,7 @@
def parse_image_id(image_ref):
"""Return the image id from a given image ref."""
- return image_ref.rsplit('/')[-1]
+ return image_ref.rsplit('/')[-1]
def arbitrary_string(size=4, base_text=None):
diff --git a/tempest/config.py b/tempest/config.py
index 70b1c79..a7b9d27 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -79,29 +79,6 @@
conf.identity.uri = authurl
-identity_admin_group = cfg.OptGroup(name='identity-admin',
- title="Identity Admin Options")
-
-IdentityAdminGroup = [
- cfg.StrOpt('username',
- default='admin',
- help="Username to use for Identity Admin API requests"),
- cfg.StrOpt('tenant_name',
- default='admin',
- help="Tenant name to use for Identity Admin API requests"),
- cfg.StrOpt('password',
- default='pass',
- help="API key to use for Identity Admin API requests",
- secret=True),
-]
-
-
-def register_identity_admin_opts(conf):
- conf.register_group(identity_admin_group)
- for opt in IdentityAdminGroup:
- conf.register_opt(opt, group='identity-admin')
-
-
compute_group = cfg.OptGroup(name='compute',
title='Compute Service Options')
@@ -273,18 +250,6 @@
cfg.StrOpt('api_version',
default='1',
help="Version of the API"),
- cfg.StrOpt('username',
- default='demo',
- help="Username to use for Images API requests. Defaults to "
- "'demo'."),
- cfg.StrOpt('password',
- default='pass',
- help="Password for user",
- secret=True),
- cfg.StrOpt('tenant_name',
- default="demo",
- help="Tenant to use for Images API requests. Defaults to "
- "'demo'."),
]
@@ -304,16 +269,6 @@
cfg.StrOpt('api_version',
default="v1.1",
help="Version of Quantum API"),
- cfg.StrOpt('username',
- default="demo",
- help="Username to use for Quantum API requests."),
- cfg.StrOpt('tenant_name',
- default="demo",
- help="Tenant name to use for Quantum API requests."),
- cfg.StrOpt('password',
- default="pass",
- help="API key to use when authenticating as admin.",
- secret=True),
cfg.StrOpt('tenant_network_cidr',
default="10.100.0.0/16",
help="The cidr block to allocate tenant networks from"),
@@ -340,31 +295,6 @@
for opt in NetworkGroup:
conf.register_opt(opt, group='network')
-network_admin_group = cfg.OptGroup(name='network-admin',
- title="Network Admin Options")
-
-NetworkAdminGroup = [
- cfg.StrOpt('username',
- default='admin',
- help="Administrative Username to use for Quantum API "
- "requests."),
- cfg.StrOpt('tenant_name',
- default='admin',
- help="Administrative Tenant name to use for Quantum API "
- "requests."),
- cfg.StrOpt('password',
- default='pass',
- help="API key to use when authenticating as admin.",
- secret=True),
-]
-
-
-def register_network_admin_opts(conf):
- conf.register_group(network_admin_group)
- for opt in NetworkAdminGroup:
- conf.register_opt(opt, group='network-admin')
-
-
volume_group = cfg.OptGroup(name='volume',
title='Block Storage Options')
@@ -510,21 +440,17 @@
register_compute_opts(cfg.CONF)
register_identity_opts(cfg.CONF)
- register_identity_admin_opts(cfg.CONF)
register_compute_admin_opts(cfg.CONF)
register_image_opts(cfg.CONF)
register_network_opts(cfg.CONF)
- register_network_admin_opts(cfg.CONF)
register_volume_opts(cfg.CONF)
register_object_storage_opts(cfg.CONF)
register_boto_opts(cfg.CONF)
self.compute = cfg.CONF.compute
self.compute_admin = cfg.CONF['compute-admin']
self.identity = cfg.CONF.identity
- self.identity_admin = cfg.CONF['identity-admin']
self.images = cfg.CONF.image
self.network = cfg.CONF.network
- self.network_admin = cfg.CONF['network-admin']
self.volume = cfg.CONF.volume
self.object_storage = cfg.CONF['object-storage']
self.boto = cfg.CONF.boto
diff --git a/tempest/manager.py b/tempest/manager.py
index 8e7cbd1..ef9eed4 100644
--- a/tempest/manager.py
+++ b/tempest/manager.py
@@ -153,17 +153,18 @@
# This identity client is not intended to check the security
# of the identity service, so use admin credentials by default.
if not username:
- username = self.config.identity_admin.username
+ username = self.config.compute_admin.username
if not password:
- password = self.config.identity_admin.password
+ password = self.config.compute_admin.password
if not tenant_name:
- tenant_name = self.config.identity_admin.tenant_name
+ tenant_name = self.config.compute_admin.tenant_name
if None in (username, password, tenant_name):
msg = ("Missing required credentials for identity client. "
"username: %(username)s, password: %(password)s, "
"tenant_name: %(tenant_name)s") % locals()
raise exceptions.InvalidConfiguration(msg)
+ #TODO(afazekas): Above is a code dpulication, net to be resolved
auth_url = self.config.identity.uri
dscv = self.config.identity.disable_ssl_certificate_validation
@@ -181,9 +182,9 @@
# preferable to authenticating as a specific user because
# working with certain resources (public routers and networks)
# often requires admin privileges anyway.
- username = self.config.network_admin.username
- password = self.config.network_admin.password
- tenant_name = self.config.network_admin.tenant_name
+ username = self.config.compute_admin.username
+ password = self.config.compute_admin.password
+ tenant_name = self.config.compute_admin.tenant_name
if None in (username, password, tenant_name):
msg = ("Missing required credentials for network client. "
diff --git a/tempest/services/boto/__init__.py b/tempest/services/boto/__init__.py
index 83bf1f9..f744d9d 100644
--- a/tempest/services/boto/__init__.py
+++ b/tempest/services/boto/__init__.py
@@ -96,4 +96,4 @@
else:
raise InvalidConfiguration(
"Unable to get access and secret keys")
- return self.connect_method(**self.connection_data)
+ return self.connect_method(**self.connection_data)
diff --git a/tempest/services/identity/json/admin_client.py b/tempest/services/identity/json/identity_client.py
similarity index 97%
rename from tempest/services/identity/json/admin_client.py
rename to tempest/services/identity/json/identity_client.py
index 7b1cb4b..9cc30d9 100644
--- a/tempest/services/identity/json/admin_client.py
+++ b/tempest/services/identity/json/identity_client.py
@@ -5,11 +5,11 @@
from tempest import exceptions
-class AdminClientJSON(RestClient):
+class IdentityClientJSON(RestClient):
def __init__(self, config, username, password, auth_url, tenant_name=None):
- super(AdminClientJSON, self).__init__(config, username, password,
- auth_url, tenant_name)
+ super(IdentityClientJSON, self).__init__(config, username, password,
+ auth_url, tenant_name)
self.service = self.config.identity.catalog_type
self.endpoint_url = 'adminURL'
diff --git a/tempest/services/identity/xml/admin_client.py b/tempest/services/identity/xml/identity_client.py
similarity index 98%
rename from tempest/services/identity/xml/admin_client.py
rename to tempest/services/identity/xml/identity_client.py
index 1c71d87..02be91e 100644
--- a/tempest/services/identity/xml/admin_client.py
+++ b/tempest/services/identity/xml/identity_client.py
@@ -33,11 +33,11 @@
XMLNS = "http://docs.openstack.org/identity/api/v2.0"
-class AdminClientXML(RestClientXML):
+class IdentityClientXML(RestClientXML):
def __init__(self, config, username, password, auth_url, tenant_name=None):
- super(AdminClientXML, self).__init__(config, username, password,
- auth_url, tenant_name)
+ super(IdentityClientXML, self).__init__(config, username, password,
+ auth_url, tenant_name)
self.service = self.config.identity.catalog_type
self.endpoint_url = 'adminURL'
diff --git a/tempest/services/image/service.py b/tempest/services/image/service.py
index cf4ff4d..270bf03 100644
--- a/tempest/services/image/service.py
+++ b/tempest/services/image/service.py
@@ -44,9 +44,9 @@
dscv = self.config.identity.disable_ssl_certificate_validation
auth_url = self.config.identity.uri
keystone = keystoneclient.v2_0.client.Client(
- username=config.images.username,
- password=config.images.password,
- tenant_name=config.images.tenant_name,
+ username=config.compute.username,
+ password=config.compute.password,
+ tenant_name=config.compute.tenant_name,
auth_url=auth_url,
insecure=dscv)
token = keystone.auth_token
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index 2256170..edfb234 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -140,6 +140,12 @@
resp, body = self.get(url)
return resp, body
+ def create_object_segments(self, container, object_name, segment, data):
+ """Creates object segments."""
+ url = "{0}/{1}/{2}".format(container, object_name, segment)
+ resp, body = self.put(url, data, self.headers)
+ return resp, body
+
class ObjectClientCustomizedHeader(RestClient):
diff --git a/tempest/tests/boto/__init__.py b/tempest/tests/boto/__init__.py
index 62918c2..ec51b18 100644
--- a/tempest/tests/boto/__init__.py
+++ b/tempest/tests/boto/__init__.py
@@ -85,7 +85,7 @@
s3client = openstack.s3_client
try:
s3client.get_bucket("^INVALID*#()@INVALID.")
- except boto.exception.BotoServerError as exc:
+ except boto.exception.BotoServerError as exc:
if exc.status == 403:
_cred_sub_check(s3client.connection_data)
except Exception as exc:
diff --git a/tempest/tests/compute/base.py b/tempest/tests/compute/base.py
index c44a2f1..ae7c5ab 100644
--- a/tempest/tests/compute/base.py
+++ b/tempest/tests/compute/base.py
@@ -78,8 +78,8 @@
"""
Returns an instance of the Identity Admin API client
"""
- os = clients.IdentityManager(interface=cls._interface)
- admin_client = os.admin_client
+ os = clients.AdminManager(interface=cls._interface)
+ admin_client = os.identity_client
return admin_client
@classmethod
@@ -87,8 +87,8 @@
return (
cls.config,
- cls.config.identity_admin.username,
- cls.config.identity_admin.password,
+ cls.config.compute_admin.username,
+ cls.config.compute_admin.password,
cls.config.identity.uri
)
diff --git a/tempest/tests/compute/servers/test_servers.py b/tempest/tests/compute/servers/test_servers.py
index 3566ef4..8054c1f 100644
--- a/tempest/tests/compute/servers/test_servers.py
+++ b/tempest/tests/compute/servers/test_servers.py
@@ -132,14 +132,14 @@
#Update the IPv4 and IPv6 access addresses
resp, body = self.client.update_server(server['id'],
accessIPv4='1.1.1.1',
- accessIPv6='::babe:2.2.2.2')
+ accessIPv6='::babe:202:202')
self.assertEqual(200, resp.status)
self.client.wait_for_server_status(server['id'], 'ACTIVE')
#Verify the access addresses have been updated
resp, server = self.client.get_server(server['id'])
self.assertEqual('1.1.1.1', server['accessIPv4'])
- self.assertEqual('::babe:2.2.2.2', server['accessIPv6'])
+ self.assertEqual('::babe:202:202', server['accessIPv6'])
#Teardown
finally:
diff --git a/tempest/tests/compute/servers/test_servers_negative.py b/tempest/tests/compute/servers/test_servers_negative.py
index dfe5944..f7624b3 100644
--- a/tempest/tests/compute/servers/test_servers_negative.py
+++ b/tempest/tests/compute/servers/test_servers_negative.py
@@ -176,7 +176,7 @@
# Pass invalid network uuid while creating a server
server_name = rand_name('server')
- networks = [{'fixed_ip': '10.0.1.1', 'uuid':'a-b-c-d-e-f-g-h-i-j'}]
+ networks = [{'fixed_ip': '10.0.1.1', 'uuid': 'a-b-c-d-e-f-g-h-i-j'}]
self.assertRaises(exceptions.BadRequest,
self.create_server_with_extras,
diff --git a/tempest/tests/compute/test_live_block_migration.py b/tempest/tests/compute/test_live_block_migration.py
index 915868c..eceaaba 100644
--- a/tempest/tests/compute/test_live_block_migration.py
+++ b/tempest/tests/compute/test_live_block_migration.py
@@ -43,7 +43,7 @@
def setUpClass(cls):
super(LiveBlockMigrationTest, cls).setUpClass()
- tenant_name = cls.config.identity_admin.tenant_name
+ tenant_name = cls.config.compute_admin.tenant_name
cls.admin_hosts_client = HostsClientJSON(
*cls._get_client_args(), tenant_name=tenant_name)
diff --git a/tempest/tests/identity/base.py b/tempest/tests/identity/base.py
index 8fee7ef..125e46c 100644
--- a/tempest/tests/identity/base.py
+++ b/tempest/tests/identity/base.py
@@ -26,8 +26,8 @@
@classmethod
def setUpClass(cls):
- os = clients.IdentityManager(interface=cls._interface)
- cls.client = os.admin_client
+ os = clients.AdminManager(interface=cls._interface)
+ cls.client = os.identity_client
cls.token_client = os.token_client
if not cls.client.has_admin_extensions():
@@ -35,8 +35,8 @@
cls.data = DataGenerator(cls.client)
- os = clients.IdentityNaManager(interface=cls._interface)
- cls.non_admin_client = os.admin_client
+ os = clients.NonAdminManager(interface=cls._interface)
+ cls.non_admin_client = os.identity_client
@classmethod
def tearDownClass(cls):
diff --git a/tempest/tests/object_storage/base.py b/tempest/tests/object_storage/base.py
index 10e2269..5e3d0bc 100644
--- a/tempest/tests/object_storage/base.py
+++ b/tempest/tests/object_storage/base.py
@@ -34,16 +34,16 @@
cls.account_client = cls.os.account_client
cls.config = cls.os.config
cls.custom_object_client = cls.os.custom_object_client
- cls.os_admin = clients.IdentityManager()
+ cls.os_admin = clients.AdminManager()
cls.token_client = cls.os_admin.token_client
- cls.admin_client = cls.os_admin.admin_client
+ cls.identity_admin_client = cls.os_admin.identity_client
cls.custom_account_client = cls.os.custom_account_client
cls.os_alt = clients.AltManager()
cls.object_client_alt = cls.os_alt.object_client
cls.container_client_alt = cls.os_alt.container_client
- cls.admin_client_alt = cls.os_alt.admin_client
+ cls.identity_client_alt = cls.os_alt.identity_client
- cls.data = DataGenerator(cls.admin_client)
+ cls.data = DataGenerator(cls.identity_admin_client)
try:
cls.account_client.list_account_containers()
diff --git a/tempest/tests/object_storage/test_object_services.py b/tempest/tests/object_storage/test_object_services.py
index fc3f45f..2733c38 100644
--- a/tempest/tests/object_storage/test_object_services.py
+++ b/tempest/tests/object_storage/test_object_services.py
@@ -366,7 +366,7 @@
self.assertEqual(resp['x-container-read'], '.r:*,.rlistings')
# Trying to GET Auth Token of Alternate user
- token = self.admin_client_alt.get_auth()
+ token = self.identity_client_alt.get_auth()
headers = {'X-Auth-Token': token}
# Trying to create object with Alternate user creds
@@ -475,7 +475,7 @@
self.assertEqual(resp['x-container-write'], '-*')
#Trying to GET auth token of Alternate user
- token = self.admin_client_alt.get_auth()
+ token = self.identity_client_alt.get_auth()
headers = {'Content-Type': 'application/json',
'Accept': 'application/json',
@@ -656,3 +656,40 @@
metadata=metadata)
resp, _ = self.account_client.list_account_metadata()
self.assertNotIn('x-account-meta-temp-url-key', resp)
+
+ @attr(type='positive')
+ def test_object_upload_in_segments(self):
+ #Attempt to upload object in segments
+
+ #Create Object
+ object_name = rand_name(name='LObject')
+ data = arbitrary_string(size=len(object_name),
+ base_text=object_name)
+ segments = 10
+ self.object_client.create_object(self.container_name,
+ object_name, data)
+ #Uploading 10 segments
+ for i in range(segments):
+ resp, _ = \
+ self.object_client.create_object_segments(self.container_name,
+ object_name, i, data)
+ # Creating a Manifest File (Metadata Update)
+
+ metadata = {'X-Object-Manifest': '%s/%s/'
+ % (self.container_name, object_name)}
+ resp, _ = \
+ self.object_client.update_object_metadata(self.container_name,
+ object_name, metadata,
+ metadata_prefix='')
+ resp, _ = \
+ self.object_client.list_object_metadata(self.container_name,
+ object_name)
+ self.assertIn('x-object-manifest', resp)
+ self.assertEqual(resp['x-object-manifest'],
+ '%s/%s/' % (self.container_name, object_name))
+
+ #Downloading the object
+ resp, body = \
+ self.object_client.get_object(self.container_name, object_name)
+
+ self.assertEqual(data * segments, body)
diff --git a/tempest/tests/volume/base.py b/tempest/tests/volume/base.py
index 8657db8..1b35170 100644
--- a/tempest/tests/volume/base.py
+++ b/tempest/tests/volume/base.py
@@ -73,8 +73,8 @@
"""
Returns an instance of the Identity Admin API client
"""
- os = clients.IdentityManager()
- return os.admin_client
+ os = clients.AdminManager()
+ return os.identity_client
@classmethod
def _get_isolated_creds(cls):