Esempio n. 1
0
 def test_opaque_rack_ids(self):
     ring_model = RingSpecifications(model=safe_load(ringspec_region_zones))
     r, z = ring_model.get_region_zone('region1', 'account', 21)
     self.assertEquals((r, z), (2, -1))
     r, z = ring_model.get_region_zone('region1', 'account', '21')
     self.assertEquals((r, z), (2, -1))
     r, z = ring_model.get_region_zone('region2', 'account', '51')
     self.assertEquals((r, z), (5, 6))
Esempio n. 2
0
 def test_rack_ids(self):
     scenarios = [
         ('region1', 'container', 21, 2, -1),
         ('region1', 'object-0', 31, 3, -1),
         ('region2', 'account', 'four3', 4, 6),
         ('region2', 'account', 52, 5, 6),
         ('region2', 'object-0', 'four1', 4, 7),
         ('region2', 'object-0', 53, 5, 8),
         ('region2', 'container', 91, 9, None),
         ('region2', 'container', 101, None, 10),
         ('region2', 'bad-ring', 52, 5, None),
         ('bad-region', 'account', 52, None, None),
         ('region1', 'container', None, None, -1),
         ('region2', 'container', None, None, None),
         ('region2', 'object-0', None, None, None),
     ]
     ring_model = RingSpecifications(model=safe_load(ringspec_region_zones))
     for scenario in scenarios:
         rg, rng, rck, rv, rz = scenario
         r, z = ring_model.get_region_zone(rg, rng, rck)
         self.assertEquals((rg, rng, rck, r, z), (rg, rng, rck, rv, rz))