Fix [H405] pep rule in heat_integrationtests
Implements bp docstring-improvements Change-Id: I7aebbdafef121c3414e6a0260452c1353af62e88
This commit is contained in:
parent
c797cf1c28
commit
ab40f01982
@ -23,7 +23,8 @@ import swiftclient
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
|
@ -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
|
||||
|
@ -88,8 +88,7 @@ class Client(object):
|
||||
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,7 +169,8 @@ class RemoteClient(object):
|
||||
return self.ssh_client.exec_command(cmd)
|
||||
|
||||
def validate_authentication(self):
|
||||
"""Validate ssh connection and authentication
|
||||
"""Validate ssh connection and authentication.
|
||||
|
||||
This method raises an Exception when the validation fails.
|
||||
"""
|
||||
self.ssh_client.test_connection_auth()
|
||||
|
@ -35,7 +35,8 @@ _LOG_FORMAT = "%(levelname)8s [%(name)s] %(message)s"
|
||||
|
||||
|
||||
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 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
|
||||
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
|
||||
|
@ -189,7 +189,9 @@ class AutoscalingGroupBasicTest(AutoscalingGroupTest):
|
||||
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 @@ class AutoscalingGroupBasicTest(AutoscalingGroupTest):
|
||||
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 @@ class AutoscalingGroupBasicTest(AutoscalingGroupTest):
|
||||
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 @@ class AutoscalingGroupUpdatePolicyTest(AutoscalingGroupTest):
|
||||
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 @@ class AutoscalingGroupUpdatePolicyTest(AutoscalingGroupTest):
|
||||
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 @@ class AutoscalingGroupUpdatePolicyTest(AutoscalingGroupTest):
|
||||
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 @@ class AutoscalingGroupUpdatePolicyTest(AutoscalingGroupTest):
|
||||
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 @@ class AutoscalingGroupUpdatePolicyTest(AutoscalingGroupTest):
|
||||
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 @@ class AutoscalingGroupUpdatePolicyTest(AutoscalingGroupTest):
|
||||
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.
|
||||
|
@ -82,7 +82,7 @@ resources:
|
||||
"""
|
||||
|
||||
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
|
||||
|
@ -332,7 +332,8 @@ resources:
|
||||
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 @@ resources:
|
||||
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:
|
||||
|
@ -131,6 +131,7 @@ class InstanceGroupBasicTest(InstanceGroupTest):
|
||||
|
||||
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 @@ class InstanceGroupBasicTest(InstanceGroupTest):
|
||||
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 @@ class InstanceGroupBasicTest(InstanceGroupTest):
|
||||
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 @@ class InstanceGroupBasicTest(InstanceGroupTest):
|
||||
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 @@ class InstanceGroupUpdatePolicyTest(InstanceGroupTest):
|
||||
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 @@ class InstanceGroupUpdatePolicyTest(InstanceGroupTest):
|
||||
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 @@ class InstanceGroupUpdatePolicyTest(InstanceGroupTest):
|
||||
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 @@ class InstanceGroupUpdatePolicyTest(InstanceGroupTest):
|
||||
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 @@ class InstanceGroupUpdatePolicyTest(InstanceGroupTest):
|
||||
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 @@ class InstanceGroupUpdatePolicyTest(InstanceGroupTest):
|
||||
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.
|
||||
|
@ -267,11 +267,13 @@ resources:
|
||||
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
|
||||
|
@ -195,9 +195,12 @@ outputs:
|
||||
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 @@ Outputs:
|
||||
|
||||
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 @@ Outputs:
|
||||
|
||||
class TemplateResourceErrorMessageTest(functional_base.FunctionalTestsBase):
|
||||
"""Prove that nested stack errors don't suck."""
|
||||
|
||||
template = '''
|
||||
HeatTemplateFormatVersion: '2012-12-12'
|
||||
Resources:
|
||||
@ -743,7 +748,7 @@ resources:
|
||||
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 @@ resources:
|
||||
|
||||
class ValidateFacadeTest(test.HeatIntegrationTest):
|
||||
"""Prove that nested stack errors don't suck."""
|
||||
|
||||
template = '''
|
||||
heat_template_version: 2015-10-15
|
||||
resources:
|
||||
|
@ -14,7 +14,7 @@ from heat_integrationtests.common import test
|
||||
|
||||
|
||||
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()
|
||||
|
@ -20,8 +20,7 @@ from heat_integrationtests.scenario import scenario_base
|
||||
|
||||
|
||||
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 @@ class AutoscalingLoadBalancerTest(scenario_base.ScenarioTestsBase):
|
||||
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
|
||||
|
@ -17,9 +17,7 @@ from heat_integrationtests.scenario import scenario_base
|
||||
|
||||
|
||||
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 @@ class CfnInitIntegrationTest(scenario_base.ScenarioTestsBase):
|
||||
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.
|
||||
|
@ -133,8 +133,7 @@ class SoftwareConfigIntegrationTest(scenario_base.ScenarioTestsBase):
|
||||
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.
|
||||
|
@ -22,9 +22,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
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 @@ class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase):
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user