Merge "Fix H404/405 violations for remaining"

This commit is contained in:
Jenkins 2015-11-20 00:39:15 +00:00 committed by Gerrit Code Review
commit c4dc060b8c
19 changed files with 115 additions and 122 deletions

View File

@ -154,10 +154,7 @@ LOG = logging.getLogger(__name__)
class Manager(manager.Manager): class Manager(manager.Manager):
"""Top level manager for OpenStack tempest clients"""
"""
Top level manager for OpenStack tempest clients
"""
default_params = { default_params = {
'disable_ssl_certificate_validation': 'disable_ssl_certificate_validation':

View File

@ -35,7 +35,9 @@ group_regex=([^\.]*\.)*
def get_tempest_default_config_dir(): def get_tempest_default_config_dir():
"""Returns the correct default config dir to support both cases of """Get default config directory of tempest
Returns the correct default config dir to support both cases of
tempest being or not installed in a virtualenv. tempest being or not installed in a virtualenv.
Cases considered: Cases considered:
- no virtual env, python2: real_prefix and base_prefix not set - no virtual env, python2: real_prefix and base_prefix not set

View File

@ -33,8 +33,7 @@ LOG = logging.getLogger(__name__)
def discover_stress_tests(path="./", filter_attr=None, call_inherited=False): def discover_stress_tests(path="./", filter_attr=None, call_inherited=False):
"""Discovers all tempest tests and create action out of them """Discovers all tempest tests and create action out of them"""
"""
LOG.info("Start test discovery") LOG.info("Start test discovery")
tests = [] tests = []
testloader = loader.TestLoader() testloader = loader.TestLoader()

View File

@ -17,8 +17,7 @@ import testtools
class TempestException(Exception): class TempestException(Exception):
""" """Base Tempest Exception
Base Tempest Exception
To correctly use this class, inherit from it and define To correctly use this class, inherit from it and define
a 'message' property. That message will get printf'd a 'message' property. That message will get printf'd

View File

@ -23,16 +23,15 @@ CONF = config.CONF
class Manager(object): class Manager(object):
"""Base manager class
"""
Base manager class
Manager objects are responsible for providing a configuration object Manager objects are responsible for providing a configuration object
and a client object for a test case to use in performing actions. and a client object for a test case to use in performing actions.
""" """
def __init__(self, credentials): def __init__(self, credentials):
""" """Initialization of base manager class
Credentials to be used within the various client classes managed by the Credentials to be used within the various client classes managed by the
Manager object must be defined. Manager object must be defined.

View File

@ -27,10 +27,7 @@ LOG = logging.getLogger(__name__)
class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest): class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
"""Check VM connectivity after some advanced instance operations executed:
"""
This test case checks VM connectivity after some advanced
instance operations executed:
* Stop/Start an instance * Stop/Start an instance
* Reboot an instance * Reboot an instance

View File

@ -36,7 +36,8 @@ Floating_IP_tuple = collections.namedtuple('Floating_IP_tuple',
class TestNetworkBasicOps(manager.NetworkScenarioTest): class TestNetworkBasicOps(manager.NetworkScenarioTest):
""" """The test suite of network basic operations
This smoke test suite assumes that Nova has been configured to This smoke test suite assumes that Nova has been configured to
boot VM's with Neutron-managed networking, and attempts to boot VM's with Neutron-managed networking, and attempts to
verify network connectivity as follows: verify network connectivity as follows:
@ -123,9 +124,9 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
self.floating_ip_tuple = Floating_IP_tuple(floating_ip, server) self.floating_ip_tuple = Floating_IP_tuple(floating_ip, server)
def check_networks(self): def check_networks(self):
""" """Checks that we see the newly created network/subnet/router
Checks that we see the newly created network/subnet/router via
checking the result of list_[networks,routers,subnets] via checking the result of list_[networks,routers,subnets]
""" """
seen_nets = self._list_networks() seen_nets = self._list_networks()
@ -182,7 +183,8 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
def check_public_network_connectivity( def check_public_network_connectivity(
self, should_connect=True, msg=None, self, should_connect=True, msg=None,
should_check_floating_ip_status=True): should_check_floating_ip_status=True):
"""Verifies connectivty to a VM via public network and floating IP, """Verifies connectivty to a VM via public network and floating IP
and verifies floating IP has resource status is correct. and verifies floating IP has resource status is correct.
:param should_connect: bool. determines if connectivity check is :param should_connect: bool. determines if connectivity check is
@ -294,8 +296,8 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
def _check_network_internal_connectivity(self, network, def _check_network_internal_connectivity(self, network,
should_connect=True): should_connect=True):
""" """via ssh check VM internal connectivity:
via ssh check VM internal connectivity:
- ping internal gateway and DHCP port, implying in-tenant connectivity - ping internal gateway and DHCP port, implying in-tenant connectivity
pinging both, because L3 and DHCP agents might be on different nodes pinging both, because L3 and DHCP agents might be on different nodes
""" """
@ -312,10 +314,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
should_connect) should_connect)
def _check_network_external_connectivity(self): def _check_network_external_connectivity(self):
""" """ping default gateway to imply external connectivity"""
ping public network default gateway to imply external connectivity
"""
if not CONF.network.public_network_id: if not CONF.network.public_network_id:
msg = 'public network not defined.' msg = 'public network not defined.'
LOG.info(msg) LOG.info(msg)
@ -359,7 +358,8 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
@test.idempotent_id('f323b3ba-82f8-4db7-8ea6-6a895869ec49') @test.idempotent_id('f323b3ba-82f8-4db7-8ea6-6a895869ec49')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_network_basic_ops(self): def test_network_basic_ops(self):
""" """Basic network operation test
For a freshly-booted VM with an IP address ("port") on a given For a freshly-booted VM with an IP address ("port") on a given
network: network:
@ -412,7 +412,8 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
'Baremetal relies on a shared physical network.') 'Baremetal relies on a shared physical network.')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_connectivity_between_vms_on_different_networks(self): def test_connectivity_between_vms_on_different_networks(self):
""" """Test connectivity between VMs on different networks
For a freshly-booted VM with an IP address ("port") on a given For a freshly-booted VM with an IP address ("port") on a given
network: network:
@ -460,7 +461,8 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
'vnic_type direct or macvtap') 'vnic_type direct or macvtap')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_hotplug_nic(self): def test_hotplug_nic(self):
""" """Test hotplug network interface
1. create a new network, with no gateway (to prevent overwriting VM's 1. create a new network, with no gateway (to prevent overwriting VM's
gateway) gateway)
2. connect VM to new network 2. connect VM to new network
@ -480,7 +482,8 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
'network') 'network')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_update_router_admin_state(self): def test_update_router_admin_state(self):
""" """Test to update admin state up of router
1. Check public connectivity before updating 1. Check public connectivity before updating
admin_state_up attribute of router to False admin_state_up attribute of router to False
2. Check public connectivity after updating 2. Check public connectivity after updating
@ -512,8 +515,9 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
"DHCP client is not available.") "DHCP client is not available.")
@test.services('compute', 'network') @test.services('compute', 'network')
def test_subnet_details(self): def test_subnet_details(self):
"""Tests that subnet's extra configuration details are affecting """Tests that subnet's extra configuration details are affecting VMs.
the VMs. This test relies on non-shared, isolated tenant networks.
This test relies on non-shared, isolated tenant networks.
NOTE: Neutron subnets push data to servers via dhcp-agent, so any NOTE: Neutron subnets push data to servers via dhcp-agent, so any
update in subnet requires server to actively renew its DHCP lease. update in subnet requires server to actively renew its DHCP lease.
@ -567,12 +571,11 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
"Failed to update subnet's nameservers") "Failed to update subnet's nameservers")
def check_new_dns_server(): def check_new_dns_server():
"""Server needs to renew its dhcp lease in order to get the new dns # NOTE: Server needs to renew its dhcp lease in order to get new
definitions from subnet # definitions from subnet
NOTE(amuller): we are renewing the lease as part of the retry # NOTE(amuller): we are renewing the lease as part of the retry
because Neutron updates dnsmasq asynchronously after the # because Neutron updates dnsmasq asynchronously after the
subnet-update API call returns. # subnet-update API call returns.
"""
ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address']) ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'])
if ssh_client.get_dns_servers() != [alt_dns_server]: if ssh_client.get_dns_servers() != [alt_dns_server]:
LOG.debug("Failed to update DNS nameservers") LOG.debug("Failed to update DNS nameservers")
@ -594,7 +597,8 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
"by the test environment") "by the test environment")
@test.services('compute', 'network') @test.services('compute', 'network')
def test_update_instance_port_admin_state(self): def test_update_instance_port_admin_state(self):
""" """Test to update admin_state_up attribute of instance port
1. Check public connectivity before updating 1. Check public connectivity before updating
admin_state_up attribute of instance port to False admin_state_up attribute of instance port to False
2. Check public connectivity after updating 2. Check public connectivity after updating
@ -625,8 +629,10 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
'supported in the version of Nova being tested.') 'supported in the version of Nova being tested.')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_preserve_preexisting_port(self): def test_preserve_preexisting_port(self):
"""Tests that a pre-existing port provided on server boot is not """Test preserve pre-existing port
deleted if the server is deleted.
Tests that a pre-existing port provided on server boot is not deleted
if the server is deleted.
Nova should unbind the port from the instance on delete if the port was Nova should unbind the port from the instance on delete if the port was
not created by Nova as part of the boot request. not created by Nova as part of the boot request.

