예제 #1
0
 def tokens512_partition_16_nodes_test(self):
     partitions = [
         i for i in IStorage._tokens_partitions(self.t16, 512, 16)
     ]
     flat = reduce(list.__add__, partitions)
     self.check_full_range(flat)
     self.assertGreaterEqual(len(partitions), 16)
     self.assertGreater(len(set(flat)), 512)
예제 #2
0
 def tokens16_partition_16_nodes_test(self):
     partitions = [i for i in IStorage._tokens_partitions(self.t16, 16, 16)]
     flat = reduce(list.__add__, partitions)
     self.check_full_range(flat)
     self.assertGreaterEqual(16, len(partitions))
     self.assertEqual((2**63) - 1, reduce(max, map(lambda a: a[1], flat)))
     self.assertEqual(-9223372036854775808,
                      reduce(min, map(lambda a: a[0], flat)))
     self.assertEqual(16, len(set(flat)))
예제 #3
0
 def tokens1024_16_blocks_with_16_vtokens_test(self):
     partitions = [
         i for i in IStorage._tokens_partitions(self.t1024_tuples, 16, 16)
     ]
     flat = reduce(list.__add__, partitions)
     self.check_full_range(flat)
     self.assertGreaterEqual(len(partitions), 16)
     self.assertEqual((2**63) - 1, reduce(max, map(lambda a: a[1], flat)))
     self.assertEqual(-(2**63), reduce(min, map(lambda a: a[0], flat)))
     #self.assertEqual({64}, reduce(set.union, map(lambda a: {len(a)}, partitions)))
     self.assertGreaterEqual(len(set(flat)), 1024)