]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Add test case for volume_encryption_metadata_get
authorJoel Coffman <joel.coffman@jhuapl.edu>
Thu, 26 Mar 2015 22:14:01 +0000 (18:14 -0400)
committerHadi Esiely <hadi.esiely-barrera@jhuapl.edu>
Fri, 24 Apr 2015 14:46:37 +0000 (10:46 -0400)
commita92170c3ea25367fa7ca27f048722ba32d823697
treefc6ab02412d122413ae7a240b7a318fb4e89d2f9
parent3bb18f4a5504e1b884af2cb4670bd7e2a3cd8238
Add test case for volume_encryption_metadata_get

This change adds unit tests for the volume_encryption_metadata_get
function. The unit tests provide protection against regressions when
refactoring this code as part of follow-up patches.

Writing the unit tests also exposed a minor issue with the existing
implementation of the volume_encryption_metadata_get function. If the
volume type is not encrypted, then the existing implementation would
raise an exception due to volume_type_encryption_get returning None.
In practice, this issue would not be encountered due to separate
checks to ensure that the volume type is encrypted, but a small
refactoring obviates the need for these checks and allows the
volume_encryption_metadata_get function to be invoked for both
encrypted and "normal" volumes.

A separate patch will clean up the unnecessary checks to ensure that
the volume type was encrypted prior to calling this function.

Related to blueprint volume-encryption-metadata

Change-Id: I6ba62a58ac62a3b7bfb2b9d4d18b37ef458b616c
cinder/db/sqlalchemy/api.py
cinder/tests/unit/test_db_api.py