From 9ebef8aa4be2085a7f5500bc23db02fa08adab97 Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Thu, 7 May 2020 18:22:36 +0300 Subject: [PATCH] [ci] Turn on validation of plugins docstings Change-Id: Iab31e047a1e8e7ac7505413db4cd5776d96061b4 --- .../environment/platforms/existing.py | 70 ++++++++----------- .../task/scenarios/neutron/network.py | 1 + rally_openstack/task/scenarios/vm/vmtasks.py | 17 +++-- test-requirements.txt | 4 +- tests/unit/doc/test_docstrings.py | 2 - 5 files changed, 45 insertions(+), 49 deletions(-) diff --git a/rally_openstack/environment/platforms/existing.py b/rally_openstack/environment/platforms/existing.py index 2688132b..b83f97f1 100644 --- a/rally_openstack/environment/platforms/existing.py +++ b/rally_openstack/environment/platforms/existing.py @@ -263,55 +263,44 @@ class OpenStack(platform.Platform): def create_spec_from_sys_environ(cls, sys_environ): """Create a spec based on system environment. - .. envvar:: OS_AUTH_URL - The auth url for OpenStack cluster. Supported both versioned and - unversioned urls. + * OS_AUTH_URL - The auth url for OpenStack cluster. Supported both + versioned and unversioned urls. - .. envvar:: OS_USERNAME - A user name with admin role to use. + * OS_USERNAME - A user name with admin role to use. - .. envvar:: OS_PASSWORD - A password for selected user. + * OS_PASSWORD - A password for selected user. - .. envvar:: OS_PROJECT_NAME - Project name to scope to + * OS_PROJECT_NAME - Project name to scope to - .. envvar:: OS_TENANT_NAME - Project name to scope to (an alternative for $OS_PROJECT_NAME) + * OS_TENANT_NAME - Project name to scope to (an alternative for + $OS_PROJECT_NAME) - .. envvar:: OS_USER_DOMAIN_NAME - User domain name (in case of Keystone V3) + * OS_USER_DOMAIN_NAME - User domain name (in case of Keystone V3) - .. envvar:: OS_PROJECT_DOMAIN_NAME - Domain name containing project (in case of Keystone V3) + * OS_PROJECT_DOMAIN_NAME - Domain name containing project (in case of + Keystone V3) - .. envvar:: OS_ENDPOINT_TYPE - Type of endpoint. Valid endpoint types: admin, public, internal + * OS_ENDPOINT_TYPE - Type of endpoint. Valid endpoint types: admin, + public, internal - .. envvar:: OS_INTERFACE - Type of endpoint (an alternative for $OS_INTERFACE) + * OS_INTERFACE - Type of endpoint (an alternative for OS_ENDPOINT_TYPE) - .. envvar:: OS_REGION_NAME - Authentication region name + * OS_REGION_NAME - Authentication region name - .. envvar:: OS_CACERT - A path to CA certificate bundle file + * OS_CACERT - A path to CA certificate bundle file - .. envvar:: OS_CERT - A path to Client certificate bundle file + * OS_CERT - A path to Client certificate bundle file - .. envvar:: OS_KEY - A path to Client certificate key file + * OS_KEY - A path to Client certificate key file - .. envvar:: OS_INSECURE - Disable server certificate verification + * OS_INSECURE - Disable server certificate verification - .. envvar:: OSPROFILER_HMAC_KEY - HMAC key to use for encrypting context while using osprofiler + * OSPROFILER_HMAC_KEY - HMAC key to use for encrypting context while + using osprofiler + + * OSPROFILER_CONN_STR - A connection string for OSProfiler collector + to grep profiling results while building html task reports - .. envvar:: OSPROFILER_CONN_STR - A connection string for OSProfiler collector to grep profiling - results while building html task reports """ from oslo_utils import strutils @@ -383,9 +372,12 @@ class OpenStack(platform.Platform): @classmethod def _get_doc(cls): doc = cls.__doc__.strip() - doc += "\n **Create a spec based on system environment.**\n" - # cut the first line since we already included the first line of it. - doc += "\n".join( - [line.strip() for line in - cls.create_spec_from_sys_environ.__doc__.split("\n")][1:]) + + env_vars_docs = cls.create_spec_from_sys_environ.__doc__ + env_vars_description = "\n".join( + line for line in env_vars_docs.split("\n")[1:] + ) + doc += (f"\n **The following environment variables are expected for " + f"creation a Rally environment using sustem environment " + f"variables**\n{env_vars_description}") return doc diff --git a/rally_openstack/task/scenarios/neutron/network.py b/rally_openstack/task/scenarios/neutron/network.py index c10c980c..30ad8406 100644 --- a/rally_openstack/task/scenarios/neutron/network.py +++ b/rally_openstack/task/scenarios/neutron/network.py @@ -648,6 +648,7 @@ class AssociateAndDissociateFloatingIps(utils.NeutronScenario): "openstack floating ip unset" commands performance. Because of the prerequisites for "floating ip set/unset" we also measure the performance of the following commands: + * "openstack network create" * "openstack subnet create" * "openstack port create" diff --git a/rally_openstack/task/scenarios/vm/vmtasks.py b/rally_openstack/task/scenarios/vm/vmtasks.py index dbdfb83e..dea2d448 100644 --- a/rally_openstack/task/scenarios/vm/vmtasks.py +++ b/rally_openstack/task/scenarios/vm/vmtasks.py @@ -566,14 +566,17 @@ class CheckDesignateDNSResolving(vm_utils.VMScenario): """Try to resolve hostname from VM against existing designate DNS. - requires zone context with set_zone_in_network parameter - zones: - set_zone_in_network: True + + > zones: + > set_zone_in_network: True + - designate IP should be in default dns_nameservers list for new - networks or it can be specified in a network context - network: - dns_nameservers: - - 8.8.8.8 - - 192.168.210.45 + networks or it can be specified in a network context + + > network: + > dns_nameservers: + > - 8.8.8.8 + > - 192.168.210.45 :param image: glance image name to use for the vm :param flavor: VM flavor name diff --git a/test-requirements.txt b/test-requirements.txt index fd1f1fa9..4aed6366 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -16,4 +16,6 @@ coverage!=4.4 # Apache License, Version ddt!=1.4.0 # MIT testtools # MIT -docutils \ No newline at end of file +# docs +docutils +Pygments diff --git a/tests/unit/doc/test_docstrings.py b/tests/unit/doc/test_docstrings.py index 45f78cf0..1a680a79 100644 --- a/tests/unit/doc/test_docstrings.py +++ b/tests/unit/doc/test_docstrings.py @@ -65,8 +65,6 @@ class DocstringsTestCase(test.TestCase): _HAS_VALID_DEFINITIONS = [] def _validate_rst(self, plugin_name, text, msg_buffer): - # need to wait till the next release of rally - return parsed_docstring = _parse_rst(text) for item in parsed_docstring: if (isinstance(item, nodes.definition_list)