Merge "Add ability to skip for test_signed_image_upload_boot_snapshot" into mcp/train
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/scenario/test_image_signing.py b/barbican_tempest_plugin/tests/scenario/test_image_signing.py
index fb4d866..f7db163 100644
--- a/barbican_tempest_plugin/tests/scenario/test_image_signing.py
+++ b/barbican_tempest_plugin/tests/scenario/test_image_signing.py
@@ -15,6 +15,8 @@
import testtools
from oslo_log import log as logging
+import testtools
+
from tempest.api.compute import base as compute_base
from tempest.common import utils
from tempest import config
@@ -29,8 +31,12 @@
class ImageSigningTest(barbican_manager.BarbicanScenarioTest):
+ @decorators.attr(type='smoke')
@decorators.idempotent_id('4343df3c-5553-40ea-8705-0cce73b297a9')
@utils.services('compute', 'image')
+ @testtools.skipUnless(
+ CONF.compute_feature_enabled.barbican_integration_enabled,
+ 'Barbican integration must be enabled.')
def test_signed_image_upload_and_boot(self):
"""Test that Nova boots a signed image.
@@ -51,8 +57,12 @@
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(
+ CONF.compute_feature_enabled.barbican_integration_enabled,
+ 'Barbican integration must be enabled.')
def test_signed_image_upload_boot_failure(self):
"""Test that Nova refuses to boot an incorrectly signed image.
diff --git a/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py b/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py
index c2033fb..c7d2577 100644
--- a/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py
+++ b/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py
@@ -12,10 +12,14 @@
# 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.common import waiters
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 +58,36 @@
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 did not appear in %d sec' % (
+ device_name, 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.servers_client.stop_server(server['id'])
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'SHUTOFF')
+
+ self.servers_client.start_server(server['id'])
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'ACTIVE')
+ 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 +100,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):