diff options
author | Rakesh H S <rh-s@hpe.com> | 2016-02-18 18:54:00 +0530 |
---|---|---|
committer | Rakesh H S <rh-s@hpe.com> | 2016-03-02 18:29:47 +0530 |
commit | 05a7694cdcb7573ca1f67f029299bf5f3b6f1240 (patch) | |
tree | d7fbfa6ca34df3e0561ccb9fe4326a975167cd8b /heat_integrationtests | |
parent | 11ed94d2a883374d624817d7973dcd03ca85af1c (diff) | |
download | heat-05a7694cdcb7573ca1f67f029299bf5f3b6f1240.tar.gz |
Fix test_encryption_vol_type to take admin creds from conf
Heat integration test test_encryption_vol_type will not work in environments
where admin user is named differently or does not have the same password as
that of the demo user.
The admin credentials is now made available via heat_integrationtests.conf.
The tests which require admin privileges should be run only if admin
credentials are available and use the same.
Change-Id: I5f329be6d4c4249763e0aec8696fb87605a0812a
Closes-Bug: #1546993
Diffstat (limited to 'heat_integrationtests')
4 files changed, 23 insertions, 6 deletions
diff --git a/heat_integrationtests/common/config.py b/heat_integrationtests/common/config.py index b45a8d8c0..160f31be7 100644 --- a/heat_integrationtests/common/config.py +++ b/heat_integrationtests/common/config.py @@ -21,10 +21,15 @@ IntegrationTestGroup = [ 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/heat_integrationtests/functional/test_encryption_vol_type.py b/heat_integrationtests/functional/test_encryption_vol_type.py index e1a3e769b..2679990db 100644 --- a/heat_integrationtests/functional/test_encryption_vol_type.py +++ b/heat_integrationtests/functional/test_encryption_vol_type.py @@ -42,11 +42,14 @@ test_encryption_vol_type = { 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 diff --git a/heat_integrationtests/heat_integrationtests.conf.sample b/heat_integrationtests/heat_integrationtests.conf.sample index e63639406..2da9af2c9 100644 --- a/heat_integrationtests/heat_integrationtests.conf.sample +++ b/heat_integrationtests/heat_integrationtests.conf.sample @@ -4,12 +4,18 @@ # From heat_integrationtests.common.config # -# Username to use for API requests. (string value) +# Username to use for non admin API requests. (string value) #username = <None> -# API key to use when authenticating. (string value) +# Username to use for admin API requests. (string value) +#admin_username = <None> + +# Non admin API key to use when authenticating. (string value) #password = <None> +# Admin API key to use when authenticating. (string value) +#admin_password = <None> + # Tenant name to use for API requests. (string value) #tenant_name = <None> diff --git a/heat_integrationtests/prepare_test_env.sh b/heat_integrationtests/prepare_test_env.sh index 93aad8973..9c74732d4 100755 --- a/heat_integrationtests/prepare_test_env.sh +++ b/heat_integrationtests/prepare_test_env.sh @@ -35,6 +35,9 @@ curl http://tarballs.openstack.org/heat-test-image/fedora-heat-test-image.qcow2 iniset heat_integrationtests.conf DEFAULT image_ref fedora-heat-test-image iniset heat_integrationtests.conf DEFAULT boot_config_env $DEST/heat-templates/hot/software-config/boot-config/test_image_env.yaml iniset heat_integrationtests.conf DEFAULT minimal_image_ref cirros-0.3.4-x86_64-uec +# admin creds already sourced, store in conf +iniset heat_integrationtests.conf DEFAULT admin_username $OS_USERNAME +iniset heat_integrationtests.conf DEFAULT admin_password $OS_PASSWORD # Add scenario tests to skip # VolumeBackupRestoreIntegrationTest skipped until failure rate can be reduced ref bug #1382300 |