class TestMdtMetrics(CommandCaptureTestCase, PatchedContextTestCase): def setUp(self): tests = os.path.join(os.path.dirname(__file__), '..') self.test_root = os.path.join( tests, "data/lustre_versions/2.9.58_86_g2383a62/mds_mgs") super(TestMdtMetrics, self).setUp() self.audit = MdtAudit() self.add_command(CMD, stdout=lctl_output) self.metrics = self.audit.metrics()['raw']['lustre']['target'] def test_get_client_count(self): self.assertEqual(self.metrics['testfs-MDT0000']['client_count'], 1) def test_mdt_stats_list(self): """Test that a representative sample of mdt stats is collected.""" stats_list = "req_waittime " \ "req_qdepth " \ "req_active " \ "req_timeout " \ "reqbuf_avail " \ "ldlm_ibits_enqueue " \ "mds_reint_setattr " \ "mds_reint_open " \ "mds_getattr " \ "mds_connect " \ "mds_get_root " \ "mds_statfs " \ "mds_getxattr " \ "obd_ping " \ "open " \ "close " \ "mknod " \ "getattr " \ "setattr " \ "statfs " \ "getxattr".split() for stat in stats_list: assert stat in self.metrics['testfs-MDT0000']['stats'].keys( ), "%s is missing" % stat def test_mdt_stats_vals(self): """Test that the mdt stats contain the correct values.""" stats = self.metrics['testfs-MDT0000']['stats'] self.assertEqual(stats['mds_getattr']['units'], "usec") self.assertEqual(stats['mds_get_root']['sum'], 15) self.assertEqual(stats['mknod']['units'], "reqs") self.assertEqual(stats['close']['count'], 8) def test_mdt_int_metrics(self): """Test that the mdt simple integer metrics are collected.""" int_list = "client_count kbytestotal kbytesfree filestotal filesfree".split( ) for metric in int_list: assert metric in self.metrics['testfs-MDT0000'].keys( ), "%s is missing" % metric def test_mdt_filesfree(self): """Test that mdt int metrics are sane.""" self.assertEqual(self.metrics['testfs-MDT0000']['filesfree'], 4194037)
class TestMdtMetrics(CommandCaptureTestCase, PatchedContextTestCase): def setUp(self): tests = os.path.join(os.path.dirname(__file__), '..') self.test_root = os.path.join(tests, "data/lustre_versions/2.5.0/mds") super(TestMdtMetrics, self).setUp() self.audit = MdtAudit() self.add_command(CMD, stdout=lctl_output) self.metrics = self.audit.metrics()['raw']['lustre']['target'] def test_get_client_count(self): self.assertEqual(self.metrics['lustre-MDT0000']['client_count'], 2) def test_mdt_stats_list(self): """Test that a representative sample of mdt stats is collected.""" stats_list = "req_waittime req_qdepth req_active req_timeout reqbuf_avail mds_getattr mds_connect mds_getstatus mds_statfs mds_sync mds_getxattr open close unlink mkdir rmdir getxattr".split( ) for stat in stats_list: assert stat in self.metrics['lustre-MDT0000']['stats'].keys( ), "%s is missing" % stat def test_mdt_stats_vals(self): """Test that the mdt stats contain the correct values.""" stats = self.metrics['lustre-MDT0000']['stats'] self.assertEqual(stats['mds_getattr']['units'], "usec") self.assertEqual(stats['mds_sync']['sum'], 4480017) self.assertEqual(stats['mkdir']['units'], "reqs") self.assertEqual(stats['unlink']['count'], 50254) def test_mdt_int_metrics(self): """Test that the mdt simple integer metrics are collected.""" int_list = "client_count kbytestotal kbytesfree filestotal filesfree".split( ) for metric in int_list: assert metric in self.metrics['lustre-MDT0000'].keys( ), "%s is missing" % metric def test_mdt_filesfree(self): """Test that mdt int metrics are sane.""" self.assertEqual(self.metrics['lustre-MDT0000']['filesfree'], 511954)