Tempest plugin for the barbican project.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
3.2 KiB

# Copyright (c) 2017 Johns Hopkins University Applied Physics Laboratory
# 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.common import utils
from tempest import config
from tempest.lib.common import api_version_utils
from tempest.lib import decorators
from barbican_tempest_plugin.tests.scenario import barbican_manager
CONF = config.CONF
LOG = logging.getLogger(__name__)
class EphemeralStorageEncryptionTest(barbican_manager.BarbicanScenarioTest):
min_microversion = '2.1'
"""The test suite for encrypted ephemeral storage
This test verifies the functionality of encrypted ephemeral storage.
This test performs the following:
* Creates an image in Glance
* Boots an instance from the image
* Writes to a new file in the instance
def skip_checks(cls):
super(EphemeralStorageEncryptionTest, cls).skip_checks()
if not CONF.ephemeral_storage_encryption.enabled:
raise cls.skipException(
'Ephemeral storage encryption is not supported')
if not CONF.auth.create_isolated_networks:
# FIXME(redorobt): remove this skip when system-scope admin
# issue is fixed.
raise cls.skipException(
'Ephemeral storage encryption requires isolated networks')
def resource_setup(cls):
super(EphemeralStorageEncryptionTest, cls).resource_setup()
cls.request_microversion = (
@utils.services('compute', 'image')
def test_encrypted_ephemeral_lvm_storage(self):
test_string = 'Once upon a time ...'
client_test_path = '/tmp/ephemeral_disk_encryption_test'
img_uuid = self.sign_and_upload_image()
keypair = self.create_keypair()
security_group = self._create_security_group()
instance = self.create_server(
security_groups=[{'name': security_group['name']}],
instance_ip = self.get_server_ip(instance)
ssh_client = self.get_remote_client(
ssh_client.exec_command('echo "%s" > %s' % (test_string,
test_output = ssh_client.exec_command('cat %s' % client_test_path)
self.assertEqual(str(test_string), str(test_output.rstrip()))