Fix [H405] pep rule in heat_integrationtests
Implements bp docstring-improvements
Change-Id: I7aebbdafef121c3414e6a0260452c1353af62e88
diff --git a/common/clients.py b/common/clients.py
index daba708..9718d03 100644
--- a/common/clients.py
+++ b/common/clients.py
@@ -23,7 +23,8 @@
class ClientManager(object):
- """
+ """Provides access to the official python clients for calling various APIs.
+
Manager that provides access to the official python clients for
calling various OpenStack APIs.
"""
diff --git a/common/exceptions.py b/common/exceptions.py
index 5132850..b092fd0 100644
--- a/common/exceptions.py
+++ b/common/exceptions.py
@@ -12,8 +12,7 @@
class IntegrationException(Exception):
- """
- Base Tempest Exception
+ """Base Tempest Exception.
To correctly use this class, inherit from it and define
a 'message' property. That message will get printf'd
diff --git a/common/remote_client.py b/common/remote_client.py
index c8c4f95..201b10f 100644
--- a/common/remote_client.py
+++ b/common/remote_client.py
@@ -88,8 +88,7 @@
return (time.time() - self.timeout) > start_time
def exec_command(self, cmd):
- """
- Execute the specified command on the server.
+ """Execute the specified command on the server.
Note that this method is reading whole command outputs to memory, thus
shouldn't be used for large outputs.
@@ -170,8 +169,9 @@
return self.ssh_client.exec_command(cmd)
def validate_authentication(self):
- """Validate ssh connection and authentication
- This method raises an Exception when the validation fails.
+ """Validate ssh connection and authentication.
+
+ This method raises an Exception when the validation fails.
"""
self.ssh_client.test_connection_auth()
diff --git a/common/test.py b/common/test.py
index 4f3d923..8d8fa15 100644
--- a/common/test.py
+++ b/common/test.py
@@ -35,7 +35,8 @@
def call_until_true(duration, sleep_for, func, *args, **kwargs):
- """
+ """Call the function until it returns True or the duration elapsed.
+
Call the given function until it returns True (and return True) or
until the specified duration (in seconds) elapses (and return
False).
@@ -281,8 +282,7 @@
def _wait_for_stack_status(self, stack_identifier, status,
failure_pattern=None,
success_on_not_found=False):
- """
- Waits for a Stack to reach a given status.
+ """Waits for a Stack to reach a given status.
Note this compares the full $action_$status, e.g
CREATE_COMPLETE, not just COMPLETE which is exposed
diff --git a/functional/test_autoscaling.py b/functional/test_autoscaling.py
index 9041405..5c2d1af 100644
--- a/functional/test_autoscaling.py
+++ b/functional/test_autoscaling.py
@@ -189,7 +189,9 @@
self.assert_instance_count(stack, 5)
def test_update_group_replace(self):
- """Make sure that during a group update the non updatable
+ """Test case for ensuring non-updatable props case a replacement.
+
+ Make sure that during a group update the non-updatable
properties cause a replacement.
"""
files = {'provider.yaml': self.instance_template}
@@ -219,7 +221,9 @@
self.assertNotEqual(orig_asg_id, rsrc.physical_resource_id)
def test_create_instance_error_causes_group_error(self):
- """If a resource in an instance group fails to be created, the instance
+ """Test create failing a resource in the instance group.
+
+ If a resource in an instance group fails to be created, the instance
group itself will fail and the broken inner resource will remain.
"""
stack_name = self._stack_rand_name()
@@ -252,7 +256,9 @@
self._assert_instance_state(nested_ident, 0, 2)
def test_update_instance_error_causes_group_error(self):
- """If a resource in an instance group fails to be created during an
+ """Test update failing a resource in the instance group.
+
+ If a resource in an instance group fails to be created during an
update, the instance group itself will fail and the broken inner
resource will remain.
"""
@@ -408,9 +414,10 @@
self.assertNotIn(deletes_expected, updt_names)
def test_instance_group_update_replace(self):
- """
- Test simple update replace with no conflict in batch size and
- minimum instances in service.
+ """Test simple update replace.
+
+ Test update replace with no conflict in batch size and minimum
+ instances in service.
"""
updt_template = self.ig_tmpl_with_updt_policy()
grp = updt_template['Resources']['JobServerGroup']
@@ -427,9 +434,10 @@
update_replace=True)
def test_instance_group_update_replace_with_adjusted_capacity(self):
- """
- Test update replace with capacity adjustment due to conflict in
- batch size and minimum instances in service.
+ """Test update replace with capacity adjustment.
+
+ Test update replace with capacity adjustment due to conflict in batch
+ size and minimum instances in service.
"""
updt_template = self.ig_tmpl_with_updt_policy()
grp = updt_template['Resources']['JobServerGroup']
@@ -446,9 +454,7 @@
update_replace=True)
def test_instance_group_update_replace_huge_batch_size(self):
- """
- Test update replace with a huge batch size.
- """
+ """Test update replace with a huge batch size."""
updt_template = self.ig_tmpl_with_updt_policy()
group = updt_template['Resources']['JobServerGroup']
policy = group['UpdatePolicy']['AutoScalingRollingUpdate']
@@ -464,9 +470,7 @@
update_replace=True)
def test_instance_group_update_replace_huge_min_in_service(self):
- """
- Test update replace with a huge number of minimum instances in service.
- """
+ """Update replace with huge number of minimum instances in service."""
updt_template = self.ig_tmpl_with_updt_policy()
group = updt_template['Resources']['JobServerGroup']
policy = group['UpdatePolicy']['AutoScalingRollingUpdate']
@@ -483,7 +487,8 @@
update_replace=True)
def test_instance_group_update_no_replace(self):
- """
+ """Test simple update only and no replace.
+
Test simple update only and no replace (i.e. updated instance flavor
in Launch Configuration) with no conflict in batch size and
minimum instances in service.
@@ -504,7 +509,8 @@
update_replace=False)
def test_instance_group_update_no_replace_with_adjusted_capacity(self):
- """
+ """Test update only and no replace with capacity adjustment.
+
Test update only and no replace (i.e. updated instance flavor in
Launch Configuration) with capacity adjustment due to conflict in
batch size and minimum instances in service.
diff --git a/functional/test_conditional_exposure.py b/functional/test_conditional_exposure.py
index d037712..90f7d7a 100644
--- a/functional/test_conditional_exposure.py
+++ b/functional/test_conditional_exposure.py
@@ -82,7 +82,7 @@
"""
def test_non_admin_forbidden_create_flavors(self):
- """Fail to create Flavor resource w/o admin role
+ """Fail to create Flavor resource w/o admin role.
Integration tests job runs as normal OpenStack user,
and OS::Nova:Flavor is configured to require
diff --git a/functional/test_create_update.py b/functional/test_create_update.py
index 4597d4c..153eb9f 100644
--- a/functional/test_create_update.py
+++ b/functional/test_create_update.py
@@ -332,7 +332,8 @@
self.list_resources(nested_identifier))
def test_stack_update_provider_group(self):
- '''Test two-level nested update.'''
+ """Test two-level nested update."""
+
# Create a ResourceGroup (which creates a nested stack),
# containing provider resources (which create a nested
# stack), thus exercising an update which traverses
@@ -403,10 +404,12 @@
self.list_resources(provider_identifier))
def test_stack_update_with_replacing_userdata(self):
- """Confirm that we can update userdata of instance during updating
- stack by the user of member role.
+ """Test case for updating userdata of instance.
- Make sure that a resource that inherites from StackUser can be deleted
+ Confirm that we can update userdata of instance during updating stack
+ by the user of member role.
+
+ Make sure that a resource that inherits from StackUser can be deleted
during updating stack.
"""
if not self.conf.minimal_image_ref:
diff --git a/functional/test_instance_group.py b/functional/test_instance_group.py
index b8bcc3d..02a2858 100644
--- a/functional/test_instance_group.py
+++ b/functional/test_instance_group.py
@@ -131,6 +131,7 @@
def test_basic_create_works(self):
"""Make sure the working case is good.
+
Note this combines test_override_aws_ec2_instance into this test as
well, which is:
If AWS::EC2::Instance is overridden, InstanceGroup will automatically
@@ -177,8 +178,10 @@
self.assert_instance_count(stack, 5)
def test_update_group_replace(self):
- """Make sure that during a group update the non updatable
- properties cause a replacement.
+ """Test case for ensuring non-updatable props case a replacement.
+
+ Make sure that during a group update the non-updatable properties cause
+ a replacement.
"""
files = {'provider.yaml': self.instance_template}
env = {'resource_registry':
@@ -207,7 +210,9 @@
self.assertNotEqual(orig_asg_id, rsrc.physical_resource_id)
def test_create_instance_error_causes_group_error(self):
- """If a resource in an instance group fails to be created, the instance
+ """Test create failing a resource in the instance group.
+
+ If a resource in an instance group fails to be created, the instance
group itself will fail and the broken inner resource will remain.
"""
stack_name = self._stack_rand_name()
@@ -240,7 +245,9 @@
self._assert_instance_state(nested_ident, 0, 2)
def test_update_instance_error_causes_group_error(self):
- """If a resource in an instance group fails to be created during an
+ """Test update failing a resource in the instance group.
+
+ If a resource in an instance group fails to be created during an
update, the instance group itself will fail and the broken inner
resource will remain.
"""
@@ -376,7 +383,8 @@
self.assertNotIn(deletes_expected, updt_names)
def test_instance_group_update_replace(self):
- """
+ """Test simple update replace with no conflict.
+
Test simple update replace with no conflict in batch size and
minimum instances in service.
"""
@@ -395,7 +403,8 @@
update_replace=True)
def test_instance_group_update_replace_with_adjusted_capacity(self):
- """
+ """Test update replace with capacity adjustment.
+
Test update replace with capacity adjustment due to conflict in
batch size and minimum instances in service.
"""
@@ -414,9 +423,7 @@
update_replace=True)
def test_instance_group_update_replace_huge_batch_size(self):
- """
- Test update replace with a huge batch size.
- """
+ """Test update replace with a huge batch size."""
updt_template = self.ig_tmpl_with_updt_policy()
group = updt_template['Resources']['JobServerGroup']
policy = group['UpdatePolicy']['RollingUpdate']
@@ -432,9 +439,7 @@
update_replace=True)
def test_instance_group_update_replace_huge_min_in_service(self):
- """
- Test update replace with a huge number of minimum instances in service.
- """
+ """Update replace with huge number of minimum instances in service."""
updt_template = self.ig_tmpl_with_updt_policy()
group = updt_template['Resources']['JobServerGroup']
policy = group['UpdatePolicy']['RollingUpdate']
@@ -451,7 +456,8 @@
update_replace=True)
def test_instance_group_update_no_replace(self):
- """
+ """Test simple update only and no replace with no conflict.
+
Test simple update only and no replace (i.e. updated instance flavor
in Launch Configuration) with no conflict in batch size and
minimum instances in service.
@@ -472,7 +478,8 @@
update_replace=False)
def test_instance_group_update_no_replace_with_adjusted_capacity(self):
- """
+ """Test update only and no replace with capacity adjustment.
+
Test update only and no replace (i.e. updated instance flavor in
Launch Configuration) with capacity adjustment due to conflict in
batch size and minimum instances in service.
diff --git a/functional/test_resource_group.py b/functional/test_resource_group.py
index 5335245..4fd70af 100644
--- a/functional/test_resource_group.py
+++ b/functional/test_resource_group.py
@@ -267,11 +267,13 @@
self.assertEqual(initial_rand, updated_rand)
def test_update_nochange_resource_needs_update(self):
- """Test update when the resource definition has changed."""
- # Test the scenario when the ResourceGroup update happens without
- # any changed properties, this can happen if the definition of
- # a contained provider resource changes (files map changes), then
- # the group and underlying nested stack should end up updated.
+ """Test update when the resource definition has changed.
+
+ Test the scenario when the ResourceGroup update happens without
+ any changed properties, this can happen if the definition of
+ a contained provider resource changes (files map changes), then
+ the group and underlying nested stack should end up updated.
+ """
random_templ1 = '''
heat_template_version: 2013-05-23
diff --git a/functional/test_template_resource.py b/functional/test_template_resource.py
index 9609664..dabc924 100644
--- a/functional/test_template_resource.py
+++ b/functional/test_template_resource.py
@@ -195,9 +195,12 @@
self.assertIn('arn:openstack:heat:', test_ref)
def test_transparent_ref(self):
- """With the addition of OS::stack_id we can now use the nested resource
+ """Test using nested resource more transparently.
+
+ With the addition of OS::stack_id we can now use the nested resource
more transparently.
"""
+
nested_templ = '''
heat_template_version: 2014-10-16
resources:
@@ -520,6 +523,7 @@
class TemplateResourceUpdateFailedTest(functional_base.FunctionalTestsBase):
"""Prove that we can do updates on a nested stack to fix a stack."""
+
main_template = '''
HeatTemplateFormatVersion: '2012-12-12'
Resources:
@@ -688,6 +692,7 @@
class TemplateResourceErrorMessageTest(functional_base.FunctionalTestsBase):
"""Prove that nested stack errors don't suck."""
+
template = '''
HeatTemplateFormatVersion: '2012-12-12'
Resources:
@@ -743,7 +748,7 @@
super(TemplateResourceSuspendResumeTest, self).setUp()
def test_suspend_resume(self):
- """Basic test for template resource suspend resume"""
+ """Basic test for template resource suspend resume."""
stack_identifier = self.stack_create(
template=self.main_template,
files={'the.yaml': self.nested_templ}
@@ -755,6 +760,7 @@
class ValidateFacadeTest(test.HeatIntegrationTest):
"""Prove that nested stack errors don't suck."""
+
template = '''
heat_template_version: 2015-10-15
resources:
diff --git a/scenario/scenario_base.py b/scenario/scenario_base.py
index 84e14a9..14b8cec 100644
--- a/scenario/scenario_base.py
+++ b/scenario/scenario_base.py
@@ -14,7 +14,7 @@
class ScenarioTestsBase(test.HeatIntegrationTest):
- "This class define common parameters for scenario tests"
+ """This class defines common parameters for scenario tests."""
def setUp(self):
super(ScenarioTestsBase, self).setUp()
diff --git a/scenario/test_autoscaling_lb.py b/scenario/test_autoscaling_lb.py
index 21b27dd..1d4d41d 100644
--- a/scenario/test_autoscaling_lb.py
+++ b/scenario/test_autoscaling_lb.py
@@ -20,8 +20,7 @@
class AutoscalingLoadBalancerTest(scenario_base.ScenarioTestsBase):
- """
- The class is responsible for testing ASG + LB scenario.
+ """The class is responsible for testing ASG + LB scenario.
The very common use case tested is an autoscaling group
of some web application servers behind a loadbalancer.
@@ -52,8 +51,7 @@
return all_res and all_res_complete
def test_autoscaling_loadbalancer_neutron(self):
- """
- Check work of AutoScaing and Neutron LBaaS resource in Heat.
+ """Check work of AutoScaing and Neutron LBaaS resource in Heat.
The scenario is the following:
1. Launch a stack with a load balancer and autoscaling group
diff --git a/scenario/test_server_cfn_init.py b/scenario/test_server_cfn_init.py
index 267b44b..d3ee7ee 100644
--- a/scenario/test_server_cfn_init.py
+++ b/scenario/test_server_cfn_init.py
@@ -17,9 +17,7 @@
class CfnInitIntegrationTest(scenario_base.ScenarioTestsBase):
- """
- The class is responsible for testing cfn-init and cfn-signal workability
- """
+ """Testing cfn-init and cfn-signal workability."""
def setUp(self):
super(CfnInitIntegrationTest, self).setUp()
@@ -94,8 +92,7 @@
raise e
def test_server_cfn_init(self):
- """
- Check cfn-init and cfn-signal availability on the created server.
+ """Check cfn-init and cfn-signal availability on the created server.
The alternative scenario is the following:
1. Create a stack with a server and configured security group.
diff --git a/scenario/test_server_software_config.py b/scenario/test_server_software_config.py
index 8739a99..ad76763 100644
--- a/scenario/test_server_software_config.py
+++ b/scenario/test_server_software_config.py
@@ -133,8 +133,7 @@
dep1_dep.creation_time)
def test_server_software_config(self):
- """
- Check that passed files with scripts are executed on created server.
+ """Check that passed files with scripts are executed on created server.
The alternative scenario is the following:
1. Create a stack and pass files with scripts.
diff --git a/scenario/test_volumes.py b/scenario/test_volumes.py
index d4b1aa8..7980d81 100644
--- a/scenario/test_volumes.py
+++ b/scenario/test_volumes.py
@@ -22,9 +22,7 @@
class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase):
- """
- Class is responsible for testing of volume backup.
- """
+ """Class is responsible for testing of volume backup."""
def setUp(self):
super(VolumeBackupRestoreIntegrationTest, self).setUp()
@@ -101,8 +99,7 @@
volume_id2)
def test_cinder_volume_create_backup_restore(self):
- """
- Ensure the 'Snapshot' deletion policy works.
+ """Ensure the 'Snapshot' deletion policy works.
This requires a more complex test, but it tests several aspects
of the heat cinder resources: