Fix functional test run

Change-Id: Ie3055019546888d8b4198d64c5c3ffa7c0edcae1
This commit is contained in:
Julia Kreger
2024-01-29 08:20:09 -08:00
committed by Jay Faulkner
parent b319505e2f
commit a1761b8915
2 changed files with 18 additions and 19 deletions

View File

@@ -44,12 +44,12 @@ class FunctionalTestBase(base.ClientTestBase):
client = base.CLIClient(cli_dir=cli_dir, client = base.CLIClient(cli_dir=cli_dir,
username=config['os_username'], username=config['os_username'],
password=config['os_password'], password=config['os_password'],
tenant_name=config['os_project_name'], tenant_name=config.get('os_project_name'),
uri=config['os_auth_url']) uri=config['os_auth_url'])
for keystone_object in 'user', 'project': for keystone_object in 'user', 'project':
domain_attr = 'os_%s_domain_id' % keystone_object domain_attr = 'os_%s_domain_id' % keystone_object
if config.get(domain_attr): if config.get(domain_attr):
setattr(self, domain_attr, config[domain_attr]) setattr(self, domain_attr, config.get(domain_attr))
else: else:
self.ironic_url = config['ironic_url'] self.ironic_url = config['ironic_url']
client = base.CLIClient(cli_dir=cli_dir, client = base.CLIClient(cli_dir=cli_dir,
@@ -78,27 +78,24 @@ class FunctionalTestBase(base.ClientTestBase):
'os_password', 'os_project_name'] 'os_password', 'os_project_name']
keystone_v3_conf_settings += ['os_user_domain_id', keystone_v3_conf_settings += ['os_user_domain_id',
'os_project_domain_id', 'os_project_domain_id',
'os_identity_api_version'] 'os_identity_api_version',
'os_system_scope']
else: else:
conf_settings += ['ironic_url'] conf_settings += ['ironic_url']
cli_flags = {} cli_flags = {}
missing = []
for c in conf_settings + keystone_v3_conf_settings: for c in conf_settings + keystone_v3_conf_settings:
try: try:
cli_flags[c] = config.get('functional', c) setting_value = config.get('functional', c)
if setting_value is not None:
cli_flags[c] = setting_value
except configparser.NoOptionError: except configparser.NoOptionError:
# NOTE(vdrok): Here we ignore the absence of KS v3 options as # NOTE(TheJulia): Here we populate the options, and if we
# v2 may be used. Keystone client will do the actual check of # don't have an option, it is okay, The keystone client will
# the parameters' correctness. # do the actual validity check instead of us trying to have
if c not in keystone_v3_conf_settings: # internal check logic, as there are several different forms
missing.append(c) # and parameters which can be used.
if missing: pass
self.fail('Missing required setting in test.conf (%(conf)s) for '
'auth_strategy=%(auth)s: %(missing)s' %
{'conf': config_file,
'auth': auth_strategy,
'missing': ','.join(missing)})
return cli_flags return cli_flags
def _cmd_no_auth(self, cmd, action, flags='', params=''): def _cmd_no_auth(self, cmd, action, flags='', params=''):
@@ -150,7 +147,8 @@ class FunctionalTestBase(base.ClientTestBase):
else: else:
for keystone_object in 'user', 'project': for keystone_object in 'user', 'project':
domain_attr = 'os_%s_domain_id' % keystone_object domain_attr = 'os_%s_domain_id' % keystone_object
if hasattr(self, domain_attr): if (hasattr(self, domain_attr)
and getattr(self, domain_attr) is not None):
flags += ' --os-%(ks_obj)s-domain-id %(value)s' % { flags += ' --os-%(ks_obj)s-domain-id %(value)s' % {
'ks_obj': keystone_object, 'ks_obj': keystone_object,
'value': getattr(self, domain_attr) 'value': getattr(self, domain_attr)

View File

@@ -36,11 +36,12 @@
os_identity_api_version=$OS_IDENTITY_API_VERSION os_identity_api_version=$OS_IDENTITY_API_VERSION
os_username=$OS_USERNAME os_username=$OS_USERNAME
os_password=$OS_PASSWORD os_password=$OS_PASSWORD
os_project_name=$OS_PROJECT_NAME
os_user_domain_id=$OS_USER_DOMAIN_ID os_user_domain_id=$OS_USER_DOMAIN_ID
os_project_domain_id=$OS_PROJECT_DOMAIN_ID # os_project_name=$OS_PROJECT_NAME
# os_project_domain_id=$OS_PROJECT_DOMAIN_ID
os_service_type=baremetal os_service_type=baremetal
os_endpoint_type=public os_endpoint_type=public
os_system_scope=all
END END
fi fi
echo 'Configuration file is in '$CONFIG_FILE'' echo 'Configuration file is in '$CONFIG_FILE''