def test_collect_segment_hash_table_simple(redisdb): node = CommitteeCandidate() node.conn = redisdb cluster_listen_address = 'test_cluster' node._client_response_listening_channel = cluster_listen_address client_request = { 'client_id': '123', 'hashes': range(NUMBER_OF_DATASET_SEGMENTS) } redisdb.lpush(cluster_listen_address, yaml.dump(client_request)) node.collect_segment_hash_table() assert len(node.segment_hash_table) == NUMBER_OF_DATASET_SEGMENTS
def test_inform_client_of_task_integrated(client_task_definition_data, redisdb): client_address = 'test_client' node = CommitteeCandidate() node.conn = redisdb node.task_id = '123' node.task_data = client_task_definition_data node.task_data['client_listen_address'] = client_address node._client_response_listening_channel = 'test_cluster' node.inform_client_of_task_id() client = Client() client._client_id = client_task_definition_data['client_id'] client.conn = redisdb client._client_listen_address = client_address client.obtain_cluster_task_id() assert client._task_id == '123' assert client._cluster_address == 'test_cluster'