Merge "Fix H404/405 violations for scenario tests"
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 2226179..c99343d 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -131,14 +131,13 @@
self.cleanup_waits.append(wait_dict)
def _wait_for_cleanups(self):
- """To handle async delete actions, a list of waits is added
- which will be iterated over as the last step of clearing the
- cleanup queue. That way all the delete calls are made up front
- and the tests won't succeed unless the deletes are eventually
- successful. This is the same basic approach used in the api tests to
- limit cleanup execution time except here it is multi-resource,
- because of the nature of the scenario tests.
- """
+ # To handle async delete actions, a list of waits is added
+ # which will be iterated over as the last step of clearing the
+ # cleanup queue. That way all the delete calls are made up front
+ # and the tests won't succeed unless the deletes are eventually
+ # successful. This is the same basic approach used in the api tests to
+ # limit cleanup execution time except here it is multi-resource,
+ # because of the nature of the scenario tests.
for wait in self.cleanup_waits:
waiter_callable = wait.pop('waiter_callable')
waiter_callable(**wait)
@@ -519,7 +518,8 @@
username=None,
private_key=None,
should_connect=True):
- """
+ """Check server connectivity
+
:param ip_address: server to test against
:param username: server's ssh username
:param private_key: server's ssh private key to be used
@@ -603,6 +603,7 @@
class NetworkScenarioTest(ScenarioTest):
"""Base class for network scenario tests.
+
This class provide helpers for network scenario tests, using the neutron
API. Helpers from ancestor which use the nova network API are overridden
with the neutron API.
@@ -673,9 +674,9 @@
def _create_subnet(self, network, client=None, subnets_client=None,
namestart='subnet-smoke', **kwargs):
- """
- Create a subnet for the given network within the cidr block
- configured for tenant networks.
+ """Create a subnet for the given network
+
+ within the cidr block configured for tenant networks.
"""
if not client:
client = self.network_client
@@ -683,7 +684,8 @@
subnets_client = self.subnets_client
def cidr_in_use(cidr, tenant_id):
- """
+ """Check cidr existence
+
:return True if subnet with cidr already exist in tenant
False else
"""
@@ -801,9 +803,7 @@
return floating_ip
def _disassociate_floating_ip(self, floating_ip):
- """
- :param floating_ip: type DeletableFloatingIp
- """
+ """:param floating_ip: type DeletableFloatingIp"""
floating_ip.update(port_id=None)
self.assertIsNone(floating_ip.port_id)
return floating_ip
@@ -856,8 +856,7 @@
raise
def _check_remote_connectivity(self, source, dest, should_succeed=True):
- """
- check ping server via source ssh connection
+ """check ping server via source ssh connection
:param source: RemoteClient: an ssh connection from which to ping
:param dest: and IP to ping against
@@ -988,7 +987,9 @@
return sg_rule
def _create_loginable_secgroup_rule(self, client=None, secgroup=None):
- """These rules are intended to permit inbound ssh and icmp
+ """Create loginable security group rule
+
+ These rules are intended to permit inbound ssh and icmp
traffic from all sources, so no group_id is provided.
Setting a group_id would only permit traffic from ports
belonging to the same security group.
@@ -1349,9 +1350,7 @@
class EncryptionScenarioTest(ScenarioTest):
- """
- Base class for encryption scenario tests
- """
+ """Base class for encryption scenario tests"""
credentials = ['primary', 'admin']
@@ -1401,8 +1400,7 @@
class ObjectStorageScenarioTest(ScenarioTest):
- """
- Provide harness to do Object Storage scenario tests.
+ """Provide harness to do Object Storage scenario tests.
Subclasses implement the tests that use the methods provided by this
class.
@@ -1470,10 +1468,8 @@
def list_and_check_container_objects(self, container_name,
present_obj=None,
not_present_obj=None):
- """
- List objects for a given container and assert which are present and
- which are not.
- """
+ # List objects for a given container and assert which are present and
+ # which are not.
if present_obj is None:
present_obj = []
if not_present_obj is None:
diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py
index 22d2603..62c0262 100644
--- a/tempest/scenario/test_aggregates_basic_ops.py
+++ b/tempest/scenario/test_aggregates_basic_ops.py
@@ -25,8 +25,8 @@
class TestAggregatesBasicOps(manager.ScenarioTest):
- """
- Creates an aggregate within an availability zone
+ """Creates an aggregate within an availability zone
+
Adds a host to the aggregate
Checks aggregate details
Updates aggregate's name
diff --git a/tempest/scenario/test_baremetal_basic_ops.py b/tempest/scenario/test_baremetal_basic_ops.py
index ed691ac..fa05577 100644
--- a/tempest/scenario/test_baremetal_basic_ops.py
+++ b/tempest/scenario/test_baremetal_basic_ops.py
@@ -26,9 +26,9 @@
class BaremetalBasicOps(manager.BaremetalScenarioTest):
- """
- This smoke test tests the pxe_ssh Ironic driver. It follows this basic
- set of operations:
+ """This smoke test tests the pxe_ssh Ironic driver.
+
+ It follows this basic set of operations:
* Creates a keypair
* Boots an instance using the keypair
* Monitors the associated Ironic node for power and
diff --git a/tempest/scenario/test_dashboard_basic_ops.py b/tempest/scenario/test_dashboard_basic_ops.py
index f6d9f88..cb6b968 100644
--- a/tempest/scenario/test_dashboard_basic_ops.py
+++ b/tempest/scenario/test_dashboard_basic_ops.py
@@ -58,7 +58,8 @@
class TestDashboardBasicOps(manager.ScenarioTest):
- """
+ """The test suite for dashboard basic operations
+
This is a basic scenario test:
* checks that the login page is available
* logs in as a regular user
diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py
index 3f0123d..99837eb 100644
--- a/tempest/scenario/test_encrypted_cinder_volumes.py
+++ b/tempest/scenario/test_encrypted_cinder_volumes.py
@@ -22,7 +22,8 @@
class TestEncryptedCinderVolumes(manager.EncryptionScenarioTest):
- """
+ """The test suite for encrypted cinder volumes
+
This test is for verifying the functionality of encrypted cinder volumes.
For both LUKS and cryptsetup encryption types, this test performs
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index 63dd4f0..6497f7a 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -31,8 +31,7 @@
class TestLargeOpsScenario(manager.ScenarioTest):
- """
- Test large operations.
+ """Test large operations.
This test below:
* Spin up multiple instances in one nova call, and repeat three times
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 22aa06c..c3f3c78 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -29,8 +29,7 @@
class TestMinimumBasicScenario(manager.ScenarioTest):
- """
- This is a basic minimum scenario test.
+ """This is a basic minimum scenario test.
This test below:
* across the multiple components
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index f82e7e4..151eef8 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -70,12 +70,13 @@
'security_groups': [{'name': self.sec_grp['name']}]}
def prepare_network(self, address6_mode, n_subnets6=1, dualnet=False):
- """Creates network with
- given number of IPv6 subnets in the given mode and
- one IPv4 subnet
- Creates router with ports on all subnets
- if dualnet - create IPv6 subnets on a different network
- :return: list of created networks
+ """Prepare network
+
+ Creates network with given number of IPv6 subnets in the given mode and
+ one IPv4 subnet.
+ Creates router with ports on all subnets.
+ if dualnet - create IPv6 subnets on a different network
+ :return: list of created networks
"""
self.network = self._create_network(tenant_id=self.tenant_id)
if dualnet:
diff --git a/tempest/scenario/test_object_storage_basic_ops.py b/tempest/scenario/test_object_storage_basic_ops.py
index 49768c5..98dd705 100644
--- a/tempest/scenario/test_object_storage_basic_ops.py
+++ b/tempest/scenario/test_object_storage_basic_ops.py
@@ -25,8 +25,8 @@
class TestObjectStorageBasicOps(manager.ObjectStorageScenarioTest):
- """
- Test swift basic ops.
+ """Test swift basic ops.
+
* get swift stat.
* create container.
* upload a file to the created container.
@@ -57,6 +57,7 @@
@test.services('object_storage')
def test_swift_acl_anonymous_download(self):
"""This test will cover below steps:
+
1. Create container
2. Upload object to the new container
3. Change the ACL of the container
diff --git a/tempest/scenario/test_object_storage_telemetry_middleware.py b/tempest/scenario/test_object_storage_telemetry_middleware.py
index 3376a7c..eee4d3d 100644
--- a/tempest/scenario/test_object_storage_telemetry_middleware.py
+++ b/tempest/scenario/test_object_storage_telemetry_middleware.py
@@ -35,8 +35,8 @@
class TestObjectStorageTelemetry(manager.ObjectStorageScenarioTest):
- """
- Test that swift uses the ceilometer middleware.
+ """Test that swift uses the ceilometer middleware.
+
* create container.
* upload a file to the created container.
* retrieve the file from the created container.
@@ -57,19 +57,15 @@
cls.telemetry_client = cls.os_operator.telemetry_client
def _confirm_notifications(self, container_name, obj_name):
- """
- Loop seeking for appropriate notifications about the containers
- and objects sent to swift.
- """
+ # NOTE: Loop seeking for appropriate notifications about the containers
+ # and objects sent to swift.
def _check_samples():
- """
- Return True only if we have notifications about some
- containers and some objects and the notifications are about
- the expected containers and objects.
- Otherwise returning False will case _check_samples to be
- called again.
- """
+ # NOTE: Return True only if we have notifications about some
+ # containers and some objects and the notifications are about
+ # the expected containers and objects.
+ # Otherwise returning False will case _check_samples to be
+ # called again.
results = self.telemetry_client.list_samples(
'storage.objects.incoming.bytes')
LOG.debug('got samples %s', results)
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index d2a7ec6..29e393f 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -28,7 +28,8 @@
class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
- """
+ """The test suite for security groups
+
This test suite assumes that Nova has been configured to
boot VM's with Neutron-managed networking, and attempts to
verify cross tenant connectivity as follows
@@ -95,8 +96,7 @@
credentials = ['primary', 'alt', 'admin']
class TenantProperties(object):
- """
- helper class to save tenant details
+ """helper class to save tenant details
id
credentials
network
@@ -232,9 +232,7 @@
return port['device_owner'].startswith('network:router_interface')
def _create_server(self, name, tenant, security_groups=None):
- """
- creates a server and assigns to security group
- """
+ """creates a server and assigns to security group"""
self._set_compute_context(tenant)
if security_groups is None:
security_groups = [tenant.security_groups['default']]
@@ -268,11 +266,9 @@
tenant.servers.append(server)
def _set_access_point(self, tenant):
- """
- creates a server in a secgroup with rule allowing external ssh
- in order to access tenant internal network
- workaround ip namespace
- """
+ # creates a server in a secgroup with rule allowing external ssh
+ # in order to access tenant internal network
+ # workaround ip namespace
secgroups = tenant.security_groups.values()
name = 'server-{tenant}-access_point'.format(
tenant=tenant.creds.tenant_name)
@@ -301,8 +297,7 @@
return self.servers_client
def _deploy_tenant(self, tenant_or_id):
- """
- creates:
+ """creates:
network
subnet
router (if public not defined)
@@ -320,9 +315,7 @@
self._set_access_point(tenant)
def _get_server_ip(self, server, floating=False):
- """
- returns the ip (floating/internal) of a server
- """
+ """returns the ip (floating/internal) of a server"""
if floating:
server_ip = self.floating_ips[server['id']].floating_ip_address
else:
@@ -333,9 +326,7 @@
return server_ip
def _connect_to_access_point(self, tenant):
- """
- create ssh connection to tenant access point
- """
+ """create ssh connection to tenant access point"""
access_point_ssh = \
self.floating_ips[tenant.access_point['id']].floating_ip_address
private_key = tenant.keypair['private_key']
@@ -374,10 +365,8 @@
ip=self._get_server_ip(server))
def _test_cross_tenant_block(self, source_tenant, dest_tenant):
- """
- if public router isn't defined, then dest_tenant access is via
- floating-ip
- """
+ # if public router isn't defined, then dest_tenant access is via
+ # floating-ip
access_point_ssh = self._connect_to_access_point(source_tenant)
ip = self._get_server_ip(dest_tenant.access_point,
floating=self.floating_ip_access)
diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py
index c83dbb1..9387dc7 100644
--- a/tempest/scenario/test_server_advanced_ops.py
+++ b/tempest/scenario/test_server_advanced_ops.py
@@ -28,9 +28,9 @@
class TestServerAdvancedOps(manager.ScenarioTest):
- """
- This test case stresses some advanced server instance operations:
+ """The test suite for server advanced operations
+ This test case stresses some advanced server instance operations:
* Resizing an instance
* Sequence suspend resume
"""
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index c55cff6..8a19254 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -32,9 +32,9 @@
class TestServerBasicOps(manager.ScenarioTest):
- """
- This smoke test case follows this basic set of operations:
+ """The test suite for server basic operations
+ This smoke test case follows this basic set of operations:
* Create a keypair for use in launching an instance
* Create a security group to control network access in instance
* Add simple permissive rules to the security group
diff --git a/tempest/scenario/test_server_multinode.py b/tempest/scenario/test_server_multinode.py
index ef78b4a..403804d 100644
--- a/tempest/scenario/test_server_multinode.py
+++ b/tempest/scenario/test_server_multinode.py
@@ -27,11 +27,7 @@
class TestServerMultinode(manager.ScenarioTest):
-
- """
- This is a set of tests specific to multinode testing.
-
- """
+ """This is a set of tests specific to multinode testing."""
credentials = ['primary', 'admin']
@classmethod
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index 3b38888..11f7fc9 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -27,8 +27,8 @@
class TestShelveInstance(manager.ScenarioTest):
- """
- This test shelves then unshelves a Nova instance
+ """This test shelves then unshelves a Nova instance
+
The following is the scenario outline:
* boot an instance and create a timestamp file in it
* shelve the instance
diff --git a/tempest/scenario/test_snapshot_pattern.py b/tempest/scenario/test_snapshot_pattern.py
index 5ac3a7e..f56a5fb 100644
--- a/tempest/scenario/test_snapshot_pattern.py
+++ b/tempest/scenario/test_snapshot_pattern.py
@@ -26,8 +26,8 @@
class TestSnapshotPattern(manager.ScenarioTest):
- """
- This test is for snapshotting an instance and booting with it.
+ """This test is for snapshotting an instance and booting with it.
+
The following is the scenario outline:
* boot an instance and create a timestamp file in it
* snapshot the instance
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 6eceeb2..ee9bdb8 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -33,7 +33,8 @@
class TestStampPattern(manager.ScenarioTest):
- """
+ """The test suite for both snapshoting and attaching of volume
+
This test is for snapshotting an instance/volume and attaching the volume
created from snapshot to the instance booted from snapshot.
The following is the scenario outline:
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 414305d..9afa909 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -25,8 +25,7 @@
class TestVolumeBootPattern(manager.ScenarioTest):
- """
- This test case attempts to reproduce the following steps:
+ """This test case attempts to reproduce the following steps:
* Create in Cinder some bootable volume importing a Glance image
* Boot an instance from the bootable volume
diff --git a/tempest/scenario/utils.py b/tempest/scenario/utils.py
index 12509f7..ad9deea 100644
--- a/tempest/scenario/utils.py
+++ b/tempest/scenario/utils.py
@@ -72,8 +72,7 @@
@misc.singleton
class InputScenarioUtils(object):
- """
- Example usage:
+ """Example usage:
import testscenarios
(...)
@@ -124,9 +123,7 @@
@property
def scenario_images(self):
- """
- :return: a scenario with name and uuid of images
- """
+ """:return: a scenario with name and uuid of images"""
if not CONF.service_available.glance:
return []
if not hasattr(self, '_scenario_images'):
@@ -143,9 +140,7 @@
@property
def scenario_flavors(self):
- """
- :return: a scenario with name and uuid of flavors
- """
+ """:return: a scenario with name and uuid of flavors"""
if not hasattr(self, '_scenario_flavors'):
try:
flavors = self.flavors_client.list_flavors()['flavors']
@@ -160,10 +155,11 @@
def load_tests_input_scenario_utils(*args):
+ """Wrapper for testscenarios to set the scenarios
+
+ The purpose is to avoid running a getattr on the CONF object at import.
"""
- Wrapper for testscenarios to set the scenarios to avoid running a getattr
- on the CONF object at import.
- """
+
if getattr(args[0], 'suiteClass', None) is not None:
loader, standard_tests, pattern = args
else: