Пример #1
0
 def test_bcache_parse_tolerates_missing_blockdev_data(self):
     """ BcacheParser  ValueError on missing 'blockdev' dict."""
     del (self.probe_data['blockdev'])
     b = BcacheParser(self.probe_data)
     (configs, errors) = b.parse()
     self.assertEqual([], configs)
     self.assertEqual([], errors)
Пример #2
0
 def test_bcache_parse_ignores_bcache_cache_only(self):
     """ BcacheParser ignores cache device only. """
     probe_data = _get_data('probert_storage_diglett.json')
     probe_data['bcache']['backing'] = {}
     bcachep = BcacheParser(probe_data)
     (configs, errors) = bcachep.parse()
     self.assertEqual([], errors)
     self.assertEqual(0, len(configs))
Пример #3
0
 def test_bcache_parse_extracts_bcache_backing_only(self):
     """ BcacheParser extracts bcache config w/ backing device only. """
     probe_data = _get_data('probert_storage_diglett.json')
     probe_data['bcache']['caching'] = {}
     bcachep = BcacheParser(probe_data)
     (configs, errors) = bcachep.parse()
     self.assertEqual([], errors)
     self.assertEqual(1, len(configs))
     expected_config = {
         'type': 'bcache',
         'id': 'disk-bcache0',
         'name': 'bcache0',
         'backing_device': 'partition-sda3',
         'cache_mode': 'writeback',
     }
     self.assertDictEqual(expected_config, configs[0])
Пример #4
0
 def test_bcache_parse(self):
     """ BcacheParser initializes class_data, backing, caching attrs."""
     bcachep = BcacheParser(self.probe_data)
     self.assertDictEqual(self.probe_data, bcachep.probe_data)
     self.assertDictEqual(self.probe_data['bcache'], bcachep.class_data)
     self.assertDictEqual(self.probe_data['bcache']['backing'],
                          bcachep.backing)
     self.assertDictEqual(self.probe_data['bcache']['caching'],
                          bcachep.caching)