From: Jos Collin Date: Thu, 24 Mar 2022 04:57:58 +0000 (+0530) Subject: qa: make test_perf_stats_stale_metrics check only the clients created for the tests X-Git-Tag: v17.2.1~86^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4552cd028dfb977ec41d380a6410650bce9aa71a;p=ceph.git qa: make test_perf_stats_stale_metrics check only the clients created for the tests Uses the client's global id to get the metrics, instead of using the index. This ensures that test_perf_stats_stale_metrics checks only the clients mounted for the tests. Fixes: https://tracker.ceph.com/issues/54971 Signed-off-by: Jos Collin (cherry picked from commit 1621308214cd18750c8be803fc014bdf73e2218a) --- diff --git a/qa/tasks/cephfs/test_mds_metrics.py b/qa/tasks/cephfs/test_mds_metrics.py index 4c85d9f25102..9d9c961c3529 100644 --- a/qa/tasks/cephfs/test_mds_metrics.py +++ b/qa/tasks/cephfs/test_mds_metrics.py @@ -402,16 +402,17 @@ class TestMDSMetrics(CephFSTestCase): # validate valid, metrics = self._get_metrics(self.verify_mds_metrics( active_mds_count=1, client_count=TestMDSMetrics.CLIENTS_REQUIRED), 30) - log.debug("metrics={0}".format(metrics)) + log.debug(f'metrics={metrics}') self.assertTrue(valid) - global_metrics = metrics['global_metrics'] + #mount_a and mount_b are the clients mounted for TestMDSMetrics. So get their + #entries from the global_metrics. + client_a_name = f'client.{self.mount_a.get_global_id()}' + client_b_name = f'client.{self.mount_b.get_global_id()}' - #TestMDSMetrics.CLIENTS_REQUIRED clients are mounted here. So they should be - #the first two entries in the global_metrics and won't be culled later on. - gm_keys_list = list(global_metrics.keys()) - client1_metrics = global_metrics[gm_keys_list[0]] - client2_metrics = global_metrics[gm_keys_list[1]] + global_metrics = metrics['global_metrics'] + client_a_metrics = global_metrics[client_a_name] + client_b_metrics = global_metrics[client_b_name] #fail rank0 mds self.fs.rank_fail(rank=0) @@ -435,16 +436,16 @@ class TestMDSMetrics(CephFSTestCase): try: valid, metrics_new = self._get_metrics(self.verify_mds_metrics( active_mds_count=1, client_count=TestMDSMetrics.CLIENTS_REQUIRED), 30) - log.debug("metrics={0}".format(metrics_new)) + log.debug(f'metrics={metrics_new}') self.assertTrue(valid) global_metrics = metrics_new['global_metrics'] - client1_metrics_new = global_metrics[gm_keys_list[0]] - client2_metrics_new = global_metrics[gm_keys_list[1]] + client_a_metrics_new = global_metrics[client_a_name] + client_b_metrics_new = global_metrics[client_b_name] #the metrics should be different for the test to succeed. - self.assertNotEqual(client1_metrics, client1_metrics_new) - self.assertNotEqual(client2_metrics, client2_metrics_new) + self.assertNotEqual(client_a_metrics, client_a_metrics_new) + self.assertNotEqual(client_b_metrics, client_b_metrics_new) except MaxWhileTries: raise RuntimeError("Failed to fetch `ceph fs perf stats` metrics") finally: