summaryrefslogtreecommitdiffstats
path: root/tests/functional/heketi
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2019-08-30 18:49:42 +0530
committerValerii Ponomarov <vponomar@redhat.com>2019-08-30 18:49:42 +0530
commit8832a8ac463ee480762276bd19dc085a1f637f3f (patch)
treee468105ebca57cc22970779d4367afb0696c4f36 /tests/functional/heketi
parentd4e92d0e0b4cde1209e54d3edc1cc6796cc858ef (diff)
Fix pep8 errors in the files of the 'tests' dir
Change-Id: I26c750c68055c6cc50de8015942d0d9725819aaf
Diffstat (limited to 'tests/functional/heketi')
-rw-r--r--tests/functional/heketi/test_block_volumes_heketi.py9
-rw-r--r--tests/functional/heketi/test_create_distributed_replica_heketi_volume.py8
-rw-r--r--tests/functional/heketi/test_heketi_create_volume.py9
-rw-r--r--tests/functional/heketi/test_heketi_device_operations.py12
-rw-r--r--tests/functional/heketi/test_heketi_metrics.py28
-rw-r--r--tests/functional/heketi/test_volume_expansion_and_devices.py39
6 files changed, 52 insertions, 53 deletions
diff --git a/tests/functional/heketi/test_block_volumes_heketi.py b/tests/functional/heketi/test_block_volumes_heketi.py
index 120880f9..fe157282 100644
--- a/tests/functional/heketi/test_block_volumes_heketi.py
+++ b/tests/functional/heketi/test_block_volumes_heketi.py
@@ -112,8 +112,8 @@ class TestBlockVolumeOps(BaseClass):
"is less than the default_bhv_size %s"
% (free_space_available, default_bhv_size))
block_host_create_info = heketi_volume_create(
- self.heketi_client_node, self.heketi_server_url,
- default_bhv_size, json=True, block=True)
+ self.heketi_client_node, self.heketi_server_url,
+ default_bhv_size, json=True, block=True)
block_vol_size = block_host_create_info["blockinfo"]["freesize"]
block_hosting_vol_id = block_host_create_info["id"]
self.addCleanup(heketi_volume_delete,
@@ -178,9 +178,8 @@ class TestBlockVolumeOps(BaseClass):
"is less than the default_bhv_size %s ."
% (free_space_available, default_bhv_size))
block_host_create_info = heketi_volume_create(
- self.heketi_client_node,
- self.heketi_server_url, default_bhv_size,
- json=True, block=True)
+ self.heketi_client_node, self.heketi_server_url, default_bhv_size,
+ json=True, block=True)
self.addCleanup(heketi_volume_delete,
self.heketi_client_node,
self.heketi_server_url,
diff --git a/tests/functional/heketi/test_create_distributed_replica_heketi_volume.py b/tests/functional/heketi/test_create_distributed_replica_heketi_volume.py
index f5c41d8d..2856d0e3 100644
--- a/tests/functional/heketi/test_create_distributed_replica_heketi_volume.py
+++ b/tests/functional/heketi/test_create_distributed_replica_heketi_volume.py
@@ -53,8 +53,8 @@ class TestHeketiVolume(BaseClass):
for node_id in node_ids:
node_info = heketi_node_info(
self.heketi_client_node, heketi_url, node_id, json=True)
- if (node_info['state'].lower() != 'online' or
- not node_info['devices']):
+ if (node_info['state'].lower() != 'online'
+ or not node_info['devices']):
continue
if len(nodes) > 2:
out = heketi_node_disable(
@@ -80,8 +80,8 @@ class TestHeketiVolume(BaseClass):
nodes[node_id].append(device['storage']['free'])
# Skip test if nodes requirements are not met
- if (len(nodes) < 3 or
- not all(map((lambda _list: len(_list) > 1), nodes.values()))):
+ if (len(nodes) < 3
+ or not all(map((lambda _l: len(_l) > 1), nodes.values()))):
raise self.skipTest(
"Could not find 3 online nodes with, "
"at least, 2 online devices having free space "
diff --git a/tests/functional/heketi/test_heketi_create_volume.py b/tests/functional/heketi/test_heketi_create_volume.py
index 115810b8..0d6f24e0 100644
--- a/tests/functional/heketi/test_heketi_create_volume.py
+++ b/tests/functional/heketi/test_heketi_create_volume.py
@@ -166,9 +166,8 @@ class TestHeketiVolume(BaseClass):
self.topology_volumes_with_bricks())
for vol_name in volume_names[:2]:
self.assertNotIn(vol_name, topology_volumes.keys(), (
- "volume %s shown in the heketi topology after "
- "deletion\nTopology info:\n%s" % (
- vol_name, indented_topology)))
+ "volume %s shown in the heketi topology after deletion"
+ "\nTopology info:\n%s" % (vol_name, indented_topology)))
# Check the existence of third volume
self.assertIn(volume_names[2], topology_volumes.keys(), ("volume %s "
@@ -246,8 +245,8 @@ class TestHeketiVolume(BaseClass):
for node_id in node_ids:
node_info = heketi_node_info(
self.heketi_client_node, heketi_url, node_id, json=True)
- if (node_info['state'].lower() != 'online' or
- not node_info['devices']):
+ if (node_info['state'].lower() != 'online'
+ or not node_info['devices']):
continue
for device in node_info['devices']:
if device['state'].lower() != 'online':
diff --git a/tests/functional/heketi/test_heketi_device_operations.py b/tests/functional/heketi/test_heketi_device_operations.py
index eb016941..e27fc0d5 100644
--- a/tests/functional/heketi/test_heketi_device_operations.py
+++ b/tests/functional/heketi/test_heketi_device_operations.py
@@ -213,8 +213,8 @@ class TestHeketiDeviceOperations(BaseClass):
for device in host["devices"]:
if device["state"].strip().lower() != "online":
continue
- if (lowest_device_size is None or
- device["storage"]["total"] < lowest_device_size):
+ if (lowest_device_size is None
+ or device["storage"]["total"] < lowest_device_size):
lowest_device_size = device["storage"]["total"]
lowest_device_id = device["id"]
lowest_device_name = device["name"]
@@ -340,8 +340,8 @@ class TestHeketiDeviceOperations(BaseClass):
for node_id in node_ids:
node_info = heketi_node_info(
heketi_node, heketi_url, node_id, json=True)
- if (node_info["state"].lower() != "online" or
- not node_info["devices"]):
+ if (node_info["state"].lower() != "online"
+ or not node_info["devices"]):
continue
if len(nodes) > 2:
heketi_node_disable(heketi_node, heketi_url, node_id)
@@ -365,8 +365,8 @@ class TestHeketiDeviceOperations(BaseClass):
"device_id": device["id"], "free": free_space})
# Skip test if nodes requirements are not met
- if (len(nodes) < 3 or
- not all(map((lambda _list: len(_list) > 1), nodes.values()))):
+ if (len(nodes) < 3
+ or not all(map((lambda _l: len(_l) > 1), nodes.values()))):
raise self.skipTest(
"Could not find 3 online nodes with 2 online devices "
"having free space bigger than %dGb." % min_free_space_gb)
diff --git a/tests/functional/heketi/test_heketi_metrics.py b/tests/functional/heketi/test_heketi_metrics.py
index 23351aea..9e4f5ff8 100644
--- a/tests/functional/heketi/test_heketi_metrics.py
+++ b/tests/functional/heketi/test_heketi_metrics.py
@@ -77,8 +77,8 @@ class TestHeketiMetrics(BaseClass):
for obj in metrics['heketi_device_count']])
self.assertIn(hostname, hostnames)
for device_count in metrics['heketi_device_count']:
- if (device_count['cluster'] == cluster_id and
- device_count['hostname'] == hostname):
+ if (device_count['cluster'] == cluster_id
+ and device_count['hostname'] == hostname):
self.assertEqual(
len(node['devices']), device_count['value'])
@@ -101,9 +101,9 @@ class TestHeketiMetrics(BaseClass):
metrics['heketi_device_brick_count']])
self.assertIn(device_name, devices)
for brick_count in metrics['heketi_device_brick_count']:
- if (brick_count['cluster'] == cluster_id and
- brick_count['hostname'] == hostname and
- brick_count['device'] == device_name):
+ if (brick_count['cluster'] == cluster_id
+ and brick_count['hostname'] == hostname
+ and brick_count['device'] == device_name):
self.assertEqual(
len(device['bricks']), brick_count['value'])
@@ -117,9 +117,9 @@ class TestHeketiMetrics(BaseClass):
for obj in metrics['heketi_device_size']])
self.assertIn(device_name, devices)
for device_size in metrics['heketi_device_size']:
- if (device_size['cluster'] == cluster_id and
- device_size['hostname'] == hostname and
- device_size['device'] == device_name):
+ if (device_size['cluster'] == cluster_id
+ and device_size['hostname'] == hostname
+ and device_size['device'] == device_name):
self.assertEqual(
device_size_t, device_size['value'])
@@ -133,9 +133,9 @@ class TestHeketiMetrics(BaseClass):
for obj in metrics['heketi_device_free']])
self.assertIn(device_name, devices)
for device_free in metrics['heketi_device_free']:
- if (device_free['cluster'] == cluster_id and
- device_free['hostname'] == hostname and
- device_free['device'] == device_name):
+ if (device_free['cluster'] == cluster_id
+ and device_free['hostname'] == hostname
+ and device_free['device'] == device_name):
self.assertEqual(
device_free_t, device_free['value'])
@@ -149,9 +149,9 @@ class TestHeketiMetrics(BaseClass):
for obj in metrics['heketi_device_used']])
self.assertIn(device_name, devices)
for device_used in metrics['heketi_device_used']:
- if (device_used['cluster'] == cluster_id and
- device_used['hostname'] == hostname and
- device_used['device'] == device_name):
+ if (device_used['cluster'] == cluster_id
+ and device_used['hostname'] == hostname
+ and device_used['device'] == device_name):
self.assertEqual(
device_used_t, device_used['value'])
diff --git a/tests/functional/heketi/test_volume_expansion_and_devices.py b/tests/functional/heketi/test_volume_expansion_and_devices.py
index 830f49f5..f73ed736 100644
--- a/tests/functional/heketi/test_volume_expansion_and_devices.py
+++ b/tests/functional/heketi/test_volume_expansion_and_devices.py
@@ -132,7 +132,7 @@ class TestVolumeExpansionAndDevicesTestCases(BaseClass):
total_free_space += device["storage"]["free"]
free_spaces.append(total_free_space)
- total_free_space = sum(free_spaces)/(1024 ** 2)
+ total_free_space = sum(free_spaces) / (1024 ** 2)
total_free_space = int(math.floor(total_free_space))
return total_free_space
@@ -221,15 +221,15 @@ class TestVolumeExpansionAndDevicesTestCases(BaseClass):
volume_info_after_expansion["size"])
difference_size_after_expansion = (
- heketi_vol_info_size_after_expansion -
- heketi_vol_info_size_before_expansion)
+ heketi_vol_info_size_after_expansion
+ - heketi_vol_info_size_before_expansion)
self.assertTrue(
difference_size_after_expansion > 0,
"Volume expansion for %s did not consume free space" % volume_id)
- num_of_bricks_added_after_expansion = (num_of_bricks_after_expansion -
- num_of_bricks_before_expansion)
+ num_of_bricks_added_after_expansion = (
+ num_of_bricks_after_expansion - num_of_bricks_before_expansion)
self.assertEqual(
num_of_bricks_added_after_expansion, 3,
@@ -270,16 +270,16 @@ class TestVolumeExpansionAndDevicesTestCases(BaseClass):
volume_info_after_further_expansion["size"])
difference_size_after_further_expansion = (
- heketi_vol_info_size_after_further_expansion -
- heketi_vol_info_size_after_expansion)
+ heketi_vol_info_size_after_further_expansion
+ - heketi_vol_info_size_after_expansion)
self.assertTrue(
difference_size_after_further_expansion > 0,
"Size of volume %s did not increase" % volume_id)
num_of_bricks_added_after_further_expansion = (
- num_of_bricks_after_further_expansion -
- num_of_bricks_after_expansion)
+ num_of_bricks_after_further_expansion
+ - num_of_bricks_after_expansion)
self.assertEqual(
num_of_bricks_added_after_further_expansion, 3,
@@ -330,8 +330,8 @@ class TestVolumeExpansionAndDevicesTestCases(BaseClass):
devices, "Node '%s' does not have devices." % node_id)
if devices[0]["state"].strip().lower() != "online":
self.skipTest("Test expects first device to be enabled.")
- if (smallest_size is None or
- devices[0]["storage"]["free"] < smallest_size):
+ if (smallest_size is None
+ or devices[0]["storage"]["free"] < smallest_size):
smallest_size = devices[0]["storage"]["free"]
for device in node_info["devices"][1:]:
heketi_ops.heketi_device_disable(
@@ -346,8 +346,8 @@ class TestVolumeExpansionAndDevicesTestCases(BaseClass):
gluster_server_data = self.gluster_servers_info[gluster_server]
g_manage = gluster_server_data["manage"]
g_storage = gluster_server_data["storage"]
- if not (g_manage in node_info["hostnames"]["manage"] or
- g_storage in node_info["hostnames"]["storage"]):
+ if not (g_manage in node_info["hostnames"]["manage"]
+ or g_storage in node_info["hostnames"]["storage"]):
continue
additional_device_name = ((
gluster_server_data.get("additional_devices") or [''])[0])
@@ -358,8 +358,9 @@ class TestVolumeExpansionAndDevicesTestCases(BaseClass):
"'%s' node, which has following hostnames and "
"IP addresses: %s.\n" % (
node_id,
- ', '.join(node_info["hostnames"]["manage"] +
- node_info["hostnames"]["storage"])))
+ ', '.join(
+ node_info["hostnames"]["manage"]
+ + node_info["hostnames"]["storage"])))
continue
heketi_ops.heketi_device_add(
@@ -487,8 +488,8 @@ class TestVolumeExpansionAndDevicesTestCases(BaseClass):
heketi_vol_info_size_after_expansion = (
volume_info_after_expansion["size"])
- difference_size = (heketi_vol_info_size_after_expansion -
- heketi_vol_info_size_before_expansion)
+ difference_size = (heketi_vol_info_size_after_expansion
+ - heketi_vol_info_size_before_expansion)
self.assertTrue(
difference_size > 0,
@@ -497,8 +498,8 @@ class TestVolumeExpansionAndDevicesTestCases(BaseClass):
self.get_brick_and_volume_status(volume_name)
num_of_bricks_after_expansion = self.get_num_of_bricks(volume_name)
- num_of_bricks_added = (num_of_bricks_after_expansion -
- num_of_bricks_before_expansion)
+ num_of_bricks_added = (
+ num_of_bricks_after_expansion - num_of_bricks_before_expansion)
self.assertEqual(
num_of_bricks_added, 3,