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
diff --git a/barbican_tempest_plugin/tests/api/test_consumers.py b/barbican_tempest_plugin/tests/api/test_consumers.py
index bd11cc8..606ae0e 100644
--- a/barbican_tempest_plugin/tests/api/test_consumers.py
+++ b/barbican_tempest_plugin/tests/api/test_consumers.py
@@ -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(
diff --git a/barbican_tempest_plugin/tests/api/test_containers.py b/barbican_tempest_plugin/tests/api/test_containers.py
index 7f19a57..1c2a6cc 100644
--- a/barbican_tempest_plugin/tests/api/test_containers.py
+++ b/barbican_tempest_plugin/tests/api/test_containers.py
@@ -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 @@
# 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")
diff --git a/barbican_tempest_plugin/tests/api/test_orders.py b/barbican_tempest_plugin/tests/api/test_orders.py
index fa76516..de8791b 100644
--- a/barbican_tempest_plugin/tests/api/test_orders.py
+++ b/barbican_tempest_plugin/tests/api/test_orders.py
@@ -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()
diff --git a/barbican_tempest_plugin/tests/api/test_quotas.py b/barbican_tempest_plugin/tests/api/test_quotas.py
index 882fbb1..cde33e3 100644
--- a/barbican_tempest_plugin/tests/api/test_quotas.py
+++ b/barbican_tempest_plugin/tests/api/test_quotas.py
@@ -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 @@
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()
diff --git a/barbican_tempest_plugin/tests/api/test_secret_metadata.py b/barbican_tempest_plugin/tests/api/test_secret_metadata.py
index 5c4cd36..2c09f29 100644
--- a/barbican_tempest_plugin/tests/api/test_secret_metadata.py
+++ b/barbican_tempest_plugin/tests/api/test_secret_metadata.py
@@ -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()
diff --git a/barbican_tempest_plugin/tests/api/test_secrets.py b/barbican_tempest_plugin/tests/api/test_secrets.py
index 39dae9d..da2afcb 100644
--- a/barbican_tempest_plugin/tests/api/test_secrets.py
+++ b/barbican_tempest_plugin/tests/api/test_secrets.py
@@ -22,16 +22,20 @@
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 @@
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 @@
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 @@
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()
diff --git a/barbican_tempest_plugin/tests/test_barbican_tempest_plugin.py b/barbican_tempest_plugin/tests/test_barbican_tempest_plugin.py
index dc78b9f..9b542c5 100644
--- a/barbican_tempest_plugin/tests/test_barbican_tempest_plugin.py
+++ b/barbican_tempest_plugin/tests/test_barbican_tempest_plugin.py
@@ -19,10 +19,13 @@
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
diff --git a/tox.ini b/tox.ini
index 90ca6bb..f100b39 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,7 +13,9 @@
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}