示例#1
0
    def test_remove_shard(self):
        shard = rcluster.shard.Shard(0)
        shard_id = shard.add_shard("localhost", 6380, 0)
        shard.remove_shard(shard_id)

        self.assertFalse(
            shard.is_shard_alive(shard_id),
            "Removed shard is alive.",
        )
示例#2
0
    def test_fault_tolerance_2_shards_2_replicas_1_fault(self):
        shard = rcluster.shard.Shard(0)
        shard.replicaness = 2
        shard.add_shard("localhost", 6380, 0)
        shard2_id = shard.add_shard("localhost", 6381, 0)

        key, data = self._key(), os.urandom(32)
        shard.set(key, data)
        shard.remove_shard(shard2_id)

        self.assertEqual(data, shard.get(key), "Data is not read.")