Merge "Fix test_encryption_vol_type to take admin creds from conf"
diff --git a/common/config.py b/common/config.py
index 39c0846..6d35600 100644
--- a/common/config.py
+++ b/common/config.py
@@ -21,10 +21,15 @@
cfg.StrOpt('username',
default=os.environ.get('OS_USERNAME'),
- help="Username to use for API requests."),
+ help="Username to use for non admin API requests."),
cfg.StrOpt('password',
default=os.environ.get('OS_PASSWORD'),
- help="API key to use when authenticating.",
+ help="Non admin API key to use when authenticating.",
+ secret=True),
+ cfg.StrOpt('admin_username',
+ help="Username to use for admin API requests."),
+ cfg.StrOpt('admin_password',
+ help="Admin API key to use when authentication.",
secret=True),
cfg.StrOpt('tenant_name',
default=(os.environ.get('OS_PROJECT_NAME') or
diff --git a/functional/test_encryption_vol_type.py b/functional/test_encryption_vol_type.py
index e1a3e76..2679990 100644
--- a/functional/test_encryption_vol_type.py
+++ b/functional/test_encryption_vol_type.py
@@ -42,11 +42,14 @@
class EncryptionVolTypeTest(functional_base.FunctionalTestsBase):
def setUp(self):
super(EncryptionVolTypeTest, self).setUp()
+ if not self.conf.admin_username or not self.conf.admin_password:
+ self.skipTest('No admin creds found, skipping')
self.conf = config.init_conf()
# cinder security policy usage of volume type is limited
# to being used by administrators only.
- # Temporarily set username as admin for this test case.
- self.conf.username = 'admin'
+ # Temporarily switch to admin
+ self.conf.username = self.conf.admin_username
+ self.conf.password = self.conf.admin_password
self.manager = clients.ClientManager(self.conf)
self.client = self.manager.orchestration_client
self.volume_client = self.manager.volume_client