summaryrefslogtreecommitdiffstats
path: root/tests/functional
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
parentd4e92d0e0b4cde1209e54d3edc1cc6796cc858ef (diff)
Fix pep8 errors in the files of the 'tests' dir
Change-Id: I26c750c68055c6cc50de8015942d0d9725819aaf
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/arbiter/test_arbiter.py6
-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
-rw-r--r--tests/functional/provisioning/test_dynamic_provisioning_block.py9
-rw-r--r--tests/functional/provisioning/test_dynamic_provisioning_file.py5
-rw-r--r--tests/functional/provisioning/test_pv_resize.py22
-rw-r--r--tests/functional/provisioning/test_storage_class_cases.py10
-rw-r--r--tests/functional/test_gluster_ops_check.py3
12 files changed, 78 insertions, 82 deletions
diff --git a/tests/functional/arbiter/test_arbiter.py b/tests/functional/arbiter/test_arbiter.py
index ae4b98d6..4d6d2ebd 100644
--- a/tests/functional/arbiter/test_arbiter.py
+++ b/tests/functional/arbiter/test_arbiter.py
@@ -321,7 +321,7 @@ class TestArbiterVolumeCreateExpandDelete(BaseClass):
vol_info = get_gluster_vol_info_by_pvc_name(self.node, self.pvc_name)
self.verify_amount_and_proportion_of_arbiter_and_data_bricks(
- vol_info, arbiter_bricks=2, data_bricks=4)
+ vol_info, arbiter_bricks=2, data_bricks=4)
# NOTE(vponomar): do not create big volumes setting value less than 64
# for 'avg_file_size'. It will cause creation of very huge amount of files
@@ -358,8 +358,8 @@ class TestArbiterVolumeCreateExpandDelete(BaseClass):
vol_info))
expected_file_amount = pvc_size_gb * 1024**2 / (avg_file_size or 64)
- expected_file_amount = (expected_file_amount /
- bricks_info['arbiter_amount'])
+ expected_file_amount = (
+ expected_file_amount / bricks_info['arbiter_amount'])
# Try to create expected amount of files on arbiter brick mount
passed_arbiter_bricks = []
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,
diff --git a/tests/functional/provisioning/test_dynamic_provisioning_block.py b/tests/functional/provisioning/test_dynamic_provisioning_block.py
index 0a587973..6b288fcb 100644
--- a/tests/functional/provisioning/test_dynamic_provisioning_block.py
+++ b/tests/functional/provisioning/test_dynamic_provisioning_block.py
@@ -255,8 +255,7 @@ class TestDynamicProvisioningBlockP0(GlusterBlockBaseClass):
for pvc in self.pvc_name_list:
with self.assertRaises(ExecutionError):
wait_for_resource_absence(
- self.ocp_client[0], 'pvc', pvc,
- interval=3, timeout=30)
+ self.ocp_client[0], 'pvc', pvc, interval=3, timeout=30)
finally:
# bring back heketi-pod
scale_dc_pod_amount_and_wait(self.ocp_client[0],
@@ -309,11 +308,11 @@ class TestDynamicProvisioningBlockP0(GlusterBlockBaseClass):
pv_name = get_pv_name_from_pvc(self.node, self.pvc_name)
vol_name = oc_get_custom_resource(
- self.node, 'pv',
- ':.metadata.annotations.glusterBlockShare', pv_name)[0]
+ self.node, 'pv',
+ ':.metadata.annotations.glusterBlockShare', pv_name)[0]
block_vol_list = heketi_blockvolume_list(
- self.heketi_client_node, self.heketi_server_url)
+ self.heketi_client_node, self.heketi_server_url)
self.assertIn(vol_name, block_vol_list)
diff --git a/tests/functional/provisioning/test_dynamic_provisioning_file.py b/tests/functional/provisioning/test_dynamic_provisioning_file.py
index 4b53d3c6..57c1e2e4 100644
--- a/tests/functional/provisioning/test_dynamic_provisioning_file.py
+++ b/tests/functional/provisioning/test_dynamic_provisioning_file.py
@@ -74,7 +74,7 @@ class TestDynamicProvisioningP0(BaseClass):
r'"gluster\.kubernetes\.io\/heketi-volume-id"'
]
pv_vol_name, vol_id = oc_get_custom_resource(
- self.ocp_client[0], 'pv', custom, pv_name)
+ self.ocp_client[0], 'pv', custom, pv_name)
# check if the pv_volume_name is present in heketi
# Check if volume name is "vol_"+volumeid or not
@@ -331,8 +331,7 @@ class TestDynamicProvisioningP0(BaseClass):
for pvc in self.pvc_name_list:
with self.assertRaises(ExecutionError):
wait_for_resource_absence(
- self.ocp_client[0], 'pvc', pvc,
- interval=3, timeout=30)
+ self.ocp_client[0], 'pvc', pvc, interval=3, timeout=30)
finally:
# bring back heketi-pod
scale_dc_pod_amount_and_wait(self.ocp_client[0],
diff --git a/tests/functional/provisioning/test_pv_resize.py b/tests/functional/provisioning/test_pv_resize.py
index 68730c6f..ebf31529 100644
--- a/tests/functional/provisioning/test_pv_resize.py
+++ b/tests/functional/provisioning/test_pv_resize.py
@@ -48,7 +48,7 @@ class TestPvResizeClass(BaseClass):
(True, True),
(False, True),
(False, False),
- )
+ )
@ddt.unpack
def test_pv_resize_with_prefix_for_name_and_size(
self, create_vol_name_prefix=False, valid_size=True):
@@ -79,8 +79,8 @@ class TestPvResizeClass(BaseClass):
cmd = ("dd if=/dev/urandom of=%sfile "
"bs=100K count=1000") % dir_path
ret, out, err = oc_rsh(node, pod_name, cmd)
- self.assertEqual(ret, 0, "failed to execute command %s on %s" % (
- cmd, node))
+ self.assertEqual(
+ ret, 0, "Failed to execute command %s on %s" % (cmd, node))
pv_name = get_pv_name_from_pvc(node, pvc_name)
# If resize size is invalid then size should not change
@@ -111,8 +111,8 @@ class TestPvResizeClass(BaseClass):
cmd = ("dd if=/dev/urandom of=%sfile_new "
"bs=50K count=10000") % dir_path
ret, out, err = oc_rsh(node, pod_name, cmd)
- self.assertEqual(ret, 0, "failed to execute command %s on %s" % (
- cmd, node))
+ self.assertEqual(
+ ret, 0, "Failed to execute command %s on %s" % (cmd, node))
def _pv_resize(self, exceed_free_space):
dir_path = "/mnt"
@@ -128,8 +128,8 @@ class TestPvResizeClass(BaseClass):
for node_id in node_id_list:
node_info = heketi_ops.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_ops.heketi_node_disable(
@@ -239,8 +239,8 @@ class TestPvResizeClass(BaseClass):
cmd = ("dd if=/dev/urandom of=%sfile "
"bs=100K count=3000") % dir_path
ret, out, err = oc_rsh(node, pod_name, cmd)
- self.assertEqual(ret, 0, "failed to execute command %s on %s" % (
- cmd, node))
+ self.assertEqual(
+ ret, 0, "Failed to execute command %s on %s" % (cmd, node))
pvc_resize = 2
with self.assertRaises(AssertionError):
resize_pvc(node, pvc_name, pvc_resize)
@@ -250,8 +250,8 @@ class TestPvResizeClass(BaseClass):
cmd = ("dd if=/dev/urandom of=%sfile_new "
"bs=100K count=2000") % dir_path
ret, out, err = oc_rsh(node, pod_name, cmd)
- self.assertEqual(ret, 0, "failed to execute command %s on %s" % (
- cmd, node))
+ self.assertEqual(
+ ret, 0, "Failed to execute command %s on %s" % (cmd, node))
def test_pv_resize_when_heketi_down(self):
"""Create a PVC and try to expand it when heketi is down, It should
diff --git a/tests/functional/provisioning/test_storage_class_cases.py b/tests/functional/provisioning/test_storage_class_cases.py
index 2e319f6c..cdf61d43 100644
--- a/tests/functional/provisioning/test_storage_class_cases.py
+++ b/tests/functional/provisioning/test_storage_class_cases.py
@@ -183,7 +183,7 @@ class TestStorageClassCases(BaseClass):
{"restuser": "fakeuser"},
{"volumenameprefix": "dept_qe"},
{"clusterids": "123456789abcdefg"},
- )
+ )
def test_sc_glusterfile_incorrect_parameter(self, parameter={}):
"""Validate glusterfile storage with different incorrect parameters"""
self.create_sc_with_parameter("glusterfile", parameter=parameter)
@@ -194,7 +194,7 @@ class TestStorageClassCases(BaseClass):
"restsecretnamespace": "fakerestnamespace"},
{"restuser": "fakeuser"},
{"clusterids": "123456789abcdefg"},
- )
+ )
def test_sc_glusterblock_incorrect_parameter(self, parameter={}):
"""Validate glusterblock storage with different incorrect parameters"""
self.create_sc_with_parameter("glusterblock", parameter=parameter)
@@ -341,6 +341,6 @@ class TestStorageClassCases(BaseClass):
self.ocp_master_node[0], "pv", ":spec.glusterfs.endpoints",
name=pv_name)
self.assertTrue(
- endpoint,
- "Failed to read Endpoints of %s on %s " % (
- pv_name, self.ocp_master_node[0]))
+ endpoint,
+ "Failed to read Endpoints of %s on %s " % (
+ pv_name, self.ocp_master_node[0]))
diff --git a/tests/functional/test_gluster_ops_check.py b/tests/functional/test_gluster_ops_check.py
index de20ab00..fc966342 100644
--- a/tests/functional/test_gluster_ops_check.py
+++ b/tests/functional/test_gluster_ops_check.py
@@ -29,6 +29,5 @@ class TestOpsCheck(BaseClass):
# Validate the result
err_msg = ("Got unexepeted max-brick process - '%s' "
- "Expected max brick process is : 250") % (
- bprocess_status)
+ "Expected max brick process is : 250") % bprocess_status
self.assertIn(bprocess_status, '250', err_msg)