Merge "Adding xml support for load balancer"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 2f07a19..cd57354 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -53,6 +53,9 @@
# The above administrative user's tenant name
admin_tenant_name = admin
+# The role that is required to administrate keystone.
+admin_role = admin
+
[compute]
# This section contains configuration options used when executing tests
# against the OpenStack Compute API.
@@ -119,6 +122,10 @@
# Number of seconds to wait to authenticate to an instance
ssh_timeout = 300
+# Additinal wait time for clean state, when there is
+# no OS-EXT-STS extension availiable
+ready_wait = 0
+
# Number of seconds to wait for output from ssh channel
ssh_channel_timeout = 60
@@ -223,6 +230,8 @@
# Unless you have a custom Keystone service catalog implementation, you
# probably want to leave this value as "volume"
catalog_type = volume
+# The disk format to use when copying a volume to image
+disk_format = raw
# Number of seconds to wait while looping to check the status of a
# volume that is being made available
build_interval = 10
diff --git a/requirements.txt b/requirements.txt
index ab48ec5..b15fb92 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -19,3 +19,6 @@
testrepository>=0.0.17
oslo.config>=1.1.0
eventlet>=0.13.0
+six<1.4.0
+iso8601>=0.1.4
+fixtures>=0.3.14
diff --git a/tempest/api/compute/admin/test_availability_zone.py b/tempest/api/compute/admin/test_availability_zone.py
index 8a56b89..d1e1be6 100644
--- a/tempest/api/compute/admin/test_availability_zone.py
+++ b/tempest/api/compute/admin/test_availability_zone.py
@@ -51,7 +51,7 @@
@attr(type='gate')
def test_get_availability_zone_list_with_non_admin_user(self):
- # List of availability zone with non admin user
+ # List of availability zone with non-administrator user
resp, availability_zone = \
self.non_adm_client.get_availability_zone_list()
self.assertEqual(200, resp.status)
@@ -59,7 +59,8 @@
@attr(type=['negative', 'gate'])
def test_get_availability_zone_list_detail_with_non_admin_user(self):
- # List of availability zones and available services with non admin user
+ # List of availability zones and available services with
+ # non-administrator user
self.assertRaises(
exceptions.Unauthorized,
self.non_adm_client.get_availability_zone_list_detail)
diff --git a/tempest/api/compute/admin/test_fixed_ips.py b/tempest/api/compute/admin/test_fixed_ips.py
index 895f773..85b03e6 100644
--- a/tempest/api/compute/admin/test_fixed_ips.py
+++ b/tempest/api/compute/admin/test_fixed_ips.py
@@ -21,42 +21,29 @@
from tempest.test import attr
-class FixedIPsBase(base.BaseComputeAdminTest):
- _interface = 'json'
- ip = None
-
- @classmethod
- def setUpClass(cls):
- super(FixedIPsBase, cls).setUpClass()
- if cls.config.service_available.neutron:
- msg = ("%s skipped as neutron is available" % cls.__name__)
- raise cls.skipException(msg)
- # NOTE(maurosr): The idea here is: the server creation is just an
- # auxiliary element to the ip details or reservation, there was no way
- # (at least none in my mind) to get an valid and existing ip except
- # by creating a server and using its ip. So the intention is to create
- # fewer server possible (one) and use it to both: json and xml tests.
- # This decreased time to run both tests, in my test machine, from 53
- # secs to 29 (agains 23 secs when running only json tests)
- if cls.ip is None:
- cls.client = cls.os_adm.fixed_ips_client
- cls.non_admin_client = cls.fixed_ips_client
- resp, server = cls.create_server(wait_until='ACTIVE')
- resp, server = cls.servers_client.get_server(server['id'])
- for ip_set in server['addresses']:
- for ip in server['addresses'][ip_set]:
- if ip['OS-EXT-IPS:type'] == 'fixed':
- cls.ip = ip['addr']
- break
- if cls.ip:
- break
-
-
-class FixedIPsTestJson(FixedIPsBase):
+class FixedIPsTestJson(base.BaseComputeAdminTest):
_interface = 'json'
CONF = config.TempestConfig()
+ @classmethod
+ def setUpClass(cls):
+ super(FixedIPsTestJson, cls).setUpClass()
+ if cls.config.service_available.neutron:
+ msg = ("%s skipped as neutron is available" % cls.__name__)
+ raise cls.skipException(msg)
+ cls.client = cls.os_adm.fixed_ips_client
+ cls.non_admin_client = cls.fixed_ips_client
+ resp, server = cls.create_server(wait_until='ACTIVE')
+ resp, server = cls.servers_client.get_server(server['id'])
+ for ip_set in server['addresses']:
+ for ip in server['addresses'][ip_set]:
+ if ip['OS-EXT-IPS:type'] == 'fixed':
+ cls.ip = ip['addr']
+ break
+ if cls.ip:
+ break
+
@attr(type='gate')
def test_list_fixed_ip_details(self):
resp, fixed_ip = self.client.get_fixed_ip_details(self.ip)
diff --git a/tempest/api/compute/flavors/test_flavors.py b/tempest/api/compute/flavors/test_flavors.py
index 51ce20c..c3ba671 100644
--- a/tempest/api/compute/flavors/test_flavors.py
+++ b/tempest/api/compute/flavors/test_flavors.py
@@ -52,7 +52,7 @@
@attr(type=['negative', 'gate'])
def test_get_non_existant_flavor(self):
- # flavor details are not returned for non existant flavors
+ # flavor details are not returned for non-existent flavors
self.assertRaises(exceptions.NotFound, self.client.get_flavor_details,
999)
@@ -150,7 +150,7 @@
@attr(type=['negative', 'gate'])
def test_get_flavor_details_for_invalid_flavor_id(self):
- # Ensure 404 returned for non-existant flavor ID
+ # Ensure 404 returned for non-existent flavor ID
self.assertRaises(exceptions.NotFound, self.client.get_flavor_details,
9999)
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 e380334..f5baa3c 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -80,12 +80,12 @@
@attr(type=['negative', 'gate'])
def test_get_nonexistant_floating_ip_details(self):
# Negative test:Should not be able to GET the details
- # of nonexistant floating IP
+ # of non-existent floating IP
floating_ip_id = []
resp, body = self.client.list_floating_ips()
for i in range(len(body)):
floating_ip_id.append(body[i]['id'])
- # Creating a nonexistant floatingIP id
+ # Creating a non-existent floatingIP id
while True:
non_exist_id = rand_name('999')
if non_exist_id not in floating_ip_id:
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 52239cd..a769744 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -120,20 +120,20 @@
@attr(type=['negative', 'gate'])
def test_update_nonexistant_image_metadata(self):
- # Negative test:An update should not happen for a nonexistant image
+ # Negative test:An update should not happen for a non-existent image
meta = {'key1': 'alt1', 'key2': 'alt2'}
self.assertRaises(exceptions.NotFound,
self.client.update_image_metadata, 999, meta)
@attr(type=['negative', 'gate'])
def test_get_nonexistant_image_metadata_item(self):
- # Negative test: Get on nonexistant image should not happen
+ # Negative test: Get on non-existent image should not happen
self.assertRaises(exceptions.NotFound,
self.client.get_image_metadata_item, 999, 'key2')
@attr(type=['negative', 'gate'])
def test_set_nonexistant_image_metadata(self):
- # Negative test: Metadata should not be set to a nonexistant image
+ # Negative test: Metadata should not be set to a non-existent image
meta = {'key1': 'alt1', 'key2': 'alt2'}
self.assertRaises(exceptions.NotFound, self.client.set_image_metadata,
999, meta)
@@ -149,8 +149,8 @@
@attr(type=['negative', 'gate'])
def test_delete_nonexistant_image_metadata_item(self):
- # Negative test: Shouldnt be able to delete metadata
- # item from nonexistant image
+ # Negative test: Shouldn't be able to delete metadata
+ # item from non-existent image
self.assertRaises(exceptions.NotFound,
self.client.delete_image_metadata_item, 999, 'key1')
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index a80f456..e700278 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -230,7 +230,7 @@
@attr(type=['negative', 'gate'])
def test_get_nonexistant_image(self):
- # Negative test: GET on non existant image should fail
+ # Negative test: GET on non-existent image should fail
self.assertRaises(exceptions.NotFound, self.client.get_image, 999)
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 083fbd7..78c547a 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -157,7 +157,7 @@
k_name = rand_name('keypair-')
resp, _ = self.client.create_keypair(k_name)
self.assertEqual(200, resp.status)
- # Now try the same keyname to ceate another key
+ # Now try the same keyname to create another key
self.assertRaises(exceptions.Duplicate, self.client.create_keypair,
k_name)
resp, _ = self.client.delete_keypair(k_name)
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 472b8b4..6071e54 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -35,7 +35,7 @@
@attr(type='gate')
def test_security_group_rules_create(self):
# Positive test: Creation of Security Group rule
- # should be successfull
+ # should be successful
# Creating a Security Group to add rules to it
s_name = rand_name('securitygroup-')
s_description = rand_name('description-')
@@ -59,7 +59,7 @@
def test_security_group_rules_create_with_optional_arguments(self):
# Positive test: Creation of Security Group rule
# with optional arguments
- # should be successfull
+ # should be successful
secgroup1 = None
secgroup2 = None
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 30db206..3e459a2 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -112,12 +112,12 @@
@attr(type=['negative', 'gate'])
def test_security_group_get_nonexistant_group(self):
# Negative test:Should not be able to GET the details
- # of nonexistant Security Group
+ # of non-existent Security Group
security_group_id = []
resp, body = self.client.list_security_groups()
for i in range(len(body)):
security_group_id.append(body[i]['id'])
- # Creating a nonexistant Security Group id
+ # Creating a non-existent Security Group id
while True:
non_exist_id = rand_name('999')
if non_exist_id not in security_group_id:
@@ -201,12 +201,12 @@
"Skipped until the Bug #1182384 is resolved")
@attr(type=['negative', 'gate'])
def test_delete_nonexistant_security_group(self):
- # Negative test:Deletion of a nonexistant Security Group should Fail
+ # Negative test:Deletion of a non-existent Security Group should Fail
security_group_id = []
resp, body = self.client.list_security_groups()
for i in range(len(body)):
security_group_id.append(body[i]['id'])
- # Creating Non Existant Security Group
+ # Creating non-existent Security Group
while True:
non_exist_id = rand_name('999')
if non_exist_id not in security_group_id:
diff --git a/tempest/api/compute/servers/test_server_metadata.py b/tempest/api/compute/servers/test_server_metadata.py
index 45de0d6..9997b97 100644
--- a/tempest/api/compute/servers/test_server_metadata.py
+++ b/tempest/api/compute/servers/test_server_metadata.py
@@ -115,7 +115,7 @@
@attr(type='gate')
def test_get_server_metadata_item(self):
- # The value for a specic metadata key should be returned
+ # The value for a specific metadata key should be returned
resp, meta = self.client.get_server_metadata_item(self.server_id,
'key2')
self.assertTrue('value2', meta['key2'])
@@ -148,13 +148,13 @@
@attr(type=['negative', 'gate'])
def test_get_nonexistant_server_metadata_item(self):
- # Negative test: GET on nonexistant server should not succeed
+ # Negative test: GET on a non-existent server should not succeed
self.assertRaises(exceptions.NotFound,
self.client.get_server_metadata_item, 999, 'test2')
@attr(type=['negative', 'gate'])
def test_list_nonexistant_server_metadata(self):
- # Negative test:List metadata on a non existant server should
+ # Negative test:List metadata on a non-existent server should
# not succeed
self.assertRaises(exceptions.NotFound,
self.client.list_server_metadata, 999)
@@ -171,7 +171,7 @@
@attr(type=['negative', 'gate'])
def test_set_nonexistant_server_metadata(self):
- # Negative test: Set metadata on a non existant server should not
+ # Negative test: Set metadata on a non-existent server should not
# succeed
meta = {'meta1': 'data1'}
self.assertRaises(exceptions.NotFound,
@@ -179,7 +179,7 @@
@attr(type=['negative', 'gate'])
def test_update_nonexistant_server_metadata(self):
- # Negative test: An update should not happen for a nonexistant image
+ # Negative test: An update should not happen for a non-existent image
meta = {'key1': 'value1', 'key2': 'value2'}
self.assertRaises(exceptions.NotFound,
self.client.update_server_metadata, 999, meta)
@@ -195,7 +195,7 @@
@attr(type=['negative', 'gate'])
def test_delete_nonexistant_server_metadata_item(self):
# Negative test: Should not be able to delete metadata item from a
- # nonexistant server
+ # non-existent server
# Delete the metadata item
self.assertRaises(exceptions.NotFound,
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index e09a23f..226c40e 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -154,7 +154,7 @@
@attr(type=['negative', 'gate'])
def test_create_with_non_existant_keypair(self):
- # Pass a non existant keypair while creating a server
+ # Pass a non-existent keypair while creating a server
key_name = rand_name('key')
self.assertRaises(exceptions.BadRequest,
diff --git a/tempest/api/identity/admin/test_roles.py b/tempest/api/identity/admin/test_roles.py
index cc112cc..ac145c6 100644
--- a/tempest/api/identity/admin/test_roles.py
+++ b/tempest/api/identity/admin/test_roles.py
@@ -56,7 +56,7 @@
@attr(type='gate')
def test_list_roles_by_unauthorized_user(self):
- # Non admin user should not be able to list roles
+ # Non-administrator user should not be able to list roles
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.list_roles)
@@ -116,7 +116,8 @@
@attr(type='gate')
def test_assign_user_role_by_unauthorized_user(self):
- # Non admin user should not be authorized to assign a role to user
+ # Non-administrator user should not be authorized to
+ # assign a role to user
(user, tenant, role) = self._get_role_params()
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.assign_user_role,
@@ -174,7 +175,8 @@
@attr(type='gate')
def test_remove_user_role_by_unauthorized_user(self):
- # Non admin user should not be authorized to remove a user's role
+ # Non-administrator user should not be authorized to
+ # remove a user's role
(user, tenant, role) = self._get_role_params()
resp, user_role = self.client.assign_user_role(tenant['id'],
user['id'],
@@ -237,7 +239,8 @@
@attr(type='gate')
def test_list_user_roles_by_unauthorized_user(self):
- # Non admin user should not be authorized to list a user's roles
+ # Non-administrator user should not be authorized to list
+ # a user's roles
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
self.assertRaises(exceptions.Unauthorized,
diff --git a/tempest/api/identity/admin/test_tenants.py b/tempest/api/identity/admin/test_tenants.py
index e8625db..a61a115 100644
--- a/tempest/api/identity/admin/test_tenants.py
+++ b/tempest/api/identity/admin/test_tenants.py
@@ -26,7 +26,7 @@
@attr(type='gate')
def test_list_tenants_by_unauthorized_user(self):
- # Non-admin user should not be able to list tenants
+ # Non-administrator user should not be able to list tenants
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.list_tenants)
@@ -63,7 +63,7 @@
@attr(type='gate')
def test_tenant_delete_by_unauthorized_user(self):
- # Non-admin user should not be able to delete a tenant
+ # Non-administrator user should not be able to delete a tenant
tenant_name = rand_name('tenant-')
resp, tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
@@ -164,7 +164,7 @@
@attr(type='gate')
def test_create_tenant_by_unauthorized_user(self):
- # Non-admin user should not be authorized to create a tenant
+ # Non-administrator user should not be authorized to create a tenant
tenant_name = rand_name('tenant-')
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.create_tenant, tenant_name)
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index 4cfeb45..3455b5d 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -48,7 +48,7 @@
@attr(type=['negative', 'gate'])
def test_create_user_by_unauthorized_user(self):
- # Non-admin should not be authorized to create a user
+ # Non-administrator should not be authorized to create a user
self.data.setup_test_tenant()
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.create_user, self.alt_user,
@@ -115,7 +115,7 @@
@attr(type=['negative', 'gate'])
def test_delete_users_by_unauthorized_user(self):
- # Non admin user should not be authorized to delete a user
+ # Non-administrator user should not be authorized to delete a user
self.data.setup_test_user()
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.delete_user,
@@ -213,7 +213,7 @@
@attr(type=['negative', 'gate'])
def test_get_users_by_unauthorized_user(self):
- # Non admin user should not be authorized to get user list
+ # Non-administrator user should not be authorized to get user list
self.data.setup_test_user()
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.get_users)
@@ -301,7 +301,7 @@
@attr(type=['negative', 'gate'])
def test_list_users_with_invalid_tenant(self):
# Should not be able to return a list of all
- # users for a nonexistant tenant
+ # users for a non-existent tenant
# Assign invalid tenant ids
invalid_id = list()
invalid_id.append(rand_name('999'))
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
new file mode 100644
index 0000000..efd2f83
--- /dev/null
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -0,0 +1,120 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 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.identity import base
+from tempest.common.utils.data_utils import rand_name
+from tempest.test import attr
+
+
+class CredentialsTestJSON(base.BaseIdentityAdminTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(CredentialsTestJSON, cls).setUpClass()
+ cls.projects = list()
+ cls.creds_list = [['project_id', 'user_id', 'id'],
+ ['access', 'secret']]
+ u_name = rand_name('user-')
+ u_desc = '%s description' % u_name
+ u_email = '%s@testmail.tm' % u_name
+ u_password = rand_name('pass-')
+ for i in range(2):
+ resp, cls.project = cls.v3_client.create_project(
+ rand_name('project-'), description=rand_name('project-desc-'))
+ assert resp['status'] == '201', "Expected %s" % resp['status']
+ cls.projects.append(cls.project['id'])
+
+ resp, cls.user_body = cls.v3_client.create_user(
+ u_name, description=u_desc, password=u_password,
+ email=u_email, project_id=cls.projects[0])
+ assert resp['status'] == '201', "Expected: %s" % resp['status']
+
+ @classmethod
+ def tearDownClass(cls):
+ resp, _ = cls.v3_client.delete_user(cls.user_body['id'])
+ assert resp['status'] == '204', "Expected: %s" % resp['status']
+ for p in cls.projects:
+ resp, _ = cls.v3_client.delete_project(p)
+ assert resp['status'] == '204', "Expected: %s" % resp['status']
+ super(CredentialsTestJSON, cls).tearDownClass()
+
+ def _delete_credential(self, cred_id):
+ resp, body = self.creds_client.delete_credential(cred_id)
+ self.assertEqual(resp['status'], '204')
+
+ @attr(type='smoke')
+ def test_credentials_create_get_update_delete(self):
+ keys = [rand_name('Access-'), rand_name('Secret-')]
+ resp, cred = self.creds_client.create_credential(
+ keys[0], keys[1], self.user_body['id'],
+ self.projects[0])
+ self.addCleanup(self._delete_credential, cred['id'])
+ self.assertEqual(resp['status'], '201')
+ for value1 in self.creds_list[0]:
+ self.assertIn(value1, cred)
+ for value2 in self.creds_list[1]:
+ self.assertIn(value2, cred['blob'])
+
+ new_keys = [rand_name('NewAccess-'), rand_name('NewSecret-')]
+ resp, update_body = self.creds_client.update_credential(
+ cred['id'], access_key=new_keys[0], secret_key=new_keys[1],
+ project_id=self.projects[1])
+ self.assertEqual(resp['status'], '200')
+ self.assertEqual(cred['id'], update_body['id'])
+ self.assertEqual(self.projects[1], update_body['project_id'])
+ self.assertEqual(self.user_body['id'], update_body['user_id'])
+ self.assertEqual(update_body['blob']['access'], new_keys[0])
+ self.assertEqual(update_body['blob']['secret'], new_keys[1])
+
+ resp, get_body = self.creds_client.get_credential(cred['id'])
+ self.assertEqual(resp['status'], '200')
+ for value1 in self.creds_list[0]:
+ self.assertEqual(update_body[value1],
+ get_body[value1])
+ for value2 in self.creds_list[1]:
+ self.assertEqual(update_body['blob'][value2],
+ get_body['blob'][value2])
+
+ @attr(type='smoke')
+ def test_credentials_list_delete(self):
+ created_cred_ids = list()
+ fetched_cred_ids = list()
+
+ for i in range(2):
+ resp, cred = self.creds_client.create_credential(
+ rand_name('Access-'), rand_name('Secret-'),
+ self.user_body['id'], self.projects[0])
+ self.assertEqual(resp['status'], '201')
+ created_cred_ids.append(cred['id'])
+ self.addCleanup(self._delete_credential, cred['id'])
+
+ resp, creds = self.creds_client.list_credentials()
+ self.assertEqual(resp['status'], '200')
+
+ for i in creds:
+ fetched_cred_ids.append(i['id'])
+ missing_creds = [c for c in created_cred_ids
+ if c not in fetched_cred_ids]
+ self.assertEqual(0, len(missing_creds),
+ "Failed to find cred %s in fetched list" %
+ ', '.join(m_cred for m_cred
+ in missing_creds))
+
+
+class CredentialsTestXML(CredentialsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index 9136934..2fbef77 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -25,7 +25,7 @@
_interface = 'json'
def _delete_domain(self, domain_id):
- # It is necessary to disable the domian before deleting,
+ # It is necessary to disable the domain before deleting,
# or else it would result in unauthorized error
_, body = self.v3_client.update_domain(domain_id, enabled=False)
resp, _ = self.v3_client.delete_domain(domain_id)
@@ -39,7 +39,7 @@
for _ in range(3):
_, domain = self.v3_client.create_domain(
rand_name('domain-'), description=rand_name('domain-desc-'))
- # Delete the domian at the end of this method
+ # Delete the domain at the end of this method
self.addCleanup(self._delete_domain, domain['id'])
domain_ids.append(domain['id'])
# List and Verify Domains
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 9d143ed..02a6f5b 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -59,7 +59,7 @@
def test_list_endpoints(self):
# Get a list of endpoints
resp, fetched_endpoints = self.client.list_endpoints()
- # Asserting LIST Endpoint
+ # Asserting LIST endpoints
self.assertEqual(resp['status'], '200')
missing_endpoints =\
[e for e in self.setup_endpoints if e not in fetched_endpoints]
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index 980323a..a238c46 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -54,7 +54,7 @@
resp[1], _ = cls.v3_client.delete_group(cls.group_body['id'])
resp[2], _ = cls.v3_client.delete_user(cls.user_body['id'])
resp[3], _ = cls.v3_client.delete_project(cls.project['id'])
- # NOTE(harika-vakadi): It is necessary to disable the domian
+ # NOTE(harika-vakadi): It is necessary to disable the domain
# before deleting,or else it would result in unauthorized error
cls.v3_client.update_domain(cls.domain['id'], enabled=False)
resp[4], _ = cls.v3_client.delete_domain(cls.domain['id'])
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index bfb5372..2a168de 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -34,6 +34,7 @@
cls.service_client = os.service_client
cls.policy_client = os.policy_client
cls.v3_token = os.token_v3_client
+ cls.creds_client = os.credentials_client
if not cls.client.has_admin_extensions():
raise cls.skipException("Admin extensions disabled")
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 7e116b9..a2b4ab3 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -58,49 +58,11 @@
def setUpClass(cls):
super(NetworksTestJSON, cls).setUpClass()
cls.network = cls.create_network()
- cls.network1 = cls.create_network()
- cls.network2 = cls.create_network()
cls.name = cls.network['name']
cls.subnet = cls.create_subnet(cls.network)
cls.cidr = cls.subnet['cidr']
cls.port = cls.create_port(cls.network)
- def _delete_networks(self, created_networks):
- for n in created_networks:
- resp, body = self.client.delete_network(n['id'])
- self.assertEqual(204, resp.status)
- # Asserting that the networks are not found in the list after deletion
- resp, body = self.client.list_networks()
- networks_list = list()
- for network in body['networks']:
- networks_list.append(network['id'])
- for n in created_networks:
- self.assertNotIn(n['id'], networks_list)
-
- def _delete_subnets(self, created_subnets):
- for n in created_subnets:
- resp, body = self.client.delete_subnet(n['id'])
- self.assertEqual(204, resp.status)
- # Asserting that the subnets are not found in the list after deletion
- resp, body = self.client.list_subnets()
- subnets_list = list()
- for subnet in body['subnets']:
- subnets_list.append(subnet['id'])
- for n in created_subnets:
- self.assertNotIn(n['id'], subnets_list)
-
- def _delete_ports(self, created_ports):
- for n in created_ports:
- resp, body = self.client.delete_port(n['id'])
- self.assertEqual(204, resp.status)
- # Asserting that the ports are not found in the list after deletion
- resp, body = self.client.list_ports()
- ports_list = list()
- for port in body['ports']:
- ports_list.append(port['id'])
- for n in created_ports:
- self.assertNotIn(n['id'], ports_list)
-
@attr(type='smoke')
def test_create_update_delete_network_subnet(self):
# Creates a network
@@ -240,6 +202,75 @@
self.assertRaises(exceptions.NotFound, self.client.show_port,
non_exist_id)
+
+class NetworksTestXML(NetworksTestJSON):
+ _interface = 'xml'
+
+
+class BulkNetworkOpsJSON(base.BaseNetworkTest):
+ _interface = 'json'
+
+ """
+ Tests the following operations in the Neutron API using the REST client for
+ Neutron:
+
+ bulk network creation
+ bulk subnet creation
+ bulk subnet creation
+ list tenant's networks
+
+ v2.0 of the Neutron API is assumed. It is also assumed that the following
+ options are defined in the [network] section of etc/tempest.conf:
+
+ tenant_network_cidr with a block of cidr's from which smaller blocks
+ can be allocated for tenant networks
+
+ tenant_network_mask_bits with the mask bits to be used to partition the
+ block defined by tenant-network_cidr
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ super(BulkNetworkOpsJSON, cls).setUpClass()
+ cls.network1 = cls.create_network()
+ cls.network2 = cls.create_network()
+
+ def _delete_networks(self, created_networks):
+ for n in created_networks:
+ resp, body = self.client.delete_network(n['id'])
+ self.assertEqual(204, resp.status)
+ # Asserting that the networks are not found in the list after deletion
+ resp, body = self.client.list_networks()
+ networks_list = list()
+ for network in body['networks']:
+ networks_list.append(network['id'])
+ for n in created_networks:
+ self.assertNotIn(n['id'], networks_list)
+
+ def _delete_subnets(self, created_subnets):
+ for n in created_subnets:
+ resp, body = self.client.delete_subnet(n['id'])
+ self.assertEqual(204, resp.status)
+ # Asserting that the subnets are not found in the list after deletion
+ resp, body = self.client.list_subnets()
+ subnets_list = list()
+ for subnet in body['subnets']:
+ subnets_list.append(subnet['id'])
+ for n in created_subnets:
+ self.assertNotIn(n['id'], subnets_list)
+
+ def _delete_ports(self, created_ports):
+ for n in created_ports:
+ resp, body = self.client.delete_port(n['id'])
+ self.assertEqual(204, resp.status)
+ # Asserting that the ports are not found in the list after deletion
+ resp, body = self.client.list_ports()
+ ports_list = list()
+ for port in body['ports']:
+ ports_list.append(port['id'])
+ for n in created_ports:
+ self.assertNotIn(n['id'], ports_list)
+
@attr(type='smoke')
def test_bulk_create_delete_network(self):
# Creates 2 networks in one request
@@ -326,5 +357,5 @@
self.assertIn(n['id'], ports_list)
-class NetworksTestXML(NetworksTestJSON):
+class BulkNetworkOpsXML(BulkNetworkOpsJSON):
_interface = 'xml'
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 9f8c742..8b939fe 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -97,7 +97,7 @@
name = rand_name('router-')
resp, create_body = self.client.create_router(name)
self.addCleanup(self.client.delete_router, create_body['router']['id'])
- # Add router interafce with subnet id
+ # Add router interface with subnet id
resp, interface = self.client.add_router_interface_with_subnet_id(
create_body['router']['id'], subnet['id'])
self.assertEqual('200', resp['status'])
diff --git a/tempest/api/network/test_security_groups.py b/tempest/api/network/test_security_groups.py
index 24f8286..60ca88a 100644
--- a/tempest/api/network/test_security_groups.py
+++ b/tempest/api/network/test_security_groups.py
@@ -31,7 +31,7 @@
def _delete_security_group(self, secgroup_id):
resp, _ = self.client.delete_security_group(secgroup_id)
self.assertEqual(204, resp.status)
- # Asserting that the secgroup is not found in the list
+ # Asserting that the security group is not found in the list
# after deletion
resp, list_body = self.client.list_security_groups()
self.assertEqual('200', resp['status'])
@@ -43,7 +43,7 @@
def _delete_security_group_rule(self, rule_id):
resp, _ = self.client.delete_security_group_rule(rule_id)
self.assertEqual(204, resp.status)
- # Asserting that the secgroup is not found in the list
+ # Asserting that the security group is not found in the list
# after deletion
resp, list_body = self.client.list_security_group_rules()
self.assertEqual('200', resp['status'])
@@ -88,7 +88,7 @@
for secgroup in list_body['security_groups']:
secgroup_list.append(secgroup['id'])
self.assertIn(group_create_body['security_group']['id'], secgroup_list)
- # No Udpate in security group
+ # No Update in security group
# Create rule
resp, rule_create_body = self.client.create_security_group_rule(
group_create_body['security_group']['id']
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index e6e8d17..1d16b2f 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -73,6 +73,11 @@
cls.data = DataGenerator(cls.identity_admin_client)
@classmethod
+ def tearDownClass(cls):
+ cls.isolated_creds.clear_isolated_creds()
+ super(BaseObjectTest, cls).tearDownClass()
+
+ @classmethod
def _assign_member_role(cls):
primary_user = cls.isolated_creds.get_primary_user()
alt_user = cls.isolated_creds.get_alt_user()
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index c934020..174c82a 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -147,7 +147,7 @@
@attr(type='slow')
def test_created_network(self):
- """Verifies created netowrk."""
+ """Verifies created network."""
network_id = self.test_resources.get('Network')['physical_resource_id']
resp, body = self.network_client.show_network(network_id)
self.assertEqual('200', resp['status'])
diff --git a/tempest/api/orchestration/stacks/test_server_cfn_init.py b/tempest/api/orchestration/stacks/test_server_cfn_init.py
index ffe8def..41849d0 100644
--- a/tempest/api/orchestration/stacks/test_server_cfn_init.py
+++ b/tempest/api/orchestration/stacks/test_server_cfn_init.py
@@ -158,7 +158,7 @@
resp, body = self.client.get_resource(sid, rid)
self.assertEqual('CREATE_COMPLETE', body['resource_status'])
- # fetch the ip address from servers client, since we can't get it
+ # fetch the IP address from servers client, since we can't get it
# from the stack until stack create is complete
resp, server = self.servers_client.get_server(
body['physical_resource_id'])
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 766a2c7..ad80505 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -103,7 +103,9 @@
# there is no way to delete it from Cinder, so we delete it from Glance
# using the Glance image_client and from Cinder via tearDownClass.
image_name = rand_name('Image-')
- resp, body = self.client.upload_volume(self.volume['id'], image_name)
+ resp, body = self.client.upload_volume(self.volume['id'],
+ image_name,
+ self.config.volume.disk_format)
image_id = body["image_id"]
self.addCleanup(self.image_client.delete_image, image_id)
self.assertEqual(202, resp.status)
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index f7f428c..12b03b5 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -69,6 +69,10 @@
fetched_volume['metadata'],
'The fetched Volume is different '
'from the created Volume')
+ if 'imageRef' in kwargs:
+ self.assertEqual(fetched_volume['bootable'], True)
+ if 'imageRef' not in kwargs:
+ self.assertEqual(fetched_volume['bootable'], False)
@attr(type='gate')
def test_volume_get_metadata_none(self):
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 8c39e08..d9c9e48 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -17,8 +17,11 @@
from tempest.api.volume import base
from tempest.common.utils.data_utils import rand_name
+from tempest.openstack.common import log as logging
from tempest.test import attr
+LOG = logging.getLogger(__name__)
+
class VolumesListTest(base.BaseVolumeTest):
@@ -27,7 +30,7 @@
ensure that the backing file for the volume group that Nova uses
has space for at least 3 1G volumes!
If you are running a Devstack environment, ensure that the
- VOLUME_BACKING_FILE_SIZE is atleast 4G in your localrc
+ VOLUME_BACKING_FILE_SIZE is at least 4G in your localrc
"""
_interface = 'json'
@@ -64,22 +67,17 @@
resp, volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
- except Exception:
+ except Exception as exc:
+ LOG.exception(exc)
if cls.volume_list:
# We could not create all the volumes, though we were able
# to create *some* of the volumes. This is typically
# because the backing file size of the volume group is
- # too small. So, here, we clean up whatever we did manage
- # to create and raise a SkipTest
+ # too small.
for volid in cls.volume_id_list:
cls.client.delete_volume(volid)
cls.client.wait_for_resource_deletion(volid)
- msg = ("Failed to create ALL necessary volumes to run "
- "test. This typically means that the backing file "
- "size of the nova-volumes group is too small to "
- "create the 3 volumes needed by this test case")
- raise cls.skipException(msg)
- raise
+ raise exc
@classmethod
def tearDownClass(cls):
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index e2b15a4..014ab32 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -31,8 +31,8 @@
@attr(type='gate')
def test_volume_get_nonexistant_volume_id(self):
- # Should not be able to get a nonexistant volume
- # Creating a nonexistant volume id
+ # Should not be able to get a non-existent volume
+ # Creating a non-existent volume id
volume_id_list = []
resp, volumes = self.client.list_volumes()
for i in range(len(volumes)):
@@ -41,14 +41,14 @@
non_exist_id = rand_name('999')
if non_exist_id not in volume_id_list:
break
- # Trying to Get a non existant volume
+ # Trying to Get a non-existent volume
self.assertRaises(exceptions.NotFound, self.client.get_volume,
non_exist_id)
@attr(type='gate')
def test_volume_delete_nonexistant_volume_id(self):
- # Should not be able to delete a nonexistant Volume
- # Creating nonexistant volume id
+ # Should not be able to delete a non-existent Volume
+ # Creating non-existent volume id
volume_id_list = []
resp, volumes = self.client.list_volumes()
for i in range(len(volumes)):
@@ -57,7 +57,7 @@
non_exist_id = '12345678-abcd-4321-abcd-123456789098'
if non_exist_id not in volume_id_list:
break
- # Try to Delete a non existant volume
+ # Try to delete a non-existent volume
self.assertRaises(exceptions.NotFound, self.client.delete_volume,
non_exist_id)
diff --git a/tempest/cli/output_parser.py b/tempest/cli/output_parser.py
index f22ec4e..bb3368f 100644
--- a/tempest/cli/output_parser.py
+++ b/tempest/cli/output_parser.py
@@ -158,7 +158,7 @@
def _table_columns(first_table_row):
"""Find column ranges in output line.
- Return list of touples (start,end) for each column
+ Return list of tuples (start,end) for each column
detected by plus (+) characters in delimiter line.
"""
positions = []
diff --git a/tempest/clients.py b/tempest/clients.py
index 48e4939..49b9283 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -71,6 +71,8 @@
VolumesExtensionsClientXML
from tempest.services.identity.json.identity_client import IdentityClientJSON
from tempest.services.identity.json.identity_client import TokenClientJSON
+from tempest.services.identity.v3.json.credentials_client import \
+ CredentialsClientJSON
from tempest.services.identity.v3.json.endpoints_client import \
EndPointClientJSON
from tempest.services.identity.v3.json.identity_client import \
@@ -79,6 +81,8 @@
from tempest.services.identity.v3.json.policy_client import PolicyClientJSON
from tempest.services.identity.v3.json.service_client import \
ServiceClientJSON
+from tempest.services.identity.v3.xml.credentials_client import \
+ CredentialsClientXML
from tempest.services.identity.v3.xml.endpoints_client import EndPointClientXML
from tempest.services.identity.v3.xml.identity_client import \
IdentityV3ClientXML
@@ -252,6 +256,11 @@
"xml": V3TokenClientXML,
}
+CREDENTIALS_CLIENT = {
+ "json": CredentialsClientJSON,
+ "xml": CredentialsClientXML,
+}
+
class Manager(object):
@@ -336,6 +345,8 @@
self.policy_client = POLICY_CLIENT[interface](*client_args)
self.hypervisor_client = HYPERVISOR_CLIENT[interface](*client_args)
self.token_v3_client = V3_TOKEN_CLIENT[interface](*client_args)
+ self.credentials_client = \
+ CREDENTIALS_CLIENT[interface](*client_args)
if client_args_v3_auth:
self.servers_client_v3_auth = SERVERS_CLIENTS[interface](
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 22e1bd2..d6b4466 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -141,10 +141,11 @@
role = None
try:
roles = self._list_roles()
+ admin_role = self.config.identity.admin_role
if self.tempest_client:
- role = next(r for r in roles if r['name'] == 'admin')
+ role = next(r for r in roles if r['name'] == admin_role)
else:
- role = next(r for r in roles if r.name == 'admin')
+ role = next(r for r in roles if r.name == admin_role)
except StopIteration:
msg = "No admin role found"
raise exceptions.NotFound(msg)
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 2cbb74d..0d0e794 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -52,12 +52,12 @@
return self.ssh_client.test_connection_auth()
def hostname_equals_servername(self, expected_hostname):
- # Get hostname using command "hostname"
+ # Get host name using command "hostname"
actual_hostname = self.ssh_client.exec_command("hostname").rstrip()
return expected_hostname == actual_hostname
def get_files(self, path):
- # Return a list of comma seperated files
+ # Return a list of comma separated files
command = "ls -m " + path
return self.ssh_client.exec_command(command).rstrip('\n').split(', ')
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
new file mode 100644
index 0000000..15569cd
--- /dev/null
+++ b/tempest/common/waiters.py
@@ -0,0 +1,82 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# 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.
+
+
+import time
+
+from tempest import config
+from tempest import exceptions
+from tempest.openstack.common import log as logging
+
+CONFIG = config.TempestConfig()
+LOG = logging.getLogger(__name__)
+
+
+# NOTE(afazekas): This function needs to know a token and a subject.
+def wait_for_server_status(client, server_id, status, ready_wait=True):
+ """Waits for a server to reach a given status."""
+
+ def _get_task_state(body):
+ task_state = body.get('OS-EXT-STS:task_state', None)
+ return task_state
+
+ # NOTE(afazekas): UNKNOWN status possible on ERROR
+ # or in a very early stage.
+ resp, body = client.get_server(server_id)
+ old_status = server_status = body['status']
+ old_task_state = task_state = _get_task_state(body)
+ start_time = int(time.time())
+ while True:
+ # NOTE(afazekas): Now the BUILD status only reached
+ # between the UNKOWN->ACTIVE transition.
+ # TODO(afazekas): enumerate and validate the stable status set
+ if status == 'BUILD' and server_status != 'UNKNOWN':
+ return
+ if server_status == status:
+ if ready_wait:
+ if status == 'BUILD':
+ return
+ # NOTE(afazekas): The instance is in "ready for action state"
+ # when no task in progress
+ # NOTE(afazekas): Converted to string bacuse of the XML
+ # responses
+ if str(task_state) == "None":
+ # without state api extension 3 sec usually enough
+ time.sleep(CONFIG.compute.ready_wait)
+ return
+ else:
+ return
+
+ time.sleep(client.build_interval)
+ resp, body = client.get_server(server_id)
+ server_status = body['status']
+ task_state = _get_task_state(body)
+ if (server_status != old_status) or (task_state != old_task_state):
+ LOG.info('State transition "%s" ==> "%s" after %d second wait',
+ '/'.join((old_status, str(old_task_state))),
+ '/'.join((server_status, str(task_state))),
+ time.time() - start_time)
+ if server_status == 'ERROR':
+ raise exceptions.BuildErrorException(server_id=server_id)
+
+ timed_out = int(time.time()) - start_time >= client.build_timeout
+
+ if timed_out:
+ message = ('Server %s failed to reach %s status within the '
+ 'required time (%s s).' %
+ (server_id, status, client.build_timeout))
+ message += ' Current status: %s.' % server_status
+ raise exceptions.TimeoutException(message)
+ old_status = server_status
+ old_task_state = task_state
diff --git a/tempest/config.py b/tempest/config.py
index acb0e8d..b386968 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -51,6 +51,9 @@
cfg.StrOpt('tenant_name',
default='demo',
help="Tenant name to use for Nova API requests."),
+ cfg.StrOpt('admin_role',
+ default='admin',
+ help="Role required to administrate keystone."),
cfg.StrOpt('password',
default='pass',
help="API key to use when authenticating.",
@@ -174,6 +177,10 @@
default=300,
help="Timeout in seconds to wait for authentication to "
"succeed."),
+ cfg.IntOpt('ready_wait',
+ default=0,
+ help="Additinal wait time for clean state, when there is"
+ " no OS-EXT-STS extension availiable"),
cfg.IntOpt('ssh_channel_timeout',
default=60,
help="Timeout in seconds to wait for output from ssh "
@@ -323,6 +330,9 @@
cfg.StrOpt('vendor_name',
default='Open Source',
help='Backend vendor to target when creating volume types'),
+ cfg.StrOpt('disk_format',
+ default='raw',
+ help='Disk format to use when copying a volume to image'),
]
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index d3c2a18..21c37b9 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -16,6 +16,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import logging
import os
import subprocess
@@ -37,11 +38,18 @@
from tempest.common.utils.linux.remote_client import RemoteClient
from tempest import exceptions
import tempest.manager
-from tempest.openstack.common import log as logging
+from tempest.openstack.common import log
import tempest.test
-LOG = logging.getLogger(__name__)
+LOG = log.getLogger(__name__)
+
+# NOTE(afazekas): Workaround for the stdout logging
+LOG_nova_client = logging.getLogger('novaclient.client')
+LOG_nova_client.addHandler(log.NullHandler())
+
+LOG_cinder_client = logging.getLogger('cinderclient.client')
+LOG_cinder_client.addHandler(log.NullHandler())
class OfficialClientManager(tempest.manager.Manager):
@@ -89,7 +97,8 @@
*client_args,
service_type=service_type,
no_cache=True,
- insecure=dscv)
+ insecure=dscv,
+ http_log_debug=True)
def _get_image_client(self):
token = self.identity_client.auth_token
@@ -105,7 +114,8 @@
username,
password,
tenant_name,
- auth_url)
+ auth_url,
+ http_log_debug=True)
def _get_orchestration_client(self, username=None, password=None,
tenant_name=None):
diff --git a/tempest/scenario/orchestration/test_autoscaling.py b/tempest/scenario/orchestration/test_autoscaling.py
index 88f2ebd..1a4d802 100644
--- a/tempest/scenario/orchestration/test_autoscaling.py
+++ b/tempest/scenario/orchestration/test_autoscaling.py
@@ -85,7 +85,7 @@
def server_count():
# the number of servers is the number of resources
- # in the nexted stack
+ # in the nested stack
self.server_count = len(
self.client.resources.list(nested_stack_id))
return self.server_count
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 662e919..9d7086c 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -62,7 +62,7 @@
Tempest host. A public network is assumed to be reachable from
the Tempest host, and it should be possible to associate a public
('floating') IP address with a tenant ('fixed') IP address to
- faciliate external connectivity to a potentially unroutable
+ facilitate external connectivity to a potentially unroutable
tenant IP address.
This test suite can be configured to test network connectivity to
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index c5827f6..1f2daec 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -21,6 +21,7 @@
import urllib
from tempest.common.rest_client import RestClient
+from tempest.common import waiters
from tempest import exceptions
@@ -152,28 +153,7 @@
def wait_for_server_status(self, server_id, status):
"""Waits for a server to reach a given status."""
- resp, body = self.get_server(server_id)
- server_status = body['status']
- start = int(time.time())
-
- while(server_status != status):
- if status == 'BUILD' and server_status != 'UNKNOWN':
- return
- time.sleep(self.build_interval)
- resp, body = self.get_server(server_id)
- server_status = body['status']
-
- if server_status == 'ERROR':
- raise exceptions.BuildErrorException(server_id=server_id)
-
- timed_out = int(time.time()) - start >= self.build_timeout
-
- if server_status != status and timed_out:
- message = ('Server %s failed to reach %s status within the '
- 'required time (%s s).' %
- (server_id, status, self.build_timeout))
- message += ' Current status: %s.' % server_status
- raise exceptions.TimeoutException(message)
+ return waiters.wait_for_server_status(self, server_id, status)
def wait_for_server_termination(self, server_id, ignore_error=False):
"""Waits for server to reach termination."""
diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py
index 6f17611..bf72bdc 100644
--- a/tempest/services/compute/xml/servers_client.py
+++ b/tempest/services/compute/xml/servers_client.py
@@ -22,6 +22,7 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
+from tempest.common import waiters
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.services.compute.xml.common import Document
@@ -336,28 +337,7 @@
def wait_for_server_status(self, server_id, status):
"""Waits for a server to reach a given status."""
- resp, body = self.get_server(server_id)
- server_status = body['status']
- start = int(time.time())
-
- while(server_status != status):
- if status == 'BUILD' and server_status != 'UNKNOWN':
- return
- time.sleep(self.build_interval)
- resp, body = self.get_server(server_id)
- server_status = body['status']
-
- if server_status == 'ERROR':
- raise exceptions.BuildErrorException(server_id=server_id)
-
- timed_out = int(time.time()) - start >= self.build_timeout
-
- if server_status != status and timed_out:
- message = ('Server %s failed to reach %s status within the '
- 'required time (%s s).' %
- (server_id, status, self.build_timeout))
- message += ' Current status: %s.' % server_status
- raise exceptions.TimeoutException(message)
+ return waiters.wait_for_server_status(self, server_id, status)
def wait_for_server_termination(self, server_id, ignore_error=False):
"""Waits for server to reach termination."""
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
new file mode 100644
index 0000000..c3f788a
--- /dev/null
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -0,0 +1,97 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 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.
+
+import json
+from urlparse import urlparse
+
+from tempest.common.rest_client import RestClient
+
+
+class CredentialsClientJSON(RestClient):
+
+ def __init__(self, config, username, password, auth_url, tenant_name=None):
+ super(CredentialsClientJSON, self).__init__(config, username, password,
+ auth_url, tenant_name)
+ self.service = self.config.identity.catalog_type
+ self.endpoint_url = 'adminURL'
+
+ def request(self, method, url, headers=None, body=None, wait=None):
+ """Overriding the existing HTTP request in super class rest_client."""
+ self._set_auth()
+ self.base_url = self.base_url.replace(urlparse(self.base_url).path,
+ "/v3")
+ return super(CredentialsClientJSON, self).request(method, url,
+ headers=headers,
+ body=body)
+
+ def create_credential(self, access_key, secret_key, user_id, project_id):
+ """Creates a credential."""
+ blob = "{\"access\": \"%s\", \"secret\": \"%s\"}" % (
+ access_key, secret_key)
+ post_body = {
+ "blob": blob,
+ "project_id": project_id,
+ "type": "ec2",
+ "user_id": user_id
+ }
+ post_body = json.dumps({'credential': post_body})
+ resp, body = self.post('credentials', post_body,
+ self.headers)
+ body = json.loads(body)
+ body['credential']['blob'] = json.loads(body['credential']['blob'])
+ return resp, body['credential']
+
+ def update_credential(self, credential_id, **kwargs):
+ """Updates a credential."""
+ resp, body = self.get_credential(credential_id)
+ cred_type = kwargs.get('type', body['type'])
+ access_key = kwargs.get('access_key', body['blob']['access'])
+ secret_key = kwargs.get('secret_key', body['blob']['secret'])
+ project_id = kwargs.get('project_id', body['project_id'])
+ user_id = kwargs.get('user_id', body['user_id'])
+ blob = "{\"access\": \"%s\", \"secret\": \"%s\"}" % (
+ access_key, secret_key)
+ post_body = {
+ "blob": blob,
+ "project_id": project_id,
+ "type": cred_type,
+ "user_id": user_id
+ }
+ post_body = json.dumps({'credential': post_body})
+ resp, body = self.patch('credentials/%s' % credential_id, post_body,
+ self.headers)
+ body = json.loads(body)
+ body['credential']['blob'] = json.loads(body['credential']['blob'])
+ return resp, body['credential']
+
+ def get_credential(self, credential_id):
+ """To GET Details of a credential."""
+ resp, body = self.get('credentials/%s' % credential_id)
+ body = json.loads(body)
+ body['credential']['blob'] = json.loads(body['credential']['blob'])
+ return resp, body['credential']
+
+ def list_credentials(self):
+ """Lists out all the available credentials."""
+ resp, body = self.get('credentials')
+ body = json.loads(body)
+ return resp, body['credentials']
+
+ def delete_credential(self, credential_id):
+ """Deletes a credential."""
+ resp, body = self.delete('credentials/%s' % credential_id)
+ return resp, body
diff --git a/tempest/services/identity/v3/xml/credentials_client.py b/tempest/services/identity/v3/xml/credentials_client.py
new file mode 100644
index 0000000..dc0ade1
--- /dev/null
+++ b/tempest/services/identity/v3/xml/credentials_client.py
@@ -0,0 +1,121 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 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.
+
+import json
+from urlparse import urlparse
+
+from lxml import etree
+
+from tempest.common.rest_client import RestClientXML
+from tempest.services.compute.xml.common import Document
+from tempest.services.compute.xml.common import Element
+from tempest.services.compute.xml.common import Text
+from tempest.services.compute.xml.common import xml_to_json
+
+
+XMLNS = "http://docs.openstack.org/identity/api/v3"
+
+
+class CredentialsClientXML(RestClientXML):
+
+ def __init__(self, config, username, password, auth_url, tenant_name=None):
+ super(CredentialsClientXML, self).__init__(config, username, password,
+ auth_url, tenant_name)
+ self.service = self.config.identity.catalog_type
+ self.endpoint_url = 'adminURL'
+
+ def request(self, method, url, headers=None, body=None, wait=None):
+ """Overriding the existing HTTP request in super class rest_client."""
+ self._set_auth()
+ self.base_url = self.base_url.replace(urlparse(self.base_url).path,
+ "/v3")
+ return super(CredentialsClientXML, self).request(method, url,
+ headers=headers,
+ body=body)
+
+ def _parse_body(self, body):
+ data = xml_to_json(body)
+ return data
+
+ def _parse_creds(self, node):
+ array = []
+ for child in node.getchildren():
+ tag_list = child.tag.split('}', 1)
+ if tag_list[1] == "credential":
+ array.append(xml_to_json(child))
+ return array
+
+ def create_credential(self, access_key, secret_key, user_id, project_id):
+ """Creates a credential."""
+ cred_type = 'ec2'
+ access = ""access": "%s"" % access_key
+ secret = ""secret": "%s"" % secret_key
+ blob = Element('blob',
+ xmlns=XMLNS)
+ blob.append(Text("{%s , %s}"
+ % (access, secret)))
+ credential = Element('credential', project_id=project_id,
+ type=cred_type, user_id=user_id)
+ credential.append(blob)
+ resp, body = self.post('credentials', str(Document(credential)),
+ self.headers)
+ body = self._parse_body(etree.fromstring(body))
+ body['blob'] = json.loads(body['blob'])
+ return resp, body
+
+ def update_credential(self, credential_id, **kwargs):
+ """Updates a credential."""
+ resp, body = self.get_credential(credential_id)
+ cred_type = kwargs.get('type', body['type'])
+ access_key = kwargs.get('access_key', body['blob']['access'])
+ secret_key = kwargs.get('secret_key', body['blob']['secret'])
+ project_id = kwargs.get('project_id', body['project_id'])
+ user_id = kwargs.get('user_id', body['user_id'])
+ access = ""access": "%s"" % access_key
+ secret = ""secret": "%s"" % secret_key
+ blob = Element('blob',
+ xmlns=XMLNS)
+ blob.append(Text("{%s , %s}"
+ % (access, secret)))
+ credential = Element('credential', project_id=project_id,
+ type=cred_type, user_id=user_id)
+ credential.append(blob)
+ resp, body = self.patch('credentials/%s' % credential_id,
+ str(Document(credential)),
+ self.headers)
+ body = self._parse_body(etree.fromstring(body))
+ body['blob'] = json.loads(body['blob'])
+ return resp, body
+
+ def get_credential(self, credential_id):
+ """To GET Details of a credential."""
+ resp, body = self.get('credentials/%s' % credential_id, self.headers)
+ body = self._parse_body(etree.fromstring(body))
+ body['blob'] = json.loads(body['blob'])
+ return resp, body
+
+ def list_credentials(self):
+ """Lists out all the available credentials."""
+ resp, body = self.get('credentials', self.headers)
+ body = self._parse_creds(etree.fromstring(body))
+ return resp, body
+
+ def delete_credential(self, credential_id):
+ """Deletes a credential."""
+ resp, body = self.delete('credentials/%s' % credential_id,
+ self.headers)
+ return resp, body
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index dd5f3ec..75f7a33 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -35,7 +35,7 @@
metadata_prefix='X-Container-Meta-'):
"""
Creates a container, with optional metadata passed in as a
- dictonary
+ dictionary
"""
url = str(container_name)
headers = {}
@@ -92,9 +92,9 @@
"""
Returns complete list of all objects in the container, even if
item count is beyond 10,000 item listing limit.
- Does not require any paramaters aside from container name.
+ Does not require any parameters aside from container name.
"""
- # TODO(dwalleck): Rewite using json format to avoid newlines at end of
+ # TODO(dwalleck): Rewrite using json format to avoid newlines at end of
# obj names. Set limit to API limit - 1 (max returned items = 9999)
limit = 9999
if params is not None:
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index 1c97869..c605a45 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -126,7 +126,7 @@
return resp, body
def get_object_using_temp_url(self, container, object_name, expires, key):
- """Retrieve object's data using temp URL."""
+ """Retrieve object's data using temporary URL."""
self._set_auth()
method = 'GET'
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 2ae73b1..c35452e 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -89,10 +89,11 @@
"""Deletes the Specified Volume."""
return self.delete("volumes/%s" % str(volume_id))
- def upload_volume(self, volume_id, image_name):
+ def upload_volume(self, volume_id, image_name, disk_format):
"""Uploads a volume in Glance."""
post_body = {
'image_name': image_name,
+ 'disk_format': disk_format
}
post_body = json.dumps({'os-volume_upload_image': post_body})
url = 'volumes/%s/action' % (volume_id)
diff --git a/tempest/services/volume/xml/snapshots_client.py b/tempest/services/volume/xml/snapshots_client.py
index 51c46da..3596017 100644
--- a/tempest/services/volume/xml/snapshots_client.py
+++ b/tempest/services/volume/xml/snapshots_client.py
@@ -81,7 +81,7 @@
display_name: Optional snapshot Name.
display_description: User friendly snapshot description.
"""
- # NOTE(afazekas): it should use the volume namaspace
+ # NOTE(afazekas): it should use the volume namespace
snapshot = Element("snapshot", xmlns=XMLNS_11, volume_id=volume_id)
for key, value in kwargs.items():
snapshot.add_attr(key, value)
diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py
index 936e036..9fa7a1e 100644
--- a/tempest/services/volume/xml/volumes_client.py
+++ b/tempest/services/volume/xml/volumes_client.py
@@ -60,6 +60,21 @@
"""Return the element 'attachment' from input volumes."""
return volume['attachments']['attachment']
+ def _check_if_bootable(self, volume):
+ """
+ Check if the volume is bootable, also change the value
+ of 'bootable' from string to boolean.
+ """
+ if volume['bootable'] == 'True':
+ volume['bootable'] = True
+ elif volume['bootable'] == 'False':
+ volume['bootable'] = False
+ else:
+ raise ValueError(
+ 'bootable flag is supposed to be either True or False,'
+ 'it is %s' % volume['bootable'])
+ return volume
+
def list_volumes(self, params=None):
"""List all the volumes created."""
url = 'volumes'
@@ -72,6 +87,8 @@
volumes = []
if body is not None:
volumes += [self._parse_volume(vol) for vol in list(body)]
+ for v in volumes:
+ v = self._check_if_bootable(v)
return resp, volumes
def list_volumes_with_detail(self, params=None):
@@ -86,14 +103,17 @@
volumes = []
if body is not None:
volumes += [self._parse_volume(vol) for vol in list(body)]
+ for v in volumes:
+ v = self._check_if_bootable(v)
return resp, volumes
def get_volume(self, volume_id):
"""Returns the details of a single volume."""
url = "volumes/%s" % str(volume_id)
resp, body = self.get(url, self.headers)
- body = etree.fromstring(body)
- return resp, self._parse_volume(body)
+ body = self._parse_volume(etree.fromstring(body))
+ body = self._check_if_bootable(body)
+ return resp, body
def create_volume(self, size, **kwargs):
"""Creates a new Volume.
@@ -183,10 +203,11 @@
body = xml_to_json(etree.fromstring(body))
return resp, body
- def upload_volume(self, volume_id, image_name):
+ def upload_volume(self, volume_id, image_name, disk_format):
"""Uploads a volume in Glance."""
post_body = Element("os-volume_upload_image",
- image_name=image_name)
+ image_name=image_name,
+ disk_format=disk_format)
url = 'volumes/%s/action' % str(volume_id)
resp, body = self.post(url, str(Document(post_body)), self.headers)
volume = xml_to_json(etree.fromstring(body))
diff --git a/tempest/stress/stressaction.py b/tempest/stress/stressaction.py
index 28251af..45a628d 100644
--- a/tempest/stress/stressaction.py
+++ b/tempest/stress/stressaction.py
@@ -42,7 +42,7 @@
def setUp(self, **kwargs):
"""This method is called before the run method
- to help the test initiatlize any structures.
+ to help the test initialize any structures.
kwargs contains arguments passed in from the
configuration json file.
@@ -59,7 +59,7 @@
def execute(self, shared_statistic):
"""This is the main execution entry point called
by the driver. We register a signal handler to
- allow us to gracefull tearDown, and then exit.
+ allow us to tearDown gracefully, and then exit.
We also keep track of how many runs we do.
"""
signal.signal(signal.SIGHUP, self._shutdown_handler)