Skip to content

Commit 11c82f3

Browse files
committed
fix unit test findings
Signed-off-by: hwassman <[email protected]>
1 parent c5be623 commit 11c82f3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

source/collector.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ def __init__(self, columnInfo, dps, filtersMap, defaultLabels):
4949

5050
@cond_execution_time(enabled=analytics.inspect_special)
5151
def parse_tags(self, filtersMap, defaultLabels):
52-
tagsDict = defaultdict(set)
5352
logger = getBridgeLogger()
53+
if not (filtersMap and defaultLabels):
54+
logger.trace(f'No labels, no filters in local cache for {self.columnInfo.keys[0].__str__()}')
55+
return
56+
tagsDict = defaultdict(set)
5457
for key in self.columnInfo.keys:
5558
ident = [key.parent]
5659
ident.extend(key.identifier)
@@ -205,6 +208,7 @@ def _get_sensor_labels(self):
205208
md = MetadataHandler()
206209
return md.metaData.getSensorLabels(self.sensor)
207210

211+
208212
@classattributes(dict(metricsaggr=None, filters=None, grouptags=None,
209213
start='', end='', nsamples=0, duration=0,
210214
dsBucketSize=0, dsOp='', rawData=False),

tests/test_topo_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def my_setup():
99
path = os.getcwd()
1010
topoStrFile = os.path.join(path, "tests", "test_data", 'topoStr.json')
1111
with open(topoStrFile) as f:
12-
topoStr = json.load(f)
12+
topoStr = json.load(f)
1313
topo = Topo(topoStr)
1414
metrics = ['cpu_user']
1515
metrics1 = ['gpfs_fs_inode_used']

0 commit comments

Comments
 (0)