Set use_dynamic_credentials with a priority
When an accounts.yaml file is used, python-tempestconf has to set use_dynamic_credentials to False, otherwise the generated tempest.conf doesn't work with Tempest. However, values from a deployer input file are set with a priority, so that they are not overriden during discovery. To fix the issue, use_dynamic_credentials has to be set with priority too. The related unit tests checks only a return value from set function. The patch improves them, so that they check if a value was overriden when it was supposed to and the other way around. Story: 2004140 Task: 27606 Depends-On: https://review.openstack.org/#/c/614312/ Change-Id: I76b8cf694116801e36587929bf320e5743534791
This commit is contained in:
parent
aab99ff6dd
commit
6c8b05f3cf
@ -184,7 +184,7 @@ def set_options(conf, deployer_input, non_admin, image_path, overrides=[],
|
||||
conf.set("auth", "admin_username", "")
|
||||
conf.set("auth", "admin_project_name", "")
|
||||
conf.set("auth", "admin_password", "")
|
||||
conf.set("auth", "use_dynamic_credentials", "False")
|
||||
conf.set("auth", "use_dynamic_credentials", "False", priority=True)
|
||||
|
||||
# get and set auth data from client's config
|
||||
if cloud_creds:
|
||||
@ -192,7 +192,7 @@ def set_options(conf, deployer_input, non_admin, image_path, overrides=[],
|
||||
|
||||
if accounts_path:
|
||||
# new way for running using accounts file
|
||||
conf.set("auth", "use_dynamic_credentials", "False")
|
||||
conf.set("auth", "use_dynamic_credentials", "False", priority=True)
|
||||
conf.set("auth", "test_accounts_file",
|
||||
os.path.abspath(accounts_path))
|
||||
|
||||
|
@ -62,7 +62,7 @@ class BaseConfigTempestTest(base.BaseTestCase):
|
||||
conf.set("auth", "admin_username", "admin")
|
||||
conf.set("auth", "admin_project_name", "adminProject")
|
||||
conf.set("auth", "admin_password", "adminPass")
|
||||
conf.set("auth", "use_dynamic_credentials", "False")
|
||||
conf.set("auth", "use_dynamic_credentials", "False", priority=True)
|
||||
return conf
|
||||
|
||||
def _get_alt_conf(self, V2, V3):
|
||||
@ -79,7 +79,7 @@ class BaseConfigTempestTest(base.BaseTestCase):
|
||||
conf.set("auth", "admin_username", "admin")
|
||||
conf.set("auth", "admin_project_name", "adminProject")
|
||||
conf.set("auth", "admin_password", "adminPass")
|
||||
conf.set("auth", "use_dynamic_credentials", "True")
|
||||
conf.set("auth", "use_dynamic_credentials", "True", priority=True)
|
||||
return conf
|
||||
|
||||
def _get_creds(self, conf, admin=False, v2=False):
|
||||
|
@ -36,23 +36,28 @@ class TestTempestConf(BaseConfigTempestTest):
|
||||
# set value wihout priority (default: priority=False)
|
||||
resp = self.conf.set("section", "key", "value")
|
||||
# value should be overwritten, because it wasn't set with priority
|
||||
resp = self.conf.set("section", "key", "value")
|
||||
resp = self.conf.set("section", "key", "new_value")
|
||||
self.assertTrue(resp)
|
||||
self.assertEqual(self.conf.get("section", "key"), "new_value")
|
||||
|
||||
def test_set_value_overwrite_priority(self):
|
||||
resp = self.conf.set("sectionPriority", "key", "value", priority=True)
|
||||
resp = self.conf.set("sectionPriority", "key", "value")
|
||||
resp = self.conf.set("sectionPriority", "key", "new_value")
|
||||
self.assertFalse(resp)
|
||||
self.assertEqual(self.conf.get("sectionPriority", "key"), "value")
|
||||
|
||||
def test_set_value_overwrite_by_priority(self):
|
||||
resp = self.conf.set("section", "key", "value")
|
||||
resp = self.conf.set("section", "key", "value", priority=True)
|
||||
resp = self.conf.set("section", "key", "new_value", priority=True)
|
||||
self.assertTrue(resp)
|
||||
self.assertEqual(self.conf.get("section", "key"), "new_value")
|
||||
|
||||
def test_set_value_overwrite_priority_by_priority(self):
|
||||
resp = self.conf.set("sectionPriority", "key", "value", priority=True)
|
||||
resp = self.conf.set("sectionPriority", "key", "value", priority=True)
|
||||
resp = self.conf.set("sectionPriority", "key",
|
||||
"new_value", priority=True)
|
||||
self.assertTrue(resp)
|
||||
self.assertEqual(self.conf.get("sectionPriority", "key"), "new_value")
|
||||
|
||||
def test_get_bool_value(self):
|
||||
self.assertTrue(self.conf.get_bool_value("True"))
|
||||
|
Loading…
Reference in New Issue
Block a user