Esempio n. 1
0
def transactionCommittedToContainersWithinTimeout(context, containers, timeout):
    # Set the max time before stopping attempts
    maxTime = datetime.now() + timedelta(seconds=timeout)
    endpoint = "/transactions/{0}".format(context.transactionID)

    for container in containers:
        request_url = bdd_request_util.buildContainerUrl(context, container, endpoint)
        urlFound = httpGetUntilSuccessfulOrTimeout(request_url, maxTime, responseIsOk)

        assert urlFound, "Timed out waiting for transaction to be committed to {}" \
            .format(container.name)
Esempio n. 2
0
def allTransactionsCommittedToContainersWithinTimeout(context, containers, timeout):
    maxTime = datetime.now() + timedelta(seconds=timeout)
    endpoint = "/chain"
    expectedMinHeight = int(context.chainheight) + int(context.txcount)

    allTransactionsCommitted = lambda (response): \
        getAttributeFromJSON("height", response.json()) >= expectedMinHeight

    for container in containers:
        request_url = bdd_request_util.buildContainerUrl(context, container, endpoint)
        urlFound = httpGetUntilSuccessfulOrTimeout(request_url, maxTime, allTransactionsCommitted)

        assert urlFound, "Timed out waiting for transaction to be committed to {}" \
            .format(container.name)
Esempio n. 3
0
def transactionCommittedToContainersWithinTimeout(context, containers,
                                                  timeout):
    # Set the max time before stopping attempts
    maxTime = datetime.now() + timedelta(seconds=timeout)
    endpoint = "/transactions/{0}".format(context.transactionID)

    for container in containers:
        request_url = bdd_request_util.buildContainerUrl(
            context, container, endpoint)
        urlFound = httpGetUntilSuccessfulOrTimeout(request_url, maxTime,
                                                   responseIsOk)

        assert urlFound, "Timed out waiting for transaction to be committed to {}" \
            .format(container.name)
Esempio n. 4
0
def allTransactionsCommittedToContainersWithinTimeout(context, containers,
                                                      timeout):
    maxTime = datetime.now() + timedelta(seconds=timeout)
    endpoint = "/chain"
    expectedMinHeight = int(context.chainheight) + int(context.txcount)

    allTransactionsCommitted = lambda (response): \
        getAttributeFromJSON("height", response.json()) >= expectedMinHeight

    for container in containers:
        request_url = bdd_request_util.buildContainerUrl(
            context, container, endpoint)
        urlFound = httpGetUntilSuccessfulOrTimeout(request_url, maxTime,
                                                   allTransactionsCommitted)

        assert urlFound, "Timed out waiting for transaction to be committed to {}" \
            .format(container.name)