def test_bootstrap_partial_locations(self): for groups in ( prefixes(1), # 16 prefixes(2), # 256 prefixes(3), # 4096 prefixes(4)): # 64ki groups = list(groups) # whatever the number of bases to spread, a partial location # is well padded left srv = list(self.generate_services(9, nb_sites=3, fill_token=0)) self.assertRaises(PreconditionFailed, _bootstrap, srv, groups, replicas=2, level=0, degradation=1) self.assertRaises(PreconditionFailed, _bootstrap, srv, groups, replicas=2, level=1, degradation=1) self._test_ok(groups, sites=3, replicas=1, level=2, fill_token=2)
def test_bootstrap_enough_sites(self): for groups in (prefixes(1), # 16 prefixes(2), # 256 prefixes(3), # 4096 prefixes(4)): # 64ki groups = list(groups) max_replicas = 5 for replicas in range(1, max_replicas+1): for sites in range(replicas, max_replicas+1): self._test_ok(groups, sites=sites, replicas=replicas, level=0, fill_token=2)
def test_bootstrap_not_enough_sites(self): for groups in (prefixes(1), # 16 prefixes(2), # 256 prefixes(3), # 4096 prefixes(4)): # 64ki groups = list(groups) for replicas in range(2, 5): for sites in range(1, replicas): srv = list(self.generate_services(sites*3, nb_sites=sites, fill_token=2)) self.assertRaises(PreconditionFailed, _bootstrap, srv, groups, replicas=replicas, level=0, degradation=1)