Add idempotent_id lines for tests

All tempest tests should have a line to identify the
test with a unique UUID.  This patch adds the line
@decorators.idempotent_id('UNIQUE_UUID')
to the beginning of the test cases, and also adds
a line to tox.ini to check for the proper existence
of this line.

Change-Id: I02b1d7936423d351c7d9b236aaebe54dee3e174a
Depends-On: I18f5c726513b68083d8a5793b8eb391b421b8514
This commit is contained in:
Brianna Poulos 2017-02-24 14:01:34 -05:00
parent b17c38df9c
commit 27d768a0d2
8 changed files with 28 additions and 1 deletions

View File

@ -12,12 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.lib import decorators
from barbican_tempest_plugin.tests.api import base
class ConsumersTest(base.BaseKeyManagerTest):
"""Containers API tests."""
@decorators.idempotent_id('7d46a170-6b3b-4f4d-903a-b29aebb93289')
def test_add_delete_consumers_in_container(self):
# Create a container to test against
body = self.create_container(

View File

@ -12,12 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.lib import decorators
from barbican_tempest_plugin.tests.api import base
class ContainersTest(base.BaseKeyManagerTest):
"""Containers API tests."""
@decorators.idempotent_id('2e13d4bb-54de-463a-a358-0fb9a221d8f3')
def test_create_list_delete_empty_container(self):
# Create a container to test against.
body = self.create_container(type="generic", name="empty-container")
@ -61,6 +64,7 @@ class ContainersTest(base.BaseKeyManagerTest):
# Leave the container behind to get cleaned up by infra.
@decorators.idempotent_id('af10a78d-b1f8-440d-8b89-639861f16fd0')
def test_add_to_delete_from_container(self):
# Create a container to test against.
body = self.create_container(type="generic", name="test-container")

View File

@ -12,12 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.lib import decorators
from barbican_tempest_plugin.tests.api import base
class OrdersTest(base.BaseKeyManagerTest):
"""Orders API tests."""
@decorators.idempotent_id('077c1729-1950-4e62-a29c-daba4aa186ad')
def test_create_list_delete_orders(self):
# Confirm that there are no orders
body = self.order_client.list_orders()

View File

@ -15,6 +15,7 @@
from barbican_tempest_plugin.tests.api import base
from tempest import config
from tempest.lib import decorators
CONF = config.CONF
@ -22,6 +23,7 @@ CONF = config.CONF
class QuotasTest(base.BaseKeyManagerTest):
"""Quotas API tests."""
@decorators.idempotent_id('47ebc42b-0e53-4060-b1a1-55bee2c7c43f')
def test_create_get_delete_quota(self):
# Verify the default quota settings
body = self.quota_client.get_default_project_quota()

View File

@ -13,11 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.lib import decorators
from barbican_tempest_plugin.tests.api import base
class SecretMetadataTest(base.BaseKeyManagerTest):
"""Metadata API test"""
@decorators.idempotent_id('2b0c1707-afc3-4674-a6c6-4dc42f318117')
def test_secret_metadata(self):
# Create a secret
sec = self.create_secret()

View File

@ -22,16 +22,20 @@ from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from tempest.lib import decorators
from barbican_tempest_plugin.tests.api import base
class SecretsTest(base.BaseKeyManagerTest):
"""Secrets API tests."""
@decorators.idempotent_id('d5fb4ae4-c418-4405-9701-95fc6877aeb9')
def test_create_delete_empty_secret(self):
sec = self.create_secret()
uuid = base._get_uuid(sec['secret_ref'])
self.delete_secret(uuid)
@decorators.idempotent_id('9aee2ad3-5b61-4451-8ccc-a727bbe4618a')
def test_create_delete_symmetric_key(self):
password = b"password"
salt = os.urandom(16)
@ -50,6 +54,7 @@ class SecretsTest(base.BaseKeyManagerTest):
uuid = base._get_uuid(sec['secret_ref'])
self.delete_secret(uuid)
@decorators.idempotent_id('79ec555d-215d-4006-bcf0-ab4c6cb0b9ff')
def test_list_secrets(self):
# Create two secrets
self.create_secret(name='secret_1')
@ -64,6 +69,7 @@ class SecretsTest(base.BaseKeyManagerTest):
secrets = resp['secrets']
self.assertEqual('secret_2', secrets[0]['name'])
@decorators.idempotent_id('f5608620-f1f7-45a5-ac0a-e1c17d1f2f42')
def test_get_secret_metadata(self):
secret = self.create_secret()
uuid = base._get_uuid(secret['secret_ref'])
@ -71,6 +77,7 @@ class SecretsTest(base.BaseKeyManagerTest):
self.assertEqual(uuid, base._get_uuid(resp['secret_ref']))
self.delete_secret(uuid)
@decorators.idempotent_id('c5caa619-1e43-4724-8d94-a61ff7025a07')
def test_get_and_put_payload(self):
# Create secret without payload
secret = self.create_secret()

View File

@ -19,10 +19,13 @@ test_barbican_tempest_plugin
Tests for `barbican_tempest_plugin` module.
"""
from tempest.lib import decorators
from barbican_tempest_plugin.tests import base
class TestBarbican_tempest_plugin(base.TestCase):
@decorators.idempotent_id('8abf6dec-37b9-43ca-95cf-b8ebecda3c8d')
def test_something(self):
pass

View File

@ -13,7 +13,9 @@ deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}'
[testenv:pep8]
commands = flake8 {posargs}
commands =
flake8 {posargs}
check-uuid --package barbican_tempest_plugin
[testenv:venv]
commands = {posargs}