Merge "Add support of Identity API V3 in functional tests"
This commit is contained in:
commit
d7bd72fea6
@ -39,6 +39,10 @@ iniset $MANILACLIENT_CONF DEFAULT username $OS_USERNAME
|
||||
iniset $MANILACLIENT_CONF DEFAULT tenant_name $OS_TENANT_NAME
|
||||
iniset $MANILACLIENT_CONF DEFAULT password $OS_PASSWORD
|
||||
iniset $MANILACLIENT_CONF DEFAULT auth_url $OS_AUTH_URL
|
||||
iniset $MANILACLIENT_CONF DEFAULT project_domain_name $OS_PROJECT_DOMAIN_NAME
|
||||
iniset $MANILACLIENT_CONF DEFAULT user_domain_name $OS_USER_DOMAIN_NAME
|
||||
iniset $MANILACLIENT_CONF DEFAULT project_domain_id $OS_PROJECT_DOMAIN_ID
|
||||
iniset $MANILACLIENT_CONF DEFAULT user_domain_id $OS_USER_DOMAIN_ID
|
||||
|
||||
source $BASE/new/devstack/openrc admin demo
|
||||
env | grep OS_
|
||||
@ -47,6 +51,10 @@ iniset $MANILACLIENT_CONF DEFAULT admin_username $OS_USERNAME
|
||||
iniset $MANILACLIENT_CONF DEFAULT admin_tenant_name $OS_TENANT_NAME
|
||||
iniset $MANILACLIENT_CONF DEFAULT admin_password $OS_PASSWORD
|
||||
iniset $MANILACLIENT_CONF DEFAULT admin_auth_url $OS_AUTH_URL
|
||||
iniset $MANILACLIENT_CONF DEFAULT admin_project_domain_name $OS_PROJECT_DOMAIN_NAME
|
||||
iniset $MANILACLIENT_CONF DEFAULT admin_user_domain_name $OS_USER_DOMAIN_NAME
|
||||
iniset $MANILACLIENT_CONF DEFAULT admin_project_domain_id $OS_PROJECT_DOMAIN_ID
|
||||
iniset $MANILACLIENT_CONF DEFAULT admin_user_domain_id $OS_USER_DOMAIN_ID
|
||||
|
||||
# Suppress errors in cleanup of resources
|
||||
SUPPRESS_ERRORS=${SUPPRESS_ERRORS_IN_CLEANUP:-True}
|
||||
|
@ -22,5 +22,6 @@ localrc_path=$BASE/new/devstack/localrc
|
||||
# Set big quota for share networks to avoid limit exceedances
|
||||
echo "MANILA_OPTGROUP_DEFAULT_quota_share_networks=50" >> $localrc_path
|
||||
|
||||
# Set following to '3' when manilaclient functional tests support it.
|
||||
echo "IDENTITY_API_VERSION=2.0" >> $localrc_path
|
||||
# Enable and use only v3 of Identity API
|
||||
echo "IDENTITY_API_VERSION=3" >> $localrc_path
|
||||
echo "ENABLE_IDENTITY_V2=False" >> $localrc_path
|
||||
|
@ -26,6 +26,7 @@ from manilaclient import api_versions
|
||||
# "auth_opts" are used by functional tests that are located in
|
||||
# directory "%project_root%/manilaclient/tests/functional"
|
||||
auth_opts = [
|
||||
# Options for user with 'member' role.
|
||||
cfg.StrOpt("username",
|
||||
help="This should be the username of a user WITHOUT "
|
||||
"administrative privileges."),
|
||||
@ -36,6 +37,20 @@ auth_opts = [
|
||||
cfg.StrOpt("auth_url",
|
||||
help="URL for where to find the OpenStack Identity public "
|
||||
"API endpoint."),
|
||||
cfg.StrOpt("project_domain_name",
|
||||
help=("Project domain Name of user with 'member' role "
|
||||
"as specified for auth v3.")),
|
||||
cfg.StrOpt("project_domain_id",
|
||||
help=("Project domain ID of user with 'member' role "
|
||||
"as specified for auth v3.")),
|
||||
cfg.StrOpt("user_domain_name",
|
||||
help=("User domain Name of user with 'member' role "
|
||||
"as specified for auth v3.")),
|
||||
cfg.StrOpt("user_domain_id",
|
||||
help=("User domain ID of user with 'member' role "
|
||||
"as specified for auth v3.")),
|
||||
|
||||
# Options for user with 'admin' role.
|
||||
cfg.StrOpt("admin_username",
|
||||
help="This should be the username of a user WITH "
|
||||
"administrative privileges."),
|
||||
@ -46,6 +61,20 @@ auth_opts = [
|
||||
cfg.StrOpt("admin_auth_url",
|
||||
help="URL for where to find the OpenStack Identity admin "
|
||||
"API endpoint."),
|
||||
cfg.StrOpt("admin_project_domain_name",
|
||||
help=("Project domain Name of user with 'admin' role "
|
||||
"as specified for auth v3.")),
|
||||
cfg.StrOpt("admin_project_domain_id",
|
||||
help=("Project domain ID of user with 'admin' role "
|
||||
"as specified for auth v3.")),
|
||||
cfg.StrOpt("admin_user_domain_name",
|
||||
help=("User domain Name of user with 'admin' role "
|
||||
"as specified for auth v3.")),
|
||||
cfg.StrOpt("admin_user_domain_id",
|
||||
help=("User domain ID of user with 'admin' role "
|
||||
"as specified for auth v3.")),
|
||||
|
||||
# Other auth options
|
||||
cfg.BoolOpt("insecure",
|
||||
default=False,
|
||||
help="Disable SSL certificate verification."),
|
||||
|
@ -121,6 +121,10 @@ class BaseTestCase(base.ClientTestBase):
|
||||
username=CONF.admin_username,
|
||||
password=CONF.admin_password,
|
||||
tenant_name=CONF.admin_tenant_name,
|
||||
project_domain_name=CONF.admin_project_domain_name,
|
||||
project_domain_id=CONF.admin_project_domain_id,
|
||||
user_domain_name=CONF.admin_user_domain_name,
|
||||
user_domain_id=CONF.admin_user_domain_id,
|
||||
uri=CONF.admin_auth_url or CONF.auth_url,
|
||||
insecure=CONF.insecure,
|
||||
cli_dir=CONF.manila_exec_dir)
|
||||
@ -134,6 +138,10 @@ class BaseTestCase(base.ClientTestBase):
|
||||
username=CONF.username,
|
||||
password=CONF.password,
|
||||
tenant_name=CONF.tenant_name,
|
||||
project_domain_name=CONF.project_domain_name,
|
||||
project_domain_id=CONF.project_domain_id,
|
||||
user_domain_name=CONF.user_domain_name,
|
||||
user_domain_id=CONF.user_domain_id,
|
||||
uri=CONF.auth_url,
|
||||
insecure=CONF.insecure,
|
||||
cli_dir=CONF.manila_exec_dir)
|
||||
|
@ -261,13 +261,41 @@ class ManilaCLIClient(base.CLIClient):
|
||||
microversion=microversion)
|
||||
|
||||
def get_project_id(self, name_or_id):
|
||||
try:
|
||||
# Temporary workaround for bug #1497162
|
||||
project_id = self.openstack(
|
||||
'project show -f value -c id %s' % name_or_id)
|
||||
except Exception:
|
||||
tenant = self.keystone("tenant-get %s" % name_or_id)
|
||||
project_id = re.search("id(.*)\|(.*)\|", tenant).group(2).strip()
|
||||
identity_api_version = (
|
||||
"3" if "/v3" in (CONF.admin_auth_url or CONF.auth_url) else "2.0")
|
||||
flags = (
|
||||
"--os-username %(username)s "
|
||||
"--os-project-name %(project_name)s "
|
||||
"--os-password %(password)s "
|
||||
"--os-identity-api-version %(identity_api_version)s "
|
||||
) % {
|
||||
"username": CONF.admin_username,
|
||||
"project_name": CONF.admin_tenant_name,
|
||||
"password": CONF.admin_password,
|
||||
"identity_api_version": identity_api_version,
|
||||
}
|
||||
|
||||
if identity_api_version == "3":
|
||||
if CONF.admin_project_domain_name:
|
||||
flags += (
|
||||
"--os-project-domain-name %s " %
|
||||
CONF.admin_project_domain_name)
|
||||
elif CONF.admin_project_domain_id:
|
||||
flags += (
|
||||
"--os-project-domain-id %s " %
|
||||
CONF.admin_project_domain_id)
|
||||
|
||||
if CONF.admin_user_domain_name:
|
||||
flags += (
|
||||
"--os-user-domain-name %s " %
|
||||
CONF.admin_user_domain_name)
|
||||
elif CONF.admin_user_domain_id:
|
||||
flags += (
|
||||
"--os-user-domain-id %s " %
|
||||
CONF.admin_user_domain_id)
|
||||
|
||||
project_id = self.openstack(
|
||||
'project show -f value -c id %s' % name_or_id, flags=flags)
|
||||
return project_id.strip()
|
||||
|
||||
@not_found_wrapper
|
||||
|
Loading…
Reference in New Issue
Block a user