From 3f8a49e8735b769042853f75bb296bea2559f2d6 Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Fri, 22 Sep 2017 16:24:49 -0700 Subject: [PATCH] Finish work on renaming namespace to platform CLI, Verifier, Docs and Tests are updated Change-Id: I382bd1e1899b809743fad3250d66a036e7bac5f5 --- doc/ext/plugin_reference.py | 4 +- doc/release_notes/archive/v0.5.0.rst | 2 +- .../step_8_discovering_more_plugins.rst | 84 ++++++++++--------- etc/rally.bash_completion | 8 +- .../openstack/verification/tempest/manager.py | 2 +- tests/check_samples/test_task_samples.py | 10 +-- tests/functional/test_cli_plugin.py | 27 +++--- tests/unit/fakes.py | 10 +-- 8 files changed, 75 insertions(+), 72 deletions(-) diff --git a/doc/ext/plugin_reference.py b/doc/ext/plugin_reference.py index b510e418..f3793a49 100644 --- a/doc/ext/plugin_reference.py +++ b/doc/ext/plugin_reference.py @@ -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()) diff --git a/doc/release_notes/archive/v0.5.0.rst b/doc/release_notes/archive/v0.5.0.rst index 846e91d6..14bdd3cf 100644 --- a/doc/release_notes/archive/v0.5.0.rst +++ b/doc/release_notes/archive/v0.5.0.rst @@ -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: diff --git a/doc/source/quick_start/tutorial/step_8_discovering_more_plugins.rst b/doc/source/quick_start/tutorial/step_8_discovering_more_plugins.rst index 5757a68c..9034b047 100644 --- a/doc/source/quick_start/tutorial/step_8_discovering_more_plugins.rst +++ b/doc/source/quick_start/tutorial/step_8_discovering_more_plugins.rst @@ -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/ diff --git a/etc/rally.bash_completion b/etc/rally.bash_completion index 73c506a6..61e21a57 100644 --- a/etc/rally.bash_completion +++ b/etc/rally.bash_completion @@ -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" diff --git a/rally/plugins/openstack/verification/tempest/manager.py b/rally/plugins/openstack/verification/tempest/manager.py index 3f450304..8e9df5c2 100644 --- a/rally/plugins/openstack/verification/tempest/manager.py +++ b/rally/plugins/openstack/verification/tempest/manager.py @@ -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): diff --git a/tests/check_samples/test_task_samples.py b/tests/check_samples/test_task_samples.py index fad1898b..444ef30e 100644 --- a/tests/check_samples/test_task_samples.py +++ b/tests/check_samples/test_task_samples.py @@ -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 diff --git a/tests/functional/test_cli_plugin.py b/tests/functional/test_cli_plugin.py index e71f8254..5218ee81 100644 --- a/tests/functional/test_cli_plugin.py +++ b/tests/functional/test_cli_plugin.py @@ -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) diff --git a/tests/unit/fakes.py b/tests/unit/fakes.py index 6d4803a4..b49705e3 100644 --- a/tests/unit/fakes.py +++ b/tests/unit/fakes.py @@ -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