Exemplo n.º 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)
Exemplo n.º 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))
Exemplo n.º 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])