def assert_find(glob, expected_matches): # Check we can find the matches of a glob matches = sorted(list(self.accessor.glob_metric_names(glob))) # Lucene is supposed to give perfect results, so filter wrongly expected matches. if IS_LUCENE: glob_re = re.compile(bg_glob_utils.glob_to_regex(glob)) expected_matches = list(filter(glob_re.match, expected_matches)) self.assertEqual(expected_matches, matches)
def filter_metrics(metrics, glob): print(glob + " ===> " + bg_glob.glob_to_regex(glob)) glob_re = re.compile(bg_glob.glob_to_regex(glob)) return list(filter(glob_re.match, metrics))
def filter_metrics(metrics, glob): print(glob + " ===> " + bg_glob.glob_to_regex(glob)) glob_re = re.compile(bg_glob.glob_to_regex(glob)) return list(filter(glob_re.match, metrics))