Merge "Add skip for tests test_signed_image_upload_*" into mcp/xenial/rocky
diff --git a/barbican_tempest_plugin/tests/api/base.py b/barbican_tempest_plugin/tests/api/base.py
index 7256a10..26fe533 100644
--- a/barbican_tempest_plugin/tests/api/base.py
+++ b/barbican_tempest_plugin/tests/api/base.py
@@ -65,6 +65,12 @@
created_objects = {}
@classmethod
+ def skip_checks(cls):
+ super(BaseKeyManagerTest, cls).skip_checks()
+ if not CONF.service_available.barbican:
+ raise cls.skipException('Barbican is not enabled.')
+
+ @classmethod
def setup_clients(cls):
super(BaseKeyManagerTest, cls).setup_clients()
os = getattr(cls, 'os_%s' % cls.credentials[0])
diff --git a/barbican_tempest_plugin/tests/api/test_consumers.py b/barbican_tempest_plugin/tests/api/test_consumers.py
index 606ae0e..1f003ec 100644
--- a/barbican_tempest_plugin/tests/api/test_consumers.py
+++ b/barbican_tempest_plugin/tests/api/test_consumers.py
@@ -20,6 +20,7 @@
class ConsumersTest(base.BaseKeyManagerTest):
"""Containers API tests."""
+ @decorators.attr(type='smoke')
@decorators.idempotent_id('7d46a170-6b3b-4f4d-903a-b29aebb93289')
def test_add_delete_consumers_in_container(self):
# Create a container to test against
diff --git a/barbican_tempest_plugin/tests/api/test_orders.py b/barbican_tempest_plugin/tests/api/test_orders.py
index de8791b..5a3d233 100644
--- a/barbican_tempest_plugin/tests/api/test_orders.py
+++ b/barbican_tempest_plugin/tests/api/test_orders.py
@@ -20,6 +20,7 @@
class OrdersTest(base.BaseKeyManagerTest):
"""Orders API tests."""
+ @decorators.attr(type='smoke')
@decorators.idempotent_id('077c1729-1950-4e62-a29c-daba4aa186ad')
def test_create_list_delete_orders(self):
# Confirm that there are no orders
diff --git a/barbican_tempest_plugin/tests/api/test_secrets.py b/barbican_tempest_plugin/tests/api/test_secrets.py
index da2afcb..5ce1c9f 100644
--- a/barbican_tempest_plugin/tests/api/test_secrets.py
+++ b/barbican_tempest_plugin/tests/api/test_secrets.py
@@ -17,6 +17,7 @@
from datetime import datetime
from datetime import timedelta
import os
+import time
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
@@ -95,6 +96,12 @@
# Associate the payload with the created secret
self.secret_client.put_secret_payload(uuid, key)
+ # NOTE(vsaienko): in HA mode create and get requests might go to
+ # different backends. In case when dogtag is used sync of keys
+ # might take some time.
+ # TODO(vsaienko): switch to retry logic when get 404 exception
+ time.sleep(2)
+
# Retrieve the payload
payload = self.secret_client.get_secret_payload(uuid)
self.assertEqual(key, base64.b64encode(payload))
diff --git a/barbican_tempest_plugin/tests/scenario/test_image_signing.py b/barbican_tempest_plugin/tests/scenario/test_image_signing.py
index 6d9399c..90b6586 100644
--- a/barbican_tempest_plugin/tests/scenario/test_image_signing.py
+++ b/barbican_tempest_plugin/tests/scenario/test_image_signing.py
@@ -29,6 +29,7 @@
class ImageSigningTest(barbican_manager.BarbicanScenarioTest):
+ @decorators.attr(type='smoke')
@decorators.idempotent_id('4343df3c-5553-40ea-8705-0cce73b297a9')
@utils.services('compute', 'image')
@testtools.skipUnless(
@@ -54,6 +55,7 @@
wait_until='ACTIVE')
self.servers_client.delete_server(instance['id'])
+ @decorators.attr(type='smoke')
@decorators.idempotent_id('74f022d6-a6ef-4458-96b7-541deadacf99')
@utils.services('compute', 'image')
@testtools.skipUnless(
diff --git a/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py b/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py
index c2033fb..51491d4 100644
--- a/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py
+++ b/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py
@@ -12,10 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
+import time
+
from oslo_log import log as logging
from tempest.common import utils
from tempest import config
from tempest.lib import decorators
+from tempest.lib import exceptions as lib_exc
from barbican_tempest_plugin.tests.scenario import barbican_manager
@@ -54,12 +57,28 @@
control_location='front-end')
return self.create_volume(volume_type=volume_type['name'])
+ def wait_for_disk(self, server_ip, keypair, device_name, wait_interval=1,
+ wait_timeout=15):
+ start = int(time.time())
+ ssh_client = self.get_remote_client(
+ server_ip, private_key=keypair['private_key'])
+ disks = ssh_client.get_disks()
+ while True:
+ time.sleep(wait_interval)
+ if device_name in disks:
+ return
+ if int(time.time()) - start >= wait_timeout:
+ message = 'Device %s was not found in %d sec' % wait_timeout
+ raise lib_exc.TimeoutException(message)
+
def attach_detach_volume(self, server, volume, keypair):
# Attach volume
- self.nova_volume_attach(server, volume)
+ attached_volume = self.nova_volume_attach(server, volume)
# Write a timestamp to volume
server_ip = self.get_server_ip(server)
+ self.wait_for_disk(server_ip, keypair,
+ CONF.compute.volume_device_name)
timestamp = self.create_timestamp(
server_ip,
dev_name=CONF.compute.volume_device_name,
@@ -72,6 +91,9 @@
)
self.assertEqual(timestamp, timestamp2)
+ # Detach volume
+ self.nova_volume_detach(server, attached_volume)
+
@decorators.idempotent_id('89165fb4-5534-4b9d-8429-97ccffb8f86f')
@utils.services('compute', 'volume', 'image')
def test_encrypted_cinder_volumes_luks(self):