Finish work on renaming namespace to platform
CLI, Verifier, Docs and Tests are updated Change-Id: I382bd1e1899b809743fad3250d66a036e7bac5f5
This commit is contained in:
parent
a0c68d4fa3
commit
b5bcf8bb06
@ -231,9 +231,9 @@ class PluginsReferenceDirective(rst.Directive):
|
||||
if info["description"]:
|
||||
section_obj.extend(utils.parse_text(info["description"]))
|
||||
|
||||
if info["namespace"]:
|
||||
if info["platform"]:
|
||||
section_obj.append(utils.paragraph(
|
||||
"**Namespace**: %s" % info["namespace"]))
|
||||
"**Platform**: %s" % info["platform"]))
|
||||
|
||||
if base_name:
|
||||
ref_prefix = "%s-%s-" % (base_name, plugin_cls.get_name())
|
||||
|
@ -126,7 +126,7 @@ Statements of plugin bases:
|
||||
- Each plugin base is unique entity;
|
||||
- Names of plugin bases can't conflict with each other;
|
||||
- Names of two or more plugins in one plugin base can't conflict with each
|
||||
other(in case of same namespace).
|
||||
other(in case of same platform).
|
||||
- Names of two or more plugins in different plugin base can conflict
|
||||
|
||||
Current list of plugin bases:
|
||||
|
@ -44,23 +44,25 @@ information about them:
|
||||
|
||||
$ rally plugin show create_meter_and_get_stats
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Create a meter and fetch its statistics.
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
NAME
|
||||
CeilometerStats.create_meter_and_get_stats
|
||||
NAMESPACE
|
||||
default
|
||||
PLATFORM
|
||||
openstack
|
||||
MODULE
|
||||
rally.plugins.openstack.scenarios.ceilometer.stats
|
||||
DESCRIPTION
|
||||
Meter is first created and then statistics is fetched for the same
|
||||
using GET /v2/meters/(meter_name)/statistics.
|
||||
PARAMETERS
|
||||
+--------+------------------------------------------------+
|
||||
| name | description |
|
||||
+--------+------------------------------------------------+
|
||||
+--------+-----------------------------------------------+
|
||||
| name | description |
|
||||
+--------+-----------------------------------------------+
|
||||
| kwargs | contains optional arguments to create a meter |
|
||||
| | |
|
||||
+--------+------------------------------------------------+
|
||||
|
||||
+--------+-----------------------------------------------+
|
||||
|
||||
In case if multiple plugins were found, all matched elements are listed:
|
||||
|
||||
@ -69,14 +71,14 @@ In case if multiple plugins were found, all matched elements are listed:
|
||||
$ rally plugin show NovaKeypair
|
||||
|
||||
Multiple plugins found:
|
||||
+-------------------------------------------------+-----------+-------------------------------------------------------+
|
||||
| name | namespace | title |
|
||||
+-------------------------------------------------+-----------+-------------------------------------------------------+
|
||||
| NovaKeypair.boot_and_delete_server_with_keypair | default | Boot and delete server with keypair. |
|
||||
| NovaKeypair.create_and_delete_keypair | default | Create a keypair with random name and delete keypair. |
|
||||
| NovaKeypair.create_and_list_keypairs | default | Create a keypair with random name and list keypairs. |
|
||||
+-------------------------------------------------+-----------+-------------------------------------------------------+
|
||||
|
||||
+-------------+-------------------------------------------------+-----------+-------------------------------------------------------+
|
||||
| Plugin base | Name | Platform | Title |
|
||||
+-------------+-------------------------------------------------+-----------+-------------------------------------------------------+
|
||||
| Scenario | NovaKeypair.boot_and_delete_server_with_keypair | openstack | Boot and delete server with keypair. |
|
||||
| Scenario | NovaKeypair.create_and_delete_keypair | openstack | Create a keypair with random name and delete keypair. |
|
||||
| Scenario | NovaKeypair.create_and_get_keypair | openstack | Create a keypair and get the keypair details. |
|
||||
| Scenario | NovaKeypair.create_and_list_keypairs | openstack | Create a keypair with random name and list keypairs. |
|
||||
+-------------+-------------------------------------------------+-----------+-------------------------------------------------------+
|
||||
|
||||
CLI: rally plugin list
|
||||
----------------------
|
||||
@ -87,29 +89,33 @@ This command can be used to list filtered by name list of plugins.
|
||||
|
||||
$ rally plugin list --name Keystone
|
||||
|
||||
+--------------------------------------------------+-----------+-----------------------------------------------------------------+
|
||||
| name | namespace | title |
|
||||
+--------------------------------------------------+-----------+-----------------------------------------------------------------+
|
||||
| Authenticate.keystone | default | Check Keystone Client. |
|
||||
| KeystoneBasic.add_and_remove_user_role | default | Create a user role add to a user and disassociate. |
|
||||
| KeystoneBasic.create_add_and_list_user_roles | default | Create user role, add it and list user roles for given user. |
|
||||
| KeystoneBasic.create_and_delete_ec2credential | default | Create and delete keystone ec2-credential. |
|
||||
| KeystoneBasic.create_and_delete_role | default | Create a user role and delete it. |
|
||||
| KeystoneBasic.create_and_delete_service | default | Create and delete service. |
|
||||
| KeystoneBasic.create_and_list_ec2credentials | default | Create and List all keystone ec2-credentials. |
|
||||
| KeystoneBasic.create_and_list_services | default | Create and list services. |
|
||||
| KeystoneBasic.create_and_list_tenants | default | Create a keystone tenant with random name and list all tenants. |
|
||||
| KeystoneBasic.create_and_list_users | default | Create a keystone user with random name and list all users. |
|
||||
| KeystoneBasic.create_delete_user | default | Create a keystone user with random name and then delete it. |
|
||||
| KeystoneBasic.create_tenant | default | Create a keystone tenant with random name. |
|
||||
| KeystoneBasic.create_tenant_with_users | default | Create a keystone tenant and several users belonging to it. |
|
||||
| KeystoneBasic.create_update_and_delete_tenant | default | Create, update and delete tenant. |
|
||||
| KeystoneBasic.create_user | default | Create a keystone user with random name. |
|
||||
| KeystoneBasic.create_user_set_enabled_and_delete | default | Create a keystone user, enable or disable it, and delete it. |
|
||||
| KeystoneBasic.create_user_update_password | default | Create user and update password for that user. |
|
||||
| KeystoneBasic.get_entities | default | Get instance of a tenant, user, role and service by id's. |
|
||||
+--------------------------------------------------+-----------+-----------------------------------------------------------------+
|
||||
|
||||
+-------------+----------------------------------------------------+-----------+-----------------------------------------------------------------+
|
||||
| Plugin base | Name | Platform | Title |
|
||||
+-------------+----------------------------------------------------+-----------+-----------------------------------------------------------------+
|
||||
| OSClient | keystone | openstack | Wrapper for KeystoneClient which hides OpenStack auth details. |
|
||||
| Scenario | Authenticate.keystone | openstack | Check Keystone Client. |
|
||||
| Scenario | KeystoneBasic.add_and_remove_user_role | openstack | Create a user role add to a user and disassociate. |
|
||||
| Scenario | KeystoneBasic.authenticate_user_and_validate_token | openstack | Authenticate and validate a keystone token. |
|
||||
| Scenario | KeystoneBasic.create_add_and_list_user_roles | openstack | Create user role, add it and list user roles for given user. |
|
||||
| Scenario | KeystoneBasic.create_and_delete_ec2credential | openstack | Create and delete keystone ec2-credential. |
|
||||
| Scenario | KeystoneBasic.create_and_delete_role | openstack | Create a user role and delete it. |
|
||||
| Scenario | KeystoneBasic.create_and_delete_service | openstack | Create and delete service. |
|
||||
| Scenario | KeystoneBasic.create_and_get_role | openstack | Create a user role and get it detailed information. |
|
||||
| Scenario | KeystoneBasic.create_and_list_ec2credentials | openstack | Create and List all keystone ec2-credentials. |
|
||||
| Scenario | KeystoneBasic.create_and_list_roles | openstack | Create a role, then list all roles. |
|
||||
| Scenario | KeystoneBasic.create_and_list_services | openstack | Create and list services. |
|
||||
| Scenario | KeystoneBasic.create_and_list_tenants | openstack | Create a keystone tenant with random name and list all tenants. |
|
||||
| Scenario | KeystoneBasic.create_and_list_users | openstack | Create a keystone user with random name and list all users. |
|
||||
| Scenario | KeystoneBasic.create_and_update_user | openstack | Create user and update the user. |
|
||||
| Scenario | KeystoneBasic.create_delete_user | openstack | Create a keystone user with random name and then delete it. |
|
||||
| Scenario | KeystoneBasic.create_tenant | openstack | Create a keystone tenant with random name. |
|
||||
| Scenario | KeystoneBasic.create_tenant_with_users | openstack | Create a keystone tenant and several users belonging to it. |
|
||||
| Scenario | KeystoneBasic.create_update_and_delete_tenant | openstack | Create, update and delete tenant. |
|
||||
| Scenario | KeystoneBasic.create_user | openstack | Create a keystone user with random name. |
|
||||
| Scenario | KeystoneBasic.create_user_set_enabled_and_delete | openstack | Create a keystone user, enable or disable it, and delete it. |
|
||||
| Scenario | KeystoneBasic.create_user_update_password | openstack | Create user and update password for that user. |
|
||||
| Scenario | KeystoneBasic.get_entities | openstack | Get instance of a tenant, user, role and service by id's. |
|
||||
+-------------+----------------------------------------------------+-----------+-----------------------------------------------------------------+
|
||||
.. references:
|
||||
|
||||
.. _source code: https://github.com/openstack/rally/tree/master/rally/plugins/
|
||||
|
@ -65,8 +65,8 @@ Here is an example of base class for all pluggable validators.
|
||||
from rally.task import validation
|
||||
|
||||
|
||||
def configure(name, namespace="default"):
|
||||
return plugin.configure(name=name, namespace=namespace)
|
||||
def configure(name, platform="default"):
|
||||
return plugin.configure(name=name, platform=platform)
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
@configure(name="base_validator")
|
||||
|
@ -31,8 +31,8 @@ _rally()
|
||||
OPTS["deployment_recreate"]="--filename --deployment"
|
||||
OPTS["deployment_show"]="--deployment"
|
||||
OPTS["deployment_use"]="--deployment"
|
||||
OPTS["plugin_list"]="--name --namespace --plugin-base"
|
||||
OPTS["plugin_show"]="--name --namespace"
|
||||
OPTS["plugin_list"]="--name --platform --plugin-base"
|
||||
OPTS["plugin_show"]="--name --platform"
|
||||
OPTS["task_abort"]="--uuid --soft"
|
||||
OPTS["task_delete"]="--force --uuid"
|
||||
OPTS["task_detailed"]="--uuid --iterations-data"
|
||||
@ -50,13 +50,13 @@ _rally()
|
||||
OPTS["task_validate"]="--deployment --task --task-args --task-args-file"
|
||||
OPTS["verify_add-verifier-ext"]="--id --source --version --extra-settings"
|
||||
OPTS["verify_configure-verifier"]="--id --deployment-id --reconfigure --extend --override --show"
|
||||
OPTS["verify_create-verifier"]="--name --type --namespace --source --version --system-wide --extra-settings --no-use"
|
||||
OPTS["verify_create-verifier"]="--name --type --platform --source --version --system-wide --extra-settings --no-use"
|
||||
OPTS["verify_delete"]="--uuid"
|
||||
OPTS["verify_delete-verifier"]="--id --deployment-id --force"
|
||||
OPTS["verify_delete-verifier-ext"]="--id --name"
|
||||
OPTS["verify_import"]="--id --deployment-id --file --run-args --no-use"
|
||||
OPTS["verify_list"]="--id --deployment-id --tag --status"
|
||||
OPTS["verify_list-plugins"]="--namespace"
|
||||
OPTS["verify_list-plugins"]="--platform"
|
||||
OPTS["verify_list-verifier-exts"]="--id"
|
||||
OPTS["verify_list-verifier-tests"]="--id --pattern"
|
||||
OPTS["verify_list-verifiers"]="--status"
|
||||
|
23
rally/api.py
23
rally/api.py
@ -620,26 +620,26 @@ class _Task(APIGroup):
|
||||
|
||||
class _Verifier(APIGroup):
|
||||
|
||||
def list_plugins(self, namespace=None):
|
||||
def list_plugins(self, platform=None):
|
||||
"""List all plugins for verifiers management.
|
||||
|
||||
:param namespace: Verifier plugin namespace
|
||||
:param platform: Verifier plugin platform
|
||||
"""
|
||||
return [{"name": p.get_name(),
|
||||
"namespace": p.get_platform(),
|
||||
"platform": p.get_platform(),
|
||||
"description": p.get_info()["title"],
|
||||
"location": "%s.%s" % (p.__module__, p.__name__)}
|
||||
for p in vmanager.VerifierManager.get_all(platform=namespace)]
|
||||
for p in vmanager.VerifierManager.get_all(platform=platform)]
|
||||
|
||||
def create(self, name, vtype, namespace=None, source=None, version=None,
|
||||
def create(self, name, vtype, platform=None, source=None, version=None,
|
||||
system_wide=False, extra_settings=None):
|
||||
"""Create a verifier.
|
||||
|
||||
:param name: Verifier name
|
||||
:param vtype: Verifier plugin name
|
||||
:param namespace: Verifier plugin namespace. Should be specified when
|
||||
:param platform: Verifier plugin platform. Should be specified when
|
||||
there are two verifier plugins with equal names but
|
||||
in different namespaces
|
||||
in different platforms
|
||||
:param source: Path or URL to the repo to clone verifier from
|
||||
:param version: Branch, tag or commit ID to checkout before
|
||||
verifier installation
|
||||
@ -648,7 +648,7 @@ class _Verifier(APIGroup):
|
||||
:param extra_settings: Extra installation settings for verifier
|
||||
"""
|
||||
# check that the specified verifier type exists
|
||||
vmanager.VerifierManager.get(vtype, platform=namespace)
|
||||
vmanager.VerifierManager.get(vtype, platform=platform)
|
||||
|
||||
LOG.info("Creating verifier '%s'." % name)
|
||||
|
||||
@ -657,7 +657,7 @@ class _Verifier(APIGroup):
|
||||
except exceptions.ResourceNotFound:
|
||||
verifier = objects.Verifier.create(
|
||||
name=name, source=source, system_wide=system_wide,
|
||||
version=version, vtype=vtype, namespace=namespace,
|
||||
version=version, vtype=vtype, platform=platform,
|
||||
extra_settings=extra_settings)
|
||||
else:
|
||||
raise exceptions.RallyException(
|
||||
@ -665,10 +665,7 @@ class _Verifier(APIGroup):
|
||||
"another name for verifier and try again." % verifier.name)
|
||||
|
||||
properties = {}
|
||||
|
||||
default_namespace = verifier.manager.get_platform()
|
||||
if not namespace and default_namespace:
|
||||
properties["namespace"] = default_namespace
|
||||
properties["platform"] = platform or verifier.manager.get_platform()
|
||||
|
||||
default_source = verifier.manager._meta_get("default_repo")
|
||||
if not source and default_source:
|
||||
|
@ -28,43 +28,45 @@ class PluginCommands(object):
|
||||
def _print_plugins_list(plugin_list):
|
||||
formatters = {
|
||||
"Name": lambda p: p.get_name(),
|
||||
"Namespace": lambda p: p.get_platform(),
|
||||
"Platform": lambda p: p.get_platform(),
|
||||
"Title": lambda p: p.get_info()["title"],
|
||||
"Plugin base": lambda p: p._get_base().__name__
|
||||
}
|
||||
|
||||
cliutils.print_list(plugin_list, formatters=formatters,
|
||||
normalize_field_names=True,
|
||||
fields=["Plugin base", "Name", "Namespace",
|
||||
fields=["Plugin base", "Name", "Platform",
|
||||
"Title"])
|
||||
|
||||
@cliutils.args("--name", dest="name", type=str,
|
||||
help="Plugin name.")
|
||||
@cliutils.args("--namespace", dest="namespace", type=str,
|
||||
help="Plugin namespace.")
|
||||
@cliutils.args("--platform", dest="platform", type=str,
|
||||
help="Plugin platform.")
|
||||
@cliutils.deprecated_args("--namespace", dest="platform",
|
||||
release="0.10.0", alternative="--platform")
|
||||
@plugins.ensure_plugins_are_loaded
|
||||
def show(self, api, name, namespace=None):
|
||||
def show(self, api, name, platform=None):
|
||||
"""Show detailed information about a Rally plugin."""
|
||||
name_lw = name.lower()
|
||||
all_plugins = plugin.Plugin.get_all(platform=namespace)
|
||||
all_plugins = plugin.Plugin.get_all(platform=platform)
|
||||
found = [p for p in all_plugins if name_lw in p.get_name().lower()]
|
||||
exact_match = [p for p in found if name_lw == p.get_name().lower()]
|
||||
|
||||
if not found:
|
||||
if namespace:
|
||||
if platform:
|
||||
print(
|
||||
"There is no plugin: %(name)s in %(namespace)s namespace"
|
||||
% {"name": name, "namespace": namespace}
|
||||
"Plugin %(name)s@%(platform)s not found"
|
||||
% {"name": name, "platform": platform}
|
||||
)
|
||||
else:
|
||||
print("There is no plugin: %s" % name)
|
||||
print("Plugin %s not found at any platform" % name)
|
||||
|
||||
elif len(found) == 1 or exact_match:
|
||||
plugin_ = found[0] if len(found) == 1 else exact_match[0]
|
||||
plugin_info = plugin_.get_info()
|
||||
print(cliutils.make_header(plugin_info["title"]))
|
||||
print("NAME\n\t%s" % plugin_info["name"])
|
||||
print("NAMESPACE\n\t%s" % plugin_info["namespace"])
|
||||
print("PLATFORM\n\t%s" % plugin_info["platform"])
|
||||
print("MODULE\n\t%s" % plugin_info["module"])
|
||||
if plugin_info["description"]:
|
||||
print("DESCRIPTION\n\t", end="")
|
||||
@ -84,15 +86,17 @@ class PluginCommands(object):
|
||||
"--name", dest="name", type=str,
|
||||
help="List only plugins that match the given name.")
|
||||
@cliutils.args(
|
||||
"--namespace", dest="namespace", type=str,
|
||||
help="List only plugins that are in the specified namespace.")
|
||||
"--platform", dest="platform", type=str,
|
||||
help="List only plugins that are in the specified platform.")
|
||||
@cliutils.deprecated_args("--namespace", dest="platform",
|
||||
release="0.10.0", alternative="--platform")
|
||||
@cliutils.args(
|
||||
"--plugin-base", dest="base_cls", type=str,
|
||||
help="Plugin base class.")
|
||||
@plugins.ensure_plugins_are_loaded
|
||||
def list(self, api, name=None, namespace=None, base_cls=None):
|
||||
"""List all Rally plugins that match name and namespace."""
|
||||
all_plugins = plugin.Plugin.get_all(platform=namespace)
|
||||
def list(self, api, name=None, platform=None, base_cls=None):
|
||||
"""List all Rally plugins that match name and platform."""
|
||||
all_plugins = plugin.Plugin.get_all(platform=platform)
|
||||
matched = all_plugins
|
||||
if name:
|
||||
name_lw = name.lower()
|
||||
@ -104,8 +108,8 @@ class PluginCommands(object):
|
||||
if p._get_base().__name__ == base_cls]
|
||||
|
||||
if not all_plugins:
|
||||
print("There is no plugin namespace: %s" % namespace)
|
||||
print("Platform %s not found" % platform)
|
||||
elif not matched:
|
||||
print("There is no plugin: %s" % name)
|
||||
print("Plugin %s not found" % name)
|
||||
else:
|
||||
self._print_plugins_list(matched)
|
||||
|
@ -87,17 +87,18 @@ class VerifyCommands(object):
|
||||
def _get_location(self, uuid, loc):
|
||||
return os.path.join(self._base_dir(uuid), loc)
|
||||
|
||||
@cliutils.args("--namespace", dest="namespace", type=str, metavar="<name>",
|
||||
required=False,
|
||||
help="Namespace name (for example, openstack).")
|
||||
@cliutils.args("--platform", dest="platform", type=str,
|
||||
help="Requried patform (e.g. openstack).")
|
||||
@cliutils.deprecated_args("--namespace", dest="platform",
|
||||
release="0.10.0", alternative="--platform")
|
||||
@plugins.ensure_plugins_are_loaded
|
||||
def list_plugins(self, api, namespace=None):
|
||||
def list_plugins(self, api, platform=None):
|
||||
"""List all plugins for verifiers management."""
|
||||
if namespace:
|
||||
namespace = namespace.lower()
|
||||
verifier_plugins = api.verifier.list_plugins(namespace=namespace)
|
||||
if platform:
|
||||
platform = platform.lower()
|
||||
verifier_plugins = api.verifier.list_plugins(platform=platform)
|
||||
|
||||
fields = ["Plugin name", "Namespace", "Description"]
|
||||
fields = ["Plugin name", "Platform", "Description"]
|
||||
if logging.is_debug():
|
||||
fields.append("Location")
|
||||
|
||||
@ -112,11 +113,12 @@ class VerifyCommands(object):
|
||||
help="Verifier plugin name. HINT: You can list all "
|
||||
"verifier plugins, executing command `rally verify "
|
||||
"list-plugins`.")
|
||||
@cliutils.args("--namespace", dest="namespace", type=str, metavar="<name>",
|
||||
required=False,
|
||||
help="Verifier plugin namespace. Should be specified in "
|
||||
@cliutils.args("--platform", dest="platform", type=str,
|
||||
help="Verifier plugin platform. Should be specified in "
|
||||
"case of two verifier plugins with equal names but "
|
||||
"in different namespaces.")
|
||||
"in different platforms.")
|
||||
@cliutils.deprecated_args("--namespace", dest="platform",
|
||||
release="0.10.0", alternative="--platform")
|
||||
@cliutils.args("--source", dest="source", type=str, required=False,
|
||||
help="Path or URL to the repo to clone verifier from.")
|
||||
@cliutils.args("--version", dest="version", type=str, required=False,
|
||||
@ -133,12 +135,12 @@ class VerifyCommands(object):
|
||||
help="Not to set the created verifier as the default "
|
||||
"verifier for future operations.")
|
||||
@plugins.ensure_plugins_are_loaded
|
||||
def create_verifier(self, api, name, vtype, namespace="", source=None,
|
||||
def create_verifier(self, api, name, vtype, platform="", source=None,
|
||||
version=None, system_wide=False, extra=None,
|
||||
do_use=True):
|
||||
"""Create a verifier."""
|
||||
verifier_uuid = api.verifier.create(
|
||||
name=name, vtype=vtype, namespace=namespace, source=source,
|
||||
name=name, vtype=vtype, platform=platform, source=source,
|
||||
version=version, system_wide=system_wide, extra_settings=extra)
|
||||
|
||||
if do_use:
|
||||
@ -163,7 +165,7 @@ class VerifyCommands(object):
|
||||
"""List all verifiers."""
|
||||
verifiers = api.verifier.list(status=status)
|
||||
if verifiers:
|
||||
fields = ["UUID", "Name", "Type", "Namespace", "Created at",
|
||||
fields = ["UUID", "Name", "Type", "Platform", "Created at",
|
||||
"Updated at", "Status", "Version", "System-wide",
|
||||
"Active"]
|
||||
cv = envutils.get_global(envutils.ENV_VERIFIER)
|
||||
@ -189,7 +191,7 @@ class VerifyCommands(object):
|
||||
"""Show detailed information about a verifier."""
|
||||
verifier = api.verifier.get(verifier_id=verifier_id)
|
||||
fields = ["UUID", "Status", "Created at", "Updated at", "Active",
|
||||
"Name", "Description", "Type", "Namespace", "Source",
|
||||
"Name", "Description", "Type", "Platform", "Source",
|
||||
"Version", "System-wide", "Extra settings", "Location",
|
||||
"Venv location"]
|
||||
used_verifier = envutils.get_global(envutils.ENV_VERIFIER)
|
||||
@ -624,8 +626,8 @@ class VerifyCommands(object):
|
||||
"Verifier name": lambda v: "%s (UUID: %s)" % (verifier["name"],
|
||||
verifier["uuid"]),
|
||||
"Verifier type": (
|
||||
lambda v: "%s (namespace: %s)" % (verifier["type"],
|
||||
verifier["namespace"])),
|
||||
lambda v: "%s (platform: %s)" % (verifier["type"],
|
||||
verifier["platform"])),
|
||||
"Deployment name": (
|
||||
lambda v: "%s (UUID: %s)" % (deployment["name"],
|
||||
deployment["uuid"])),
|
||||
|
@ -362,13 +362,13 @@ def resource_delete(id):
|
||||
return get_impl().resource_delete(id)
|
||||
|
||||
|
||||
def verifier_create(name, vtype, namespace, source, version, system_wide,
|
||||
def verifier_create(name, vtype, platform, source, version, system_wide,
|
||||
extra_settings=None):
|
||||
"""Create a verifier record.
|
||||
|
||||
:param name: verifier name
|
||||
:param vtype: verifier plugin name
|
||||
:param namespace: verifier plugin namespace
|
||||
:param platform: verifier plugin platform
|
||||
:param source: path or URL to a verifier repo
|
||||
:param version: branch, tag or commit ID of a verifier repo
|
||||
:param system_wide: whether or not to use the system-wide environment
|
||||
@ -376,7 +376,7 @@ def verifier_create(name, vtype, namespace, source, version, system_wide,
|
||||
:returns: a dict with verifier data
|
||||
"""
|
||||
return get_impl().verifier_create(name=name, vtype=vtype,
|
||||
namespace=namespace, source=source,
|
||||
platform=platform, source=source,
|
||||
version=version, system_wide=system_wide,
|
||||
extra_settings=extra_settings)
|
||||
|
||||
|
@ -651,10 +651,10 @@ class Connection(object):
|
||||
raise exceptions.ResourceNotFound(id=id)
|
||||
|
||||
@serialize
|
||||
def verifier_create(self, name, vtype, namespace, source, version,
|
||||
def verifier_create(self, name, vtype, platform, source, version,
|
||||
system_wide, extra_settings=None):
|
||||
verifier = models.Verifier()
|
||||
properties = {"name": name, "type": vtype, "namespace": namespace,
|
||||
properties = {"name": name, "type": vtype, "platform": platform,
|
||||
"source": source, "extra_settings": extra_settings,
|
||||
"version": version, "system_wide": system_wide}
|
||||
verifier.update(properties)
|
||||
|
@ -0,0 +1,40 @@
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Rename Namespace To Platform
|
||||
|
||||
Revision ID: 9a18c6fe265c
|
||||
Revises: 046a38742e89
|
||||
Create Date: 2017-10-12 17:28:17.636938
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
|
||||
from rally import exceptions
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "9a18c6fe265c"
|
||||
down_revision = "046a38742e89"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table("verifiers") as batch_op:
|
||||
batch_op.alter_column("namespace", new_column_name="platform")
|
||||
|
||||
|
||||
def downgrade():
|
||||
raise exceptions.DowngradeNotSupported()
|
@ -364,7 +364,7 @@ class Verifier(BASE, RallyBase):
|
||||
description = sa.Column(sa.Text)
|
||||
|
||||
type = sa.Column(sa.String(255), nullable=False)
|
||||
namespace = sa.Column(sa.String(255))
|
||||
platform = sa.Column(sa.String(255))
|
||||
|
||||
source = sa.Column(sa.String(255))
|
||||
version = sa.Column(sa.String(255))
|
||||
|
@ -142,17 +142,17 @@ class Deployment(object):
|
||||
credentials["users"]]})
|
||||
return all_credentials
|
||||
|
||||
def get_credentials_for(self, namespace):
|
||||
if namespace == "default":
|
||||
def get_credentials_for(self, platform):
|
||||
if platform == "default":
|
||||
return {"admin": None, "users": []}
|
||||
try:
|
||||
creds = self.deployment["credentials"][namespace][0]
|
||||
creds = self.deployment["credentials"][platform][0]
|
||||
except (KeyError, IndexError):
|
||||
raise exceptions.RallyException(
|
||||
"No credentials found for %s" % namespace)
|
||||
"No credentials found for %s" % platform)
|
||||
|
||||
admin = creds["admin"]
|
||||
credential_cls = credential.get(namespace)
|
||||
credential_cls = credential.get(platform)
|
||||
return {"admin": credential_cls(**admin) if admin else None,
|
||||
"users": [credential_cls(**user) for user in creds["users"]]}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class Verifier(object):
|
||||
def to_dict(self, item=None):
|
||||
data = {}
|
||||
formatters = ["created_at", "updated_at"]
|
||||
fields = ["status", "system_wide", "uuid", "type", "namespace",
|
||||
fields = ["status", "system_wide", "uuid", "type", "platform",
|
||||
"name", "source", "version", "extra_settings",
|
||||
"id", "description"]
|
||||
for field in fields:
|
||||
@ -56,10 +56,10 @@ class Verifier(object):
|
||||
return data
|
||||
|
||||
@classmethod
|
||||
def create(cls, name, vtype, namespace, source, version, system_wide,
|
||||
def create(cls, name, vtype, platform, source, version, system_wide,
|
||||
extra_settings=None):
|
||||
db_entry = db.verifier_create(name=name, vtype=vtype,
|
||||
namespace=namespace, source=source,
|
||||
platform=platform, source=source,
|
||||
version=version, system_wide=system_wide,
|
||||
extra_settings=extra_settings)
|
||||
return cls(db_entry)
|
||||
@ -99,6 +99,6 @@ class Verifier(object):
|
||||
# lazy load manager to be able to use non-plugin related stuff without
|
||||
# loading plugins
|
||||
if not self._manager:
|
||||
self._manager = manager.VerifierManager.get(self.type,
|
||||
self.namespace)(self)
|
||||
self._manager = manager.VerifierManager.get(
|
||||
self.type, self.platform)(self)
|
||||
return self._manager
|
||||
|
@ -128,7 +128,7 @@ class InfoMixin(object):
|
||||
return {
|
||||
"name": cls.get_name(),
|
||||
"platform": cls.get_platform(),
|
||||
"namespace": cls.get_platform(),
|
||||
"platform": cls.get_platform(),
|
||||
"module": cls.__module__,
|
||||
"title": doc["short_description"],
|
||||
"description": doc["long_description"],
|
||||
|
@ -21,15 +21,15 @@ import six
|
||||
from rally.common.plugin import plugin
|
||||
|
||||
|
||||
def configure(namespace):
|
||||
def configure(platform):
|
||||
def wrapper(cls):
|
||||
cls = plugin.configure(name="credential", platform=namespace)(cls)
|
||||
cls = plugin.configure(name="credential", platform=platform)(cls)
|
||||
return cls
|
||||
return wrapper
|
||||
|
||||
|
||||
def get(namespace):
|
||||
return Credential.get(name="credential", platform=namespace)
|
||||
def get(platform):
|
||||
return Credential.get(name="credential", platform=platform)
|
||||
|
||||
|
||||
@plugin.base()
|
||||
@ -61,17 +61,17 @@ class Credential(plugin.Plugin):
|
||||
return {}
|
||||
|
||||
|
||||
def configure_builder(namespace):
|
||||
def configure_builder(platform):
|
||||
def wrapper(cls):
|
||||
cls = plugin.configure(name="credential_builder",
|
||||
platform=namespace)(cls)
|
||||
platform=platform)(cls)
|
||||
return cls
|
||||
return wrapper
|
||||
|
||||
|
||||
def get_builder(namespace):
|
||||
def get_builder(platform):
|
||||
return CredentialBuilder.get(name="credential_builder",
|
||||
platform=namespace)
|
||||
platform=platform)
|
||||
|
||||
|
||||
@plugin.base()
|
||||
|
@ -42,12 +42,12 @@ class ArgsValidator(validation.Validator):
|
||||
def validate(self, context, config, plugin_cls, plugin_cfg):
|
||||
scenario = plugin_cls
|
||||
name = scenario.get_name()
|
||||
namespace = scenario.get_platform()
|
||||
platform = scenario.get_platform()
|
||||
scenario = scenario().run
|
||||
args, _varargs, varkwargs, defaults = inspect.getargspec(scenario)
|
||||
|
||||
hint_msg = (" Use `rally plugin show --name %s --namespace %s` "
|
||||
"to display scenario description." % (name, namespace))
|
||||
hint_msg = (" Use `rally plugin show --name %s --platform %s` "
|
||||
"to display scenario description." % (name, platform))
|
||||
|
||||
# scenario always accepts an instance of scenario cls as a first arg
|
||||
missed_args = args[1:]
|
||||
|
@ -31,7 +31,7 @@ AVAILABLE_SETS = (list(consts.TempestTestSets) +
|
||||
list(consts.TempestScenarioTestSets))
|
||||
|
||||
|
||||
@manager.configure(name="tempest", namespace="openstack",
|
||||
@manager.configure(name="tempest", platform="openstack",
|
||||
default_repo="https://git.openstack.org/openstack/tempest",
|
||||
context={"tempest": {}, "testr": {}})
|
||||
class TempestManager(testr.TestrLauncher):
|
||||
|
@ -46,18 +46,18 @@ class VerifierSetupFailure(exceptions.RallyException):
|
||||
msg_fmt = "Failed to set up verifier '%(verifier)s': %(message)s"
|
||||
|
||||
|
||||
def configure(name, namespace="default", default_repo=None,
|
||||
def configure(name, platform="default", default_repo=None,
|
||||
default_version=None, context=None):
|
||||
"""Decorator to configure plugin's attributes.
|
||||
|
||||
:param name: Plugin name that is used for searching purpose
|
||||
:param namespace: Plugin namespace
|
||||
:param platform: Plugin platform
|
||||
:param default_repo: Default repository to clone
|
||||
:param default_version: Default version to checkout
|
||||
:param context: List of contexts that should be executed for verification
|
||||
"""
|
||||
def decorator(plugin_inst):
|
||||
plugin_inst = plugin.configure(name, platform=namespace)(plugin_inst)
|
||||
plugin_inst = plugin.configure(name, platform=platform)(plugin_inst)
|
||||
plugin_inst._meta_set("default_repo", default_repo)
|
||||
plugin_inst._meta_set("default_version", default_version)
|
||||
plugin_inst._meta_set("context", context or {})
|
||||
|
@ -21,7 +21,7 @@ from rally.task import context
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@context.configure(name="create_flavor", namespace="openstack", order=1000)
|
||||
@context.configure(name="create_flavor", platform="openstack", order=1000)
|
||||
class CreateFlavorContext(context.Context):
|
||||
"""Create sample flavor
|
||||
|
||||
|
@ -96,11 +96,11 @@ class TestTaskSamples(unittest.TestCase):
|
||||
original_get_credentials_for = deployment.get_credentials_for
|
||||
creds_cache = {}
|
||||
|
||||
def get_credentials_for(namespace):
|
||||
if namespace not in creds_cache:
|
||||
creds_cache[namespace] = original_get_credentials_for(
|
||||
namespace)
|
||||
return creds_cache[namespace]
|
||||
def get_credentials_for(platform):
|
||||
if platform not in creds_cache:
|
||||
creds_cache[platform] = original_get_credentials_for(
|
||||
platform)
|
||||
return creds_cache[platform]
|
||||
|
||||
deployment.get_credentials_for = get_credentials_for
|
||||
|
||||
|
@ -20,14 +20,11 @@ from tests.functional import utils
|
||||
|
||||
class PluginTestCase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PluginTestCase, self).setUp()
|
||||
|
||||
def test_show_one(self):
|
||||
rally = utils.Rally()
|
||||
result = rally("plugin show Dummy.dummy")
|
||||
self.assertIn("NAME", result)
|
||||
self.assertIn("NAMESPACE", result)
|
||||
self.assertIn("PLATFORM", result)
|
||||
self.assertIn("Dummy.dummy", result)
|
||||
self.assertIn("MODULE", result)
|
||||
|
||||
@ -43,18 +40,18 @@ class PluginTestCase(unittest.TestCase):
|
||||
rally = utils.Rally()
|
||||
name = "Dummy666666"
|
||||
result = rally("plugin show %s" % name)
|
||||
self.assertIn("There is no plugin: %s" % name, result)
|
||||
self.assertIn("Plugin %s not found" % name, result)
|
||||
|
||||
def test_show_not_found_in_specific_namespace(self):
|
||||
def test_show_not_found_in_specific_platform(self):
|
||||
rally = utils.Rally()
|
||||
name = "Dummy"
|
||||
namespace = "non_existing"
|
||||
platform = "non_existing"
|
||||
result = rally(
|
||||
"plugin show --name %(name)s --namespace %(namespace)s"
|
||||
% {"name": name, "namespace": namespace})
|
||||
"plugin show --name %(name)s --platform %(platform)s"
|
||||
% {"name": name, "platform": platform})
|
||||
self.assertIn(
|
||||
"There is no plugin: %(name)s in %(namespace)s namespace"
|
||||
% {"name": name, "namespace": namespace},
|
||||
"Plugin %(name)s@%(platform)s not found"
|
||||
% {"name": name, "platform": platform},
|
||||
result)
|
||||
|
||||
def test_list(self):
|
||||
@ -64,12 +61,12 @@ class PluginTestCase(unittest.TestCase):
|
||||
self.assertIn("Dummy.dummy_exception", result)
|
||||
self.assertIn("Dummy.dummy_random_fail_in_atomic", result)
|
||||
|
||||
def test_list_not_found_namespace(self):
|
||||
def test_list_not_found_platform(self):
|
||||
rally = utils.Rally()
|
||||
result = rally("plugin list --namespace some")
|
||||
self.assertIn("There is no plugin namespace: some", result)
|
||||
result = rally("plugin list --platform some")
|
||||
self.assertIn("Platform some not found", result)
|
||||
|
||||
def test_list_not_found_name(self):
|
||||
rally = utils.Rally()
|
||||
result = rally("plugin list Dummy2222")
|
||||
self.assertIn("There is no plugin: Dummy2222", result)
|
||||
self.assertIn("Plugin Dummy2222 not found", result)
|
||||
|
@ -78,12 +78,12 @@ class PluginCommandsTestCase(test.TestCase):
|
||||
[self.Plugin1, self.Plugin2])
|
||||
|
||||
self.assertEqual(
|
||||
"+-------------+------+-----------+-------+\n"
|
||||
"| Plugin base | Name | Namespace | Title |\n"
|
||||
"+-------------+------+-----------+-------+\n"
|
||||
"| Plugin | p1 | p1_ns | T1. |\n"
|
||||
"| Plugin | p2 | p2_ns | T2. |\n"
|
||||
"+-------------+------+-----------+-------+\n", out.getvalue())
|
||||
"+-------------+------+----------+-------+\n"
|
||||
"| Plugin base | Name | Platform | Title |\n"
|
||||
"+-------------+------+----------+-------+\n"
|
||||
"| Plugin | p1 | p1_ns | T1. |\n"
|
||||
"| Plugin | p2 | p2_ns | T2. |\n"
|
||||
"+-------------+------+----------+-------+\n", out.getvalue())
|
||||
|
||||
def test_show(self):
|
||||
with utils.StdOutCapture() as out:
|
||||
@ -91,7 +91,7 @@ class PluginCommandsTestCase(test.TestCase):
|
||||
output = out.getvalue()
|
||||
|
||||
self.assertIn("NAME\n\tp1", output)
|
||||
self.assertIn("NAMESPACE\n\tp1_ns", output)
|
||||
self.assertIn("PLATFORM\n\tp1_ns", output)
|
||||
self.assertIn("cli.commands.test_plugin", output)
|
||||
self.assertIn("DESCRIPTION\n\tDescription of T1", output)
|
||||
self.assertIn("PARAMETERS", output)
|
||||
@ -99,20 +99,20 @@ class PluginCommandsTestCase(test.TestCase):
|
||||
@ddt.data(
|
||||
{
|
||||
"name": "nonex",
|
||||
"namespace": None,
|
||||
"text": "There is no plugin: nonex\n"
|
||||
"platform": None,
|
||||
"text": "Plugin nonex not found at any platform\n"
|
||||
},
|
||||
{
|
||||
"name": "nonexplugin",
|
||||
"namespace": "nonex",
|
||||
"text": "There is no plugin: nonexplugin in nonex namespace\n"
|
||||
"platform": "nonex",
|
||||
"text": "Plugin nonexplugin@nonex not found\n"
|
||||
}
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_show_not_found(self, name, namespace, text):
|
||||
def test_show_not_found(self, name, platform, text):
|
||||
with utils.StdOutCapture() as out:
|
||||
plugin_cmd.PluginCommands().show(None, name, namespace)
|
||||
self.assertEqual(text, out.getvalue())
|
||||
plugin_cmd.PluginCommands().show(None, name, platform)
|
||||
self.assertEqual(out.getvalue(), text)
|
||||
|
||||
@mock.patch("rally.cli.commands.plugin.PluginCommands._print_plugins_list")
|
||||
def test_show_many(self, mock_plugin_commands__print_plugins_list):
|
||||
@ -130,20 +130,20 @@ class PluginCommandsTestCase(test.TestCase):
|
||||
@ddt.data(
|
||||
{
|
||||
"name": None,
|
||||
"namespace": "nonex",
|
||||
"text": "There is no plugin namespace: nonex\n"
|
||||
"platform": "nonex",
|
||||
"text": "Platform nonex not found\n"
|
||||
},
|
||||
{
|
||||
"name": "p2",
|
||||
"namespace": "p1_ns",
|
||||
"text": "There is no plugin: p2\n"
|
||||
"platform": "p1_ns",
|
||||
"text": "Plugin p2 not found\n"
|
||||
}
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_list_not_found(self, name, namespace, text):
|
||||
def test_list_not_found(self, name, platform, text):
|
||||
|
||||
with utils.StdOutCapture() as out:
|
||||
plugin_cmd.PluginCommands().list(None, name, namespace)
|
||||
plugin_cmd.PluginCommands().list(None, name, platform)
|
||||
self.assertEqual(text, out.getvalue())
|
||||
|
||||
@mock.patch("rally.cli.commands.plugin.PluginCommands._print_plugins_list")
|
||||
|
@ -42,14 +42,14 @@ class VerifyCommandsTestCase(test.TestCase):
|
||||
self.verifier_name = "My Verifier"
|
||||
self.verifier_uuid = "my-verifier-uuid"
|
||||
self.verifier_type = "OldSchoolTestTool"
|
||||
self.verifier_namespace = "OpenStack"
|
||||
self.verifier_platform = "OpenStack"
|
||||
self.verification_uuid = "uuuiiiiddd"
|
||||
|
||||
self.verifier_data = {
|
||||
"uuid": self.verifier_uuid,
|
||||
"name": self.verifier_name,
|
||||
"type": self.verifier_type,
|
||||
"namespace": self.verifier_namespace,
|
||||
"platform": self.verifier_platform,
|
||||
"description": "The best tool in the world",
|
||||
"created_at": "2016-01-01T17:00:03",
|
||||
"updated_at": "2016-01-01T17:01:05",
|
||||
@ -126,9 +126,9 @@ class VerifyCommandsTestCase(test.TestCase):
|
||||
@mock.patch("rally.cli.commands.verify.logging.is_debug",
|
||||
return_value=True)
|
||||
def test_list_plugins(self, mock_is_debug, mock_print_list):
|
||||
self.verify.list_plugins(self.fake_api, namespace="some")
|
||||
self.verify.list_plugins(self.fake_api, platform="some")
|
||||
self.fake_api.verifier.list_plugins.assert_called_once_with(
|
||||
namespace="some")
|
||||
platform="some")
|
||||
|
||||
@mock.patch("rally.cli.commands.verify.fileutils.update_globals_file")
|
||||
def test_create_verifier(self, mock_update_globals_file):
|
||||
@ -136,10 +136,10 @@ class VerifyCommandsTestCase(test.TestCase):
|
||||
self.fake_api.verifier.get.return_value = self.verifier_data
|
||||
|
||||
self.verify.create_verifier(self.fake_api, "a", vtype="b",
|
||||
namespace="c", source="d", version="e",
|
||||
platform="c", source="d", version="e",
|
||||
system_wide=True, extra={})
|
||||
self.fake_api.verifier.create.assert_called_once_with(
|
||||
name="a", vtype="b", namespace="c", source="d", version="e",
|
||||
name="a", vtype="b", platform="c", source="d", version="e",
|
||||
system_wide=True, extra_settings={})
|
||||
|
||||
self.fake_api.verifier.get.assert_called_once_with(
|
||||
@ -171,7 +171,7 @@ class VerifyCommandsTestCase(test.TestCase):
|
||||
def test_list_verifiers(self, mock_print_list):
|
||||
self.fake_api.verifier.list.return_value = [self.verifier_data]
|
||||
|
||||
additional_fields = ["UUID", "Name", "Type", "Namespace", "Created at",
|
||||
additional_fields = ["UUID", "Name", "Type", "Platform", "Created at",
|
||||
"Updated at", "Status", "Version", "System-wide",
|
||||
"Active"]
|
||||
additional_keys = ["normalize_field_names", "sortby_index",
|
||||
@ -217,7 +217,7 @@ class VerifyCommandsTestCase(test.TestCase):
|
||||
"| Name | My Verifier |\n"
|
||||
"| Description | The best tool in the world |\n"
|
||||
"| Type | OldSchoolTestTool |\n"
|
||||
"| Namespace | OpenStack |\n"
|
||||
"| Platform | OpenStack |\n"
|
||||
"| Source | https://example.com |\n"
|
||||
"| Version | master |\n"
|
||||
"| System-wide | False |\n"
|
||||
@ -555,7 +555,7 @@ class VerifyCommandsTestCase(test.TestCase):
|
||||
" |\n"
|
||||
"| Verifier name | My Verifier (UUID: my-verifier-uuid) "
|
||||
" |\n"
|
||||
"| Verifier type | OldSchoolTestTool (namespace: OpenStack) "
|
||||
"| Verifier type | OldSchoolTestTool (platform: OpenStack) "
|
||||
" |\n"
|
||||
"| Deployment name | Some Deploy (UUID: some-deploy-uuid) "
|
||||
" |\n"
|
||||
@ -584,53 +584,55 @@ class VerifyCommandsTestCase(test.TestCase):
|
||||
self.verify.show(self.fake_api, self.verifier_uuid, detailed=False)
|
||||
self.assertEqual(2, len(print_dict_calls))
|
||||
|
||||
self.assertEqual("+---------------------------------------------------"
|
||||
"--------------------------------------+\n"
|
||||
"| Verification "
|
||||
" |\n"
|
||||
"+---------------------+-----------------------------"
|
||||
"--------------------------------------+\n"
|
||||
"| UUID | uuuiiiiddd "
|
||||
" |\n"
|
||||
"| Status | success "
|
||||
" |\n"
|
||||
"| Started at | 2016-01-01 17:00:03 "
|
||||
" |\n"
|
||||
"| Finished at | 2016-01-01 17:01:05 "
|
||||
" |\n"
|
||||
"| Duration | 0:01:02 "
|
||||
" |\n"
|
||||
"| Run arguments | concurrency: 3 "
|
||||
" |\n"
|
||||
"| | load_list: (value is too lon"
|
||||
"g, use 'detailed' flag to display it) |\n"
|
||||
"| | skip_list: (value is too lon"
|
||||
"g, use 'detailed' flag to display it) |\n"
|
||||
"| Tags | bar, foo "
|
||||
" |\n"
|
||||
"| Verifier name | My Verifier (UUID: my-verifi"
|
||||
"er-uuid) |\n"
|
||||
"| Verifier type | OldSchoolTestTool (namespace"
|
||||
": OpenStack) |\n"
|
||||
"| Deployment name | Some Deploy (UUID: some-depl"
|
||||
"oy-uuid) |\n"
|
||||
"| Tests count | 2 "
|
||||
" |\n"
|
||||
"| Tests duration, sec | 4 "
|
||||
" |\n"
|
||||
"| Success | 1 "
|
||||
" |\n"
|
||||
"| Skipped | 0 "
|
||||
" |\n"
|
||||
"| Expected failures | 0 "
|
||||
" |\n"
|
||||
"| Unexpected success | 0 "
|
||||
" |\n"
|
||||
"| Failures | 1 "
|
||||
" |\n"
|
||||
"+---------------------+-----------------------------"
|
||||
"--------------------------------------+\n",
|
||||
print_dict_calls[1].getvalue())
|
||||
self.assertEqual(
|
||||
print_dict_calls[1].getvalue(),
|
||||
"+---------------------------------------------------"
|
||||
"--------------------------------------+\n"
|
||||
"| Verification "
|
||||
" |\n"
|
||||
"+---------------------+-----------------------------"
|
||||
"--------------------------------------+\n"
|
||||
"| UUID | uuuiiiiddd "
|
||||
" |\n"
|
||||
"| Status | success "
|
||||
" |\n"
|
||||
"| Started at | 2016-01-01 17:00:03 "
|
||||
" |\n"
|
||||
"| Finished at | 2016-01-01 17:01:05 "
|
||||
" |\n"
|
||||
"| Duration | 0:01:02 "
|
||||
" |\n"
|
||||
"| Run arguments | concurrency: 3 "
|
||||
" |\n"
|
||||
"| | load_list: (value is too lon"
|
||||
"g, use 'detailed' flag to display it) |\n"
|
||||
"| | skip_list: (value is too lon"
|
||||
"g, use 'detailed' flag to display it) |\n"
|
||||
"| Tags | bar, foo "
|
||||
" |\n"
|
||||
"| Verifier name | My Verifier (UUID: my-verifi"
|
||||
"er-uuid) |\n"
|
||||
"| Verifier type | OldSchoolTestTool (platform:"
|
||||
" OpenStack) |\n"
|
||||
"| Deployment name | Some Deploy (UUID: some-depl"
|
||||
"oy-uuid) |\n"
|
||||
"| Tests count | 2 "
|
||||
" |\n"
|
||||
"| Tests duration, sec | 4 "
|
||||
" |\n"
|
||||
"| Success | 1 "
|
||||
" |\n"
|
||||
"| Skipped | 0 "
|
||||
" |\n"
|
||||
"| Expected failures | 0 "
|
||||
" |\n"
|
||||
"| Unexpected success | 0 "
|
||||
" |\n"
|
||||
"| Failures | 1 "
|
||||
" |\n"
|
||||
"+---------------------+-----------------------------"
|
||||
"--------------------------------------+\n",
|
||||
)
|
||||
|
||||
self.fake_api.verification.get.assert_called_with(
|
||||
verification_uuid=self.verifier_uuid)
|
||||
|
@ -48,7 +48,7 @@ class VerifierTestCase(test.TestCase):
|
||||
def test_create(self, mock_verifier_create):
|
||||
objects.Verifier.create("a", "b", "c", "d", "e", False)
|
||||
mock_verifier_create.assert_called_once_with(
|
||||
name="a", vtype="b", namespace="c", source="d", version="e",
|
||||
name="a", vtype="b", platform="c", source="d", version="e",
|
||||
system_wide=False, extra_settings=None)
|
||||
|
||||
@mock.patch("rally.common.objects.verifier.db.verifier_get")
|
||||
@ -92,7 +92,7 @@ class VerifierTestCase(test.TestCase):
|
||||
@mock.patch("rally.common.objects.verifier.manager")
|
||||
def test_manager_property(self, mock_manager):
|
||||
self.db_obj["type"] = "some"
|
||||
self.db_obj["namespace"] = "namespace"
|
||||
self.db_obj["platform"] = "platform"
|
||||
v = objects.Verifier(self.db_obj)
|
||||
self.assertIsNone(v._manager)
|
||||
self.assertFalse(mock_manager.VerifierManager.get.called)
|
||||
@ -101,4 +101,4 @@ class VerifierTestCase(test.TestCase):
|
||||
mock_manager.VerifierManager.get.return_value.return_value,
|
||||
v.manager)
|
||||
mock_manager.VerifierManager.get.assert_called_once_with(
|
||||
self.db_obj["type"], self.db_obj["namespace"])
|
||||
self.db_obj["type"], self.db_obj["platform"])
|
||||
|
@ -65,8 +65,8 @@ class PluginModuleTestCase(test.TestCase):
|
||||
except exceptions.PluginWithSuchNameExists:
|
||||
self.assertEqual([MyPlugin], FooBase.get_all())
|
||||
else:
|
||||
self.fail("Registration two plugins with same names in one "
|
||||
"namespace should raise an exception.")
|
||||
self.fail("Registration two plugins with the same names in one "
|
||||
"platform should raise an exception.")
|
||||
|
||||
def test_configure_different_bases(self):
|
||||
name = "test_configure_different_bases"
|
||||
|
@ -1843,10 +1843,10 @@ class FakeUserContext(FakeContext):
|
||||
class FakeDeployment(dict):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
namespace = kwargs.pop("namespace", "openstack")
|
||||
platform = kwargs.pop("platform", "openstack")
|
||||
kwargs["credentials"] = {
|
||||
namespace: [{"admin": kwargs.pop("admin", None),
|
||||
"users": kwargs.pop("users", [])}],
|
||||
platform: [{"admin": kwargs.pop("admin", None),
|
||||
"users": kwargs.pop("users", [])}],
|
||||
"default": [{"admin": None, "users": []}]}
|
||||
dict.__init__(self, **kwargs)
|
||||
self.update_status = mock.Mock()
|
||||
@ -1854,8 +1854,8 @@ class FakeDeployment(dict):
|
||||
def get_platforms(self):
|
||||
return [platform for platform in self["credentials"]]
|
||||
|
||||
def get_credentials_for(self, namespace):
|
||||
return self["credentials"][namespace][0]
|
||||
def get_credentials_for(self, platform):
|
||||
return self["credentials"][platform][0]
|
||||
|
||||
def verify_connections(self):
|
||||
pass
|
||||
|
@ -25,7 +25,7 @@ class ScenarioConfigureTestCase(test.TestCase):
|
||||
|
||||
def test_configure(self):
|
||||
|
||||
@scenario.configure(name="fooscenario.name", namespace="testing")
|
||||
@scenario.configure(name="fooscenario.name", platform="testing")
|
||||
class SomeScenario(scenario.Scenario):
|
||||
def run(self):
|
||||
pass
|
||||
|
@ -1101,7 +1101,7 @@ class APITestCase(test.TestCase):
|
||||
|
||||
class FakeVerifierManager(object):
|
||||
NAME = "fake_verifier"
|
||||
NAMESPACE = "tests"
|
||||
PLATFORM = "tests"
|
||||
TITLE = "Fake verifier which is used only for testing purpose"
|
||||
|
||||
@classmethod
|
||||
@ -1110,7 +1110,7 @@ class FakeVerifierManager(object):
|
||||
|
||||
@classmethod
|
||||
def get_platform(cls):
|
||||
return cls.NAMESPACE
|
||||
return cls.PLATFORM
|
||||
|
||||
@classmethod
|
||||
def get_info(cls):
|
||||
@ -1127,18 +1127,18 @@ class VerifierAPITestCase(test.TestCase):
|
||||
|
||||
@mock.patch("rally.api.vmanager.VerifierManager.get_all")
|
||||
def test_list_plugins(self, mock_verifier_manager_get_all):
|
||||
platform = "some"
|
||||
mock_verifier_manager_get_all.return_value = [FakeVerifierManager]
|
||||
namespace = "some"
|
||||
|
||||
self.assertEqual(
|
||||
[{"name": FakeVerifierManager.NAME,
|
||||
"namespace": FakeVerifierManager.NAMESPACE,
|
||||
"platform": FakeVerifierManager.PLATFORM,
|
||||
"description": FakeVerifierManager.TITLE,
|
||||
"location": "%s.%s" % (FakeVerifierManager.__module__,
|
||||
FakeVerifierManager.__name__)}],
|
||||
self.verifier_inst.list_plugins(namespace=namespace))
|
||||
self.verifier_inst.list_plugins(platform=platform))
|
||||
mock_verifier_manager_get_all.assert_called_once_with(
|
||||
platform=namespace)
|
||||
platform=platform)
|
||||
|
||||
@mock.patch("rally.api.objects.Verifier.get")
|
||||
def test_get(self, mock_verifier_get):
|
||||
@ -1169,14 +1169,14 @@ class VerifierAPITestCase(test.TestCase):
|
||||
|
||||
name = "SomeVerifier"
|
||||
vtype = "fake_verifier"
|
||||
namespace = "tests"
|
||||
platform = "tests"
|
||||
source = "https://example.com"
|
||||
version = "3.1415"
|
||||
system_wide = True
|
||||
extra_settings = {"verifier_specific_option": "value_for_it"}
|
||||
|
||||
verifier_obj = mock_verifier_create.return_value
|
||||
verifier_obj.manager.get_platform.return_value = namespace
|
||||
verifier_obj.manager.get_platform.return_value = platform
|
||||
verifier_obj.manager._meta_get.side_effect = [source]
|
||||
|
||||
verifier_uuid = self.verifier_inst.create(
|
||||
@ -1188,11 +1188,11 @@ class VerifierAPITestCase(test.TestCase):
|
||||
mock___verifier__get.assert_called_once_with(name)
|
||||
mock_verifier_create.assert_called_once_with(
|
||||
name=name, source=None, system_wide=system_wide, version=version,
|
||||
vtype=vtype, namespace=None, extra_settings=extra_settings)
|
||||
vtype=vtype, platform=None, extra_settings=extra_settings)
|
||||
|
||||
self.assertEqual(verifier_obj.uuid, verifier_uuid)
|
||||
verifier_obj.update_properties.assert_called_once_with(
|
||||
namespace=namespace, source=source)
|
||||
platform=platform, source=source)
|
||||
self.assertEqual([mock.call(consts.VerifierStatus.INSTALLING),
|
||||
mock.call(consts.VerifierStatus.INSTALLED)],
|
||||
verifier_obj.update_status.call_args_list)
|
||||
@ -1206,7 +1206,7 @@ class VerifierAPITestCase(test.TestCase):
|
||||
mock_verifier_create):
|
||||
name = "SomeVerifier"
|
||||
vtype = "fake_verifier"
|
||||
namespace = "tests"
|
||||
platform = "tests"
|
||||
source = "https://example.com"
|
||||
version = "3.1415"
|
||||
system_wide = True
|
||||
@ -1214,13 +1214,13 @@ class VerifierAPITestCase(test.TestCase):
|
||||
|
||||
self.assertRaises(exceptions.RallyException,
|
||||
self.verifier_inst.create,
|
||||
name=name, vtype=vtype, namespace=namespace,
|
||||
name=name, vtype=vtype, platform=platform,
|
||||
source=source, version=version,
|
||||
system_wide=system_wide,
|
||||
extra_settings=extra_settings)
|
||||
|
||||
mock_verifier_manager_get.assert_called_once_with(vtype,
|
||||
platform=namespace)
|
||||
platform=platform)
|
||||
mock___verifier__get.assert_called_once_with(name)
|
||||
self.assertFalse(mock_verifier_create.called)
|
||||
|
||||
@ -1236,7 +1236,7 @@ class VerifierAPITestCase(test.TestCase):
|
||||
|
||||
name = "SomeVerifier"
|
||||
vtype = "fake_verifier"
|
||||
namespace = "tests"
|
||||
platform = "tests"
|
||||
source = "https://example.com"
|
||||
version = "3.1415"
|
||||
system_wide = True
|
||||
@ -1244,17 +1244,17 @@ class VerifierAPITestCase(test.TestCase):
|
||||
|
||||
self.assertRaises(RuntimeError,
|
||||
self.verifier_inst.create,
|
||||
name=name, vtype=vtype, namespace=namespace,
|
||||
name=name, vtype=vtype, platform=platform,
|
||||
source=source, version=version,
|
||||
system_wide=system_wide,
|
||||
extra_settings=extra_settings)
|
||||
|
||||
mock_verifier_manager_get.assert_called_once_with(vtype,
|
||||
platform=namespace)
|
||||
mock_verifier_manager_get.assert_called_once_with(
|
||||
vtype, platform=platform)
|
||||
mock___verifier__get.assert_called_once_with(name)
|
||||
mock_verifier_create.assert_called_once_with(
|
||||
name=name, source=source, system_wide=system_wide, version=version,
|
||||
vtype=vtype, namespace=namespace, extra_settings=extra_settings)
|
||||
vtype=vtype, platform=platform, extra_settings=extra_settings)
|
||||
|
||||
self.assertEqual([mock.call(consts.VerifierStatus.INSTALLING),
|
||||
mock.call(consts.VerifierStatus.FAILED)],
|
||||
|
Loading…
Reference in New Issue
Block a user