Esempio n. 1
0
def test_set_task_id_provides_consistent_hash(client_task_definition_path,
                                              client_task_definition_data):
    with open(client_task_definition_path) as request_file:
        request_data = request_file.read()

    node = CommitteeCandidate()
    node.task_data = client_task_definition_data
    node.set_task_id(request_data)

    task_id = node.task_id

    for _ in range(10):
        node.set_task_id(request_data)
        assert task_id == node.task_id
Esempio n. 2
0
def test_disable_registration_for_client_task_only_one_task_in_queue(
        redisdb, client_task_definition_path, client_task_definition_data):
    with open(client_task_definition_path) as request_file:
        request_data = request_file.read()

    node = CommitteeCandidate()
    node.conn = redisdb
    node.task_data = client_task_definition_data
    node.set_task_id(request_data)

    redisdb.lpush(CLIENT_TASK_CHANNEL, request_data)
    node.disable_registration_for_client_task()

    assert redisdb.llen(CLIENT_TASK_CHANNEL) == 0