Merge "Fix tenant isolation and unit tests with py3"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 4418b9d..ccb64f5 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -45,9 +45,9 @@
# (Optional) Enables or disables syslog rfc5424 format for logging. If
# enabled, prefixes the MSG part of the syslog message with APP-NAME
-# (RFC5424). The format without the APP-NAME is deprecated in I, and
-# will be removed in J. (boolean value)
-#use_syslog_rfc_format = false
+# (RFC5424). The format without the APP-NAME is deprecated in K, and
+# will be removed in L, along with this option. (boolean value)
+#use_syslog_rfc_format = true
# Syslog facility to receive log lines. (string value)
#syslog_log_facility = LOG_USER
diff --git a/requirements.txt b/requirements.txt
index 3a32b69..7fe8858 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-pbr>=0.6,!=0.7,<1.0
+pbr>=0.11,<2.0
anyjson>=0.3.3
httplib2>=0.7.5
jsonschema>=2.0.0,<3.0.0
@@ -11,12 +11,12 @@
netaddr>=0.7.12
testrepository>=0.0.18
pyOpenSSL>=0.11
-oslo.concurrency>=1.8.0,<1.9.0 # Apache-2.0
-oslo.config>=1.9.3,<1.10.0 # Apache-2.0
-oslo.i18n>=1.5.0,<1.6.0 # Apache-2.0
-oslo.log>=1.0.0,<1.1.0 # Apache-2.0
-oslo.serialization>=1.4.0,<1.5.0 # Apache-2.0
-oslo.utils>=1.4.0,<1.5.0 # Apache-2.0
+oslo.concurrency>=1.8.0 # Apache-2.0
+oslo.config>=1.11.0 # Apache-2.0
+oslo.i18n>=1.5.0 # Apache-2.0
+oslo.log>=1.0.0 # Apache-2.0
+oslo.serialization>=1.4.0 # Apache-2.0
+oslo.utils>=1.4.0 # Apache-2.0
six>=1.9.0
iso8601>=0.1.9
fixtures>=0.3.14
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index 6555b64..54a82e9 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -108,7 +108,7 @@
def test_delete_image_with_invalid_image_id(self):
# An image should not be deleted with invalid image id
self.assertRaises(lib_exc.NotFound, self.client.delete_image,
- '!@$%^&*()')
+ '!@$^&*()')
@test.attr(type=['negative'])
@test.idempotent_id('137aef61-39f7-44a1-8ddf-0adf82511701')
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index c62ff89..3b9e4b5 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -43,6 +43,7 @@
@classmethod
def resource_setup(cls):
+ cls.set_validation_resources()
super(ServersTestJSON, cls).resource_setup()
cls.meta = {'hello': 'world'}
cls.accessIPv4 = '1.1.1.1'
diff --git a/tempest/api/object_storage/test_account_services.py b/tempest/api/object_storage/test_account_services.py
index 77defd6..918bd5a 100644
--- a/tempest/api/object_storage/test_account_services.py
+++ b/tempest/api/object_storage/test_account_services.py
@@ -64,7 +64,6 @@
for container_name in self.containers:
self.assertIn(container_name, container_list)
- @test.attr(type='smoke')
@test.idempotent_id('884ec421-fbad-4fcc-916b-0580f2699565')
def test_list_no_containers(self):
# List request to empty account
@@ -93,7 +92,6 @@
self.assertEqual(len(container_list), 0)
- @test.attr(type='smoke')
@test.idempotent_id('1c7efa35-e8a2-4b0b-b5ff-862c7fd83704')
def test_list_containers_with_format_json(self):
# list containers setting format parameter to 'json'
@@ -106,7 +104,6 @@
self.assertTrue([c['count'] for c in container_list])
self.assertTrue([c['bytes'] for c in container_list])
- @test.attr(type='smoke')
@test.idempotent_id('4477b609-1ca6-4d4b-b25d-ad3f01086089')
def test_list_containers_with_format_xml(self):
# list containers setting format parameter to 'xml'
@@ -122,7 +119,6 @@
self.assertEqual(container_list.find(".//count").tag, 'count')
self.assertEqual(container_list.find(".//bytes").tag, 'bytes')
- @test.attr(type='smoke')
@test.idempotent_id('6eb04a6a-4860-4e31-ba91-ea3347d76b58')
@testtools.skipIf(
not CONF.object_storage_feature_enabled.discoverability,
@@ -132,7 +128,6 @@
self.assertThat(resp, custom_matchers.AreAllWellFormatted())
- @test.attr(type='smoke')
@test.idempotent_id('5cfa4ab2-4373-48dd-a41f-a532b12b08b2')
def test_list_containers_with_limit(self):
# list containers one of them, half of them then all of them
@@ -144,7 +139,6 @@
self.assertEqual(len(container_list), limit)
- @test.attr(type='smoke')
@test.idempotent_id('638f876d-6a43-482a-bbb3-0840bca101c6')
def test_list_containers_with_marker(self):
# list containers using marker param
@@ -165,7 +159,6 @@
self.assertEqual(len(container_list), self.containers_count / 2 - 1)
- @test.attr(type='smoke')
@test.idempotent_id('5ca164e4-7bde-43fa-bafb-913b53b9e786')
def test_list_containers_with_end_marker(self):
# list containers using end_marker param
@@ -184,7 +177,6 @@
self.assertHeaders(resp, 'Account', 'GET')
self.assertEqual(len(container_list), self.containers_count / 2)
- @test.attr(type='smoke')
@test.idempotent_id('ac8502c2-d4e4-4f68-85a6-40befea2ef5e')
def test_list_containers_with_marker_and_end_marker(self):
# list containers combining marker and end_marker param
@@ -195,7 +187,6 @@
self.assertHeaders(resp, 'Account', 'GET')
self.assertEqual(len(container_list), self.containers_count - 2)
- @test.attr(type='smoke')
@test.idempotent_id('f7064ae8-dbcc-48da-b594-82feef6ea5af')
def test_list_containers_with_limit_and_marker(self):
# list containers combining marker and limit param
@@ -210,7 +201,6 @@
self.assertTrue(len(container_list) <= limit, str(container_list))
- @test.attr(type='smoke')
@test.idempotent_id('888a3f0e-7214-4806-8e50-5e0c9a69bb5e')
def test_list_containers_with_limit_and_end_marker(self):
# list containers combining limit and end_marker param
@@ -223,7 +213,6 @@
self.assertEqual(len(container_list),
min(limit, self.containers_count / 2))
- @test.attr(type='smoke')
@test.idempotent_id('8cf98d9c-e3a0-4e44-971b-c87656fdddbd')
def test_list_containers_with_limit_and_marker_and_end_marker(self):
# list containers combining limit, marker and end_marker param
@@ -253,7 +242,6 @@
self.assertIn('x-account-meta-test-account-meta2', resp)
self.account_client.delete_account_metadata(metadata)
- @test.attr(type='smoke')
@test.idempotent_id('b904c2e3-24c2-4dba-ad7d-04e90a761be5')
def test_list_no_account_metadata(self):
# list no account metadata
@@ -261,7 +249,6 @@
self.assertHeaders(resp, 'Account', 'HEAD')
self.assertNotIn('x-account-meta-', str(resp))
- @test.attr(type='smoke')
@test.idempotent_id('e2a08b5f-3115-4768-a3ee-d4287acd6c08')
def test_update_account_metadata_with_create_metadata(self):
# add metadata to account
@@ -276,7 +263,6 @@
self.account_client.delete_account_metadata(metadata)
- @test.attr(type='smoke')
@test.idempotent_id('9f60348d-c46f-4465-ae06-d51dbd470953')
def test_update_account_metadata_with_delete_matadata(self):
# delete metadata from account
@@ -288,7 +274,6 @@
resp, _ = self.account_client.list_account_metadata()
self.assertNotIn('x-account-meta-test-account-meta1', resp)
- @test.attr(type='smoke')
@test.idempotent_id('64fd53f3-adbd-4639-af54-436e4982dbfb')
def test_update_account_metadata_with_create_matadata_key(self):
# if the value of metadata is not set, the metadata is not
@@ -300,7 +285,6 @@
resp, _ = self.account_client.list_account_metadata()
self.assertNotIn('x-account-meta-test-account-meta1', resp)
- @test.attr(type='smoke')
@test.idempotent_id('d4d884d3-4696-4b85-bc98-4f57c4dd2bf1')
def test_update_account_metadata_with_delete_matadata_key(self):
# Although the value of metadata is not set, the feature of
@@ -314,7 +298,6 @@
resp, _ = self.account_client.list_account_metadata()
self.assertNotIn('x-account-meta-test-account-meta1', resp)
- @test.attr(type='smoke')
@test.idempotent_id('8e5fc073-59b9-42ee-984a-29ed11b2c749')
def test_update_account_metadata_with_create_and_delete_metadata(self):
# Send a request adding and deleting metadata requests simultaneously
diff --git a/tempest/api/object_storage/test_container_acl.py b/tempest/api/object_storage/test_container_acl.py
index 73a976d..1003f82 100644
--- a/tempest/api/object_storage/test_container_acl.py
+++ b/tempest/api/object_storage/test_container_acl.py
@@ -46,7 +46,6 @@
self.delete_containers([self.container_name])
super(ObjectTestACLs, self).tearDown()
- @test.attr(type='smoke')
@test.idempotent_id('a3270f3f-7640-4944-8448-c7ea783ea5b6')
def test_read_object_with_rights(self):
# attempt to read object using authorized user
@@ -72,7 +71,6 @@
self.container_name, object_name)
self.assertHeaders(resp, 'Object', 'GET')
- @test.attr(type='smoke')
@test.idempotent_id('aa58bfa5-40d9-4bc3-82b4-d07f4a9e392a')
def test_write_object_with_rights(self):
# attempt to write object using authorized user
diff --git a/tempest/api/object_storage/test_container_services.py b/tempest/api/object_storage/test_container_services.py
index 9f2adfe..0f107f5 100644
--- a/tempest/api/object_storage/test_container_services.py
+++ b/tempest/api/object_storage/test_container_services.py
@@ -55,7 +55,6 @@
self.containers.append(container_name)
self.assertHeaders(resp, 'Container', 'PUT')
- @test.attr(type='smoke')
@test.idempotent_id('49f866ed-d6af-4395-93e7-4187eb56d322')
def test_create_container_overwrite(self):
# overwrite container with the same name
@@ -66,7 +65,6 @@
resp, _ = self.container_client.create_container(container_name)
self.assertHeaders(resp, 'Container', 'PUT')
- @test.attr(type='smoke')
@test.idempotent_id('c2ac4d59-d0f5-40d5-ba19-0635056d48cd')
def test_create_container_with_metadata_key(self):
# create container with the blank value of metadata
@@ -84,7 +82,6 @@
# in the server
self.assertNotIn('x-container-meta-test-container-meta', resp)
- @test.attr(type='smoke')
@test.idempotent_id('e1e8df32-7b22-44e1-aa08-ccfd8d446b58')
def test_create_container_with_metadata_value(self):
# create container with metadata value
@@ -103,7 +100,6 @@
self.assertEqual(resp['x-container-meta-test-container-meta'],
metadata['test-container-meta'])
- @test.attr(type='smoke')
@test.idempotent_id('24d16451-1c0c-4e4f-b59c-9840a3aba40e')
def test_create_container_with_remove_metadata_key(self):
# create container with the blank value of remove metadata
@@ -124,7 +120,6 @@
container_name)
self.assertNotIn('x-container-meta-test-container-meta', resp)
- @test.attr(type='smoke')
@test.idempotent_id('8a21ebad-a5c7-4e29-b428-384edc8cd156')
def test_create_container_with_remove_metadata_value(self):
# create container with remove metadata
@@ -143,7 +138,6 @@
container_name)
self.assertNotIn('x-container-meta-test-container-meta', resp)
- @test.attr(type='smoke')
@test.idempotent_id('95d3a249-b702-4082-a2c4-14bb860cf06a')
def test_delete_container(self):
# create a container
@@ -165,7 +159,6 @@
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @test.attr(type='smoke')
@test.idempotent_id('4646ac2d-9bfb-4c7d-a3c5-0f527402b3df')
def test_list_container_contents_with_no_object(self):
# get empty container contents list
@@ -176,7 +169,6 @@
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual('', object_list.strip('\n'))
- @test.attr(type='smoke')
@test.idempotent_id('fe323a32-57b9-4704-a996-2e68f83b09bc')
def test_list_container_contents_with_delimiter(self):
# get container contents list using delimiter param
@@ -191,7 +183,6 @@
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name.split('/')[0], object_list.strip('/\n'))
- @test.attr(type='smoke')
@test.idempotent_id('55b4fa5c-e12e-4ca9-8fcf-a79afe118522')
def test_list_container_contents_with_end_marker(self):
# get container contents list using end_marker param
@@ -205,7 +196,6 @@
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @test.attr(type='smoke')
@test.idempotent_id('196f5034-6ab0-4032-9da9-a937bbb9fba9')
def test_list_container_contents_with_format_json(self):
# get container contents list using format_json param
@@ -225,7 +215,6 @@
self.assertTrue([c['content_type'] for c in object_list])
self.assertTrue([c['last_modified'] for c in object_list])
- @test.attr(type='smoke')
@test.idempotent_id('655a53ca-4d15-408c-a377-f4c6dbd0a1fa')
def test_list_container_contents_with_format_xml(self):
# get container contents list using format_xml param
@@ -250,7 +239,6 @@
self.assertEqual(object_list.find(".//last_modified").tag,
'last_modified')
- @test.attr(type='smoke')
@test.idempotent_id('297ec38b-2b61-4ff4-bcd1-7fa055e97b61')
def test_list_container_contents_with_limit(self):
# get container contents list using limit param
@@ -264,7 +252,6 @@
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @test.attr(type='smoke')
@test.idempotent_id('c31ddc63-2a58-4f6b-b25c-94d2937e6867')
def test_list_container_contents_with_marker(self):
# get container contents list using marker param
@@ -278,7 +265,6 @@
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @test.attr(type='smoke')
@test.idempotent_id('58ca6cc9-6af0-408d-aaec-2a6a7b2f0df9')
def test_list_container_contents_with_path(self):
# get container contents list using path param
@@ -293,7 +279,6 @@
self.assertHeaders(resp, 'Container', 'GET')
self.assertEqual(object_name, object_list.strip('\n'))
- @test.attr(type='smoke')
@test.idempotent_id('77e742c7-caf2-4ec9-8aa4-f7d509a3344c')
def test_list_container_contents_with_prefix(self):
# get container contents list using prefix param
@@ -325,7 +310,6 @@
self.assertIn('x-container-meta-name', resp)
self.assertEqual(resp['x-container-meta-name'], metadata['name'])
- @test.attr(type='smoke')
@test.idempotent_id('a2faf936-6b13-4f8d-92a2-c2278355821e')
def test_list_no_container_metadata(self):
# HEAD container without metadata
@@ -336,7 +320,6 @@
self.assertHeaders(resp, 'Container', 'HEAD')
self.assertNotIn('x-container-meta-', str(resp))
- @test.attr(type='smoke')
@test.idempotent_id('cf19bc0b-7e16-4a5a-aaed-cb0c2fe8deef')
def test_update_container_metadata_with_create_and_delete_matadata(self):
# Send one request of adding and deleting metadata
@@ -360,7 +343,6 @@
self.assertEqual(resp['x-container-meta-test-container-meta2'],
metadata_2['test-container-meta2'])
- @test.attr(type='smoke')
@test.idempotent_id('2ae5f295-4bf1-4e04-bfad-21e54b62cec5')
def test_update_container_metadata_with_create_metadata(self):
# update container metadata using add metadata
@@ -378,7 +360,6 @@
self.assertEqual(resp['x-container-meta-test-container-meta1'],
metadata['test-container-meta1'])
- @test.attr(type='smoke')
@test.idempotent_id('3a5ce7d4-6e4b-47d0-9d87-7cd42c325094')
def test_update_container_metadata_with_delete_metadata(self):
# update container metadata using delete metadata
@@ -397,7 +378,6 @@
container_name)
self.assertNotIn('x-container-meta-test-container-meta1', resp)
- @test.attr(type='smoke')
@test.idempotent_id('31f40a5f-6a52-4314-8794-cd89baed3040')
def test_update_container_metadata_with_create_matadata_key(self):
# update container metadata with a blenk value of metadata
@@ -413,7 +393,6 @@
container_name)
self.assertNotIn('x-container-meta-test-container-meta1', resp)
- @test.attr(type='smoke')
@test.idempotent_id('a2e36378-6f1f-43f4-840a-ffd9cfd61914')
def test_update_container_metadata_with_delete_metadata_key(self):
# update container metadata with a blank value of matadata
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index 6acd0f2..8075e91 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -89,6 +89,7 @@
for meta_key in not_in_meta:
self.assertNotIn('x-object-meta-' + meta_key, resp)
+ @test.attr(type='smoke')
@test.idempotent_id('5b4ce26f-3545-46c9-a2ba-5754358a4c62')
def test_create_object(self):
# create object
@@ -385,7 +386,6 @@
object_name)
self.assertNotIn('x-object-meta-test-meta1', resp)
- @test.attr(type='smoke')
@test.idempotent_id('f726174b-2ded-4708-bff7-729d12ce1f84')
def test_update_object_metadata_with_create_and_remove_metadata(self):
# creation and deletion of metadata with one request
@@ -413,7 +413,6 @@
self.assertIn('x-object-meta-test-meta2', resp)
self.assertEqual(resp['x-object-meta-test-meta2'], 'Meta2')
- @test.attr(type='smoke')
@test.idempotent_id('08854588-6449-4bb7-8cca-f2e1040f5e6f')
def test_update_object_metadata_with_x_object_manifest(self):
# update object metadata with x_object_manifest
@@ -460,7 +459,6 @@
self.assertIn('x-object-meta-test-meta', resp)
self.assertEqual(resp['x-object-meta-test-meta'], '')
- @test.attr(type='smoke')
@test.idempotent_id('9a88dca4-b684-425b-806f-306cd0e57e42')
def test_update_object_metadata_with_x_remove_object_metakey(self):
# update object metadata with a blank value of remove metadata
@@ -504,7 +502,6 @@
self.assertIn('x-object-meta-test-meta', resp)
self.assertEqual(resp['x-object-meta-test-meta'], 'Meta')
- @test.attr(type='smoke')
@test.idempotent_id('170fb90e-f5c3-4b1f-ae1b-a18810821172')
def test_list_no_object_metadata(self):
# get empty list of object metadata
@@ -516,7 +513,6 @@
self.assertHeaders(resp, 'Object', 'HEAD')
self.assertNotIn('x-object-meta-', str(resp))
- @test.attr(type='smoke')
@test.idempotent_id('23a3674c-d6de-46c3-86af-ff92bfc8a3da')
def test_list_object_metadata_with_x_object_manifest(self):
# get object metadata with x_object_manifest
@@ -571,7 +567,6 @@
self.assertEqual(body, data)
- @test.attr(type='smoke')
@test.idempotent_id('005f9bf6-e06d-41ec-968e-96c78e0b1d82')
def test_get_object_with_metadata(self):
# get object with metadata
@@ -591,7 +586,6 @@
self.assertEqual(resp['x-object-meta-test-meta'], 'Meta')
self.assertEqual(body, data)
- @test.attr(type='smoke')
@test.idempotent_id('05a1890e-7db9-4a6c-90a8-ce998a2bddfa')
def test_get_object_with_range(self):
# get object with range
@@ -610,7 +604,6 @@
self.assertHeaders(resp, 'Object', 'GET')
self.assertEqual(body, data[rand_num - 3: rand_num])
- @test.attr(type='smoke')
@test.idempotent_id('11b4515b-7ba7-4ca8-8838-357ded86fc10')
def test_get_object_with_x_object_manifest(self):
# get object with x_object_manifest
@@ -654,7 +647,6 @@
self.assertEqual(''.join(data_segments), body)
- @test.attr(type='smoke')
@test.idempotent_id('c05b4013-e4de-47af-be84-e598062b16fc')
def test_get_object_with_if_match(self):
# get object with if_match
@@ -675,7 +667,6 @@
self.assertHeaders(resp, 'Object', 'GET')
self.assertEqual(body, data)
- @test.attr(type='smoke')
@test.idempotent_id('be133639-e5d2-4313-9b1f-2d59fc054a16')
def test_get_object_with_if_modified_since(self):
# get object with if_modified_since
@@ -718,7 +709,6 @@
self.assertHeaders(resp, 'Object', 'GET')
self.assertEqual(body, data)
- @test.attr(type='smoke')
@test.idempotent_id('0aa1201c-10aa-467a-bee7-63cbdd463152')
def test_get_object_with_if_unmodified_since(self):
# get object with if_unmodified_since
@@ -734,7 +724,6 @@
self.assertHeaders(resp, 'Object', 'GET')
self.assertEqual(body, data)
- @test.attr(type='smoke')
@test.idempotent_id('94587078-475f-48f9-a40f-389c246e31cd')
def test_get_object_with_x_newest(self):
# get object with x_newest
@@ -748,7 +737,6 @@
self.assertHeaders(resp, 'Object', 'GET')
self.assertEqual(body, data)
- @test.attr(type='smoke')
@test.idempotent_id('1a9ab572-1b66-4981-8c21-416e2a5e6011')
def test_copy_object_in_same_container(self):
# create source object
@@ -775,7 +763,6 @@
dst_object_name)
self.assertEqual(body, src_data)
- @test.attr(type='smoke')
@test.idempotent_id('2248abba-415d-410b-9c30-22dff9cd6e67')
def test_copy_object_to_itself(self):
# change the content type of an existing object
@@ -797,7 +784,6 @@
object_name)
self.assertEqual(resp['content-type'], metadata['content-type'])
- @test.attr(type='smoke')
@test.idempotent_id('06f90388-2d0e-40aa-934c-e9a8833e958a')
def test_copy_object_2d_way(self):
# create source object
@@ -824,7 +810,6 @@
# check data
self._check_copied_obj(dst_object_name, src_data)
- @test.attr(type='smoke')
@test.idempotent_id('aa467252-44f3-472a-b5ae-5b57c3c9c147')
def test_copy_object_across_containers(self):
# create a container to use as asource container
@@ -865,7 +850,6 @@
self.assertIn(actual_meta_key, resp)
self.assertEqual(resp[actual_meta_key], meta_value)
- @test.attr(type='smoke')
@test.idempotent_id('5a9e2cc6-85b6-46fc-916d-0cbb7a88e5fd')
def test_copy_object_with_x_fresh_metadata(self):
# create source object
@@ -886,7 +870,6 @@
# check that destination object does NOT have any object-meta
self._check_copied_obj(dst_object_name, data, not_in_meta=["src"])
- @test.attr(type='smoke')
@test.idempotent_id('a28a8b99-e701-4d7e-9d84-3b66f121460b')
def test_copy_object_with_x_object_metakey(self):
# create source object
@@ -909,7 +892,6 @@
# check destination object
self._check_copied_obj(dst_obj_name, data, in_meta=["test", "src"])
- @test.attr(type='smoke')
@test.idempotent_id('edabedca-24c3-4322-9b70-d6d9f942a074')
def test_copy_object_with_x_object_meta(self):
# create source object
@@ -1029,7 +1011,6 @@
self.delete_containers([self.container_name])
super(PublicObjectTest, self).tearDown()
- @test.attr(type='smoke')
@test.idempotent_id('07c9cf95-c0d4-4b49-b9c8-0ef2c9b27193')
def test_access_public_container_object_without_using_creds(self):
# make container public-readable and access an object in it object
@@ -1068,7 +1049,6 @@
self.assertEqual(body, data)
- @test.attr(type='smoke')
@test.idempotent_id('54e2a2fe-42dc-491b-8270-8e4217dd4cdc')
def test_access_public_object_with_another_user_creds(self):
# make container public-readable and access an object in it using
diff --git a/tempest/api/object_storage/test_object_version.py b/tempest/api/object_storage/test_object_version.py
index cd2d3c3..923166a 100644
--- a/tempest/api/object_storage/test_object_version.py
+++ b/tempest/api/object_storage/test_object_version.py
@@ -45,7 +45,6 @@
header_value = resp.get('x-versions-location', 'Missing Header')
self.assertEqual(header_value, versioned)
- @test.attr(type='smoke')
@test.idempotent_id('a151e158-dcbf-4a1f-a1e7-46cd65895a6f')
@testtools.skipIf(
not CONF.object_storage_feature_enabled.object_versioning,
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index f1965bc..70a8594 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -335,25 +335,28 @@
CONF_PARSER.optionxform = str
CONF_PARSER.readfp(conf_file)
icreds = credentials.get_isolated_credentials('verify_tempest_config')
- os = clients.Manager(icreds.get_primary_creds())
- services = check_service_availability(os, update)
- results = {}
- for service in ['nova', 'cinder', 'neutron', 'swift']:
- if service not in services:
- continue
- results = verify_extensions(os, service, results)
+ try:
+ os = clients.Manager(icreds.get_primary_creds())
+ services = check_service_availability(os, update)
+ results = {}
+ for service in ['nova', 'cinder', 'neutron', 'swift']:
+ if service not in services:
+ continue
+ results = verify_extensions(os, service, results)
- # Verify API versions of all services in the keystone catalog and keystone
- # itself.
- services.append('keystone')
- for service in services:
- verify_api_versions(os, service, update)
+ # Verify API versions of all services in the keystone catalog and
+ # keystone itself.
+ services.append('keystone')
+ for service in services:
+ verify_api_versions(os, service, update)
- display_results(results, update, replace)
- if update:
- conf_file.close()
- CONF_PARSER.write(outfile)
- outfile.close()
+ display_results(results, update, replace)
+ if update:
+ conf_file.close()
+ CONF_PARSER.write(outfile)
+ outfile.close()
+ finally:
+ icreds.clear_isolated_creds()
if __name__ == "__main__":
diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py
index 7d69541..650faf1 100644
--- a/tempest/common/accounts.py
+++ b/tempest/common/accounts.py
@@ -286,8 +286,11 @@
net_clients = clients.Manager(credentials=credential)
compute_network_client = net_clients.networks_client
net_name = self.hash_dict['networks'].get(hash, None)
- network = fixed_network.get_network_from_name(
- net_name, compute_network_client)
+ try:
+ network = fixed_network.get_network_from_name(
+ net_name, compute_network_client)
+ except exceptions.InvalidConfiguration:
+ network = {}
net_creds.set_resources(network=network)
return net_creds
diff --git a/tempest/common/fixed_network.py b/tempest/common/fixed_network.py
index 1557474..2c6e334 100644
--- a/tempest/common/fixed_network.py
+++ b/tempest/common/fixed_network.py
@@ -17,6 +17,7 @@
from tempest_lib import exceptions as lib_exc
from tempest import config
+from tempest import exceptions
CONF = config.CONF
@@ -29,51 +30,59 @@
:param str name: the name of the network to use
:param NetworksClientJSON compute_networks_client: The network client
object to use for making the network lists api request
- :return: The full dictionary for the network in question, unless the
- network for the supplied name can not be found. In which case a dict
- with just the name will be returned.
+ :return: The full dictionary for the network in question
:rtype: dict
+ :raises InvalidConfiguration: If the name provided is invalid, the networks
+ list returns a 404, there are no found networks, or the found network
+ is invalid
"""
caller = misc_utils.find_test_caller()
+
if not name:
- network = {'name': name}
+ raise exceptions.InvalidConfiguration()
+
+ try:
+ networks = compute_networks_client.list_networks(name=name)
+ except lib_exc.NotFound:
+ # In case of nova network, if the fixed_network_name is not
+ # owned by the tenant, and the network client is not an admin
+ # one, list_networks will not find it
+ msg = ('Unable to find network %s. '
+ 'Starting instance without specifying a network.' %
+ name)
+ if caller:
+ msg = '(%s) %s' % (caller, msg)
+ LOG.info(msg)
+ raise exceptions.InvalidConfiguration()
+
+ # Check that a network exists, else raise an InvalidConfigurationException
+ if len(networks) == 1:
+ network = sorted(networks)[0]
+ elif len(networks) > 1:
+ msg = ("Network with name: %s had multiple matching networks in the "
+ "list response: %s\n Unable to specify a single network" % (
+ name, networks))
+ if caller:
+ msg = '(%s) %s' % (caller, msg)
+ LOG.warn(msg)
+ raise exceptions.InvalidConfiguration()
else:
- try:
- resp = compute_networks_client.list_networks(name=name)
- if isinstance(resp, list):
- networks = resp
- elif isinstance(resp, dict):
- networks = resp['networks']
- else:
- raise lib_exc.NotFound()
- if len(networks) > 0:
- network = networks[0]
- else:
- msg = "Network with name: %s not found" % name
- if caller:
- LOG.warn('(%s) %s' % (caller, msg))
- else:
- LOG.warn(msg)
- raise lib_exc.NotFound()
- # To be consistent with network isolation, add name is only
- # label is available
- name = network.get('name', network.get('label'))
- if name:
- network['name'] = name
- else:
- raise lib_exc.NotFound()
- except lib_exc.NotFound:
- # In case of nova network, if the fixed_network_name is not
- # owned by the tenant, and the network client is not an admin
- # one, list_networks will not find it
- msg = ('Unable to find network %s. '
- 'Starting instance without specifying a network.' %
- name)
- if caller:
- LOG.info('(%s) %s' % (caller, msg))
- else:
- LOG.info(msg)
- network = {'name': name}
+ msg = "Network with name: %s not found" % name
+ if caller:
+ msg = '(%s) %s' % (caller, msg)
+ LOG.warn(msg)
+ raise exceptions.InvalidConfiguration()
+ # To be consistent between neutron and nova network always use name even
+ # if label is used in the api response. If neither is present than then
+ # the returned network is invalid.
+ name = network.get('name') or network.get('label')
+ if not name:
+ msg = "Network found from list doesn't contain a valid name or label"
+ if caller:
+ msg = '(%s) %s' % (caller, msg)
+ LOG.warn(msg)
+ raise exceptions.InvalidConfiguration()
+ network['name'] = name
return network
@@ -97,16 +106,17 @@
msg = ('No valid network provided or created, defaulting to '
'fixed_network_name')
if caller:
- LOG.debug('(%s) %s' % (caller, msg))
- else:
- LOG.debug(msg)
- network = get_network_from_name(fixed_network_name,
- compute_networks_client)
+ msg = '(%s) %s' % (caller, msg)
+ LOG.debug(msg)
+ try:
+ network = get_network_from_name(fixed_network_name,
+ compute_networks_client)
+ except exceptions.InvalidConfiguration:
+ network = {}
msg = ('Found network %s available for tenant' % network)
if caller:
- LOG.info('(%s) %s' % (caller, msg))
- else:
- LOG.info(msg)
+ msg = '(%s) %s' % (caller, msg)
+ LOG.info(msg)
return network
diff --git a/tempest/common/validation_resources.py b/tempest/common/validation_resources.py
new file mode 100644
index 0000000..d370ebc
--- /dev/null
+++ b/tempest/common/validation_resources.py
@@ -0,0 +1,113 @@
+# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
+# 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 oslo_log import log as logging
+
+from tempest import config
+from tempest_lib.common.utils import data_utils
+from tempest_lib import exceptions as lib_exc
+
+CONF = config.CONF
+LOG = logging.getLogger(__name__)
+
+
+def create_ssh_security_group(os, add_rule=False):
+ security_group_client = os.security_groups_client
+ sg_name = data_utils.rand_name('securitygroup-')
+ sg_description = data_utils.rand_name('description-')
+ security_group = \
+ security_group_client.create_security_group(sg_name, sg_description)
+ if add_rule:
+ security_group_client.create_security_group_rule(security_group['id'],
+ 'tcp', 22, 22)
+ security_group_client.create_security_group_rule(security_group['id'],
+ 'icmp', -1, -1)
+ LOG.debug("SSH Validation resource security group with tcp and icmp "
+ "rules %s created"
+ % sg_name)
+ return security_group
+
+
+def create_validation_resources(os, validation_resources=None):
+ # Create and Return the validation resources required to validate a VM
+ validation_data = {}
+ if validation_resources:
+ if validation_resources['keypair']:
+ keypair_name = data_utils.rand_name('keypair')
+ validation_data['keypair'] = \
+ os.keypairs_client.create_keypair(keypair_name)
+ LOG.debug("Validation resource key %s created" % keypair_name)
+ add_rule = False
+ if validation_resources['security_group']:
+ if validation_resources['security_group_rules']:
+ add_rule = True
+ validation_data['security_group'] = \
+ create_ssh_security_group(os, add_rule)
+ if validation_resources['floating_ip']:
+ floating_client = os.floating_ips_client
+ validation_data['floating_ip'] = \
+ floating_client.create_floating_ip()
+ return validation_data
+
+
+def clear_validation_resources(os, validation_data=None):
+ # Cleanup the vm validation resources
+ has_exception = None
+ if validation_data:
+ if 'keypair' in validation_data:
+ keypair_client = os.keypairs_client
+ keypair_name = validation_data['keypair']['name']
+ try:
+ keypair_client.delete_keypair(keypair_name)
+ except lib_exc.NotFound:
+ LOG.warn("Keypair %s is not found when attempting to delete"
+ % keypair_name)
+ except Exception as exc:
+ LOG.exception('Exception raised while deleting key %s'
+ % keypair_name)
+ if not has_exception:
+ has_exception = exc
+ if 'security_group' in validation_data:
+ security_group_client = os.security_groups_client
+ sec_id = validation_data['security_group']['id']
+ try:
+ security_group_client.delete_security_group(sec_id)
+ security_group_client.wait_for_resource_deletion(sec_id)
+ except lib_exc.NotFound:
+ LOG.warn("Security group %s is not found when attempting to "
+ " delete" % sec_id)
+ except lib_exc.Conflict as exc:
+ LOG.exception('Conflict while deleting security '
+ 'group %s VM might not be deleted ' % sec_id)
+ if not has_exception:
+ has_exception = exc
+ except Exception as exc:
+ LOG.exception('Exception raised while deleting security '
+ 'group %s ' % sec_id)
+ if not has_exception:
+ has_exception = exc
+ if 'floating_ip' in validation_data:
+ floating_client = os.floating_ips_client
+ fip_id = validation_data['floating_ip']['id']
+ try:
+ floating_client.delete_floating_ip(fip_id)
+ except lib_exc.NotFound:
+ LOG.warn('Floating ip %s not found while attempting to delete'
+ % fip_id)
+ except Exception as exc:
+ LOG.exception('Exception raised while deleting ip %s '
+ % fip_id)
+ if not has_exception:
+ has_exception = exc
+ if has_exception:
+ raise has_exception
diff --git a/tempest/test.py b/tempest/test.py
index ae77284..2d5e94a 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -34,6 +34,7 @@
from tempest.common import credentials
from tempest.common import fixed_network
import tempest.common.generator.valid_generator as valid
+import tempest.common.validation_resources as vresources
from tempest import config
from tempest import exceptions
@@ -231,6 +232,8 @@
# NOTE(andreaf) credentials holds a list of the credentials to be allocated
# at class setup time. Credential types can be 'primary', 'alt' or 'admin'
credentials = []
+ # Resources required to validate a server using ssh
+ validation_resources = {}
network_resources = {}
# NOTE(sdague): log_format is defined inline here instead of using the oslo
@@ -360,7 +363,12 @@
def resource_setup(cls):
"""Class level resource setup for test cases.
"""
- pass
+ if hasattr(cls, "os"):
+ cls.validation_resources = vresources.create_validation_resources(
+ cls.os, cls.validation_resources)
+ else:
+ LOG.warn("Client manager not found, validation resources not"
+ " created")
@classmethod
def resource_cleanup(cls):
@@ -368,7 +376,14 @@
Resource cleanup must be able to handle the case of partially setup
resources, in case a failure during `resource_setup` should happen.
"""
- pass
+ if cls.validation_resources:
+ if hasattr(cls, "os"):
+ vresources.clear_validation_resources(cls.os,
+ cls.validation_resources)
+ cls.validation_resources = {}
+ else:
+ LOG.warn("Client manager not found, validation resources not"
+ " deleted")
def setUp(self):
super(BaseTestCase, self).setUp()
@@ -434,6 +449,43 @@
cls.isolated_creds.clear_isolated_creds()
@classmethod
+ def set_validation_resources(cls, keypair=None, floating_ip=None,
+ security_group=None,
+ security_group_rules=None):
+ """Specify which ssh server validation resources should be created.
+ Each of the argument must be set to either None, True or False, with
+ None - use default from config (security groups and security group
+ rules get created when set to None)
+ False - Do not create the validation resource
+ True - create the validation resource
+
+ @param keypair
+ @param security_group
+ @param security_group_rules
+ @param floating_ip
+ """
+ if keypair is None:
+ if CONF.validation.auth_method.lower() == "keypair":
+ keypair = True
+ else:
+ keypair = False
+ if floating_ip is None:
+ if CONF.validation.connect_method.lower() == "floating":
+ floating_ip = True
+ else:
+ floating_ip = False
+ if security_group is None:
+ security_group = True
+ if security_group_rules is None:
+ security_group_rules = True
+ if not cls.validation_resources:
+ cls.validation_resources = {
+ 'keypair': keypair,
+ 'security_group': security_group,
+ 'security_group_rules': security_group_rules,
+ 'floating_ip': floating_ip}
+
+ @classmethod
def set_network_resources(cls, network=False, router=False, subnet=False,
dhcp=False):
"""Specify which network resources should be created
diff --git a/tempest/tests/common/test_admin_available.py b/tempest/tests/common/test_admin_available.py
index 4e3aa4c..5c69c5e 100644
--- a/tempest/tests/common/test_admin_available.py
+++ b/tempest/tests/common/test_admin_available.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslo.config import cfg
+from oslo_config import cfg
from oslotest import mockpatch
from tempest.common import credentials
diff --git a/test-requirements.txt b/test-requirements.txt
index 76ae521..32f33bc 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -5,9 +5,9 @@
# needed for doc build
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
python-subunit>=0.0.18
-oslosphinx>=2.5.0,<2.6.0 # Apache-2.0
+oslosphinx>=2.5.0 # Apache-2.0
mox>=0.5.3
mock>=1.0
coverage>=3.6
-oslotest>=1.5.1,<1.6.0 # Apache-2.0
-stevedore>=1.3.0,<1.4.0 # Apache-2.0
+oslotest>=1.5.1 # Apache-2.0
+stevedore>=1.3.0 # Apache-2.0