View File

@ -97,6 +97,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
class TenantProperties(object): class TenantProperties(object):
"""helper class to save tenant details """helper class to save tenant details
id id
credentials credentials
network network
@ -298,6 +299,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
def _deploy_tenant(self, tenant_or_id): def _deploy_tenant(self, tenant_or_id):
"""creates: """creates:
network network
subnet subnet
router (if public not defined) router (if public not defined)
@ -374,8 +376,8 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
should_succeed=False) should_succeed=False)
def _test_cross_tenant_allow(self, source_tenant, dest_tenant): def _test_cross_tenant_allow(self, source_tenant, dest_tenant):
""" """check for each direction:
check for each direction:
creating rule for tenant incoming traffic enables only 1way traffic creating rule for tenant incoming traffic enables only 1way traffic
""" """
ruleset = dict( ruleset = dict(
@ -408,10 +410,8 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
self._check_connectivity(access_point_ssh_2, ip) self._check_connectivity(access_point_ssh_2, ip)
def _verify_mac_addr(self, tenant): def _verify_mac_addr(self, tenant):
""" """Verify that VM has the same ip, mac as listed in port"""
verify that VM (tenant's access point) has the same ip,mac as listed in
port list
"""
access_point_ssh = self._connect_to_access_point(tenant) access_point_ssh = self._connect_to_access_point(tenant)
mac_addr = access_point_ssh.get_mac_address() mac_addr = access_point_ssh.get_mac_address()
mac_addr = mac_addr.strip().lower() mac_addr = mac_addr.strip().lower()
@ -466,9 +466,9 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
@test.idempotent_id('f4d556d7-1526-42ad-bafb-6bebf48568f6') @test.idempotent_id('f4d556d7-1526-42ad-bafb-6bebf48568f6')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_port_update_new_security_group(self): def test_port_update_new_security_group(self):
""" """Verifies the traffic after updating the vm port
This test verifies the traffic after updating the vm port with new
security group having appropriate rule. With new security group having appropriate rule.
""" """
new_tenant = self.primary_tenant new_tenant = self.primary_tenant
@ -517,8 +517,8 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
@test.idempotent_id('d2f77418-fcc4-439d-b935-72eca704e293') @test.idempotent_id('d2f77418-fcc4-439d-b935-72eca704e293')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_multiple_security_groups(self): def test_multiple_security_groups(self):
""" """Verify multiple security groups and checks that rules
This test verifies multiple security groups and checks that rules
provided in the both the groups is applied onto VM provided in the both the groups is applied onto VM
""" """
tenant = self.primary_tenant tenant = self.primary_tenant
@ -536,13 +536,11 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
secgroup=tenant.security_groups['default'], secgroup=tenant.security_groups['default'],
**ruleset **ruleset
) )
""" # NOTE: Vm now has 2 security groups one with ssh rule(
Vm now has 2 security groups one with ssh rule( # already added in setUp() method),and other with icmp rule
already added in setUp() method),and other with icmp rule # (added in the above step).The check_vm_connectivity tests
(added in the above step).The check_vm_connectivity tests # -that vm ping test is successful
-that vm ping test is successful # -ssh to vm is successful
-ssh to vm is successful
"""
self.check_vm_connectivity(ip, self.check_vm_connectivity(ip,
username=ssh_login, username=ssh_login,
private_key=private_key, private_key=private_key,
@ -552,10 +550,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
@test.idempotent_id('7c811dcc-263b-49a3-92d2-1b4d8405f50c') @test.idempotent_id('7c811dcc-263b-49a3-92d2-1b4d8405f50c')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_port_security_disable_security_group(self): def test_port_security_disable_security_group(self):
""" """Verify the default security group rules is disabled."""
This test verifies port_security_enabled=False disables
the default security group rules.
"""
new_tenant = self.primary_tenant new_tenant = self.primary_tenant
# Create server # Create server

View File

@ -32,9 +32,7 @@ class QuotaClassesClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def update_quota_class_set(self, quota_class_id, **kwargs): def update_quota_class_set(self, quota_class_id, **kwargs):
""" """Updates the quota class's limits for one or more resources."""
Updates the quota class's limits for one or more resources.
"""
post_body = json.dumps({'quota_class_set': kwargs}) post_body = json.dumps({'quota_class_set': kwargs})
resp, body = self.put('os-quota-class-sets/%s' % quota_class_id, resp, body = self.put('os-quota-class-sets/%s' % quota_class_id,

View File

@ -42,9 +42,7 @@ class QuotasClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def update_quota_set(self, tenant_id, user_id=None, **kwargs): def update_quota_set(self, tenant_id, user_id=None, **kwargs):
""" """Updates the tenant's quota limits for one or more resources"""
Updates the tenant's quota limits for one or more resources
"""
post_body = json.dumps({'quota_set': kwargs}) post_body = json.dumps({'quota_set': kwargs})
if user_id: if user_id:

View File

@ -23,8 +23,8 @@ from tempest.common import service_client
class SecurityGroupDefaultRulesClient(service_client.ServiceClient): class SecurityGroupDefaultRulesClient(service_client.ServiceClient):
def create_security_default_group_rule(self, **kwargs): def create_security_default_group_rule(self, **kwargs):
""" """Creating security group default rules.
Creating security group default rules.
ip_protocol : ip_protocol (icmp, tcp, udp). ip_protocol : ip_protocol (icmp, tcp, udp).
from_port: Port at start of range. from_port: Port at start of range.
to_port : Port at end of range. to_port : Port at end of range.

View File

@ -22,8 +22,8 @@ from tempest.common import service_client
class SecurityGroupRulesClient(service_client.ServiceClient): class SecurityGroupRulesClient(service_client.ServiceClient):
def create_security_group_rule(self, **kwargs): def create_security_group_rule(self, **kwargs):
""" """Creating a new security group rules.
Creating a new security group rules.
parent_group_id :ID of Security group parent_group_id :ID of Security group
ip_protocol : ip_proto (icmp, tcp, udp). ip_protocol : ip_proto (icmp, tcp, udp).
from_port: Port at start of range. from_port: Port at start of range.

View File

@ -44,8 +44,8 @@ class SecurityGroupsClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def create_security_group(self, **kwargs): def create_security_group(self, **kwargs):
""" """Creates a new security group.
Creates a new security group.
name (Required): Name of security group. name (Required): Name of security group.
description (Required): Description of security group. description (Required): Description of security group.
""" """
@ -56,8 +56,8 @@ class SecurityGroupsClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def update_security_group(self, security_group_id, **kwargs): def update_security_group(self, security_group_id, **kwargs):
""" """Update a security group.
Update a security group.
security_group_id: a security_group to update security_group_id: a security_group to update
name: new name of security group name: new name of security group
description: new description of security group description: new description of security group

View File

@ -23,8 +23,8 @@ from tempest.common import service_client
class ServerGroupsClient(service_client.ServiceClient): class ServerGroupsClient(service_client.ServiceClient):
def create_server_group(self, **kwargs): def create_server_group(self, **kwargs):
""" """Create the server group
Create the server group
name : Name of the server-group name : Name of the server-group
policies : List of the policies - affinity/anti-affinity) policies : List of the policies - affinity/anti-affinity)
""" """

View File

@ -34,8 +34,8 @@ class ServicesClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def enable_service(self, **kwargs): def enable_service(self, **kwargs):
""" """Enable service on a host
Enable service on a host
host_name: Name of host host_name: Name of host
binary: Service binary binary: Service binary
""" """
@ -46,8 +46,8 @@ class ServicesClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def disable_service(self, **kwargs): def disable_service(self, **kwargs):
""" """Disable service on a host
Disable service on a host
host_name: Name of host host_name: Name of host
binary: Service binary binary: Service binary
""" """

View File

@ -46,8 +46,8 @@ class VolumesClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def create_volume(self, **kwargs): def create_volume(self, **kwargs):
""" """Creates a new Volume.
Creates a new Volume.
size(Required): Size of volume in GB. size(Required): Size of volume in GB.
Following optional keyword arguments are accepted: Following optional keyword arguments are accepted:
display_name: Optional Volume Name. display_name: Optional Volume Name.

View File

@ -211,6 +211,7 @@ atexit.register(validate_tearDownClass)
class BaseTestCase(testtools.testcase.WithAttributes, class BaseTestCase(testtools.testcase.WithAttributes,
testtools.TestCase): testtools.TestCase):
"""The test base class defines Tempest framework for class level fixtures. """The test base class defines Tempest framework for class level fixtures.
`setUpClass` and `tearDownClass` are defined here and cannot be overwritten `setUpClass` and `tearDownClass` are defined here and cannot be overwritten
by subclasses (enforced via hacking rule T105). by subclasses (enforced via hacking rule T105).
@ -315,8 +316,10 @@ class BaseTestCase(testtools.testcase.WithAttributes,
@classmethod @classmethod
def skip_checks(cls): def skip_checks(cls):
"""Class level skip checks. Subclasses verify in here all """Class level skip checks.
conditions that might prevent the execution of the entire test class.
Subclasses verify in here all conditions that might prevent the
execution of the entire test class.
Checks implemented here may not make use API calls, and should rely on Checks implemented here may not make use API calls, and should rely on
configuration alone. configuration alone.
In general skip checks that require an API call are discouraged. In general skip checks that require an API call are discouraged.
@ -343,6 +346,7 @@ class BaseTestCase(testtools.testcase.WithAttributes,
@classmethod @classmethod
def setup_credentials(cls): def setup_credentials(cls):
"""Allocate credentials and the client managers from them. """Allocate credentials and the client managers from them.
A test class that requires network resources must override A test class that requires network resources must override
setup_credentials and defined the required resources before super setup_credentials and defined the required resources before super
is invoked. is invoked.
@ -380,8 +384,7 @@ class BaseTestCase(testtools.testcase.WithAttributes,
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
"""Class level resource setup for test cases. """Class level resource setup for test cases."""
"""
if hasattr(cls, "os"): if hasattr(cls, "os"):
cls.validation_resources = vresources.create_validation_resources( cls.validation_resources = vresources.create_validation_resources(
cls.os, cls.validation_resources) cls.os, cls.validation_resources)
@ -392,6 +395,7 @@ class BaseTestCase(testtools.testcase.WithAttributes,
@classmethod @classmethod
def resource_cleanup(cls): def resource_cleanup(cls):
"""Class level resource cleanup for test cases. """Class level resource cleanup for test cases.
Resource cleanup must be able to handle the case of partially setup Resource cleanup must be able to handle the case of partially setup
resources, in case a failure during `resource_setup` should happen. resources, in case a failure during `resource_setup` should happen.
""" """
@ -523,9 +527,7 @@ class BaseTestCase(testtools.testcase.WithAttributes,
@classmethod @classmethod
def clear_credentials(cls): def clear_credentials(cls):
""" """Clears creds if set"""
Clears creds if set
"""
if hasattr(cls, '_creds_provider'): if hasattr(cls, '_creds_provider'):
cls._creds_provider.clear_creds() cls._creds_provider.clear_creds()
@ -534,6 +536,7 @@ class BaseTestCase(testtools.testcase.WithAttributes,
security_group=None, security_group=None,
security_group_rules=None): security_group_rules=None):
"""Specify which ssh server validation resources should be created. """Specify which ssh server validation resources should be created.
Each of the argument must be set to either None, True or False, with Each of the argument must be set to either None, True or False, with
None - use default from config (security groups and security group None - use default from config (security groups and security group
rules get created when set to None) rules get created when set to None)
@ -631,10 +634,11 @@ class NegativeAutoTest(BaseTestCase):
@staticmethod @staticmethod
def load_tests(*args): def load_tests(*args):
""" """Wrapper for testscenarios
Wrapper for testscenarios to set the mandatory scenarios variable
only in case a real test loader is in place. Will be automatically To set the mandatory scenarios variable only in case a real test
called in case the variable "load_tests" is set. loader is in place. Will be automatically called in case the variable
"load_tests" is set.
""" """
if getattr(args[0], 'suiteClass', None) is not None: if getattr(args[0], 'suiteClass', None) is not None:
loader, standard_tests, pattern = args loader, standard_tests, pattern = args
@ -649,8 +653,7 @@ class NegativeAutoTest(BaseTestCase):
@staticmethod @staticmethod
def generate_scenario(description): def generate_scenario(description):
""" """Generates the test scenario list for a given description.
Generates the test scenario list for a given description.
:param description: A file or dictionary with the following entries: :param description: A file or dictionary with the following entries:
name (required) name for the api name (required) name for the api
@ -694,7 +697,8 @@ class NegativeAutoTest(BaseTestCase):
return scenario_list return scenario_list
def execute(self, description): def execute(self, description):
""" """Execute a http call
Execute a http call on an api that are expected to Execute a http call on an api that are expected to
result in client errors. First it uses invalid resources that are part result in client errors. First it uses invalid resources that are part
of the url, and then invalid data for queries and http request bodies. of the url, and then invalid data for queries and http request bodies.
@ -788,7 +792,8 @@ class NegativeAutoTest(BaseTestCase):
@classmethod @classmethod
def set_resource(cls, name, resource): def set_resource(cls, name, resource):
""" """Register a resoruce for a test
This function can be used in setUpClass context to register a resoruce This function can be used in setUpClass context to register a resoruce
for a test. for a test.
@ -799,10 +804,10 @@ class NegativeAutoTest(BaseTestCase):
cls._resources[name] = resource cls._resources[name] = resource
def get_resource(self, name): def get_resource(self, name):
""" """Return a valid uuid for a type of resource.
Return a valid uuid for a type of resource. If a real resource is
needed as part of a url then this method should return one. Otherwise If a real resource is needed as part of a url then this method should
it can return None. return one. Otherwise it can return None.
:param name: The name of the kind of resource such as "flavor", "role", :param name: The name of the kind of resource such as "flavor", "role",
etc. etc.
@ -819,9 +824,7 @@ class NegativeAutoTest(BaseTestCase):
def SimpleNegativeAutoTest(klass): def SimpleNegativeAutoTest(klass):
""" """This decorator registers a test function on basis of the class name."""
This decorator registers a test function on basis of the class name.
"""
@attr(type=['negative']) @attr(type=['negative'])
def generic_test(self): def generic_test(self):
if hasattr(self, '_schema'): if hasattr(self, '_schema'):
@ -838,10 +841,9 @@ def SimpleNegativeAutoTest(klass):
def call_until_true(func, duration, sleep_for): def call_until_true(func, duration, sleep_for):
""" """Call the given function until it returns True (and return True)
Call the given function until it returns True (and return True) or
until the specified duration (in seconds) elapses (and return or until the specified duration (in seconds) elapses (and return False).
False).
:param func: A zero argument callable that returns True on success. :param func: A zero argument callable that returns True on success.
:param duration: The number of seconds for which to attempt a :param duration: The number of seconds for which to attempt a

View File

@ -25,14 +25,14 @@ LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class TempestPlugin(object): class TempestPlugin(object):
"""A TempestPlugin class provides the basic hooks for an external """Provide basic hooks for an external plugin
plugin to provide tempest the necessary information to run the plugin.
To provide tempest the necessary information to run the plugin.
""" """
@abc.abstractmethod @abc.abstractmethod
def load_tests(self): def load_tests(self):
"""Method to return the information necessary to load the tests in the """Return the information necessary to load the tests in the plugin.
plugin.
:return: a tuple with the first value being the test_dir and the second :return: a tuple with the first value being the test_dir and the second
being the top_level being the top_level
@ -42,9 +42,10 @@ class TempestPlugin(object):
@abc.abstractmethod @abc.abstractmethod
def register_opts(self, conf): def register_opts(self, conf):
"""Method to add additional configuration options to tempest. This """Add additional configuration options to tempest.
method will be run for the plugin during the register_opts() function
in tempest.config This method will be run for the plugin during the register_opts()
function in tempest.config
:param ConfigOpts conf: The conf object that can be used to register :param ConfigOpts conf: The conf object that can be used to register
additional options on. additional options on.
@ -53,7 +54,7 @@ class TempestPlugin(object):
@abc.abstractmethod @abc.abstractmethod
def get_opt_lists(self): def get_opt_lists(self):
"""Method to get a list of options for sample config generation """Get a list of options for sample config generation
:return option_list: A list of tuples with the group name and options :return option_list: A list of tuples with the group name and options
in that group. in that group.

View File

@ -129,6 +129,6 @@ import_exceptions = tempest.services
# E123 skipped because it is ignored by default in the default pep8 # E123 skipped because it is ignored by default in the default pep8
# E129 skipped because it is too limiting when combined with other rules # E129 skipped because it is too limiting when combined with other rules
# Skipped because of new hacking 0.9: H405 # Skipped because of new hacking 0.9: H405
ignore = E125,E123,E129,H404,H405 ignore = E125,E123,E129
show-source = True show-source = True
exclude = .git,.venv,.tox,dist,doc,openstack,*egg exclude = .git,.venv,.tox,dist,doc,openstack,*egg