Skip to content

Commit 1a1f3d6

Browse files
authored
Merge pull request #81 from Helene/cap_metrics
fix flake8 findings
2 parents b0d0f9e + d54ed7f commit 1a1f3d6

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

source/queryHandler/Query.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Query(object):
5050
"nodegroup", "account", "filesystem", "tct_csap", "tct_operation", "cloud_nodeclass"])
5151

5252
DISK_CAP_METRICS = set(["gpfs_disk_disksize", "gpfs_disk_free_fullkb", "gpfs_disk_free_fragkb",
53-
"gpfs_pool_disksize", "gpfs_pool_free_fragkb", "gpfs_pool_free_fullkb",
53+
"gpfs_pool_disksize", "gpfs_pool_free_fragkb", "gpfs_pool_free_fullkb",
5454
"gpfs_fs_inode_used", "gpfs_fs_inode_free", "gpfs_fs_inode_alloc", "gpfs_fs_inode_max"])
5555

5656
def __init__(self, metrics=None, bucketsize=1, filters=None, groupby=None, includeDiskData=False):
@@ -188,10 +188,10 @@ def addMeasurement(self, meassure):
188188
def __str__(self):
189189
# dd = '-a' if self.includeDiskData else ''
190190
# Workaround for RTC Defect 280368: Zimon capacity query does not return all results (seen on CNSA)
191-
if (self.metrics and
192-
any(str(metric) in self.DISK_CAP_METRICS for metric in self.metrics)
193-
) or (self.sensor and
194-
self.sensor in ("GPFSDiskCap","GPFSPoolCap", "GPFSInodeCap")
191+
if (self.metrics
192+
and any(str(metric) in self.DISK_CAP_METRICS for metric in self.metrics)
193+
) or (self.sensor
194+
and self.sensor in ("GPFSDiskCap", "GPFSPoolCap", "GPFSInodeCap")
195195
):
196196
dd = '-ar'
197197
elif self.includeDiskData:

tests/test_query.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from source.queryHandler.Query import Query
2-
from source.__version__ import __version__ as version
32
from nose2.tools.decorators import with_setup
43

54

65
def my_setup():
76
global metrics, metrics1, capSensors
87
metrics = ['cpu_user']
98
metrics1 = ['gpfs_fs_inode_used']
10-
capSensors = ['GPFSDiskCap','GPFSPoolCap', 'GPFSInodeCap']
9+
capSensors = ['GPFSDiskCap', 'GPFSPoolCap', 'GPFSInodeCap']
10+
1111

1212
@with_setup(my_setup)
1313
def test_case01():
@@ -16,13 +16,15 @@ def test_case01():
1616
assert "cpu_user" in str(query)
1717
assert "-ar" not in str(query)
1818

19+
1920
@with_setup(my_setup)
2021
def test_case02():
2122
query = Query(metrics1)
2223
assert "-ar" in str(query)
2324
query.addMetric('cpu_user')
2425
assert "-ar" in str(query)
2526

27+
2628
@with_setup(my_setup)
2729
def test_case03():
2830
for sensor in capSensors:

0 commit comments

Comments
 (0)